1 //===- X86InstrInfo.cpp - X86 Instruction Information -----------*- C++ -*-===//
3 // This file contains the X86 implementation of the MachineInstrInfo class.
5 //===----------------------------------------------------------------------===//
7 #include "X86InstrInfo.h"
9 #include "llvm/CodeGen/MachineInstr.h"
11 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES)
12 #define IMPREGSLIST(NAME, ...) \
13 static const unsigned NAME[] = { __VA_ARGS__ };
14 #include "X86InstrInfo.def"
17 // X86Insts - Turn the InstrInfo.def file into a bunch of instruction
20 static const MachineInstrDescriptor X86Insts[] = {
21 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES) \
23 -1, /* Always vararg */ \
24 ((TSFLAGS) & X86II::Void) ? -1 : 0, /* Result is in 0 */ \
25 0, false, 0, 0, TSFLAGS, FLAGS, TSFLAGS, IMPDEFS, IMPUSES },
26 #include "X86InstrInfo.def"
29 X86InstrInfo::X86InstrInfo()
30 : MachineInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) {
34 static unsigned char BaseOpcodes[] = {
35 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES) BASEOPCODE,
36 #include "X86InstrInfo.def"
39 // getBaseOpcodeFor - This function returns the "base" X86 opcode for the
40 // specified opcode number.
42 unsigned char X86InstrInfo::getBaseOpcodeFor(unsigned Opcode) const {
43 assert(Opcode < sizeof(BaseOpcodes)/sizeof(BaseOpcodes[0]) &&
44 "Opcode out of range!");
45 return BaseOpcodes[Opcode];