blob: 4f469bb5b38a406b794c2e39b2cdf1090eeef1ae [file] [log] [blame]
Rafael Espindola7bc59bc2006-05-14 22:18:28 +00001//===- ARMInstrInfo.cpp - ARM Instruction Information -----------*- C++ -*-===//
2//
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;
33 case ARM::LDR_PRE:
34 case ARM::LDR_POST:
Jim Grosbach3e556122010-10-26 22:37:02 +000035 return ARM::LDRi12;
Evan Chenga8e29892007-01-19 07:51:42 +000036 case ARM::LDRH_PRE:
37 case ARM::LDRH_POST:
38 return ARM::LDRH;
39 case ARM::LDRB_PRE:
40 case ARM::LDRB_POST:
Jim Grosbachc1d30212010-10-27 00:19:44 +000041 return ARM::LDRBi12;
Evan Chenga8e29892007-01-19 07:51:42 +000042 case ARM::LDRSH_PRE:
43 case ARM::LDRSH_POST:
44 return ARM::LDRSH;
45 case ARM::LDRSB_PRE:
46 case ARM::LDRSB_POST:
47 return ARM::LDRSB;
48 case ARM::STR_PRE:
49 case ARM::STR_POST:
Jim Grosbach7e3383c2010-10-27 23:12:14 +000050 return ARM::STRi12;
Evan Chenga8e29892007-01-19 07:51:42 +000051 case ARM::STRH_PRE:
52 case ARM::STRH_POST:
53 return ARM::STRH;
54 case ARM::STRB_PRE:
55 case ARM::STRB_POST:
Jim Grosbach7e3383c2010-10-27 23:12:14 +000056 return ARM::STRBi12;
Evan Chenga8e29892007-01-19 07:51:42 +000057 }
David Goodwin334c2642009-07-08 16:09:28 +000058
Evan Chenga8e29892007-01-19 07:51:42 +000059 return 0;
60}