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

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 12:55:36 PDT 2024


Author: Craig Topper
Date: 2024-10-09T12:55:32-07:00
New Revision: f0fc1d376c85d226e6623a3981da0bf4f4efc2ec

URL: https://github.com/llvm/llvm-project/commit/f0fc1d376c85d226e6623a3981da0bf4f4efc2ec
DIFF: https://github.com/llvm/llvm-project/commit/f0fc1d376c85d226e6623a3981da0bf4f4efc2ec.diff

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

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

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

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp

Removed: 
    


################################################################################
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;
 }
 


        


More information about the llvm-commits mailing list