2005-03-17 18:17:03 +00:00
|
|
|
//===- IA64InstrInfo.cpp - IA64 Instruction Information -----------*- C++ -*-===//
|
2005-04-21 23:13:11 +00:00
|
|
|
//
|
2005-03-17 18:17:03 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-21 23:13:11 +00:00
|
|
|
//
|
2005-03-17 18:17:03 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the IA64 implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "IA64InstrInfo.h"
|
|
|
|
#include "IA64.h"
|
|
|
|
#include "IA64InstrBuilder.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
|
|
#include "IA64GenInstrInfo.inc"
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
IA64InstrInfo::IA64InstrInfo()
|
|
|
|
: TargetInstrInfo(IA64Insts, sizeof(IA64Insts)/sizeof(IA64Insts[0])) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IA64InstrInfo::isMoveInstr(const MachineInstr& MI,
|
|
|
|
unsigned& sourceReg,
|
|
|
|
unsigned& destReg) const {
|
|
|
|
MachineOpCode oc = MI.getOpcode();
|
|
|
|
if (oc == IA64::MOV || oc == IA64::FMOV) {
|
2006-01-25 02:23:38 +00:00
|
|
|
// TODO: this doesn't detect predicate moves
|
2005-03-17 18:17:03 +00:00
|
|
|
assert(MI.getNumOperands() == 2 &&
|
|
|
|
/* MI.getOperand(0).isRegister() &&
|
|
|
|
MI.getOperand(1).isRegister() && */
|
|
|
|
"invalid register-register move instruction");
|
|
|
|
if( MI.getOperand(0).isRegister() &&
|
2005-04-22 17:54:37 +00:00
|
|
|
MI.getOperand(1).isRegister() ) {
|
2005-03-17 18:17:03 +00:00
|
|
|
// if both operands of the MOV/FMOV are registers, then
|
|
|
|
// yes, this is a move instruction
|
|
|
|
sourceReg = MI.getOperand(1).getReg();
|
|
|
|
destReg = MI.getOperand(0).getReg();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false; // we don't consider e.g. %regN = MOV <FrameIndex #x> a
|
|
|
|
// move instruction
|
|
|
|
}
|
|
|
|
|
2006-10-24 16:44:55 +00:00
|
|
|
void IA64InstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB,
|
|
|
|
MachineBasicBlock *FBB,
|
|
|
|
const std::vector<MachineOperand> &Cond)const {
|
|
|
|
// Can only insert uncond branches so far.
|
|
|
|
assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!");
|
|
|
|
BuildMI(&MBB, IA64::BRL_NOTCALL, 1).addMBB(TBB);
|
2006-10-24 17:07:11 +00:00
|
|
|
}
|