Rename MachineInstrInfo -> TargetInstrInfo
[oota-llvm.git] / lib / Target / X86 / X86InstrInfo.cpp
1 //===- X86InstrInfo.cpp - X86 Instruction Information -----------*- C++ -*-===//
2 //
3 // This file contains the X86 implementation of the TargetInstrInfo class.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #include "X86InstrInfo.h"
8 #include "X86.h"
9 #include "llvm/CodeGen/MachineInstr.h"
10
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"
15
16
17 // X86Insts - Turn the InstrInfo.def file into a bunch of instruction
18 // descriptors
19 //
20 static const TargetInstrDescriptor X86Insts[] = {
21 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPUSES, IMPDEFS)   \
22              { NAME,                    \
23                -1, /* Always vararg */  \
24                ((TSFLAGS) & X86II::Void) ? -1 : 0,  /* Result is in 0 */ \
25                0,                                   /* maxImmedConst field */\
26                false,                               /* immedIsSignExtended */\
27                0,                                   /* numDelaySlots */\
28                0,                                   /* latency */\
29                0,                                   /* schedClass */\
30                FLAGS,                               /* Flags */\
31                TSFLAGS,                             /* TSFlags */\
32                IMPUSES,                             /* ImplicitUses */\
33                IMPDEFS },                           /* ImplicitDefs */
34 #include "X86InstrInfo.def"
35 };
36
37 X86InstrInfo::X86InstrInfo()
38   : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) {
39 }
40
41
42 static unsigned char BaseOpcodes[] = {
43 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES) BASEOPCODE,
44 #include "X86InstrInfo.def"
45 };
46
47 // getBaseOpcodeFor - This function returns the "base" X86 opcode for the
48 // specified opcode number.
49 //
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];
54 }