[PATCH] D73339: [RISCV] Compress instructions based on function features
Simon Cook via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 24 02:51:46 PST 2020
simoncook created this revision.
simoncook added reviewers: lenary, asb, edward-jones.
Herald added subscribers: llvm-commits, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, rkruppe, dexonsmith, the_o, brucehoult, MartinMosbeck, rogfer01, zzheng, MaskRay, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, johnrusso, rbar, hiraditya, mehdi_amini.
Herald added a project: LLVM.
When running under LTO, it is common to not specify the architecture
spec, which is used for setting up the target machine, and instead rely
on features specified in each function to generate the correct
instructions.
This works for the code generator, but the RISC-V backend uses the
AsmPrinter to do instruction compression, which does not see these
features but instead uses a MCSubtargetInfo object to see whether
compression is enabled. Since this is configured based on the
TargetMachine at startup, it will result in compressed instructions not
being emitted when it has not been given the 'c' TargetFeature, but the
function has it.
This changes the RISCVAsmPrinter to re-initialize the STI feature set
based on the current MachineFunction, such that compressed instructions
are now correctly emitted regardless of the method used to enable them.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73339
Files:
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
llvm/test/CodeGen/RISCV/compress2.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73339.240139.patch
Type: text/x-patch
Size: 7038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200124/8ffd5818/attachment.bin>
More information about the llvm-commits
mailing list