1 //===- X86InstrInfo.cpp - X86 Instruction Information -----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This file contains the X86 implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #include "X86InstrInfo.h"
16 #include "llvm/CodeGen/MachineInstrBuilder.h"
17 #include "X86GenInstrInfo.inc"
20 X86InstrInfo::X86InstrInfo()
21 : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0])) {
25 bool X86InstrInfo::isMoveInstr(const MachineInstr& MI,
27 unsigned& destReg) const {
28 MachineOpCode oc = MI.getOpcode();
29 if (oc == X86::MOV8rr || oc == X86::MOV16rr || oc == X86::MOV32rr ||
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();