2011-06-28 19:10:37 +00:00
|
|
|
//===-- llvm/MC/MCInstrInfo.h - Target Instruction Info ---------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the target machine instruction set.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_MC_MCINSTRINFO_H
|
|
|
|
#define LLVM_MC_MCINSTRINFO_H
|
|
|
|
|
|
|
|
#include "llvm/MC/MCInstrDesc.h"
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
/// MCInstrInfo - Interface to description of machine instruction set
|
|
|
|
///
|
|
|
|
class MCInstrInfo {
|
2012-02-10 13:18:44 +00:00
|
|
|
const MCInstrDesc *Desc; // Raw array to allow static init'n
|
2012-03-08 06:55:27 +00:00
|
|
|
const uint16_t *InstrNameIndices; // Array for name indices in InstrNameData
|
2012-02-10 13:18:44 +00:00
|
|
|
const char *InstrNameData; // Instruction name string pool
|
|
|
|
unsigned NumOpcodes; // Number of entries in the desc array
|
2011-06-28 19:10:37 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/// InitMCInstrInfo - Initialize MCInstrInfo, called by TableGen
|
|
|
|
/// auto-generated routines. *DO NOT USE*.
|
2012-03-08 06:55:27 +00:00
|
|
|
void InitMCInstrInfo(const MCInstrDesc *D, const uint16_t *NI, const char *ND,
|
2012-02-10 13:18:44 +00:00
|
|
|
unsigned NO) {
|
2011-06-28 19:10:37 +00:00
|
|
|
Desc = D;
|
2012-02-10 13:18:44 +00:00
|
|
|
InstrNameIndices = NI;
|
|
|
|
InstrNameData = ND;
|
2011-06-28 19:10:37 +00:00
|
|
|
NumOpcodes = NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned getNumOpcodes() const { return NumOpcodes; }
|
|
|
|
|
|
|
|
/// get - Return the machine instruction descriptor that corresponds to the
|
|
|
|
/// specified instruction opcode.
|
|
|
|
///
|
|
|
|
const MCInstrDesc &get(unsigned Opcode) const {
|
|
|
|
assert(Opcode < NumOpcodes && "Invalid opcode!");
|
|
|
|
return Desc[Opcode];
|
|
|
|
}
|
2012-02-10 13:18:44 +00:00
|
|
|
|
|
|
|
/// getName - Returns the name for the instructions with the given opcode.
|
|
|
|
const char *getName(unsigned Opcode) const {
|
|
|
|
assert(Opcode < NumOpcodes && "Invalid opcode!");
|
|
|
|
return &InstrNameData[InstrNameIndices[Opcode]];
|
|
|
|
}
|
2011-06-28 19:10:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|