LLVM API Documentation
00001 //===- IA64InstrInfo.cpp - IA64 Instruction Information -----------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the IA64 implementation of the TargetInstrInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #include "IA64InstrInfo.h" 00015 #include "IA64.h" 00016 #include "IA64InstrBuilder.h" 00017 #include "llvm/CodeGen/MachineInstrBuilder.h" 00018 #include "IA64GenInstrInfo.inc" 00019 using namespace llvm; 00020 00021 IA64InstrInfo::IA64InstrInfo() 00022 : TargetInstrInfo(IA64Insts, sizeof(IA64Insts)/sizeof(IA64Insts[0])) { 00023 } 00024 00025 00026 bool IA64InstrInfo::isMoveInstr(const MachineInstr& MI, 00027 unsigned& sourceReg, 00028 unsigned& destReg) const { 00029 MachineOpCode oc = MI.getOpcode(); 00030 if (oc == IA64::MOV || oc == IA64::FMOV) { 00031 // TODO: this doesn't detect predicate moves 00032 assert(MI.getNumOperands() == 2 && 00033 /* MI.getOperand(0).isRegister() && 00034 MI.getOperand(1).isRegister() && */ 00035 "invalid register-register move instruction"); 00036 if( MI.getOperand(0).isRegister() && 00037 MI.getOperand(1).isRegister() ) { 00038 // if both operands of the MOV/FMOV are registers, then 00039 // yes, this is a move instruction 00040 sourceReg = MI.getOperand(1).getReg(); 00041 destReg = MI.getOperand(0).getReg(); 00042 return true; 00043 } 00044 } 00045 return false; // we don't consider e.g. %regN = MOV <FrameIndex #x> a 00046 // move instruction 00047 } 00048