[PATCH] D142037: [RISCV] Make it explicit that attributes use the MCSubtargetInfo from TargetMachine.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 18 09:57:07 PST 2023
craig.topper updated this revision to Diff 490211.
craig.topper added a comment.
Remove the MCSTI variable which becomes dead after this.
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,7 @@
void RISCVAsmPrinter::emitAttributes() {
RISCVTargetStreamer &RTS =
static_cast<RISCVTargetStreamer &>(*OutStreamer->getTargetStreamer());
- RTS.emitTargetAttributes(*MCSTI);
+ RTS.emitTargetAttributes(*TM.getMCSubtargetInfo());
}
void RISCVAsmPrinter::emitFunctionEntryLabel() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142037.490211.patch
Type: text/x-patch
Size: 1480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230118/f1afd0fd/attachment.bin>
More information about the llvm-commits
mailing list