Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 1 | //===- ARMInstrInfo.cpp - ARM Instruction Information -----------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the "Instituto Nokia de Tecnologia" and |
| 6 | // is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | // |
| 11 | // This file contains the ARM implementation of the TargetInstrInfo class. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "ARMInstrInfo.h" |
| 16 | #include "ARM.h" |
| 17 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
| 18 | #include "ARMGenInstrInfo.inc" |
| 19 | using namespace llvm; |
| 20 | |
| 21 | ARMInstrInfo::ARMInstrInfo() |
| 22 | : TargetInstrInfo(ARMInsts, sizeof(ARMInsts)/sizeof(ARMInsts[0])) { |
| 23 | } |
| 24 | |
Rafael Espindola | 46adf81 | 2006-08-08 20:35:03 +0000 | [diff] [blame^] | 25 | const TargetRegisterClass *ARMInstrInfo::getPointerRegClass() const { |
| 26 | return &ARM::IntRegsRegClass; |
| 27 | } |
| 28 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 29 | /// Return true if the instruction is a register to register move and |
| 30 | /// leave the source and dest operands in the passed parameters. |
| 31 | /// |
| 32 | bool ARMInstrInfo::isMoveInstr(const MachineInstr &MI, |
| 33 | unsigned &SrcReg, unsigned &DstReg) const { |
Rafael Espindola | 49e4415 | 2006-06-27 21:52:45 +0000 | [diff] [blame] | 34 | MachineOpCode oc = MI.getOpcode(); |
| 35 | switch (oc) { |
| 36 | default: |
| 37 | return false; |
| 38 | case ARM::movrr: |
| 39 | assert(MI.getNumOperands() == 2 && |
| 40 | MI.getOperand(0).isRegister() && |
| 41 | MI.getOperand(1).isRegister() && |
| 42 | "Invalid ARM MOV instruction"); |
| 43 | SrcReg = MI.getOperand(1).getReg();; |
| 44 | DstReg = MI.getOperand(0).getReg();; |
| 45 | return true; |
| 46 | } |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 47 | } |