Skip to content

Commit ef81955

Browse files
MaskRayNoumanAmir657
authored andcommitted
[MCInstPrinter] Make printRegName non-const
Similar to printInst. printRegName may change states (e.g. llvm#113834).
1 parent 6e1f0b6 commit ef81955

File tree

53 files changed

+61
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+61
-64
lines changed

llvm/include/llvm/MC/MCInstPrinter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ class MCInstPrinter {
144144
StringRef getOpcodeName(unsigned Opcode) const;
145145

146146
/// Print the assembler register name.
147-
virtual void printRegName(raw_ostream &OS, MCRegister Reg) const;
147+
virtual void printRegName(raw_ostream &OS, MCRegister Reg);
148148

149149
bool getUseMarkup() const { return UseMarkup; }
150150
void setUseMarkup(bool Value) { UseMarkup = Value; }
151151

152152
bool getUseColor() const { return UseColor; }
153153
void setUseColor(bool Value) { UseColor = Value; }
154154

155-
WithMarkup markup(raw_ostream &OS, Markup M) const;
155+
WithMarkup markup(raw_ostream &OS, Markup M);
156156

157157
bool getPrintImmHex() const { return PrintImmHex; }
158158
void setPrintImmHex(bool Value) { PrintImmHex = Value; }

llvm/include/llvm/MC/MCParser/MCAsmParser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class MCAsmParser {
206206
SmallVectorImpl<std::pair<void *, bool>> &OpDecls,
207207
SmallVectorImpl<std::string> &Constraints,
208208
SmallVectorImpl<std::string> &Clobbers, const MCInstrInfo *MII,
209-
const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) = 0;
209+
MCInstPrinter *IP, MCAsmParserSemaCallback &SI) = 0;
210210

211211
/// Emit a note at the location \p L, with the message \p Msg.
212212
virtual void Note(SMLoc L, const Twine &Msg,

llvm/lib/MC/MCInstPrinter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ StringRef MCInstPrinter::getOpcodeName(unsigned Opcode) const {
4343
return MII.getName(Opcode);
4444
}
4545

46-
void MCInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) const {
46+
void MCInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) {
4747
llvm_unreachable("Target should implement this");
4848
}
4949

@@ -224,8 +224,7 @@ format_object<uint64_t> MCInstPrinter::formatHex(uint64_t Value) const {
224224
llvm_unreachable("unsupported print style");
225225
}
226226

227-
MCInstPrinter::WithMarkup MCInstPrinter::markup(raw_ostream &OS,
228-
Markup S) const {
227+
MCInstPrinter::WithMarkup MCInstPrinter::markup(raw_ostream &OS, Markup S) {
229228
return WithMarkup(OS, S, getUseMarkup(), getUseColor());
230229
}
231230

llvm/lib/MC/MCParser/AsmParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class AsmParser : public MCAsmParser {
264264
SmallVectorImpl<std::pair<void *, bool>> &OpDecls,
265265
SmallVectorImpl<std::string> &Constraints,
266266
SmallVectorImpl<std::string> &Clobbers,
267-
const MCInstrInfo *MII, const MCInstPrinter *IP,
267+
const MCInstrInfo *MII, MCInstPrinter *IP,
268268
MCAsmParserSemaCallback &SI) override;
269269

270270
bool parseExpression(const MCExpr *&Res);
@@ -6006,7 +6006,7 @@ bool AsmParser::parseMSInlineAsm(
60066006
SmallVectorImpl<std::pair<void *, bool>> &OpDecls,
60076007
SmallVectorImpl<std::string> &Constraints,
60086008
SmallVectorImpl<std::string> &Clobbers, const MCInstrInfo *MII,
6009-
const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) {
6009+
MCInstPrinter *IP, MCAsmParserSemaCallback &SI) {
60106010
SmallVector<void *, 4> InputDecls;
60116011
SmallVector<void *, 4> OutputDecls;
60126012
SmallVector<bool, 4> InputDeclsAddressOf;

llvm/lib/MC/MCParser/MasmParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ class MasmParser : public MCAsmParser {
539539
SmallVectorImpl<std::pair<void *, bool>> &OpDecls,
540540
SmallVectorImpl<std::string> &Constraints,
541541
SmallVectorImpl<std::string> &Clobbers,
542-
const MCInstrInfo *MII, const MCInstPrinter *IP,
542+
const MCInstrInfo *MII, MCInstPrinter *IP,
543543
MCAsmParserSemaCallback &SI) override;
544544

545545
bool parseExpression(const MCExpr *&Res);
@@ -7340,7 +7340,7 @@ bool MasmParser::parseMSInlineAsm(
73407340
SmallVectorImpl<std::pair<void *, bool>> &OpDecls,
73417341
SmallVectorImpl<std::string> &Constraints,
73427342
SmallVectorImpl<std::string> &Clobbers, const MCInstrInfo *MII,
7343-
const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) {
7343+
MCInstPrinter *IP, MCAsmParserSemaCallback &SI) {
73447344
SmallVector<void *, 4> InputDecls;
73457345
SmallVector<void *, 4> OutputDecls;
73467346
SmallVector<bool, 4> InputDeclsAddressOf;

llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ bool AArch64InstPrinter::applyTargetSpecificCLOption(StringRef Opt) {
5959
return false;
6060
}
6161

62-
void AArch64InstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) const {
62+
void AArch64InstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) {
6363
markup(OS, Markup::Register) << getRegisterName(Reg);
6464
}
6565

6666
void AArch64InstPrinter::printRegName(raw_ostream &OS, MCRegister Reg,
67-
unsigned AltIdx) const {
67+
unsigned AltIdx) {
6868
markup(OS, Markup::Register) << getRegisterName(Reg, AltIdx);
6969
}
7070

llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class AArch64InstPrinter : public MCInstPrinter {
2929

3030
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
3131
const MCSubtargetInfo &STI, raw_ostream &O) override;
32-
void printRegName(raw_ostream &OS, MCRegister Reg) const override;
33-
void printRegName(raw_ostream &OS, MCRegister Reg, unsigned AltIdx) const;
32+
void printRegName(raw_ostream &OS, MCRegister Reg) override;
33+
void printRegName(raw_ostream &OS, MCRegister Reg, unsigned AltIdx);
3434

3535
// Autogenerated by tblgen.
3636
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;

llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
using namespace llvm;
2525
using namespace llvm::AMDGPU;
2626

27-
void AMDGPUInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) const {
27+
void AMDGPUInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) {
2828
// FIXME: The current implementation of
2929
// AsmParser::parseRegisterOrRegisterNumber in MC implies we either emit this
3030
// as an integer or we provide a name which represents a physical register.

llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AMDGPUInstPrinter : public MCInstPrinter {
2929
const MCSubtargetInfo &STI, raw_ostream &O);
3030
static const char *getRegisterName(MCRegister Reg);
3131

32-
void printRegName(raw_ostream &OS, MCRegister Reg) const override;
32+
void printRegName(raw_ostream &OS, MCRegister Reg) override;
3333
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
3434
const MCSubtargetInfo &STI, raw_ostream &O) override;
3535
static void printRegOperand(MCRegister Reg, raw_ostream &O,

llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static const char *ARCCondCodeToString(ARCCC::CondCode CC) {
9393
return BadConditionCode(CC);
9494
}
9595

96-
void ARCInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) const {
96+
void ARCInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) {
9797
OS << StringRef(getRegisterName(Reg)).lower();
9898
}
9999

0 commit comments

Comments
 (0)