Skip to content

Commit

Permalink
[MC] Make generated MCInstPrinter::getMnemonic const (NFC) (#114682)
Browse files Browse the repository at this point in the history
The value returned from the function depends only on the instruction opcode.

As a drive-by, change the type of the argument to const-reference.
  • Loading branch information
s-barannikov authored Nov 3, 2024
1 parent 89b948d commit eeb987f
Show file tree
Hide file tree
Showing 34 changed files with 70 additions and 39 deletions.
2 changes: 1 addition & 1 deletion bolt/lib/Core/HashUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ std::string hashBlockLoose(BinaryContext &BC, const BinaryBasicBlock &BB) {
continue;
}

std::string Mnemonic = BC.InstPrinter->getMnemonic(&Inst).first;
std::string Mnemonic = BC.InstPrinter->getMnemonic(Inst).first;
llvm::erase_if(Mnemonic, [](unsigned char ch) { return std::isspace(ch); });
Opcodes.insert(Mnemonic);
}
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/MC/MCInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class MCInstPrinter {

/// Returns a pair containing the mnemonic for \p MI and the number of bits
/// left for further processing by printInstruction (generated by tablegen).
virtual std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) = 0;
virtual std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const = 0;

/// Print the specified MCInst to the specified raw_ostream.
///
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/MC/MCStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ class MCStreamer {

/// Returns the mnemonic for \p MI, if the streamer has access to a
/// instruction printer and returns an empty string otherwise.
virtual StringRef getMnemonic(MCInst &MI) { return ""; }
virtual StringRef getMnemonic(const MCInst &MI) const { return ""; }

/// Emit a label for \p Symbol into the current section.
///
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/MC/MCAsmStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ class MCAsmStreamer final : public MCStreamer {

void emitGNUAttribute(unsigned Tag, unsigned Value) override;

StringRef getMnemonic(MCInst &MI) override {
auto [Ptr, Bits] = InstPrinter->getMnemonic(&MI);
StringRef getMnemonic(const MCInst &MI) const override {
auto [Ptr, Bits] = InstPrinter->getMnemonic(MI);
assert((Bits != 0 || Ptr == nullptr) &&
"Invalid char pointer for instruction with no mnemonic");
return Ptr;
Expand Down
6 changes: 4 additions & 2 deletions llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class AArch64InstPrinter : public MCInstPrinter {
void printRegName(raw_ostream &OS, MCRegister Reg, unsigned AltIdx);

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
virtual void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
virtual bool printAliasInstr(const MCInst *MI, uint64_t Address,
Expand Down Expand Up @@ -248,7 +249,8 @@ class AArch64AppleInstPrinter : public AArch64InstPrinter {
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
const MCSubtargetInfo &STI, raw_ostream &O) override;

std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O) override;
bool printAliasInstr(const MCInst *MI, uint64_t Address,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class AMDGPUInstPrinter : public MCInstPrinter {
: MCInstPrinter(MAI, MII, MRI) {}

// Autogenerated by tblgen
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/AMDGPU/MCTargetDesc/R600InstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class R600InstPrinter : public MCInstPrinter {

void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
const MCSubtargetInfo &STI, raw_ostream &O) override;
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class ARCInstPrinter : public MCInstPrinter {
: MCInstPrinter(MAI, MII, MRI) {}

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ARMInstPrinter : public MCInstPrinter {
void printRegName(raw_ostream &OS, MCRegister Reg) override;

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
virtual bool printAliasInstr(const MCInst *MI, uint64_t Address,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class AVRInstPrinter : public MCInstPrinter {
}

// Autogenerated by TableGen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &O);
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class BPFInstPrinter : public MCInstPrinter {
void printBrTargetOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);
};
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class CSKYInstPrinter : public MCInstPrinter {
void printFPRRegName(raw_ostream &O, unsigned RegNo) const;

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
bool printAliasInstr(const MCInst *MI, uint64_t Address,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/DirectX/MCTargetDesc/DirectXMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class DXILInstPrinter : public MCInstPrinter {
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
const MCSubtargetInfo &STI, raw_ostream &O) override {}

std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override {
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override {
return std::make_pair<const char *, uint64_t>("", 0ull);
}

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/Hexagon/MCTargetDesc/HexagonInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class HexagonInstPrinter : public MCInstPrinter {

static char const *getRegisterName(MCRegister Reg);

std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class LanaiInstPrinter : public MCInstPrinter {
void printMemImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class LoongArchInstPrinter : public MCInstPrinter {
const MCSubtargetInfo &STI, raw_ostream &O);

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
bool printAliasInstr(const MCInst *MI, uint64_t Address,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class M68kInstPrinter : public MCInstPrinter,
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
unsigned PrintMethodIdx, raw_ostream &O);

std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;

private:
void printOperand(const MCInst *MI, unsigned opNum, raw_ostream &O);
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/MSP430/MCTargetDesc/MSP430InstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ namespace llvm {
const MCSubtargetInfo &STI, raw_ostream &O) override;

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &O);
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class MipsInstPrinter : public MCInstPrinter {
: MCInstPrinter(MAI, MII, MRI) {}

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class NVPTXInstPrinter : public MCInstPrinter {
const MCSubtargetInfo &STI, raw_ostream &OS) override;

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);
// End
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class PPCInstPrinter : public MCInstPrinter {
const MCSubtargetInfo &STI, raw_ostream &O) override;

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class RISCVInstPrinter : public MCInstPrinter {
void printRegReg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
raw_ostream &O);
// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
bool printAliasInstr(const MCInst *MI, uint64_t Address,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class SPIRVInstPrinter : public MCInstPrinter {
void printSymbolicOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);
};
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class SparcInstPrinter : public MCInstPrinter {
bool isV9(const MCSubtargetInfo &STI) const;

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);
bool printAliasInstr(const MCInst *MI, uint64_t Address,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/SystemZ/MCTargetDesc/SystemZGNUInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class SystemZGNUInstPrinter : public SystemZInstPrinterCommon {
: SystemZInstPrinterCommon(MAI, MII, MRI) {}

// Automatically generated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class SystemZHLASMInstPrinter : public SystemZInstPrinterCommon {
: SystemZInstPrinterCommon(MAI, MII, MRI) {}

// Automatically generated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/VE/MCTargetDesc/VEInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class VEInstPrinter : public MCInstPrinter {
const MCSubtargetInfo &STI, raw_ostream &OS) override;

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
bool printAliasInstr(const MCInst *, uint64_t Address,
const MCSubtargetInfo &, raw_ostream &);
void printInstruction(const MCInst *, uint64_t, const MCSubtargetInfo &,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void WebAssemblyInstPrinter::printInst(const MCInst *MI, uint64_t Address,
// operand isn't a symbol, then we have an MVP compilation unit, and the
// table shouldn't appear in the output.
OS << "\t";
OS << getMnemonic(MI).first;
OS << getMnemonic(*MI).first;
OS << " ";

assert(MI->getNumOperands() == 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class WebAssemblyInstPrinter final : public MCInstPrinter {
void printCatchList(const MCInst *MI, unsigned OpNo, raw_ostream &O);

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);
};
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class X86ATTInstPrinter final : public X86InstPrinterCommon {
raw_ostream &O);

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &OS);
static const char *getRegisterName(MCRegister Reg);

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class X86IntelInstPrinter final : public X86InstPrinterCommon {
raw_ostream &O);

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/XCore/MCTargetDesc/XCoreInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class XCoreInstPrinter : public MCInstPrinter {
: MCInstPrinter(MAI, MII, MRI) {}

// Autogenerated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/Xtensa/MCTargetDesc/XtensaInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class XtensaInstPrinter : public MCInstPrinter {
: MCInstPrinter(MAI, MII, MRI) {}

// Automatically generated by tblgen.
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
std::pair<const char *, uint64_t>
getMnemonic(const MCInst &MI) const override;
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
static const char *getRegisterName(MCRegister Reg);

Expand Down
9 changes: 5 additions & 4 deletions llvm/utils/TableGen/AsmWriterEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ void AsmWriterEmitter::EmitGetMnemonic(
O << "/// getMnemonic - This method is automatically generated by "
"tablegen\n"
"/// from the instruction set description.\n"
"std::pair<const char *, uint64_t> "
<< Target.getName() << ClassName << "::getMnemonic(const MCInst *MI) {\n";
"std::pair<const char *, uint64_t>\n"
<< Target.getName() << ClassName
<< "::getMnemonic(const MCInst &MI) const {\n";

// Build an aggregate string, and build a table of offsets into it.
SequenceToOffsetTable<std::string> StringTable;
Expand Down Expand Up @@ -458,7 +459,7 @@ void AsmWriterEmitter::EmitGetMnemonic(
// If the total bits is more than 32-bits we need to use a 64-bit type.
if (BitsLeft < (OpcodeInfoBits - 32))
BitsOS << "(uint64_t)";
BitsOS << "OpInfo" << Table << "[MI->getOpcode()] << " << Shift << ";\n";
BitsOS << "OpInfo" << Table << "[MI.getOpcode()] << " << Shift << ";\n";
// Prepare the shift for the next iteration and increment the table count.
Shift += TableSize;
++Table;
Expand Down Expand Up @@ -508,7 +509,7 @@ void AsmWriterEmitter::EmitPrintInstruction(
O << " O << \"\\t\";\n\n";

// Emit the starting string.
O << " auto MnemonicInfo = getMnemonic(MI);\n\n";
O << " auto MnemonicInfo = getMnemonic(*MI);\n\n";
O << " O << MnemonicInfo.first;\n\n";

O << " uint" << ((BitsLeft < (OpcodeInfoBits - 32)) ? 64 : 32)
Expand Down

0 comments on commit eeb987f

Please sign in to comment.