1 //===- X86InstrInfo.cpp - X86 Instruction Information ---------------===//
3 // This file contains the X86 implementation of the MachineInstrInfo class.
5 //===----------------------------------------------------------------------===//
7 #include "X86InstrInfo.h"
8 #include "llvm/CodeGen/MachineInstr.h"
11 // X86Insts - Turn the InstrInfo.def file into a bunch of instruction
14 static const MachineInstrDescriptor X86Insts[] = {
15 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS) \
17 -1, /* Always vararg */ \
18 ((TSFLAGS) & X86II::Void) ? -1 : 0, /* Result is in 0 */ \
19 0, false, 0, 0, TSFLAGS, FLAGS, TSFLAGS },
20 #include "X86InstrInfo.def"
23 X86InstrInfo::X86InstrInfo()
24 : MachineInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) {
28 static unsigned char BaseOpcodes[] = {
29 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS) BASEOPCODE,
30 #include "X86InstrInfo.def"
33 // getBaseOpcodeFor - This function returns the "base" X86 opcode for the
34 // specified opcode number.
36 unsigned char X86InstrInfo::getBaseOpcodeFor(unsigned Opcode) const {
37 assert(Opcode < sizeof(BaseOpcodes)/sizeof(BaseOpcodes[0]) &&
38 "Opcode out of range!");
39 return BaseOpcodes[Opcode];