2004-02-25 20:28:19 +01:00
|
|
|
//===- SparcV8InstrInfo.cpp - SparcV8 Instruction Information ---*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the SparcV8 implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "SparcV8InstrInfo.h"
|
2004-07-25 08:19:04 +02:00
|
|
|
#include "SparcV8.h"
|
2004-02-25 20:28:19 +01:00
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
|
|
#include "SparcV8GenInstrInfo.inc"
|
2004-02-29 06:59:33 +01:00
|
|
|
using namespace llvm;
|
2004-02-25 20:28:19 +01:00
|
|
|
|
|
|
|
SparcV8InstrInfo::SparcV8InstrInfo()
|
2004-02-29 07:31:44 +01:00
|
|
|
: TargetInstrInfo(SparcV8Insts, sizeof(SparcV8Insts)/sizeof(SparcV8Insts[0])){
|
2004-02-25 20:28:19 +01:00
|
|
|
}
|
|
|
|
|
2004-07-25 08:19:04 +02:00
|
|
|
/// Return true if the instruction is a register to register move and
|
|
|
|
/// leave the source and dest operands in the passed parameters.
|
|
|
|
///
|
|
|
|
bool SparcV8InstrInfo::isMoveInstr(const MachineInstr &MI,
|
|
|
|
unsigned &SrcReg, unsigned &DstReg) const {
|
|
|
|
if (MI.getOpcode() == V8::ORrr) {
|
|
|
|
if (MI.getOperand(1).getReg() == V8::G0) { // X = or G0, Y -> X = Y
|
|
|
|
DstReg = MI.getOperand(0).getReg();
|
|
|
|
SrcReg = MI.getOperand(2).getReg();
|
2004-09-29 05:28:15 +02:00
|
|
|
return true;
|
2004-07-25 08:19:04 +02:00
|
|
|
}
|
|
|
|
} else if (MI.getOpcode() == V8::FMOVS) {
|
|
|
|
SrcReg = MI.getOperand(1).getReg();
|
|
|
|
DstReg = MI.getOperand(0).getReg();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|