blob: 04fee641f1e01392020d7457656bb86fe77a6915 [file] [log] [blame]
Jim Grosbach31c24bf2009-11-07 22:00:39 +00001//===- ARMBaseInstrInfo.h - ARM Base Instruction Information ----*- C++ -*-===//
David Goodwin334c2642009-07-08 16:09:28 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the Base ARM implementation of the TargetInstrInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef ARMBASEINSTRUCTIONINFO_H
15#define ARMBASEINSTRUCTIONINFO_H
16
David Goodwin334c2642009-07-08 16:09:28 +000017#include "ARM.h"
Anton Korobeynikovb8e9ac82009-07-16 23:26:06 +000018#include "llvm/CodeGen/MachineInstrBuilder.h"
19#include "llvm/Target/TargetInstrInfo.h"
David Goodwin334c2642009-07-08 16:09:28 +000020
21namespace llvm {
Chris Lattner4dbbe342010-07-20 21:17:29 +000022 class ARMSubtarget;
23 class ARMBaseRegisterInfo;
David Goodwin334c2642009-07-08 16:09:28 +000024
25/// ARMII - This namespace holds all of the target specific flags that
26/// instruction info tracks.
27///
28namespace ARMII {
29 enum {
30 //===------------------------------------------------------------------===//
31 // Instruction Flags.
32
33 //===------------------------------------------------------------------===//
34 // This four-bit field describes the addressing mode used.
35
Jim Grosbachd86609f2010-10-05 18:14:55 +000036 AddrModeMask = 0x1f,
David Goodwin334c2642009-07-08 16:09:28 +000037 AddrModeNone = 0,
38 AddrMode1 = 1,
39 AddrMode2 = 2,
40 AddrMode3 = 3,
41 AddrMode4 = 4,
42 AddrMode5 = 5,
43 AddrMode6 = 6,
44 AddrModeT1_1 = 7,
45 AddrModeT1_2 = 8,
46 AddrModeT1_4 = 9,
47 AddrModeT1_s = 10, // i8 * 4 for pc and sp relative data
48 AddrModeT2_i12 = 11,
49 AddrModeT2_i8 = 12,
50 AddrModeT2_so = 13,
51 AddrModeT2_pc = 14, // +/- i12 for pc relative data
52 AddrModeT2_i8s4 = 15, // i8 * 4
53
54 // Size* - Flags to keep track of the size of an instruction.
Jim Grosbachd86609f2010-10-05 18:14:55 +000055 SizeShift = 5,
David Goodwin334c2642009-07-08 16:09:28 +000056 SizeMask = 7 << SizeShift,
57 SizeSpecial = 1, // 0 byte pseudo or special case.
58 Size8Bytes = 2,
59 Size4Bytes = 3,
60 Size2Bytes = 4,
61
Bob Wilsonbffb5b32010-03-13 07:34:35 +000062 // IndexMode - Unindex, pre-indexed, or post-indexed are valid for load
63 // and store ops only. Generic "updating" flag is used for ld/st multiple.
Jim Grosbachd86609f2010-10-05 18:14:55 +000064 IndexModeShift = 8,
David Goodwin334c2642009-07-08 16:09:28 +000065 IndexModeMask = 3 << IndexModeShift,
66 IndexModePre = 1,
67 IndexModePost = 2,
Bob Wilsonbffb5b32010-03-13 07:34:35 +000068 IndexModeUpd = 3,
David Goodwin334c2642009-07-08 16:09:28 +000069
70 //===------------------------------------------------------------------===//
71 // Instruction encoding formats.
72 //
Jim Grosbachd86609f2010-10-05 18:14:55 +000073 FormShift = 10,
David Goodwin334c2642009-07-08 16:09:28 +000074 FormMask = 0x3f << FormShift,
75
76 // Pseudo instructions
77 Pseudo = 0 << FormShift,
78
79 // Multiply instructions
80 MulFrm = 1 << FormShift,
81
82 // Branch instructions
83 BrFrm = 2 << FormShift,
84 BrMiscFrm = 3 << FormShift,
85
86 // Data Processing instructions
87 DPFrm = 4 << FormShift,
88 DPSoRegFrm = 5 << FormShift,
89
90 // Load and Store
91 LdFrm = 6 << FormShift,
92 StFrm = 7 << FormShift,
93 LdMiscFrm = 8 << FormShift,
94 StMiscFrm = 9 << FormShift,
95 LdStMulFrm = 10 << FormShift,
96
Johnny Chen81f04d52010-03-19 17:39:00 +000097 LdStExFrm = 11 << FormShift,
Jim Grosbach5278eb82009-12-11 01:42:04 +000098
David Goodwin334c2642009-07-08 16:09:28 +000099 // Miscellaneous arithmetic instructions
Johnny Chen81f04d52010-03-19 17:39:00 +0000100 ArithMiscFrm = 12 << FormShift,
Bob Wilson9a1c1892010-08-11 00:01:18 +0000101 SatFrm = 13 << FormShift,
David Goodwin334c2642009-07-08 16:09:28 +0000102
103 // Extend instructions
Bob Wilson9a1c1892010-08-11 00:01:18 +0000104 ExtFrm = 14 << FormShift,
David Goodwin334c2642009-07-08 16:09:28 +0000105
106 // VFP formats
Bob Wilson9a1c1892010-08-11 00:01:18 +0000107 VFPUnaryFrm = 15 << FormShift,
108 VFPBinaryFrm = 16 << FormShift,
109 VFPConv1Frm = 17 << FormShift,
110 VFPConv2Frm = 18 << FormShift,
111 VFPConv3Frm = 19 << FormShift,
112 VFPConv4Frm = 20 << FormShift,
113 VFPConv5Frm = 21 << FormShift,
114 VFPLdStFrm = 22 << FormShift,
115 VFPLdStMulFrm = 23 << FormShift,
116 VFPMiscFrm = 24 << FormShift,
David Goodwin334c2642009-07-08 16:09:28 +0000117
118 // Thumb format
Bob Wilson9a1c1892010-08-11 00:01:18 +0000119 ThumbFrm = 25 << FormShift,
David Goodwin334c2642009-07-08 16:09:28 +0000120
Bob Wilson26532632010-06-25 23:45:37 +0000121 // Miscelleaneous format
Bob Wilson9a1c1892010-08-11 00:01:18 +0000122 MiscFrm = 26 << FormShift,
Bob Wilson26532632010-06-25 23:45:37 +0000123
Bob Wilson1a913ed2010-06-11 21:34:50 +0000124 // NEON formats
Bob Wilson9a1c1892010-08-11 00:01:18 +0000125 NGetLnFrm = 27 << FormShift,
126 NSetLnFrm = 28 << FormShift,
127 NDupFrm = 29 << FormShift,
128 NLdStFrm = 30 << FormShift,
129 N1RegModImmFrm= 31 << FormShift,
130 N2RegFrm = 32 << FormShift,
131 NVCVTFrm = 33 << FormShift,
132 NVDupLnFrm = 34 << FormShift,
133 N2RegVShLFrm = 35 << FormShift,
134 N2RegVShRFrm = 36 << FormShift,
135 N3RegFrm = 37 << FormShift,
136 N3RegVShFrm = 38 << FormShift,
137 NVExtFrm = 39 << FormShift,
138 NVMulSLFrm = 40 << FormShift,
139 NVTBLFrm = 41 << FormShift,
David Goodwin334c2642009-07-08 16:09:28 +0000140
141 //===------------------------------------------------------------------===//
142 // Misc flags.
143
144 // UnaryDP - Indicates this is a unary data processing instruction, i.e.
145 // it doesn't have a Rn operand.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000146 UnaryDP = 1 << 16,
David Goodwin334c2642009-07-08 16:09:28 +0000147
148 // Xform16Bit - Indicates this Thumb2 instruction may be transformed into
149 // a 16-bit Thumb instruction if certain conditions are met.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000150 Xform16Bit = 1 << 17,
David Goodwin334c2642009-07-08 16:09:28 +0000151
152 //===------------------------------------------------------------------===//
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000153 // Code domain.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000154 DomainShift = 18,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000155 DomainMask = 3 << DomainShift,
156 DomainGeneral = 0 << DomainShift,
157 DomainVFP = 1 << DomainShift,
158 DomainNEON = 2 << DomainShift,
159
160 //===------------------------------------------------------------------===//
David Goodwin334c2642009-07-08 16:09:28 +0000161 // Field shifts - such shifts are used to set field while generating
162 // machine instructions.
163 M_BitShift = 5,
164 ShiftImmShift = 5,
165 ShiftShift = 7,
166 N_BitShift = 7,
167 ImmHiShift = 8,
168 SoRotImmShift = 8,
169 RegRsShift = 8,
170 ExtRotImmShift = 10,
171 RegRdLoShift = 12,
172 RegRdShift = 12,
173 RegRdHiShift = 16,
174 RegRnShift = 16,
175 S_BitShift = 20,
176 W_BitShift = 21,
177 AM3_I_BitShift = 22,
178 D_BitShift = 22,
179 U_BitShift = 23,
180 P_BitShift = 24,
181 I_BitShift = 25,
182 CondShift = 28
183 };
Evan Chengb46aaa32009-07-19 19:16:46 +0000184}
185
David Goodwin334c2642009-07-08 16:09:28 +0000186class ARMBaseInstrInfo : public TargetInstrInfoImpl {
Chris Lattner4dbbe342010-07-20 21:17:29 +0000187 const ARMSubtarget &Subtarget;
David Goodwin334c2642009-07-08 16:09:28 +0000188protected:
189 // Can be only subclassed.
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000190 explicit ARMBaseInstrInfo(const ARMSubtarget &STI);
David Goodwin334c2642009-07-08 16:09:28 +0000191public:
192 // Return the non-pre/post incrementing version of 'Opc'. Return 0
193 // if there is not such an opcode.
194 virtual unsigned getUnindexedOpcode(unsigned Opc) const =0;
195
David Goodwin334c2642009-07-08 16:09:28 +0000196 virtual MachineInstr *convertToThreeAddress(MachineFunction::iterator &MFI,
197 MachineBasicBlock::iterator &MBBI,
198 LiveVariables *LV) const;
199
200 virtual const ARMBaseRegisterInfo &getRegisterInfo() const =0;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000201 const ARMSubtarget &getSubtarget() const { return Subtarget; }
David Goodwin334c2642009-07-08 16:09:28 +0000202
Evan Cheng2457f2c2010-05-22 01:47:14 +0000203 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
204 MachineBasicBlock::iterator MI,
205 const std::vector<CalleeSavedInfo> &CSI,
206 const TargetRegisterInfo *TRI) const;
207
David Goodwin334c2642009-07-08 16:09:28 +0000208 // Branch analysis.
209 virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
210 MachineBasicBlock *&FBB,
211 SmallVectorImpl<MachineOperand> &Cond,
Chris Lattner20628752010-07-22 21:27:00 +0000212 bool AllowModify = false) const;
David Goodwin334c2642009-07-08 16:09:28 +0000213 virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
214 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
215 MachineBasicBlock *FBB,
Stuart Hastings3bf91252010-06-17 22:43:56 +0000216 const SmallVectorImpl<MachineOperand> &Cond,
217 DebugLoc DL) const;
David Goodwin334c2642009-07-08 16:09:28 +0000218
219 virtual
220 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
221
222 // Predication support.
Evan Chengab331502009-07-10 01:38:27 +0000223 bool isPredicated(const MachineInstr *MI) const {
224 int PIdx = MI->findFirstPredOperandIdx();
225 return PIdx != -1 && MI->getOperand(PIdx).getImm() != ARMCC::AL;
226 }
David Goodwin334c2642009-07-08 16:09:28 +0000227
228 ARMCC::CondCodes getPredicate(const MachineInstr *MI) const {
229 int PIdx = MI->findFirstPredOperandIdx();
230 return PIdx != -1 ? (ARMCC::CondCodes)MI->getOperand(PIdx).getImm()
231 : ARMCC::AL;
232 }
233
234 virtual
235 bool PredicateInstruction(MachineInstr *MI,
236 const SmallVectorImpl<MachineOperand> &Pred) const;
237
238 virtual
239 bool SubsumesPredicate(const SmallVectorImpl<MachineOperand> &Pred1,
240 const SmallVectorImpl<MachineOperand> &Pred2) const;
241
242 virtual bool DefinesPredicate(MachineInstr *MI,
243 std::vector<MachineOperand> &Pred) const;
244
Evan Chengac0869d2009-11-21 06:21:52 +0000245 virtual bool isPredicable(MachineInstr *MI) const;
246
David Goodwin334c2642009-07-08 16:09:28 +0000247 /// GetInstSize - Returns the size of the specified MachineInstr.
248 ///
249 virtual unsigned GetInstSizeInBytes(const MachineInstr* MI) const;
250
David Goodwin334c2642009-07-08 16:09:28 +0000251 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
252 int &FrameIndex) const;
253 virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
254 int &FrameIndex) const;
255
Jakob Stoklund Olesenac273662010-07-11 06:33:54 +0000256 virtual void copyPhysReg(MachineBasicBlock &MBB,
257 MachineBasicBlock::iterator I, DebugLoc DL,
258 unsigned DestReg, unsigned SrcReg,
259 bool KillSrc) const;
Evan Cheng5732ca02009-07-27 03:14:20 +0000260
David Goodwin334c2642009-07-08 16:09:28 +0000261 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
262 MachineBasicBlock::iterator MBBI,
263 unsigned SrcReg, bool isKill, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +0000264 const TargetRegisterClass *RC,
265 const TargetRegisterInfo *TRI) const;
David Goodwin334c2642009-07-08 16:09:28 +0000266
David Goodwin334c2642009-07-08 16:09:28 +0000267 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
268 MachineBasicBlock::iterator MBBI,
269 unsigned DestReg, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +0000270 const TargetRegisterClass *RC,
271 const TargetRegisterInfo *TRI) const;
David Goodwin334c2642009-07-08 16:09:28 +0000272
Evan Cheng62b50652010-04-26 07:39:25 +0000273 virtual MachineInstr *emitFrameIndexDebugValue(MachineFunction &MF,
Evan Cheng8601a3d2010-04-29 01:13:30 +0000274 int FrameIx,
Evan Cheng62b50652010-04-26 07:39:25 +0000275 uint64_t Offset,
276 const MDNode *MDPtr,
277 DebugLoc DL) const;
278
Evan Chengfdc83402009-11-08 00:15:23 +0000279 virtual void reMaterialize(MachineBasicBlock &MBB,
280 MachineBasicBlock::iterator MI,
281 unsigned DestReg, unsigned SubIdx,
Evan Chengd57cdd52009-11-14 02:55:43 +0000282 const MachineInstr *Orig,
Jakob Stoklund Olesen9edf7de2010-06-02 22:47:25 +0000283 const TargetRegisterInfo &TRI) const;
Evan Chengfdc83402009-11-08 00:15:23 +0000284
Jakob Stoklund Olesen30ac0462010-01-06 23:47:07 +0000285 MachineInstr *duplicate(MachineInstr *Orig, MachineFunction &MF) const;
286
Evan Cheng506049f2010-03-03 01:44:33 +0000287 virtual bool produceSameValue(const MachineInstr *MI0,
288 const MachineInstr *MI1) const;
Evan Cheng86050dc2010-06-18 23:09:54 +0000289
Bill Wendling4b722102010-06-23 23:00:16 +0000290 /// areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler to
291 /// determine if two loads are loading from the same base address. It should
292 /// only return true if the base pointers are the same and the only
293 /// differences between the two addresses is the offset. It also returns the
294 /// offsets by reference.
295 virtual bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2,
296 int64_t &Offset1, int64_t &Offset2)const;
297
298 /// shouldScheduleLoadsNear - This is a used by the pre-regalloc scheduler to
299 /// determine (in conjuction with areLoadsFromSameBasePtr) if two loads should
300 /// be scheduled togther. On some targets if two loads are loading from
301 /// addresses in the same cache line, it's better if they are scheduled
302 /// together. This function takes two integers that represent the load offsets
303 /// from the common base address. It returns true if it decides it's desirable
304 /// to schedule the two loads together. "NumLoads" is the number of loads that
305 /// have already been scheduled after Load1.
306 virtual bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2,
307 int64_t Offset1, int64_t Offset2,
308 unsigned NumLoads) const;
309
Evan Cheng86050dc2010-06-18 23:09:54 +0000310 virtual bool isSchedulingBoundary(const MachineInstr *MI,
311 const MachineBasicBlock *MBB,
312 const MachineFunction &MF) const;
Evan Cheng13151432010-06-25 22:42:03 +0000313
314 virtual bool isProfitableToIfCvt(MachineBasicBlock &MBB,
Owen Andersone3cc84a2010-10-01 22:45:50 +0000315 unsigned NumInstrs,
316 float Prob, float Confidence) const;
Evan Cheng13151432010-06-25 22:42:03 +0000317
318 virtual bool isProfitableToIfCvt(MachineBasicBlock &TMBB,unsigned NumT,
Owen Andersonb20b8512010-09-28 18:32:13 +0000319 MachineBasicBlock &FMBB,unsigned NumF,
Owen Andersone3cc84a2010-10-01 22:45:50 +0000320 float Probability, float Confidence) const;
Evan Cheng13151432010-06-25 22:42:03 +0000321
322 virtual bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB,
Owen Andersonb20b8512010-09-28 18:32:13 +0000323 unsigned NumInstrs,
Owen Andersone3cc84a2010-10-01 22:45:50 +0000324 float Probability,
325 float Confidence) const {
Evan Cheng13151432010-06-25 22:42:03 +0000326 return NumInstrs && NumInstrs == 1;
327 }
Bill Wendlinge4ddbdf2010-08-06 01:32:48 +0000328
Bill Wendlingc98af332010-08-08 05:04:59 +0000329 /// AnalyzeCompare - For a comparison instruction, return the source register
330 /// in SrcReg and the value it compares against in CmpValue. Return true if
331 /// the comparison instruction can be analyzed.
332 virtual bool AnalyzeCompare(const MachineInstr *MI, unsigned &SrcReg,
Gabor Greif04ac81d2010-09-21 12:01:15 +0000333 int &CmpMask, int &CmpValue) const;
Bill Wendlinge4ddbdf2010-08-06 01:32:48 +0000334
Bill Wendlinga6556862010-09-11 00:13:50 +0000335 /// OptimizeCompareInstr - Convert the instruction to set the zero flag so
Bill Wendlinge4ddbdf2010-08-06 01:32:48 +0000336 /// that we can remove a "comparison with zero".
Bill Wendlinga6556862010-09-11 00:13:50 +0000337 virtual bool OptimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg,
Gabor Greif04ac81d2010-09-21 12:01:15 +0000338 int CmpMask, int CmpValue,
Bill Wendling220e2402010-09-10 21:55:43 +0000339 MachineBasicBlock::iterator &MII) const;
Evan Cheng5f54ce32010-09-09 18:18:55 +0000340
341 virtual unsigned getNumMicroOps(const MachineInstr *MI,
Evan Cheng3ef1c872010-09-10 01:29:16 +0000342 const InstrItineraryData *ItinData) const;
Evan Chenga0792de2010-10-06 06:27:31 +0000343
344 virtual
345 int getOperandLatency(const InstrItineraryData *ItinData,
346 const MachineInstr *DefMI, unsigned DefIdx,
347 const MachineInstr *UseMI, unsigned UseIdx) const;
348 virtual
349 int getOperandLatency(const InstrItineraryData *ItinData,
350 SDNode *DefNode, unsigned DefIdx,
351 SDNode *UseNode, unsigned UseIdx) const;
352private:
353 int getOperandLatency(const InstrItineraryData *ItinData,
354 const TargetInstrDesc &DefTID,
355 unsigned DefIdx, unsigned DefAlign,
356 const TargetInstrDesc &UseTID,
357 unsigned UseIdx, unsigned UseAlign) const;
David Goodwin334c2642009-07-08 16:09:28 +0000358};
Evan Cheng6495f632009-07-28 05:48:47 +0000359
360static inline
361const MachineInstrBuilder &AddDefaultPred(const MachineInstrBuilder &MIB) {
362 return MIB.addImm((int64_t)ARMCC::AL).addReg(0);
David Goodwin334c2642009-07-08 16:09:28 +0000363}
364
Evan Cheng6495f632009-07-28 05:48:47 +0000365static inline
366const MachineInstrBuilder &AddDefaultCC(const MachineInstrBuilder &MIB) {
367 return MIB.addReg(0);
368}
369
370static inline
Evan Chenge8af1f92009-08-10 02:37:24 +0000371const MachineInstrBuilder &AddDefaultT1CC(const MachineInstrBuilder &MIB,
372 bool isDead = false) {
373 return MIB.addReg(ARM::CPSR, getDefRegState(true) | getDeadRegState(isDead));
Evan Cheng6495f632009-07-28 05:48:47 +0000374}
375
376static inline
Evan Chengbc9b7542009-08-15 07:59:10 +0000377const MachineInstrBuilder &AddNoT1CC(const MachineInstrBuilder &MIB) {
378 return MIB.addReg(0);
379}
380
381static inline
Evan Cheng6495f632009-07-28 05:48:47 +0000382bool isUncondBranchOpcode(int Opc) {
383 return Opc == ARM::B || Opc == ARM::tB || Opc == ARM::t2B;
384}
385
386static inline
387bool isCondBranchOpcode(int Opc) {
388 return Opc == ARM::Bcc || Opc == ARM::tBcc || Opc == ARM::t2Bcc;
389}
390
391static inline
392bool isJumpTableBranchOpcode(int Opc) {
393 return Opc == ARM::BR_JTr || Opc == ARM::BR_JTm || Opc == ARM::BR_JTadd ||
394 Opc == ARM::tBR_JTr || Opc == ARM::t2BR_JT;
395}
396
Bob Wilson8d4de5a2009-10-28 18:26:41 +0000397static inline
398bool isIndirectBranchOpcode(int Opc) {
Anton Korobeynikovce7bf1c2010-03-06 19:39:36 +0000399 return Opc == ARM::BRIND || Opc == ARM::MOVPCRX || Opc == ARM::tBRIND;
Bob Wilson8d4de5a2009-10-28 18:26:41 +0000400}
401
Evan Cheng8fb90362009-08-08 03:20:32 +0000402/// getInstrPredicate - If instruction is predicated, returns its predicate
403/// condition, otherwise returns AL. It also returns the condition code
404/// register by reference.
Evan Cheng5adb66a2009-09-28 09:14:39 +0000405ARMCC::CondCodes getInstrPredicate(const MachineInstr *MI, unsigned &PredReg);
Evan Cheng8fb90362009-08-08 03:20:32 +0000406
Evan Cheng6495f632009-07-28 05:48:47 +0000407int getMatchingCondBranchOpcode(int Opc);
408
409/// emitARMRegPlusImmediate / emitT2RegPlusImmediate - Emits a series of
410/// instructions to materializea destreg = basereg + immediate in ARM / Thumb2
411/// code.
412void emitARMRegPlusImmediate(MachineBasicBlock &MBB,
413 MachineBasicBlock::iterator &MBBI, DebugLoc dl,
414 unsigned DestReg, unsigned BaseReg, int NumBytes,
415 ARMCC::CondCodes Pred, unsigned PredReg,
416 const ARMBaseInstrInfo &TII);
417
418void emitT2RegPlusImmediate(MachineBasicBlock &MBB,
419 MachineBasicBlock::iterator &MBBI, DebugLoc dl,
420 unsigned DestReg, unsigned BaseReg, int NumBytes,
421 ARMCC::CondCodes Pred, unsigned PredReg,
422 const ARMBaseInstrInfo &TII);
423
424
Jim Grosbach764ab522009-08-11 15:33:49 +0000425/// rewriteARMFrameIndex / rewriteT2FrameIndex -
Evan Chengcdbb3f52009-08-27 01:23:50 +0000426/// Rewrite MI to access 'Offset' bytes from the FP. Return false if the
427/// offset could not be handled directly in MI, and return the left-over
428/// portion by reference.
429bool rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
430 unsigned FrameReg, int &Offset,
431 const ARMBaseInstrInfo &TII);
Evan Cheng6495f632009-07-28 05:48:47 +0000432
Evan Chengcdbb3f52009-08-27 01:23:50 +0000433bool rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
434 unsigned FrameReg, int &Offset,
435 const ARMBaseInstrInfo &TII);
Evan Cheng6495f632009-07-28 05:48:47 +0000436
437} // End llvm namespace
438
David Goodwin334c2642009-07-08 16:09:28 +0000439#endif