[PATCH] D102582: [PoC][RISCV] Report an error when target-abi option is empty but target-abi module flag is not.
Zakk Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 16 09:44:55 PDT 2021
khchen created this revision.
khchen added reviewers: asb, kito-cheng, efriedma, craig.topper, HsiangKai.
Herald added subscribers: vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
khchen requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
D72768 <https://reviews.llvm.org/D72768> allows users to give an empty target-abi option with non-empty
target-abi module flag in IR, because we attempts to allowing module flag
to overwrite the target-abi options (D72624 <https://reviews.llvm.org/D72624>).
ps. It's worth mentioning that datalayout tends to chage for different ABIs.
After digging more into LLVM TargetMahcine design, and as @efriedma mention in
https://reviews.llvm.org/D71387#1788472, overwrite the ABI/datalayout in
TargetMahcine or a bitcode file is not easy and it will generate wrong code.
(For example, IR parser supports a datalayout callback which's used to compute
a correct datalayout during the IR parsing, see D78403 <https://reviews.llvm.org/D78403> for more detal. So if
we want to read the ABI/datalayout info from IR first, it seems we need to
parse the IR twice times, it does not make sense for me.)
In this situation, I think probably reporting a error is the best way, but
this changed also requires users need to specific -target-abi option if IR has
-target-abi module flag.
In other words, for enabling LTO in RISC-V, clang driver must to forward the
target-abi option into LTO code generator.
ps. The checking routine only exists in the RISC-V back-end now because only
RISC-V will generate -target-abi module flag.
Reference: https://lists.llvm.org/pipermail/llvm-dev/2020-January/138450.html
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102582
Files:
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
llvm/test/CodeGen/RISCV/module-target-abi.ll
llvm/test/CodeGen/RISCV/module-target-abi2.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102582.345711.patch
Type: text/x-patch
Size: 5408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210516/07dfbece/attachment.bin>
More information about the llvm-commits
mailing list