1 //===-- llvm/Target/TargetFrameInfo.h ---------------------------*- 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 //===----------------------------------------------------------------------===//
10 // Interface to describe the layout of a stack frame on the target machine.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TARGET_TARGETFRAMEINFO_H
15 #define LLVM_TARGET_TARGETFRAMEINFO_H
21 /// Information about stack frame layout on the target. It holds the direction
22 /// of stack growth, the known stack alignment on entry to each function, and
23 /// the offset to the locals area.
25 /// The offset to the local area is the offset from the stack pointer on
26 /// function entry to the first location where function data (local variables,
27 /// spill locations) can be stored.
28 class TargetFrameInfo {
31 StackGrowsUp, // Adding to the stack increases the stack address
32 StackGrowsDown // Adding to the stack decreases the stack address
35 StackDirection StackDir;
36 unsigned StackAlignment;
37 unsigned TransientStackAlignment;
40 TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO,
42 : StackDir(D), StackAlignment(StackAl), TransientStackAlignment(TransAl),
43 LocalAreaOffset(LAO) {}
45 virtual ~TargetFrameInfo();
47 // These methods return information that describes the abstract stack layout
48 // of the target machine.
50 /// getStackGrowthDirection - Return the direction the stack grows
52 StackDirection getStackGrowthDirection() const { return StackDir; }
54 /// getStackAlignment - This method returns the number of bytes to which the
55 /// stack pointer must be aligned on entry to a function. Typically, this
56 /// is the largest alignment for any data object in the target.
58 unsigned getStackAlignment() const { return StackAlignment; }
60 /// getTransientStackAlignment - This method returns the number of bytes to
61 /// which the stack pointer must be aligned at all times, even between
64 unsigned getTransientStackAlignment() const {
65 return TransientStackAlignment;
68 /// getOffsetOfLocalArea - This method returns the offset of the local area
69 /// from the stack pointer on entrance to a function.
71 int getOffsetOfLocalArea() const { return LocalAreaOffset; }
73 /// getCalleeSavedSpillSlots - This method returns a pointer to an array of
74 /// pairs, that contains an entry for each callee saved register that must be
75 /// spilled to a particular stack location if it is spilled.
77 /// Each entry in this array contains a <register,offset> pair, indicating the
78 /// fixed offset from the incoming stack pointer that each register should be
79 /// spilled at. If a register is not listed here, the code generator is
80 /// allowed to spill it anywhere it chooses.
82 virtual const std::pair<unsigned, int> *
83 getCalleeSavedSpillSlots(unsigned &NumEntries) const {
89 } // End llvm namespace