1 //===- X86InstrInfo.cpp - X86 Instruction Information -----------*- C++ -*-===//
3 // This file contains the X86 implementation of the TargetInstrInfo 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 TargetInstrDescriptor X86Insts[] = {
21 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPUSES, IMPDEFS) \
23 -1, /* Always vararg */ \
24 ((TSFLAGS) & X86II::Void) ? -1 : 0, /* Result is in 0 */ \
25 0, /* maxImmedConst field */\
26 false, /* immedIsSignExtended */\
27 0, /* numDelaySlots */\
31 TSFLAGS, /* TSFlags */\
32 IMPUSES, /* ImplicitUses */\
33 IMPDEFS }, /* ImplicitDefs */
34 #include "X86InstrInfo.def"
37 X86InstrInfo::X86InstrInfo()
38 : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) {
42 static unsigned char BaseOpcodes[] = {
43 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES) BASEOPCODE,
44 #include "X86InstrInfo.def"
47 // getBaseOpcodeFor - This function returns the "base" X86 opcode for the
48 // specified opcode number.
50 unsigned char X86InstrInfo::getBaseOpcodeFor(unsigned Opcode) const {
51 assert(Opcode < sizeof(BaseOpcodes)/sizeof(BaseOpcodes[0]) &&
52 "Opcode out of range!");
53 return BaseOpcodes[Opcode];