1 //===-- llvm/MC/MCInstrInfo.h - Target Instruction Info ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the target machine instruction set.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_MC_MCINSTRINFO_H
15 #define LLVM_MC_MCINSTRINFO_H
17 #include "llvm/MC/MCInstrDesc.h"
22 //---------------------------------------------------------------------------
24 /// MCInstrInfo - Interface to description of machine instruction set
27 const MCInstrDesc *Desc; // Raw array to allow static init'n
28 const uint16_t *InstrNameIndices; // Array for name indices in InstrNameData
29 const char *InstrNameData; // Instruction name string pool
30 unsigned NumOpcodes; // Number of entries in the desc array
33 /// InitMCInstrInfo - Initialize MCInstrInfo, called by TableGen
34 /// auto-generated routines. *DO NOT USE*.
35 void InitMCInstrInfo(const MCInstrDesc *D, const uint16_t *NI, const char *ND,
38 InstrNameIndices = NI;
43 unsigned getNumOpcodes() const { return NumOpcodes; }
45 /// get - Return the machine instruction descriptor that corresponds to the
46 /// specified instruction opcode.
48 const MCInstrDesc &get(unsigned Opcode) const {
49 assert(Opcode < NumOpcodes && "Invalid opcode!");
53 /// getName - Returns the name for the instructions with the given opcode.
54 const char *getName(unsigned Opcode) const {
55 assert(Opcode < NumOpcodes && "Invalid opcode!");
56 return &InstrNameData[InstrNameIndices[Opcode]];
60 } // End llvm namespace