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
17 #include "ARMSubtarget.h"
18 #include "llvm/Target/TargetFrameLowering.h"
23 class ARMFrameLowering : public TargetFrameLowering {
25 const ARMSubtarget &STI;
28 explicit ARMFrameLowering(const ARMSubtarget &sti)
29 : TargetFrameLowering(StackGrowsDown, sti.getStackAlignment(), 0, 4),
33 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
35 void emitPrologue(MachineFunction &MF) const override;
36 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
38 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
39 MachineBasicBlock::iterator MI,
40 const std::vector<CalleeSavedInfo> &CSI,
41 const TargetRegisterInfo *TRI) const override;
43 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
44 MachineBasicBlock::iterator MI,
45 const std::vector<CalleeSavedInfo> &CSI,
46 const TargetRegisterInfo *TRI) const override;
48 bool hasFP(const MachineFunction &MF) const override;
49 bool hasReservedCallFrame(const MachineFunction &MF) const override;
50 bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
51 int getFrameIndexReference(const MachineFunction &MF, int FI,
52 unsigned &FrameReg) const override;
53 int ResolveFrameIndexReference(const MachineFunction &MF, int FI,
54 unsigned &FrameReg, int SPAdj) const;
55 int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
57 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
58 RegScavenger *RS) const override;
61 void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
62 const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
63 unsigned StrOpc, bool NoGap,
64 bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs,
65 unsigned MIFlags = 0) const;
66 void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
67 const std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
68 unsigned LdrOpc, bool isVarArg, bool NoGap,
69 bool(*Func)(unsigned, bool),
70 unsigned NumAlignedDPRCS2Regs) const;
73 eliminateCallFramePseudoInstr(MachineFunction &MF,
74 MachineBasicBlock &MBB,
75 MachineBasicBlock::iterator MI) const override;
78 } // End llvm namespace