2011-01-10 12:39:04 +00:00
|
|
|
//==-- ARMTargetFrameLowering.h - Define frame lowering for ARM --*- C++ -*-==//
|
2006-08-16 14:43:33 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
2006-08-16 14:43:33 +00:00
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef ARM_FRAMEINFO_H
|
|
|
|
#define ARM_FRAMEINFO_H
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
#include "ARMSubtarget.h"
|
2011-01-10 12:39:04 +00:00
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
2006-08-16 14:43:33 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2010-11-15 00:06:54 +00:00
|
|
|
class ARMSubtarget;
|
2006-08-16 14:43:33 +00:00
|
|
|
|
2011-01-10 12:39:04 +00:00
|
|
|
class ARMFrameLowering : public TargetFrameLowering {
|
2010-11-15 00:06:54 +00:00
|
|
|
protected:
|
|
|
|
const ARMSubtarget &STI;
|
|
|
|
|
2006-08-16 14:43:33 +00:00
|
|
|
public:
|
2011-01-10 12:39:04 +00:00
|
|
|
explicit ARMFrameLowering(const ARMSubtarget &sti)
|
|
|
|
: TargetFrameLowering(StackGrowsDown, sti.getStackAlignment(), 0, 4),
|
|
|
|
STI(sti) {
|
2006-08-16 14:43:33 +00:00
|
|
|
}
|
2010-11-15 00:06:54 +00:00
|
|
|
|
|
|
|
/// emitProlog/emitEpilog - These methods insert prolog and epilog code into
|
|
|
|
/// the function.
|
2014-03-10 02:09:33 +00:00
|
|
|
void emitPrologue(MachineFunction &MF) const override;
|
|
|
|
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
2010-11-18 21:19:35 +00:00
|
|
|
|
2010-11-27 23:05:03 +00:00
|
|
|
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
const std::vector<CalleeSavedInfo> &CSI,
|
2014-03-10 02:09:33 +00:00
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2010-11-27 23:05:03 +00:00
|
|
|
|
|
|
|
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
2014-03-10 02:09:33 +00:00
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
const std::vector<CalleeSavedInfo> &CSI,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2010-11-27 23:05:03 +00:00
|
|
|
|
2014-03-10 02:09:33 +00:00
|
|
|
bool hasFP(const MachineFunction &MF) const override;
|
|
|
|
bool hasReservedCallFrame(const MachineFunction &MF) const override;
|
|
|
|
bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
|
2010-11-20 15:59:32 +00:00
|
|
|
int getFrameIndexReference(const MachineFunction &MF, int FI,
|
2014-03-10 02:09:33 +00:00
|
|
|
unsigned &FrameReg) const override;
|
|
|
|
int ResolveFrameIndexReference(const MachineFunction &MF, int FI,
|
2010-11-20 15:59:32 +00:00
|
|
|
unsigned &FrameReg, int SPAdj) const;
|
2014-03-10 02:09:33 +00:00
|
|
|
int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
|
2010-11-20 15:59:32 +00:00
|
|
|
|
2010-11-27 23:05:25 +00:00
|
|
|
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
2014-03-10 02:09:33 +00:00
|
|
|
RegScavenger *RS) const override;
|
2010-11-27 23:05:25 +00:00
|
|
|
|
2014-04-02 16:10:33 +00:00
|
|
|
void adjustForSegmentedStacks(MachineFunction &MF) const;
|
|
|
|
|
2010-11-27 23:05:03 +00:00
|
|
|
private:
|
|
|
|
void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
2010-12-09 18:31:13 +00:00
|
|
|
const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
|
|
|
|
unsigned StrOpc, bool NoGap,
|
2011-12-23 00:36:18 +00:00
|
|
|
bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs,
|
2011-03-05 18:43:32 +00:00
|
|
|
unsigned MIFlags = 0) const;
|
2010-12-07 23:08:38 +00:00
|
|
|
void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
2010-12-09 18:31:13 +00:00
|
|
|
const std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
|
|
|
|
unsigned LdrOpc, bool isVarArg, bool NoGap,
|
2011-12-23 00:36:18 +00:00
|
|
|
bool(*Func)(unsigned, bool),
|
|
|
|
unsigned NumAlignedDPRCS2Regs) const;
|
2013-02-21 20:05:00 +00:00
|
|
|
|
2014-03-10 02:09:33 +00:00
|
|
|
void
|
|
|
|
eliminateCallFramePseudoInstr(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI) const override;
|
2006-08-16 14:43:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|