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