Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 1 | //===- IA64InstrInfo.cpp - IA64 Instruction Information -----------*- C++ -*-===// |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame^] | 2 | // |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 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. |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame^] | 7 | // |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the IA64 implementation of the TargetInstrInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "IA64InstrInfo.h" |
| 15 | #include "IA64.h" |
| 16 | #include "IA64InstrBuilder.h" |
| 17 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
| 18 | #include "IA64GenInstrInfo.inc" |
| 19 | using namespace llvm; |
| 20 | |
| 21 | IA64InstrInfo::IA64InstrInfo() |
| 22 | : TargetInstrInfo(IA64Insts, sizeof(IA64Insts)/sizeof(IA64Insts[0])) { |
| 23 | } |
| 24 | |
| 25 | |
| 26 | bool IA64InstrInfo::isMoveInstr(const MachineInstr& MI, |
| 27 | unsigned& sourceReg, |
| 28 | unsigned& destReg) const { |
| 29 | MachineOpCode oc = MI.getOpcode(); |
| 30 | if (oc == IA64::MOV || oc == IA64::FMOV) { |
| 31 | assert(MI.getNumOperands() == 2 && |
| 32 | /* MI.getOperand(0).isRegister() && |
| 33 | MI.getOperand(1).isRegister() && */ |
| 34 | "invalid register-register move instruction"); |
| 35 | if( MI.getOperand(0).isRegister() && |
| 36 | MI.getOperand(1).isRegister() ) { |
| 37 | // if both operands of the MOV/FMOV are registers, then |
| 38 | // yes, this is a move instruction |
| 39 | sourceReg = MI.getOperand(1).getReg(); |
| 40 | destReg = MI.getOperand(0).getReg(); |
| 41 | return true; |
| 42 | } |
| 43 | } |
| 44 | return false; // we don't consider e.g. %regN = MOV <FrameIndex #x> a |
| 45 | // move instruction |
| 46 | } |
| 47 | |