LLVM API Documentation
00001 //===- ARMInstrInfo.cpp - ARM Instruction Information -----------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the "Instituto Nokia de Tecnologia" and 00006 // is distributed under the University of Illinois Open Source 00007 // License. See LICENSE.TXT for details. 00008 // 00009 //===----------------------------------------------------------------------===// 00010 // 00011 // This file contains the ARM implementation of the TargetInstrInfo class. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #include "ARMInstrInfo.h" 00016 #include "ARM.h" 00017 #include "llvm/CodeGen/MachineInstrBuilder.h" 00018 #include "ARMGenInstrInfo.inc" 00019 using namespace llvm; 00020 00021 ARMInstrInfo::ARMInstrInfo() 00022 : TargetInstrInfo(ARMInsts, sizeof(ARMInsts)/sizeof(ARMInsts[0])) { 00023 } 00024 00025 /// Return true if the instruction is a register to register move and 00026 /// leave the source and dest operands in the passed parameters. 00027 /// 00028 bool ARMInstrInfo::isMoveInstr(const MachineInstr &MI, 00029 unsigned &SrcReg, unsigned &DstReg) const { 00030 MachineOpCode oc = MI.getOpcode(); 00031 switch (oc) { 00032 default: 00033 return false; 00034 case ARM::movrr: 00035 assert(MI.getNumOperands() == 2 && 00036 MI.getOperand(0).isRegister() && 00037 MI.getOperand(1).isRegister() && 00038 "Invalid ARM MOV instruction"); 00039 SrcReg = MI.getOperand(1).getReg();; 00040 DstReg = MI.getOperand(0).getReg();; 00041 return true; 00042 } 00043 }