LLVM API Documentation
00001 //===-- llvm/Target/TargetFrameInfo.h ---------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // Interface to describe the layout of a stack frame on the target machine. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_TARGET_TARGETFRAMEINFO_H 00015 #define LLVM_TARGET_TARGETFRAMEINFO_H 00016 00017 #include <utility> 00018 00019 namespace llvm { 00020 00021 /// Information about stack frame layout on the target. It holds the direction 00022 /// of stack growth, the known stack alignment on entry to each function, and 00023 /// the offset to the locals area. 00024 /// 00025 /// The offset to the local area is the offset from the stack pointer on 00026 /// function entry to the first location where function data (local variables, 00027 /// spill locations) can be stored. 00028 class TargetFrameInfo { 00029 public: 00030 enum StackDirection { 00031 StackGrowsUp, // Adding to the stack increases the stack address 00032 StackGrowsDown // Adding to the stack decreases the stack address 00033 }; 00034 private: 00035 StackDirection StackDir; 00036 unsigned StackAlignment; 00037 int LocalAreaOffset; 00038 public: 00039 TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO) 00040 : StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {} 00041 00042 virtual ~TargetFrameInfo(); 00043 00044 // These methods return information that describes the abstract stack layout 00045 // of the target machine. 00046 00047 /// getStackGrowthDirection - Return the direction the stack grows 00048 /// 00049 StackDirection getStackGrowthDirection() const { return StackDir; } 00050 00051 /// getStackAlignment - This method returns the number of bytes that the stack 00052 /// pointer must be aligned to. Typically, this is the largest alignment for 00053 /// any data object in the target. 00054 /// 00055 unsigned getStackAlignment() const { return StackAlignment; } 00056 00057 /// getOffsetOfLocalArea - This method returns the offset of the local area 00058 /// from the stack pointer on entrance to a function. 00059 /// 00060 int getOffsetOfLocalArea() const { return LocalAreaOffset; } 00061 00062 /// getCalleeSavedSpillSlots - This method returns a pointer to an array of 00063 /// pairs, that contains an entry for each callee saved register that must be 00064 /// spilled to a particular stack location if it is spilled. 00065 /// 00066 /// Each entry in this array contains a <register,offset> pair, indicating the 00067 /// fixed offset from the incoming stack pointer that each register should be 00068 /// spilled at. If a register is not listed here, the code generator is 00069 /// allowed to spill it anywhere it chooses. 00070 /// 00071 virtual const std::pair<unsigned, int> * 00072 getCalleeSavedSpillSlots(unsigned &NumEntries) const { 00073 NumEntries = 0; 00074 return 0; 00075 } 00076 }; 00077 00078 } // End llvm namespace 00079 00080 #endif
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.