File indexing completed on 2026-05-10 08:44:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_MC_MCINSTRINFO_H
0014 #define LLVM_MC_MCINSTRINFO_H
0015
0016 #include "llvm/ADT/StringRef.h"
0017 #include "llvm/MC/MCInstrDesc.h"
0018 #include <cassert>
0019
0020 namespace llvm {
0021
0022 class MCSubtargetInfo;
0023
0024
0025
0026 class MCInstrInfo {
0027 public:
0028 using ComplexDeprecationPredicate = bool (*)(MCInst &,
0029 const MCSubtargetInfo &,
0030 std::string &);
0031
0032 private:
0033 const MCInstrDesc *LastDesc;
0034 const unsigned *InstrNameIndices;
0035 const char *InstrNameData;
0036
0037
0038
0039 const uint8_t *DeprecatedFeatures;
0040
0041
0042 const ComplexDeprecationPredicate *ComplexDeprecationInfos;
0043 unsigned NumOpcodes;
0044
0045 public:
0046
0047
0048 void InitMCInstrInfo(const MCInstrDesc *D, const unsigned *NI, const char *ND,
0049 const uint8_t *DF,
0050 const ComplexDeprecationPredicate *CDI, unsigned NO) {
0051 LastDesc = D + NO - 1;
0052 InstrNameIndices = NI;
0053 InstrNameData = ND;
0054 DeprecatedFeatures = DF;
0055 ComplexDeprecationInfos = CDI;
0056 NumOpcodes = NO;
0057 }
0058
0059 unsigned getNumOpcodes() const { return NumOpcodes; }
0060
0061
0062
0063 const MCInstrDesc &get(unsigned Opcode) const {
0064 assert(Opcode < NumOpcodes && "Invalid opcode!");
0065
0066 return *(LastDesc - Opcode);
0067 }
0068
0069
0070 StringRef getName(unsigned Opcode) const {
0071 assert(Opcode < NumOpcodes && "Invalid opcode!");
0072 return StringRef(&InstrNameData[InstrNameIndices[Opcode]]);
0073 }
0074
0075
0076
0077 bool getDeprecatedInfo(MCInst &MI, const MCSubtargetInfo &STI,
0078 std::string &Info) const;
0079 };
0080
0081 }
0082
0083 #endif