diff --git a/bolt/lib/Core/HashUtilities.cpp b/bolt/lib/Core/HashUtilities.cpp index dfbbdb8a968fe..6bdf30460f340 100644 --- a/bolt/lib/Core/HashUtilities.cpp +++ b/bolt/lib/Core/HashUtilities.cpp @@ -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); } diff --git a/llvm/include/llvm/MC/MCInstPrinter.h b/llvm/include/llvm/MC/MCInstPrinter.h index e825c04a6dba6..ab1361313be05 100644 --- a/llvm/include/llvm/MC/MCInstPrinter.h +++ b/llvm/include/llvm/MC/MCInstPrinter.h @@ -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 getMnemonic(const MCInst *MI) = 0; + virtual std::pair + getMnemonic(const MCInst &MI) const = 0; /// Print the specified MCInst to the specified raw_ostream. /// diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h index a376ba810ba51..df2eb9cf136bc 100644 --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -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. /// diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index b9ad0b4eac9c7..112a4b3f1e9cd 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -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; diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h index 9cf2674ae943a..15ef2ddfc22fd 100644 --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h @@ -33,7 +33,8 @@ class AArch64InstPrinter : public MCInstPrinter { void printRegName(raw_ostream &OS, MCRegister Reg, unsigned AltIdx); // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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, @@ -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 getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h index 4729b8a6aa6f4..5a7d6cf7ba595 100644 --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h @@ -24,7 +24,8 @@ class AMDGPUInstPrinter : public MCInstPrinter { : MCInstPrinter(MAI, MII, MRI) {} // Autogenerated by tblgen - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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); diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/R600InstPrinter.h b/llvm/lib/Target/AMDGPU/MCTargetDesc/R600InstPrinter.h index afaab31375ce4..5c6572d79ccfb 100644 --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/R600InstPrinter.h +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/R600InstPrinter.h @@ -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 getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); diff --git a/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.h b/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.h index c4bd73448ca71..8c900b3c6858b 100644 --- a/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.h +++ b/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.h @@ -26,7 +26,8 @@ class ARCInstPrinter : public MCInstPrinter { : MCInstPrinter(MAI, MII, MRI) {} // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.h b/llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.h index cd1dddc5f331a..7b95b9580740f 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.h +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.h @@ -30,7 +30,8 @@ class ARMInstPrinter : public MCInstPrinter { void printRegName(raw_ostream &OS, MCRegister Reg) override; // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.h b/llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.h index 8ba24dc80d884..c5c3fb46a6b9c 100644 --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.h +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.h @@ -48,7 +48,8 @@ class AVRInstPrinter : public MCInstPrinter { } // Autogenerated by TableGen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.h b/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.h index ad2dee1a97b88..41835bb2d10d8 100644 --- a/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.h +++ b/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.h @@ -32,7 +32,8 @@ class BPFInstPrinter : public MCInstPrinter { void printBrTargetOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); }; diff --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.h b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.h index 16eccfdfb5ce5..6640add076b4b 100644 --- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.h +++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.h @@ -39,7 +39,8 @@ class CSKYInstPrinter : public MCInstPrinter { void printFPRRegName(raw_ostream &O, unsigned RegNo) const; // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/DirectX/MCTargetDesc/DirectXMCTargetDesc.cpp b/llvm/lib/Target/DirectX/MCTargetDesc/DirectXMCTargetDesc.cpp index 5a64bf6482d5e..ea5cd756b35d8 100644 --- a/llvm/lib/Target/DirectX/MCTargetDesc/DirectXMCTargetDesc.cpp +++ b/llvm/lib/Target/DirectX/MCTargetDesc/DirectXMCTargetDesc.cpp @@ -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 getMnemonic(const MCInst *MI) override { + std::pair + getMnemonic(const MCInst &MI) const override { return std::make_pair("", 0ull); } diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonInstPrinter.h b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonInstPrinter.h index fe37cd91dabc6..5435461b343aa 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonInstPrinter.h +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonInstPrinter.h @@ -34,7 +34,8 @@ class HexagonInstPrinter : public MCInstPrinter { static char const *getRegisterName(MCRegister Reg); - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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; diff --git a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h index 851613b27e3dd..de3cb8c178d8d 100644 --- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h +++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h @@ -42,7 +42,8 @@ class LanaiInstPrinter : public MCInstPrinter { void printMemImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchInstPrinter.h b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchInstPrinter.h index 8cda3fdb4510e..235f967f50ff4 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchInstPrinter.h +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchInstPrinter.h @@ -33,7 +33,8 @@ class LoongArchInstPrinter : public MCInstPrinter { const MCSubtargetInfo &STI, raw_ostream &O); // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h b/llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h index d6d17ca9568e0..32ca9131d4ce7 100644 --- a/llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h +++ b/llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h @@ -42,7 +42,8 @@ class M68kInstPrinter : public MCInstPrinter, void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, unsigned PrintMethodIdx, raw_ostream &O); - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; private: void printOperand(const MCInst *MI, unsigned opNum, raw_ostream &O); diff --git a/llvm/lib/Target/MSP430/MCTargetDesc/MSP430InstPrinter.h b/llvm/lib/Target/MSP430/MCTargetDesc/MSP430InstPrinter.h index 413492b8efeed..e1785c98bd5c7 100644 --- a/llvm/lib/Target/MSP430/MCTargetDesc/MSP430InstPrinter.h +++ b/llvm/lib/Target/MSP430/MCTargetDesc/MSP430InstPrinter.h @@ -28,7 +28,8 @@ namespace llvm { const MCSubtargetInfo &STI, raw_ostream &O) override; // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.h b/llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.h index 8e3b4614a4aad..3924cf02e2d6b 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.h +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.h @@ -79,7 +79,8 @@ class MipsInstPrinter : public MCInstPrinter { : MCInstPrinter(MAI, MII, MRI) {} // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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); diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.h b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.h index 63207e8a975ac..a17c472d3f0d9 100644 --- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.h +++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.h @@ -29,7 +29,8 @@ class NVPTXInstPrinter : public MCInstPrinter { const MCSubtargetInfo &STI, raw_ostream &OS) override; // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); // End diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.h index 1b9365fa04961..2286484c8a2dd 100644 --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.h +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.h @@ -36,7 +36,8 @@ class PPCInstPrinter : public MCInstPrinter { const MCSubtargetInfo &STI, raw_ostream &O) override; // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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); diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h index c15fd591b9e95..6d4928ee64ec9 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h @@ -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 getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.h b/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.h index 424249a09e56a..9b02524f50b81 100644 --- a/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.h +++ b/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.h @@ -46,7 +46,8 @@ class SPIRVInstPrinter : public MCInstPrinter { void printSymbolicOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); }; diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.h b/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.h index 52321d5621185..6a1d2394d488e 100644 --- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.h +++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.h @@ -33,7 +33,8 @@ class SparcInstPrinter : public MCInstPrinter { bool isV9(const MCSubtargetInfo &STI) const; // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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, diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZGNUInstPrinter.h b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZGNUInstPrinter.h index 7095e325c70bc..a0f7e9b466501 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZGNUInstPrinter.h +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZGNUInstPrinter.h @@ -28,7 +28,8 @@ class SystemZGNUInstPrinter : public SystemZInstPrinterCommon { : SystemZInstPrinterCommon(MAI, MII, MRI) {} // Automatically generated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.h b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.h index ffccbec36c749..2732986dbca7d 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.h +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.h @@ -28,7 +28,8 @@ class SystemZHLASMInstPrinter : public SystemZInstPrinterCommon { : SystemZInstPrinterCommon(MAI, MII, MRI) {} // Automatically generated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); diff --git a/llvm/lib/Target/VE/MCTargetDesc/VEInstPrinter.h b/llvm/lib/Target/VE/MCTargetDesc/VEInstPrinter.h index d5e0ebd3596ca..aa3b003aaba14 100644 --- a/llvm/lib/Target/VE/MCTargetDesc/VEInstPrinter.h +++ b/llvm/lib/Target/VE/MCTargetDesc/VEInstPrinter.h @@ -29,7 +29,8 @@ class VEInstPrinter : public MCInstPrinter { const MCSubtargetInfo &STI, raw_ostream &OS) override; // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + 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 &, diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp index 026f859b15d71..285b7279cecd0 100644 --- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp @@ -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); diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.h index e7c5e14973b63..c9351a0e44926 100644 --- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.h +++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.h @@ -50,7 +50,8 @@ class WebAssemblyInstPrinter final : public MCInstPrinter { void printCatchList(const MCInst *MI, unsigned OpNo, raw_ostream &O); // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); }; diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h b/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h index 7e525e2323622..f49f09c5dcf3e 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h +++ b/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h @@ -36,7 +36,8 @@ class X86ATTInstPrinter final : public X86InstPrinterCommon { raw_ostream &O); // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &OS); static const char *getRegisterName(MCRegister Reg); diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.h b/llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.h index 988ab9626c3fd..324c56c1329da 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.h +++ b/llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.h @@ -37,7 +37,8 @@ class X86IntelInstPrinter final : public X86InstPrinterCommon { raw_ostream &O); // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); diff --git a/llvm/lib/Target/XCore/MCTargetDesc/XCoreInstPrinter.h b/llvm/lib/Target/XCore/MCTargetDesc/XCoreInstPrinter.h index 2b47de457322e..33a2af03a877d 100644 --- a/llvm/lib/Target/XCore/MCTargetDesc/XCoreInstPrinter.h +++ b/llvm/lib/Target/XCore/MCTargetDesc/XCoreInstPrinter.h @@ -27,7 +27,8 @@ class XCoreInstPrinter : public MCInstPrinter { : MCInstPrinter(MAI, MII, MRI) {} // Autogenerated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); diff --git a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaInstPrinter.h b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaInstPrinter.h index 4122b1ff2310b..f56d5d1458dc1 100644 --- a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaInstPrinter.h +++ b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaInstPrinter.h @@ -28,7 +28,8 @@ class XtensaInstPrinter : public MCInstPrinter { : MCInstPrinter(MAI, MII, MRI) {} // Automatically generated by tblgen. - std::pair getMnemonic(const MCInst *MI) override; + std::pair + getMnemonic(const MCInst &MI) const override; void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); static const char *getRegisterName(MCRegister Reg); diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 3f09564cc0d65..b6f999093dc9e 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -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 " - << Target.getName() << ClassName << "::getMnemonic(const MCInst *MI) {\n"; + "std::pair\n" + << Target.getName() << ClassName + << "::getMnemonic(const MCInst &MI) const {\n"; // Build an aggregate string, and build a table of offsets into it. SequenceToOffsetTable StringTable; @@ -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; @@ -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)