1 //==-- ARMTargetFrameLowering.h - Define frame lowering for ARM --*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
14 #ifndef ARM_FRAMEINFO_H
15 #define ARM_FRAMEINFO_H
18 #include "ARMSubtarget.h"
19 #include "llvm/Target/TargetFrameLowering.h"
24 class ARMFrameLowering
: public TargetFrameLowering
{
26 const ARMSubtarget
&STI
;
29 explicit ARMFrameLowering(const ARMSubtarget
&sti
)
30 : TargetFrameLowering(StackGrowsDown
, sti
.getStackAlignment(), 0, 4),
34 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
36 void emitPrologue(MachineFunction
&MF
) const;
37 void emitEpilogue(MachineFunction
&MF
, MachineBasicBlock
&MBB
) const;
39 bool spillCalleeSavedRegisters(MachineBasicBlock
&MBB
,
40 MachineBasicBlock::iterator MI
,
41 const std::vector
<CalleeSavedInfo
> &CSI
,
42 const TargetRegisterInfo
*TRI
) const;
44 bool restoreCalleeSavedRegisters(MachineBasicBlock
&MBB
,
45 MachineBasicBlock::iterator MI
,
46 const std::vector
<CalleeSavedInfo
> &CSI
,
47 const TargetRegisterInfo
*TRI
) const;
49 bool hasFP(const MachineFunction
&MF
) const;
50 bool hasReservedCallFrame(const MachineFunction
&MF
) const;
51 bool canSimplifyCallFramePseudos(const MachineFunction
&MF
) const;
52 int getFrameIndexReference(const MachineFunction
&MF
, int FI
,
53 unsigned &FrameReg
) const;
54 int ResolveFrameIndexReference(const MachineFunction
&MF
,
56 unsigned &FrameReg
, int SPAdj
) const;
57 int getFrameIndexOffset(const MachineFunction
&MF
, int FI
) const;
59 void processFunctionBeforeCalleeSavedScan(MachineFunction
&MF
,
60 RegScavenger
*RS
) const;
63 void emitPushInst(MachineBasicBlock
&MBB
, MachineBasicBlock::iterator MI
,
64 const std::vector
<CalleeSavedInfo
> &CSI
, unsigned StmOpc
,
65 unsigned StrOpc
, bool NoGap
,
66 bool(*Func
)(unsigned, bool),
67 unsigned MIFlags
= 0) const;
68 void emitPopInst(MachineBasicBlock
&MBB
, MachineBasicBlock::iterator MI
,
69 const std::vector
<CalleeSavedInfo
> &CSI
, unsigned LdmOpc
,
70 unsigned LdrOpc
, bool isVarArg
, bool NoGap
,
71 bool(*Func
)(unsigned, bool)) const;
74 } // End llvm namespace