Implement cast bool to X
[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 MachineInstrInfo 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 MachineInstrDescriptor X86Insts[] = {
21 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES)   \
22              { NAME,                    \
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"
27 };
28
29 X86InstrInfo::X86InstrInfo()
30   : MachineInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) {
31 }
32
33
34 static unsigned char BaseOpcodes[] = {
35 #define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES) BASEOPCODE,
36 #include "X86InstrInfo.def"
37 };
38
39 // getBaseOpcodeFor - This function returns the "base" X86 opcode for the
40 // specified opcode number.
41 //
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];
46 }