1 //===- SparcV8InstrInfo.cpp - SparcV8 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 SparcV8 implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #include "SparcV8InstrInfo.h"
16 #include "llvm/CodeGen/MachineInstrBuilder.h"
17 #include "SparcV8GenInstrInfo.inc"
20 SparcV8InstrInfo::SparcV8InstrInfo()
21 : TargetInstrInfo(SparcV8Insts, sizeof(SparcV8Insts)/sizeof(SparcV8Insts[0])){
24 /// Return true if the instruction is a register to register move and
25 /// leave the source and dest operands in the passed parameters.
27 bool SparcV8InstrInfo::isMoveInstr(const MachineInstr &MI,
28 unsigned &SrcReg, unsigned &DstReg) const {
29 if (MI.getOpcode() == V8::ORrr) {
30 if (MI.getOperand(1).getReg() == V8::G0) { // X = or G0, Y -> X = Y
31 DstReg = MI.getOperand(0).getReg();
32 SrcReg = MI.getOperand(2).getReg();
35 } else if (MI.getOpcode() == V8::FMOVS || MI.getOpcode() == V8::FpMOVD) {
36 SrcReg = MI.getOperand(1).getReg();
37 DstReg = MI.getOperand(0).getReg();