Mercurial > hg > Members > tobaru > cbc > CbC_llvm
comparison include/llvm/MC/MCInstrInfo.h @ 95:afa8332a0e37
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | 95c75e76d11b |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
84:f3e34b893a5f | 95:afa8332a0e37 |
---|---|
18 #include <cassert> | 18 #include <cassert> |
19 | 19 |
20 namespace llvm { | 20 namespace llvm { |
21 | 21 |
22 //--------------------------------------------------------------------------- | 22 //--------------------------------------------------------------------------- |
23 /// | 23 /// \brief Interface to description of machine instruction set. |
24 /// MCInstrInfo - Interface to description of machine instruction set | |
25 /// | |
26 class MCInstrInfo { | 24 class MCInstrInfo { |
27 const MCInstrDesc *Desc; // Raw array to allow static init'n | 25 const MCInstrDesc *Desc; // Raw array to allow static init'n |
28 const unsigned *InstrNameIndices; // Array for name indices in InstrNameData | 26 const unsigned *InstrNameIndices; // Array for name indices in InstrNameData |
29 const char *InstrNameData; // Instruction name string pool | 27 const char *InstrNameData; // Instruction name string pool |
30 unsigned NumOpcodes; // Number of entries in the desc array | 28 unsigned NumOpcodes; // Number of entries in the desc array |
31 | 29 |
32 public: | 30 public: |
33 /// InitMCInstrInfo - Initialize MCInstrInfo, called by TableGen | 31 /// \brief Initialize MCInstrInfo, called by TableGen auto-generated routines. |
34 /// auto-generated routines. *DO NOT USE*. | 32 /// *DO NOT USE*. |
35 void InitMCInstrInfo(const MCInstrDesc *D, const unsigned *NI, const char *ND, | 33 void InitMCInstrInfo(const MCInstrDesc *D, const unsigned *NI, const char *ND, |
36 unsigned NO) { | 34 unsigned NO) { |
37 Desc = D; | 35 Desc = D; |
38 InstrNameIndices = NI; | 36 InstrNameIndices = NI; |
39 InstrNameData = ND; | 37 InstrNameData = ND; |
40 NumOpcodes = NO; | 38 NumOpcodes = NO; |
41 } | 39 } |
42 | 40 |
43 unsigned getNumOpcodes() const { return NumOpcodes; } | 41 unsigned getNumOpcodes() const { return NumOpcodes; } |
44 | 42 |
45 /// get - Return the machine instruction descriptor that corresponds to the | 43 /// \brief Return the machine instruction descriptor that corresponds to the |
46 /// specified instruction opcode. | 44 /// specified instruction opcode. |
47 /// | |
48 const MCInstrDesc &get(unsigned Opcode) const { | 45 const MCInstrDesc &get(unsigned Opcode) const { |
49 assert(Opcode < NumOpcodes && "Invalid opcode!"); | 46 assert(Opcode < NumOpcodes && "Invalid opcode!"); |
50 return Desc[Opcode]; | 47 return Desc[Opcode]; |
51 } | 48 } |
52 | 49 |
53 /// getName - Returns the name for the instructions with the given opcode. | 50 /// \brief Returns the name for the instructions with the given opcode. |
54 const char *getName(unsigned Opcode) const { | 51 const char *getName(unsigned Opcode) const { |
55 assert(Opcode < NumOpcodes && "Invalid opcode!"); | 52 assert(Opcode < NumOpcodes && "Invalid opcode!"); |
56 return &InstrNameData[InstrNameIndices[Opcode]]; | 53 return &InstrNameData[InstrNameIndices[Opcode]]; |
57 } | 54 } |
58 }; | 55 }; |