2002-12-28 20:12:10 +00:00
|
|
|
//===-- llvm/Target/TargetFrameInfo.h ---------------------------*- C++ -*-===//
|
2005-04-21 20:59:05 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:59:05 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-08-09 20:08:06 +00:00
|
|
|
//
|
2002-12-28 20:12:10 +00:00
|
|
|
// Interface to describe the layout of a stack frame on the target machine.
|
2002-08-09 20:08:06 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-11-08 04:52:27 +00:00
|
|
|
|
2002-12-28 20:12:10 +00:00
|
|
|
#ifndef LLVM_TARGET_TARGETFRAMEINFO_H
|
|
|
|
#define LLVM_TARGET_TARGETFRAMEINFO_H
|
2001-11-08 04:52:27 +00:00
|
|
|
|
2004-08-12 19:01:55 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2004-06-08 06:23:17 +00:00
|
|
|
/// Information about stack frame layout on the target. It holds the direction
|
|
|
|
/// of stack growth, the known stack alignment on entry to each function, and
|
|
|
|
/// the offset to the locals area.
|
|
|
|
///
|
|
|
|
/// The offset to the local area is the offset from the stack pointer on
|
|
|
|
/// function entry to the first location where function data (local variables,
|
|
|
|
/// spill locations) can be stored.
|
2004-10-27 16:14:51 +00:00
|
|
|
class TargetFrameInfo {
|
|
|
|
public:
|
2002-12-28 20:12:10 +00:00
|
|
|
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 04:52:27 +00:00
|
|
|
public:
|
2002-12-28 20:12:10 +00:00
|
|
|
TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO)
|
|
|
|
: StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {}
|
|
|
|
|
2005-04-25 02:55:55 +00:00
|
|
|
virtual ~TargetFrameInfo();
|
|
|
|
|
2002-12-28 20:12:10 +00:00
|
|
|
// 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; }
|
|
|
|
|
2007-01-02 21:30:17 +00:00
|
|
|
/// getCalleeSavedSpillSlots - This method returns a pointer to an array of
|
|
|
|
/// pairs, that contains an entry for each callee saved register that must be
|
2004-08-12 19:01:55 +00:00
|
|
|
/// spilled to a particular stack location if it is spilled.
|
|
|
|
///
|
|
|
|
/// Each entry in this array contains a <register,offset> pair, indicating the
|
|
|
|
/// fixed offset from the incoming stack pointer that each register should be
|
|
|
|
/// spilled at. If a register is not listed here, the code generator is
|
|
|
|
/// allowed to spill it anywhere it chooses.
|
2005-04-21 20:59:05 +00:00
|
|
|
///
|
2004-08-15 09:18:55 +00:00
|
|
|
virtual const std::pair<unsigned, int> *
|
2007-01-02 21:30:17 +00:00
|
|
|
getCalleeSavedSpillSlots(unsigned &NumEntries) const {
|
2004-08-12 19:01:55 +00:00
|
|
|
NumEntries = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
2001-11-08 04:52:27 +00:00
|
|
|
};
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-11-08 04:52:27 +00:00
|
|
|
#endif
|