2002-12-28 21:12:10 +01:00
|
|
|
//===-- llvm/Target/TargetFrameInfo.h ---------------------------*- C++ -*-===//
|
2002-08-09 22:08:06 +02:00
|
|
|
//
|
2002-12-28 21:12:10 +01:00
|
|
|
// Interface to describe the layout of a stack frame on the target machine.
|
2002-08-09 22:08:06 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-11-08 05:52:27 +01:00
|
|
|
|
2002-12-28 21:12:10 +01:00
|
|
|
#ifndef LLVM_TARGET_TARGETFRAMEINFO_H
|
|
|
|
#define LLVM_TARGET_TARGETFRAMEINFO_H
|
2001-11-08 05:52:27 +01:00
|
|
|
|
2002-10-28 01:28:31 +01:00
|
|
|
class MachineFunction;
|
2001-11-08 05:52:27 +01:00
|
|
|
|
2002-12-28 21:12:10 +01:00
|
|
|
struct TargetFrameInfo {
|
|
|
|
enum StackDirection {
|
|
|
|
StackGrowsUp, // Adding to the stack increases the stack address
|
|
|
|
StackGrowsDown // Adding to the stack decreases the stack address
|
|
|
|
};
|
|
|
|
private:
|
|
|
|
StackDirection StackDir;
|
|
|
|
unsigned StackAlignment;
|
|
|
|
int LocalAreaOffset;
|
2001-11-08 05:52:27 +01:00
|
|
|
public:
|
2002-12-28 21:12:10 +01:00
|
|
|
TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO)
|
|
|
|
: StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {}
|
|
|
|
|
|
|
|
// These methods return information that describes the abstract stack layout
|
|
|
|
// of the target machine.
|
|
|
|
|
|
|
|
/// getStackGrowthDirection - Return the direction the stack grows
|
|
|
|
///
|
|
|
|
StackDirection getStackGrowthDirection() const { return StackDir; }
|
|
|
|
|
|
|
|
/// getStackAlignment - This method returns the number of bytes that the stack
|
|
|
|
/// pointer must be aligned to. Typically, this is the largest alignment for
|
|
|
|
/// any data object in the target.
|
|
|
|
///
|
|
|
|
unsigned getStackAlignment() const { return StackAlignment; }
|
|
|
|
|
|
|
|
/// getOffsetOfLocalArea - This method returns the offset of the local area
|
|
|
|
/// from the stack pointer on entrance to a function.
|
|
|
|
///
|
|
|
|
int getOffsetOfLocalArea() const { return LocalAreaOffset; }
|
|
|
|
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// These methods provide details of the stack frame used by Sparc, thus they
|
|
|
|
// are Sparc specific.
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
virtual int getStackFrameSizeAlignment () const { abort(); }
|
|
|
|
virtual int getMinStackFrameSize () const { abort(); }
|
|
|
|
virtual int getNumFixedOutgoingArgs () const { abort(); }
|
|
|
|
virtual int getSizeOfEachArgOnStack () const { abort(); }
|
|
|
|
virtual bool argsOnStackHaveFixedSize () const { abort(); }
|
2002-09-16 17:57:43 +02:00
|
|
|
|
|
|
|
// This method adjusts a stack offset to meet alignment rules of target.
|
2002-12-28 21:12:10 +01:00
|
|
|
virtual int adjustAlignment(int unalignedOffset, bool growUp,
|
|
|
|
unsigned align) const { abort(); }
|
2002-09-16 17:57:43 +02:00
|
|
|
|
2002-12-28 21:12:10 +01:00
|
|
|
// These methods compute offsets using the frame contents for a particular
|
|
|
|
// function. The frame contents are obtained from the MachineFunction object
|
|
|
|
// for the given function. The rest must be implemented by the
|
|
|
|
// machine-specific subclass.
|
2001-11-08 05:52:27 +01:00
|
|
|
//
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getIncomingArgOffset (MachineFunction& mcInfo,
|
2002-12-28 21:12:10 +01:00
|
|
|
unsigned argNum)const{abort();}
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getOutgoingArgOffset (MachineFunction& mcInfo,
|
2002-12-28 21:12:10 +01:00
|
|
|
unsigned argNum)const{abort();}
|
2002-04-25 06:48:54 +02:00
|
|
|
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getFirstIncomingArgOffset (MachineFunction& mcInfo,
|
2002-12-28 21:12:10 +01:00
|
|
|
bool& growUp) const { abort();}
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getFirstOutgoingArgOffset (MachineFunction& mcInfo,
|
2002-12-28 21:12:10 +01:00
|
|
|
bool& growUp) const {abort();}
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getFirstOptionalOutgoingArgOffset (MachineFunction&,
|
2002-12-28 21:12:10 +01:00
|
|
|
bool& growUp) const {abort();}
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getFirstAutomaticVarOffset (MachineFunction& mcInfo,
|
2002-12-28 21:12:10 +01:00
|
|
|
bool& growUp) const {abort();}
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getRegSpillAreaOffset (MachineFunction& mcInfo,
|
2002-12-28 21:12:10 +01:00
|
|
|
bool& growUp) const {abort();}
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getTmpAreaOffset (MachineFunction& mcInfo,
|
2002-12-28 21:12:10 +01:00
|
|
|
bool& growUp) const {abort();}
|
2002-10-28 01:28:31 +01:00
|
|
|
virtual int getDynamicAreaOffset (MachineFunction& mcInfo,
|
2002-12-28 21:12:10 +01:00
|
|
|
bool& growUp) const {abort();}
|
2001-11-08 05:52:27 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// These methods specify the base register used for each stack area
|
|
|
|
// (generally FP or SP)
|
|
|
|
//
|
2002-12-28 21:12:10 +01:00
|
|
|
virtual int getIncomingArgBaseRegNum() const { abort(); }
|
|
|
|
virtual int getOutgoingArgBaseRegNum() const { abort(); }
|
|
|
|
virtual int getOptionalOutgoingArgBaseRegNum() const { abort(); }
|
|
|
|
virtual int getAutomaticVarBaseRegNum() const { abort(); }
|
|
|
|
virtual int getRegSpillAreaBaseRegNum() const { abort(); }
|
|
|
|
virtual int getDynamicAreaBaseRegNum() const { abort(); }
|
2001-11-08 05:52:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|