blob: e4d46d19ef5ac8877394af54913e7168b4015a5b [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- ARMInstrInfo.cpp - ARM Instruction Information --------------------===//
Rafael Espindola7bc59bc2006-05-14 22:18:28 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
Rafael Espindola7bc59bc2006-05-14 22:18:28 +00006// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the ARM implementation of the TargetInstrInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#include "ARMInstrInfo.h"
15#include "ARM.h"
Evan Chenga8e29892007-01-19 07:51:42 +000016#include "ARMMachineFunctionInfo.h"
Evan Chengee04a6d2011-07-20 23:34:39 +000017#include "MCTargetDesc/ARMAddressingModes.h"
Owen Anderson718cb662007-09-07 04:06:50 +000018#include "llvm/ADT/STLExtras.h"
Evan Chenga8e29892007-01-19 07:51:42 +000019#include "llvm/CodeGen/LiveVariables.h"
Owen Andersond94b6a12008-01-04 23:57:37 +000020#include "llvm/CodeGen/MachineFrameInfo.h"
Evan Cheng29836c32007-01-29 23:45:17 +000021#include "llvm/CodeGen/MachineInstrBuilder.h"
22#include "llvm/CodeGen/MachineJumpTableInfo.h"
Chris Lattneraf76e592009-08-22 20:48:53 +000023#include "llvm/MC/MCAsmInfo.h"
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000024using namespace llvm;
25
Anton Korobeynikovd49ea772009-06-26 21:28:53 +000026ARMInstrInfo::ARMInstrInfo(const ARMSubtarget &STI)
Anton Korobeynikovf95215f2009-11-02 00:10:38 +000027 : ARMBaseInstrInfo(STI), RI(*this, STI) {
Anton Korobeynikovd49ea772009-06-26 21:28:53 +000028}
Rafael Espindola46adf812006-08-08 20:35:03 +000029
Chris Lattnerd90183d2009-08-02 05:20:37 +000030unsigned ARMInstrInfo::getUnindexedOpcode(unsigned Opc) const {
Evan Chenga8e29892007-01-19 07:51:42 +000031 switch (Opc) {
32 default: break;
Owen Anderson9ab0f252011-08-26 20:43:14 +000033 case ARM::LDR_PRE_IMM:
34 case ARM::LDR_PRE_REG:
Owen Anderson793e7962011-07-26 20:54:26 +000035 case ARM::LDR_POST_IMM:
36 case ARM::LDR_POST_REG:
Jim Grosbach3e556122010-10-26 22:37:02 +000037 return ARM::LDRi12;
Evan Chenga8e29892007-01-19 07:51:42 +000038 case ARM::LDRH_PRE:
39 case ARM::LDRH_POST:
40 return ARM::LDRH;
Owen Anderson9ab0f252011-08-26 20:43:14 +000041 case ARM::LDRB_PRE_IMM:
42 case ARM::LDRB_PRE_REG:
Owen Anderson793e7962011-07-26 20:54:26 +000043 case ARM::LDRB_POST_IMM:
44 case ARM::LDRB_POST_REG:
Jim Grosbachc1d30212010-10-27 00:19:44 +000045 return ARM::LDRBi12;
Evan Chenga8e29892007-01-19 07:51:42 +000046 case ARM::LDRSH_PRE:
47 case ARM::LDRSH_POST:
48 return ARM::LDRSH;
49 case ARM::LDRSB_PRE:
50 case ARM::LDRSB_POST:
51 return ARM::LDRSB;
Owen Anderson793e7962011-07-26 20:54:26 +000052 case ARM::STR_PRE_IMM:
53 case ARM::STR_PRE_REG:
54 case ARM::STR_POST_IMM:
55 case ARM::STR_POST_REG:
Jim Grosbach7e3383c2010-10-27 23:12:14 +000056 return ARM::STRi12;
Evan Chenga8e29892007-01-19 07:51:42 +000057 case ARM::STRH_PRE:
58 case ARM::STRH_POST:
59 return ARM::STRH;
Owen Anderson793e7962011-07-26 20:54:26 +000060 case ARM::STRB_PRE_IMM:
61 case ARM::STRB_PRE_REG:
62 case ARM::STRB_POST_IMM:
63 case ARM::STRB_POST_REG:
Jim Grosbach7e3383c2010-10-27 23:12:14 +000064 return ARM::STRBi12;
Evan Chenga8e29892007-01-19 07:51:42 +000065 }
David Goodwin334c2642009-07-08 16:09:28 +000066
Evan Chenga8e29892007-01-19 07:51:42 +000067 return 0;
68}