MCInstrInfo.h revision 224145
1254721Semaste//===-- llvm/MC/MCInstrInfo.h - Target Instruction Info ---------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste// 10254721Semaste// This file describes the target machine instruction set. 11254721Semaste// 12254721Semaste//===----------------------------------------------------------------------===// 13254721Semaste 14296417Sdim#ifndef LLVM_MC_MCINSTRINFO_H 15254721Semaste#define LLVM_MC_MCINSTRINFO_H 16254721Semaste 17254721Semaste#include "llvm/MC/MCInstrDesc.h" 18254721Semaste#include <cassert> 19254721Semaste 20254721Semastenamespace llvm { 21254721Semaste 22254721Semaste//--------------------------------------------------------------------------- 23254721Semaste/// 24254721Semaste/// MCInstrInfo - Interface to description of machine instruction set 25254721Semaste/// 26254721Semasteclass MCInstrInfo { 27254721Semaste const MCInstrDesc *Desc; // Raw array to allow static init'n 28262528Semaste unsigned NumOpcodes; // Number of entries in the desc array 29262528Semaste 30254721Semastepublic: 31254721Semaste /// InitMCInstrInfo - Initialize MCInstrInfo, called by TableGen 32254721Semaste /// auto-generated routines. *DO NOT USE*. 33296417Sdim void InitMCInstrInfo(const MCInstrDesc *D, unsigned NO) { 34296417Sdim Desc = D; 35296417Sdim NumOpcodes = NO; 36296417Sdim } 37296417Sdim 38280031Sdim unsigned getNumOpcodes() const { return NumOpcodes; } 39254721Semaste 40254721Semaste /// get - Return the machine instruction descriptor that corresponds to the 41254721Semaste /// specified instruction opcode. 42254721Semaste /// 43254721Semaste const MCInstrDesc &get(unsigned Opcode) const { 44254721Semaste assert(Opcode < NumOpcodes && "Invalid opcode!"); 45288943Sdim return Desc[Opcode]; 46254721Semaste } 47296417Sdim}; 48296417Sdim 49296417Sdim} // End llvm namespace 50288943Sdim 51288943Sdim#endif 52254721Semaste