blob: 3ca0ebd42a5ba49d5a124a2ec3a476135506f803 [file] [log] [blame]
Andrew Lenharth304d0f32005-01-22 23:41:55 +00001//===- AlphaInstrInfo.cpp - Alpha Instruction Information ---*- C++ -*-===//
2//
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.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the Alpha implementation of the TargetInstrInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#include "Alpha.h"
15#include "AlphaInstrInfo.h"
16#include "AlphaGenInstrInfo.inc"
17#include "llvm/CodeGen/MachineInstrBuilder.h"
18#include <iostream>
19using namespace llvm;
20
21AlphaInstrInfo::AlphaInstrInfo()
22 : TargetInstrInfo(AlphaInsts, sizeof(AlphaInsts)/sizeof(AlphaInsts[0])) { }
23
24
25bool AlphaInstrInfo::isMoveInstr(const MachineInstr& MI,
26 unsigned& sourceReg,
27 unsigned& destReg) const {
28 //assert(0 && "TODO");
29 MachineOpCode oc = MI.getOpcode();
30 if (oc == Alpha::BIS) { // or r1, r2, r2
31 assert(MI.getNumOperands() == 3 &&
32 MI.getOperand(0).isRegister() &&
33 MI.getOperand(1).isRegister() &&
34 MI.getOperand(2).isRegister() &&
35 "invalid Alpha BIS instruction!");
36 if (MI.getOperand(1).getReg() == MI.getOperand(2).getReg()) {
37 sourceReg = MI.getOperand(1).getReg();
38 destReg = MI.getOperand(0).getReg();
39 return true;
40 }
41 }
42 return false;
43}