blob: 1a10a4ab1c5225cd06c2c842be744131dcd37172 [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +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"
Evan Cheng48575f62010-12-05 22:04:16 +000020#include "llvm/ADT/DenseMap.h"
21#include "llvm/ADT/SmallSet.h"
David Goodwin334c2642009-07-08 16:09:28 +000022
Evan Cheng4db3cff2011-07-01 17:57:27 +000023#define GET_INSTRINFO_HEADER
24#include "ARMGenInstrInfo.inc"
25
David Goodwin334c2642009-07-08 16:09:28 +000026namespace llvm {
Chris Lattner4dbbe342010-07-20 21:17:29 +000027 class ARMSubtarget;
28 class ARMBaseRegisterInfo;
David Goodwin334c2642009-07-08 16:09:28 +000029
Evan Cheng4db3cff2011-07-01 17:57:27 +000030class ARMBaseInstrInfo : public ARMGenInstrInfo {
Chris Lattner4dbbe342010-07-20 21:17:29 +000031 const ARMSubtarget &Subtarget;
Evan Cheng48575f62010-12-05 22:04:16 +000032
David Goodwin334c2642009-07-08 16:09:28 +000033protected:
34 // Can be only subclassed.
Anton Korobeynikovf95215f2009-11-02 00:10:38 +000035 explicit ARMBaseInstrInfo(const ARMSubtarget &STI);
Evan Cheng48575f62010-12-05 22:04:16 +000036
David Goodwin334c2642009-07-08 16:09:28 +000037public:
Jim Grosbachc01810e2012-02-28 23:53:30 +000038 // Return whether the target has an explicit NOP encoding.
39 bool hasNOP() const;
40
David Goodwin334c2642009-07-08 16:09:28 +000041 // Return the non-pre/post incrementing version of 'Opc'. Return 0
42 // if there is not such an opcode.
43 virtual unsigned getUnindexedOpcode(unsigned Opc) const =0;
44
David Goodwin334c2642009-07-08 16:09:28 +000045 virtual MachineInstr *convertToThreeAddress(MachineFunction::iterator &MFI,
46 MachineBasicBlock::iterator &MBBI,
47 LiveVariables *LV) const;
48
49 virtual const ARMBaseRegisterInfo &getRegisterInfo() const =0;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +000050 const ARMSubtarget &getSubtarget() const { return Subtarget; }
David Goodwin334c2642009-07-08 16:09:28 +000051
Evan Cheng48575f62010-12-05 22:04:16 +000052 ScheduleHazardRecognizer *
Andrew Trick2da8bc82010-12-24 05:03:26 +000053 CreateTargetHazardRecognizer(const TargetMachine *TM,
54 const ScheduleDAG *DAG) const;
55
56 ScheduleHazardRecognizer *
57 CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II,
58 const ScheduleDAG *DAG) const;
Evan Cheng48575f62010-12-05 22:04:16 +000059
David Goodwin334c2642009-07-08 16:09:28 +000060 // Branch analysis.
61 virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
62 MachineBasicBlock *&FBB,
63 SmallVectorImpl<MachineOperand> &Cond,
Chris Lattner20628752010-07-22 21:27:00 +000064 bool AllowModify = false) const;
David Goodwin334c2642009-07-08 16:09:28 +000065 virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
66 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
67 MachineBasicBlock *FBB,
Stuart Hastings3bf91252010-06-17 22:43:56 +000068 const SmallVectorImpl<MachineOperand> &Cond,
69 DebugLoc DL) const;
David Goodwin334c2642009-07-08 16:09:28 +000070
71 virtual
72 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
73
74 // Predication support.
Evan Chengddfd1372011-12-14 02:11:42 +000075 bool isPredicated(const MachineInstr *MI) const;
David Goodwin334c2642009-07-08 16:09:28 +000076
77 ARMCC::CondCodes getPredicate(const MachineInstr *MI) const {
78 int PIdx = MI->findFirstPredOperandIdx();
79 return PIdx != -1 ? (ARMCC::CondCodes)MI->getOperand(PIdx).getImm()
80 : ARMCC::AL;
81 }
82
83 virtual
84 bool PredicateInstruction(MachineInstr *MI,
85 const SmallVectorImpl<MachineOperand> &Pred) const;
86
87 virtual
88 bool SubsumesPredicate(const SmallVectorImpl<MachineOperand> &Pred1,
89 const SmallVectorImpl<MachineOperand> &Pred2) const;
90
91 virtual bool DefinesPredicate(MachineInstr *MI,
92 std::vector<MachineOperand> &Pred) const;
93
Evan Chengac0869d2009-11-21 06:21:52 +000094 virtual bool isPredicable(MachineInstr *MI) const;
95
David Goodwin334c2642009-07-08 16:09:28 +000096 /// GetInstSize - Returns the size of the specified MachineInstr.
97 ///
98 virtual unsigned GetInstSizeInBytes(const MachineInstr* MI) const;
99
David Goodwin334c2642009-07-08 16:09:28 +0000100 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
101 int &FrameIndex) const;
102 virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
103 int &FrameIndex) const;
Jakob Stoklund Olesen36ee0e62011-08-08 21:45:32 +0000104 virtual unsigned isLoadFromStackSlotPostFE(const MachineInstr *MI,
105 int &FrameIndex) const;
106 virtual unsigned isStoreToStackSlotPostFE(const MachineInstr *MI,
107 int &FrameIndex) const;
David Goodwin334c2642009-07-08 16:09:28 +0000108
Jakob Stoklund Olesenac273662010-07-11 06:33:54 +0000109 virtual void copyPhysReg(MachineBasicBlock &MBB,
110 MachineBasicBlock::iterator I, DebugLoc DL,
111 unsigned DestReg, unsigned SrcReg,
112 bool KillSrc) const;
Evan Cheng5732ca02009-07-27 03:14:20 +0000113
David Goodwin334c2642009-07-08 16:09:28 +0000114 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
115 MachineBasicBlock::iterator MBBI,
116 unsigned SrcReg, bool isKill, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +0000117 const TargetRegisterClass *RC,
118 const TargetRegisterInfo *TRI) const;
David Goodwin334c2642009-07-08 16:09:28 +0000119
David Goodwin334c2642009-07-08 16:09:28 +0000120 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
121 MachineBasicBlock::iterator MBBI,
122 unsigned DestReg, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +0000123 const TargetRegisterClass *RC,
124 const TargetRegisterInfo *TRI) const;
David Goodwin334c2642009-07-08 16:09:28 +0000125
Jakob Stoklund Olesen142bd1a2011-10-11 00:59:06 +0000126 virtual bool expandPostRAPseudo(MachineBasicBlock::iterator MI) const;
127
Evan Cheng62b50652010-04-26 07:39:25 +0000128 virtual MachineInstr *emitFrameIndexDebugValue(MachineFunction &MF,
Evan Cheng8601a3d2010-04-29 01:13:30 +0000129 int FrameIx,
Evan Cheng62b50652010-04-26 07:39:25 +0000130 uint64_t Offset,
131 const MDNode *MDPtr,
132 DebugLoc DL) const;
133
Evan Chengfdc83402009-11-08 00:15:23 +0000134 virtual void reMaterialize(MachineBasicBlock &MBB,
135 MachineBasicBlock::iterator MI,
136 unsigned DestReg, unsigned SubIdx,
Evan Chengd57cdd52009-11-14 02:55:43 +0000137 const MachineInstr *Orig,
Jakob Stoklund Olesen9edf7de2010-06-02 22:47:25 +0000138 const TargetRegisterInfo &TRI) const;
Evan Chengfdc83402009-11-08 00:15:23 +0000139
Jakob Stoklund Olesen30ac0462010-01-06 23:47:07 +0000140 MachineInstr *duplicate(MachineInstr *Orig, MachineFunction &MF) const;
141
Jakob Stoklund Olesenc5041ca2012-04-04 18:23:42 +0000142 MachineInstr *commuteInstruction(MachineInstr*, bool=false) const;
143
Evan Cheng506049f2010-03-03 01:44:33 +0000144 virtual bool produceSameValue(const MachineInstr *MI0,
Evan Cheng9fe20092011-01-20 08:34:58 +0000145 const MachineInstr *MI1,
146 const MachineRegisterInfo *MRI) const;
Evan Cheng86050dc2010-06-18 23:09:54 +0000147
Bill Wendling4b722102010-06-23 23:00:16 +0000148 /// areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler to
149 /// determine if two loads are loading from the same base address. It should
150 /// only return true if the base pointers are the same and the only
151 /// differences between the two addresses is the offset. It also returns the
152 /// offsets by reference.
153 virtual bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2,
154 int64_t &Offset1, int64_t &Offset2)const;
155
156 /// shouldScheduleLoadsNear - This is a used by the pre-regalloc scheduler to
Jim Grosbachf921c0fe2011-06-13 22:54:22 +0000157 /// determine (in conjunction with areLoadsFromSameBasePtr) if two loads
158 /// should be scheduled togther. On some targets if two loads are loading from
Bill Wendling4b722102010-06-23 23:00:16 +0000159 /// addresses in the same cache line, it's better if they are scheduled
160 /// together. This function takes two integers that represent the load offsets
161 /// from the common base address. It returns true if it decides it's desirable
162 /// to schedule the two loads together. "NumLoads" is the number of loads that
163 /// have already been scheduled after Load1.
164 virtual bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2,
165 int64_t Offset1, int64_t Offset2,
166 unsigned NumLoads) const;
167
Evan Cheng86050dc2010-06-18 23:09:54 +0000168 virtual bool isSchedulingBoundary(const MachineInstr *MI,
169 const MachineBasicBlock *MBB,
170 const MachineFunction &MF) const;
Evan Cheng13151432010-06-25 22:42:03 +0000171
172 virtual bool isProfitableToIfCvt(MachineBasicBlock &MBB,
Cameron Zwarich5876db72011-04-13 06:39:16 +0000173 unsigned NumCycles, unsigned ExtraPredCycles,
Jakub Staszakf81b7f62011-07-10 02:58:07 +0000174 const BranchProbability &Probability) const;
Evan Cheng13151432010-06-25 22:42:03 +0000175
Evan Cheng8239daf2010-11-03 00:45:17 +0000176 virtual bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
177 unsigned NumT, unsigned ExtraT,
178 MachineBasicBlock &FMBB,
179 unsigned NumF, unsigned ExtraF,
Jakub Staszakf81b7f62011-07-10 02:58:07 +0000180 const BranchProbability &Probability) const;
Evan Cheng13151432010-06-25 22:42:03 +0000181
182 virtual bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB,
Cameron Zwarich5876db72011-04-13 06:39:16 +0000183 unsigned NumCycles,
Jakub Staszakf81b7f62011-07-10 02:58:07 +0000184 const BranchProbability
185 &Probability) const {
Cameron Zwarich5876db72011-04-13 06:39:16 +0000186 return NumCycles == 1;
Evan Cheng13151432010-06-25 22:42:03 +0000187 }
Bill Wendlinge4ddbdf2010-08-06 01:32:48 +0000188
Manman Rende7266c2012-06-29 21:33:59 +0000189 /// analyzeCompare - For a comparison instruction, return the source registers
190 /// in SrcReg and SrcReg2 if having two register operands, and the value it
191 /// compares against in CmpValue. Return true if the comparison instruction
192 /// can be analyzed.
193 virtual bool analyzeCompare(const MachineInstr *MI, unsigned &SrcReg,
194 unsigned &SrcReg2, int &CmpMask,
195 int &CmpValue) const;
Bill Wendlinge4ddbdf2010-08-06 01:32:48 +0000196
Manman Rende7266c2012-06-29 21:33:59 +0000197 /// optimizeCompareInstr - Convert the instruction to set the zero flag so
198 /// that we can remove a "comparison with zero"; Remove a redundant CMP
199 /// instruction if the flags can be updated in the same way by an earlier
200 /// instruction such as SUB.
201 virtual bool optimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg,
202 unsigned SrcReg2, int CmpMask, int CmpValue,
Evan Chengeb96a2f2010-11-15 21:20:45 +0000203 const MachineRegisterInfo *MRI) const;
Evan Cheng5f54ce32010-09-09 18:18:55 +0000204
Evan Chengc4af4632010-11-17 20:13:28 +0000205 /// FoldImmediate - 'Reg' is known to be defined by a move immediate
206 /// instruction, try to fold the immediate into the use instruction.
207 virtual bool FoldImmediate(MachineInstr *UseMI, MachineInstr *DefMI,
208 unsigned Reg, MachineRegisterInfo *MRI) const;
209
Evan Cheng8239daf2010-11-03 00:45:17 +0000210 virtual unsigned getNumMicroOps(const InstrItineraryData *ItinData,
211 const MachineInstr *MI) const;
Evan Chenga0792de2010-10-06 06:27:31 +0000212
213 virtual
214 int getOperandLatency(const InstrItineraryData *ItinData,
215 const MachineInstr *DefMI, unsigned DefIdx,
216 const MachineInstr *UseMI, unsigned UseIdx) const;
217 virtual
218 int getOperandLatency(const InstrItineraryData *ItinData,
219 SDNode *DefNode, unsigned DefIdx,
220 SDNode *UseNode, unsigned UseIdx) const;
Jakob Stoklund Olesen13fd6012011-09-27 22:57:21 +0000221
Evan Cheng020f4102011-12-14 20:00:08 +0000222 virtual unsigned getOutputLatency(const InstrItineraryData *ItinData,
223 const MachineInstr *DefMI, unsigned DefIdx,
224 const MachineInstr *DepMI) const;
225
Jakob Stoklund Olesen13fd6012011-09-27 22:57:21 +0000226 /// VFP/NEON execution domains.
227 std::pair<uint16_t, uint16_t>
228 getExecutionDomain(const MachineInstr *MI) const;
229 void setExecutionDomain(MachineInstr *MI, unsigned Domain) const;
230
Evan Chenga0792de2010-10-06 06:27:31 +0000231private:
Evan Chengddfd1372011-12-14 02:11:42 +0000232 unsigned getInstBundleLength(const MachineInstr *MI) const;
233
Evan Cheng344d9db2010-10-07 23:12:15 +0000234 int getVLDMDefCycle(const InstrItineraryData *ItinData,
Evan Chenge837dea2011-06-28 19:10:37 +0000235 const MCInstrDesc &DefMCID,
Evan Cheng344d9db2010-10-07 23:12:15 +0000236 unsigned DefClass,
237 unsigned DefIdx, unsigned DefAlign) const;
238 int getLDMDefCycle(const InstrItineraryData *ItinData,
Evan Chenge837dea2011-06-28 19:10:37 +0000239 const MCInstrDesc &DefMCID,
Evan Cheng344d9db2010-10-07 23:12:15 +0000240 unsigned DefClass,
241 unsigned DefIdx, unsigned DefAlign) const;
242 int getVSTMUseCycle(const InstrItineraryData *ItinData,
Evan Chenge837dea2011-06-28 19:10:37 +0000243 const MCInstrDesc &UseMCID,
Evan Cheng344d9db2010-10-07 23:12:15 +0000244 unsigned UseClass,
245 unsigned UseIdx, unsigned UseAlign) const;
246 int getSTMUseCycle(const InstrItineraryData *ItinData,
Evan Chenge837dea2011-06-28 19:10:37 +0000247 const MCInstrDesc &UseMCID,
Evan Cheng344d9db2010-10-07 23:12:15 +0000248 unsigned UseClass,
249 unsigned UseIdx, unsigned UseAlign) const;
Evan Chenga0792de2010-10-06 06:27:31 +0000250 int getOperandLatency(const InstrItineraryData *ItinData,
Evan Chenge837dea2011-06-28 19:10:37 +0000251 const MCInstrDesc &DefMCID,
Evan Chenga0792de2010-10-06 06:27:31 +0000252 unsigned DefIdx, unsigned DefAlign,
Evan Chenge837dea2011-06-28 19:10:37 +0000253 const MCInstrDesc &UseMCID,
Evan Chenga0792de2010-10-06 06:27:31 +0000254 unsigned UseIdx, unsigned UseAlign) const;
Evan Cheng23128422010-10-19 18:58:51 +0000255
Andrew Trickb7e02892012-06-05 21:11:27 +0000256 unsigned getInstrLatency(const InstrItineraryData *ItinData,
257 const MachineInstr *MI,
258 unsigned *PredCost = 0) const;
Evan Cheng8239daf2010-11-03 00:45:17 +0000259
260 int getInstrLatency(const InstrItineraryData *ItinData,
261 SDNode *Node) const;
262
Evan Cheng23128422010-10-19 18:58:51 +0000263 bool hasHighOperandLatency(const InstrItineraryData *ItinData,
264 const MachineRegisterInfo *MRI,
265 const MachineInstr *DefMI, unsigned DefIdx,
266 const MachineInstr *UseMI, unsigned UseIdx) const;
Evan Chengc8141df2010-10-26 02:08:50 +0000267 bool hasLowDefLatency(const InstrItineraryData *ItinData,
268 const MachineInstr *DefMI, unsigned DefIdx) const;
Evan Cheng48575f62010-12-05 22:04:16 +0000269
Andrew Trick3be654f2011-09-21 02:20:46 +0000270 /// verifyInstruction - Perform target specific instruction verification.
271 bool verifyInstruction(const MachineInstr *MI, StringRef &ErrInfo) const;
272
Evan Cheng48575f62010-12-05 22:04:16 +0000273private:
274 /// Modeling special VFP / NEON fp MLA / MLS hazards.
275
276 /// MLxEntryMap - Map fp MLA / MLS to the corresponding entry in the internal
277 /// MLx table.
278 DenseMap<unsigned, unsigned> MLxEntryMap;
279
280 /// MLxHazardOpcodes - Set of add / sub and multiply opcodes that would cause
281 /// stalls when scheduled together with fp MLA / MLS opcodes.
282 SmallSet<unsigned, 16> MLxHazardOpcodes;
283
284public:
285 /// isFpMLxInstruction - Return true if the specified opcode is a fp MLA / MLS
286 /// instruction.
287 bool isFpMLxInstruction(unsigned Opcode) const {
288 return MLxEntryMap.count(Opcode);
289 }
290
291 /// isFpMLxInstruction - This version also returns the multiply opcode and the
292 /// addition / subtraction opcode to expand to. Return true for 'HasLane' for
293 /// the MLX instructions with an extra lane operand.
294 bool isFpMLxInstruction(unsigned Opcode, unsigned &MulOpc,
295 unsigned &AddSubOpc, bool &NegAcc,
296 bool &HasLane) const;
297
298 /// canCauseFpMLxStall - Return true if an instruction of the specified opcode
299 /// will cause stalls when scheduled after (within 4-cycle window) a fp
300 /// MLA / MLS instruction.
301 bool canCauseFpMLxStall(unsigned Opcode) const {
302 return MLxHazardOpcodes.count(Opcode);
303 }
David Goodwin334c2642009-07-08 16:09:28 +0000304};
Evan Cheng6495f632009-07-28 05:48:47 +0000305
306static inline
307const MachineInstrBuilder &AddDefaultPred(const MachineInstrBuilder &MIB) {
308 return MIB.addImm((int64_t)ARMCC::AL).addReg(0);
David Goodwin334c2642009-07-08 16:09:28 +0000309}
310
Evan Cheng6495f632009-07-28 05:48:47 +0000311static inline
312const MachineInstrBuilder &AddDefaultCC(const MachineInstrBuilder &MIB) {
313 return MIB.addReg(0);
314}
315
316static inline
Evan Chenge8af1f92009-08-10 02:37:24 +0000317const MachineInstrBuilder &AddDefaultT1CC(const MachineInstrBuilder &MIB,
318 bool isDead = false) {
319 return MIB.addReg(ARM::CPSR, getDefRegState(true) | getDeadRegState(isDead));
Evan Cheng6495f632009-07-28 05:48:47 +0000320}
321
322static inline
Evan Chengbc9b7542009-08-15 07:59:10 +0000323const MachineInstrBuilder &AddNoT1CC(const MachineInstrBuilder &MIB) {
324 return MIB.addReg(0);
325}
326
327static inline
Evan Cheng6495f632009-07-28 05:48:47 +0000328bool isUncondBranchOpcode(int Opc) {
329 return Opc == ARM::B || Opc == ARM::tB || Opc == ARM::t2B;
330}
331
332static inline
333bool isCondBranchOpcode(int Opc) {
334 return Opc == ARM::Bcc || Opc == ARM::tBcc || Opc == ARM::t2Bcc;
335}
336
337static inline
338bool isJumpTableBranchOpcode(int Opc) {
339 return Opc == ARM::BR_JTr || Opc == ARM::BR_JTm || Opc == ARM::BR_JTadd ||
340 Opc == ARM::tBR_JTr || Opc == ARM::t2BR_JT;
341}
342
Bob Wilson8d4de5a2009-10-28 18:26:41 +0000343static inline
344bool isIndirectBranchOpcode(int Opc) {
Bill Wendling6e46d842010-11-30 00:48:15 +0000345 return Opc == ARM::BX || Opc == ARM::MOVPCRX || Opc == ARM::tBRIND;
Bob Wilson8d4de5a2009-10-28 18:26:41 +0000346}
347
Evan Cheng8fb90362009-08-08 03:20:32 +0000348/// getInstrPredicate - If instruction is predicated, returns its predicate
349/// condition, otherwise returns AL. It also returns the condition code
350/// register by reference.
Evan Cheng5adb66a2009-09-28 09:14:39 +0000351ARMCC::CondCodes getInstrPredicate(const MachineInstr *MI, unsigned &PredReg);
Evan Cheng8fb90362009-08-08 03:20:32 +0000352
Evan Cheng6495f632009-07-28 05:48:47 +0000353int getMatchingCondBranchOpcode(int Opc);
354
Andrew Trick3be654f2011-09-21 02:20:46 +0000355
356/// Map pseudo instructions that imply an 'S' bit onto real opcodes. Whether
357/// the instruction is encoded with an 'S' bit is determined by the optional
358/// CPSR def operand.
359unsigned convertAddSubFlagsOpcode(unsigned OldOpc);
360
Evan Cheng6495f632009-07-28 05:48:47 +0000361/// emitARMRegPlusImmediate / emitT2RegPlusImmediate - Emits a series of
362/// instructions to materializea destreg = basereg + immediate in ARM / Thumb2
363/// code.
364void emitARMRegPlusImmediate(MachineBasicBlock &MBB,
365 MachineBasicBlock::iterator &MBBI, DebugLoc dl,
366 unsigned DestReg, unsigned BaseReg, int NumBytes,
367 ARMCC::CondCodes Pred, unsigned PredReg,
Anton Korobeynikov57caad72011-03-05 18:43:32 +0000368 const ARMBaseInstrInfo &TII, unsigned MIFlags = 0);
Evan Cheng6495f632009-07-28 05:48:47 +0000369
370void emitT2RegPlusImmediate(MachineBasicBlock &MBB,
371 MachineBasicBlock::iterator &MBBI, DebugLoc dl,
372 unsigned DestReg, unsigned BaseReg, int NumBytes,
373 ARMCC::CondCodes Pred, unsigned PredReg,
Anton Korobeynikov57caad72011-03-05 18:43:32 +0000374 const ARMBaseInstrInfo &TII, unsigned MIFlags = 0);
Jim Grosbache4ad3872010-10-19 23:27:08 +0000375void emitThumbRegPlusImmediate(MachineBasicBlock &MBB,
Anton Korobeynikov57caad72011-03-05 18:43:32 +0000376 MachineBasicBlock::iterator &MBBI, DebugLoc dl,
Jim Grosbache4ad3872010-10-19 23:27:08 +0000377 unsigned DestReg, unsigned BaseReg,
378 int NumBytes, const TargetInstrInfo &TII,
379 const ARMBaseRegisterInfo& MRI,
Anton Korobeynikov57caad72011-03-05 18:43:32 +0000380 unsigned MIFlags = 0);
Evan Cheng6495f632009-07-28 05:48:47 +0000381
382
Jim Grosbach764ab522009-08-11 15:33:49 +0000383/// rewriteARMFrameIndex / rewriteT2FrameIndex -
Evan Chengcdbb3f52009-08-27 01:23:50 +0000384/// Rewrite MI to access 'Offset' bytes from the FP. Return false if the
385/// offset could not be handled directly in MI, and return the left-over
386/// portion by reference.
387bool rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
388 unsigned FrameReg, int &Offset,
389 const ARMBaseInstrInfo &TII);
Evan Cheng6495f632009-07-28 05:48:47 +0000390
Evan Chengcdbb3f52009-08-27 01:23:50 +0000391bool rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
392 unsigned FrameReg, int &Offset,
393 const ARMBaseInstrInfo &TII);
Evan Cheng6495f632009-07-28 05:48:47 +0000394
395} // End llvm namespace
396
David Goodwin334c2642009-07-08 16:09:28 +0000397#endif