[PATCH] D142037: [RISCV] Make it explicit that attributes use the MCSubtargetInfo from TargetMachine. NFC
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 18 11:32:14 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9778802cb0f6: [RISCV] Make it explicit that attributes use the MCSubtargetInfo from… (authored by craig.topper).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142037/new/
https://reviews.llvm.org/D142037
Files:
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
Index: llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
+++ llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
@@ -46,13 +46,12 @@
namespace {
class RISCVAsmPrinter : public AsmPrinter {
- const MCSubtargetInfo *MCSTI;
const RISCVSubtarget *STI;
public:
explicit RISCVAsmPrinter(TargetMachine &TM,
std::unique_ptr<MCStreamer> Streamer)
- : AsmPrinter(TM, std::move(Streamer)), MCSTI(TM.getMCSubtargetInfo()) {}
+ : AsmPrinter(TM, std::move(Streamer)) {}
StringRef getPassName() const override { return "RISCV Assembly Printer"; }
@@ -189,12 +188,6 @@
}
bool RISCVAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- // Set the current MCSubtargetInfo to a copy which has the correct
- // feature bits for the current MachineFunction
- MCSubtargetInfo &NewSTI =
- OutStreamer->getContext().getSubtargetCopy(*TM.getMCSubtargetInfo());
- NewSTI.setFeatureBits(MF.getSubtarget().getFeatureBits());
- MCSTI = &NewSTI;
STI = &MF.getSubtarget<RISCVSubtarget>();
SetupMachineFunction(MF);
@@ -224,7 +217,10 @@
void RISCVAsmPrinter::emitAttributes() {
RISCVTargetStreamer &RTS =
static_cast<RISCVTargetStreamer &>(*OutStreamer->getTargetStreamer());
- RTS.emitTargetAttributes(*MCSTI);
+ // Use MCSubtargetInfo from TargetMachine. Individual functions may have
+ // attributes that differ from other functions in the module and we have no
+ // way to know which function is correct.
+ RTS.emitTargetAttributes(*TM.getMCSubtargetInfo());
}
void RISCVAsmPrinter::emitFunctionEntryLabel() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142037.490259.patch
Type: text/x-patch
Size: 1681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230118/907b8caf/attachment.bin>
More information about the llvm-commits
mailing list