[llvm] [RISCV] Use MCStreamer::emitInstruction instead of calling AsmPrinter::EmitToStreamer. NFC (PR #111714)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 10:01:00 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

This allows us to pass the STI we already have cachced instead of AsmPrinter::EmitToStreamer looking it up from the MachineFunction again.

My plan is to make EmitHwasanMemaccessSymbols use RISCVAsmPrinter::EmitToStreamer instead calling MCStreamer::emitInstruction. To do that I need control of the MCSubtargetInfo.

---
Full diff: https://github.com/llvm/llvm-project/pull/111714.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
index 3bed8c4349dac0..384a7cf59f0632 100644
--- a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
+++ b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
@@ -247,7 +247,7 @@ bool RISCVAsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) {
   bool Res = RISCVRVC::compress(CInst, Inst, *STI);
   if (Res)
     ++RISCVNumInstrsCompressed;
-  AsmPrinter::EmitToStreamer(S, Res ? CInst : Inst);
+  S.emitInstruction(Res ? CInst : Inst, *STI);
   return Res;
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/111714


More information about the llvm-commits mailing list