[llvm] 8dc006e - [RISCV] Make EmitToStreamer return whether Inst is compressed
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 20:02:59 PDT 2024
Author: Pengcheng Wang
Date: 2024-04-10T11:02:55+08:00
New Revision: 8dc006ea4008c1af298e56c4db6fffe2a40a2ba9
URL: https://github.com/llvm/llvm-project/commit/8dc006ea4008c1af298e56c4db6fffe2a40a2ba9
DIFF: https://github.com/llvm/llvm-project/commit/8dc006ea4008c1af298e56c4db6fffe2a40a2ba9.diff
LOG: [RISCV] Make EmitToStreamer return whether Inst is compressed
This is helpful to reduce calls of `RISCVRVC::compress` in #77337.
Reviewers: asb, lukel97, topperc
Reviewed By: topperc
Pull Request: https://github.com/llvm/llvm-project/pull/88120
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 5bf594c0b5eae3..9982a73ee914d9 100644
--- a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
+++ b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
@@ -80,7 +80,8 @@ class RISCVAsmPrinter : public AsmPrinter {
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
const char *ExtraCode, raw_ostream &OS) override;
- void EmitToStreamer(MCStreamer &S, const MCInst &Inst);
+ // Returns whether Inst is compressed.
+ bool EmitToStreamer(MCStreamer &S, const MCInst &Inst);
bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
const MachineInstr *MI);
@@ -180,12 +181,13 @@ void RISCVAsmPrinter::LowerSTATEPOINT(MCStreamer &OutStreamer, StackMaps &SM,
SM.recordStatepoint(*MILabel, MI);
}
-void RISCVAsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) {
+bool RISCVAsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) {
MCInst CInst;
bool Res = RISCVRVC::compress(CInst, Inst, *STI);
if (Res)
++RISCVNumInstrsCompressed;
AsmPrinter::EmitToStreamer(*OutStreamer, Res ? CInst : Inst);
+ return Res;
}
// Simple pseudo-instructions have their lowering (with expansion to real
More information about the llvm-commits
mailing list