A big X86 instruction rename. The instructions are renamed to make
[oota-llvm.git] / lib / Target / X86 / X86InstrInfo.cpp
1 //===- X86InstrInfo.cpp - X86 Instruction Information -----------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the X86 implementation of the TargetInstrInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "X86InstrInfo.h"
15 #include "X86.h"
16 #include "llvm/CodeGen/MachineInstrBuilder.h"
17 #include "X86GenInstrInfo.inc"
18 using namespace llvm;
19
20 X86InstrInfo::X86InstrInfo()
21   : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0])) {
22 }
23
24
25 bool X86InstrInfo::isMoveInstr(const MachineInstr& MI,
26                                unsigned& sourceReg,
27                                unsigned& destReg) const {
28   MachineOpCode oc = MI.getOpcode();
29   if (oc == X86::MOV8rr || oc == X86::MOV16rr || oc == X86::MOV32rr ||
30       oc == X86::FpMOV) {
31       assert(MI.getNumOperands() == 2 &&
32              MI.getOperand(0).isRegister() &&
33              MI.getOperand(1).isRegister() &&
34              "invalid register-register move instruction");
35       sourceReg = MI.getOperand(1).getReg();
36       destReg = MI.getOperand(0).getReg();
37       return true;
38   }
39   return false;
40 }