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"
18 #include "X86GenInstrInfo.inc"
22 X86InstrInfo::X86InstrInfo()
23 : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) {
27 bool X86InstrInfo::isMoveInstr(const MachineInstr& MI,
29 unsigned& destReg) const {
30 MachineOpCode oc = MI.getOpcode();
31 if (oc == X86::MOVrr8 || oc == X86::MOVrr16 || oc == X86::MOVrr32 ||
33 assert(MI.getNumOperands() == 2 &&
34 MI.getOperand(0).isRegister() &&
35 MI.getOperand(1).isRegister() &&
36 "invalid register-register move instruction");
37 sourceReg = MI.getOperand(1).getReg();
38 destReg = MI.getOperand(0).getReg();