Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8dc006e

Browse files
authoredApr 10, 2024
[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: #88120
1 parent bcf849b commit 8dc006e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ class RISCVAsmPrinter : public AsmPrinter {
8080
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
8181
const char *ExtraCode, raw_ostream &OS) override;
8282

83-
void EmitToStreamer(MCStreamer &S, const MCInst &Inst);
83+
// Returns whether Inst is compressed.
84+
bool EmitToStreamer(MCStreamer &S, const MCInst &Inst);
8485
bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
8586
const MachineInstr *MI);
8687

@@ -180,12 +181,13 @@ void RISCVAsmPrinter::LowerSTATEPOINT(MCStreamer &OutStreamer, StackMaps &SM,
180181
SM.recordStatepoint(*MILabel, MI);
181182
}
182183

183-
void RISCVAsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) {
184+
bool RISCVAsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) {
184185
MCInst CInst;
185186
bool Res = RISCVRVC::compress(CInst, Inst, *STI);
186187
if (Res)
187188
++RISCVNumInstrsCompressed;
188189
AsmPrinter::EmitToStreamer(*OutStreamer, Res ? CInst : Inst);
190+
return Res;
189191
}
190192

191193
// Simple pseudo-instructions have their lowering (with expansion to real

0 commit comments

Comments
 (0)
Please sign in to comment.