Home | History | Annotate | Download | only in CodeGen
      1 //===-- CodeGen/MachineFrameInfo.h - Abstract Stack Frame Rep. --*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // The file defines the MachineFrameInfo class.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_CODEGEN_MACHINEFRAMEINFO_H
     15 #define LLVM_CODEGEN_MACHINEFRAMEINFO_H
     16 
     17 #include "llvm/ADT/SmallVector.h"
     18 #include "llvm/Support/DataTypes.h"
     19 #include <cassert>
     20 #include <vector>
     21 
     22 namespace llvm {
     23 class raw_ostream;
     24 class TargetData;
     25 class TargetRegisterClass;
     26 class Type;
     27 class MachineFunction;
     28 class MachineBasicBlock;
     29 class TargetFrameLowering;
     30 class BitVector;
     31 class Value;
     32 
     33 /// The CalleeSavedInfo class tracks the information need to locate where a
     34 /// callee saved register is in the current frame.
     35 class CalleeSavedInfo {
     36   unsigned Reg;
     37   int FrameIdx;
     38 
     39 public:
     40   explicit CalleeSavedInfo(unsigned R, int FI = 0)
     41   : Reg(R), FrameIdx(FI) {}
     42 
     43   // Accessors.
     44   unsigned getReg()                        const { return Reg; }
     45   int getFrameIdx()                        const { return FrameIdx; }
     46   void setFrameIdx(int FI)                       { FrameIdx = FI; }
     47 };
     48 
     49 /// The MachineFrameInfo class represents an abstract stack frame until
     50 /// prolog/epilog code is inserted.  This class is key to allowing stack frame
     51 /// representation optimizations, such as frame pointer elimination.  It also
     52 /// allows more mundane (but still important) optimizations, such as reordering
     53 /// of abstract objects on the stack frame.
     54 ///
     55 /// To support this, the class assigns unique integer identifiers to stack
     56 /// objects requested clients.  These identifiers are negative integers for
     57 /// fixed stack objects (such as arguments passed on the stack) or nonnegative
     58 /// for objects that may be reordered.  Instructions which refer to stack
     59 /// objects use a special MO_FrameIndex operand to represent these frame
     60 /// indexes.
     61 ///
     62 /// Because this class keeps track of all references to the stack frame, it
     63 /// knows when a variable sized object is allocated on the stack.  This is the
     64 /// sole condition which prevents frame pointer elimination, which is an
     65 /// important optimization on register-poor architectures.  Because original
     66 /// variable sized alloca's in the source program are the only source of
     67 /// variable sized stack objects, it is safe to decide whether there will be
     68 /// any variable sized objects before all stack objects are known (for
     69 /// example, register allocator spill code never needs variable sized
     70 /// objects).
     71 ///
     72 /// When prolog/epilog code emission is performed, the final stack frame is
     73 /// built and the machine instructions are modified to refer to the actual
     74 /// stack offsets of the object, eliminating all MO_FrameIndex operands from
     75 /// the program.
     76 ///
     77 /// @brief Abstract Stack Frame Information
     78 class MachineFrameInfo {
     79 
     80   // StackObject - Represent a single object allocated on the stack.
     81   struct StackObject {
     82     // SPOffset - The offset of this object from the stack pointer on entry to
     83     // the function.  This field has no meaning for a variable sized element.
     84     int64_t SPOffset;
     85 
     86     // The size of this object on the stack. 0 means a variable sized object,
     87     // ~0ULL means a dead object.
     88     uint64_t Size;
     89 
     90     // Alignment - The required alignment of this stack slot.
     91     unsigned Alignment;
     92 
     93     // isImmutable - If true, the value of the stack object is set before
     94     // entering the function and is not modified inside the function. By
     95     // default, fixed objects are immutable unless marked otherwise.
     96     bool isImmutable;
     97 
     98     // isSpillSlot - If true the stack object is used as spill slot. It
     99     // cannot alias any other memory objects.
    100     bool isSpillSlot;
    101 
    102     // MayNeedSP - If true the stack object triggered the creation of the stack
    103     // protector. We should allocate this object right after the stack
    104     // protector.
    105     bool MayNeedSP;
    106 
    107     /// Alloca - If this stack object is originated from an Alloca instruction
    108     /// this value saves the original IR allocation. Can be NULL.
    109     const Value *Alloca;
    110 
    111     // PreAllocated - If true, the object was mapped into the local frame
    112     // block and doesn't need additional handling for allocation beyond that.
    113     bool PreAllocated;
    114 
    115     StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM,
    116                 bool isSS, bool NSP, const Value *Val)
    117       : SPOffset(SP), Size(Sz), Alignment(Al), isImmutable(IM),
    118         isSpillSlot(isSS), MayNeedSP(NSP), Alloca(Val), PreAllocated(false) {}
    119   };
    120 
    121   /// Objects - The list of stack objects allocated...
    122   ///
    123   std::vector<StackObject> Objects;
    124 
    125   /// NumFixedObjects - This contains the number of fixed objects contained on
    126   /// the stack.  Because fixed objects are stored at a negative index in the
    127   /// Objects list, this is also the index to the 0th object in the list.
    128   ///
    129   unsigned NumFixedObjects;
    130 
    131   /// HasVarSizedObjects - This boolean keeps track of whether any variable
    132   /// sized objects have been allocated yet.
    133   ///
    134   bool HasVarSizedObjects;
    135 
    136   /// FrameAddressTaken - This boolean keeps track of whether there is a call
    137   /// to builtin \@llvm.frameaddress.
    138   bool FrameAddressTaken;
    139 
    140   /// ReturnAddressTaken - This boolean keeps track of whether there is a call
    141   /// to builtin \@llvm.returnaddress.
    142   bool ReturnAddressTaken;
    143 
    144   /// StackSize - The prolog/epilog code inserter calculates the final stack
    145   /// offsets for all of the fixed size objects, updating the Objects list
    146   /// above.  It then updates StackSize to contain the number of bytes that need
    147   /// to be allocated on entry to the function.
    148   ///
    149   uint64_t StackSize;
    150 
    151   /// OffsetAdjustment - The amount that a frame offset needs to be adjusted to
    152   /// have the actual offset from the stack/frame pointer.  The exact usage of
    153   /// this is target-dependent, but it is typically used to adjust between
    154   /// SP-relative and FP-relative offsets.  E.G., if objects are accessed via
    155   /// SP then OffsetAdjustment is zero; if FP is used, OffsetAdjustment is set
    156   /// to the distance between the initial SP and the value in FP.  For many
    157   /// targets, this value is only used when generating debug info (via
    158   /// TargetRegisterInfo::getFrameIndexOffset); when generating code, the
    159   /// corresponding adjustments are performed directly.
    160   int OffsetAdjustment;
    161 
    162   /// MaxAlignment - The prolog/epilog code inserter may process objects
    163   /// that require greater alignment than the default alignment the target
    164   /// provides. To handle this, MaxAlignment is set to the maximum alignment
    165   /// needed by the objects on the current frame.  If this is greater than the
    166   /// native alignment maintained by the compiler, dynamic alignment code will
    167   /// be needed.
    168   ///
    169   unsigned MaxAlignment;
    170 
    171   /// AdjustsStack - Set to true if this function adjusts the stack -- e.g.,
    172   /// when calling another function. This is only valid during and after
    173   /// prolog/epilog code insertion.
    174   bool AdjustsStack;
    175 
    176   /// HasCalls - Set to true if this function has any function calls.
    177   bool HasCalls;
    178 
    179   /// StackProtectorIdx - The frame index for the stack protector.
    180   int StackProtectorIdx;
    181 
    182   /// FunctionContextIdx - The frame index for the function context. Used for
    183   /// SjLj exceptions.
    184   int FunctionContextIdx;
    185 
    186   /// MaxCallFrameSize - This contains the size of the largest call frame if the
    187   /// target uses frame setup/destroy pseudo instructions (as defined in the
    188   /// TargetFrameInfo class).  This information is important for frame pointer
    189   /// elimination.  If is only valid during and after prolog/epilog code
    190   /// insertion.
    191   ///
    192   unsigned MaxCallFrameSize;
    193 
    194   /// CSInfo - The prolog/epilog code inserter fills in this vector with each
    195   /// callee saved register saved in the frame.  Beyond its use by the prolog/
    196   /// epilog code inserter, this data used for debug info and exception
    197   /// handling.
    198   std::vector<CalleeSavedInfo> CSInfo;
    199 
    200   /// CSIValid - Has CSInfo been set yet?
    201   bool CSIValid;
    202 
    203   /// TargetFrameLowering - Target information about frame layout.
    204   ///
    205   const TargetFrameLowering &TFI;
    206 
    207   /// LocalFrameObjects - References to frame indices which are mapped
    208   /// into the local frame allocation block. <FrameIdx, LocalOffset>
    209   SmallVector<std::pair<int, int64_t>, 32> LocalFrameObjects;
    210 
    211   /// LocalFrameSize - Size of the pre-allocated local frame block.
    212   int64_t LocalFrameSize;
    213 
    214   /// Required alignment of the local object blob, which is the strictest
    215   /// alignment of any object in it.
    216   unsigned LocalFrameMaxAlign;
    217 
    218   /// Whether the local object blob needs to be allocated together. If not,
    219   /// PEI should ignore the isPreAllocated flags on the stack objects and
    220   /// just allocate them normally.
    221   bool UseLocalStackAllocationBlock;
    222 
    223 public:
    224     explicit MachineFrameInfo(const TargetFrameLowering &tfi) : TFI(tfi) {
    225     StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
    226     HasVarSizedObjects = false;
    227     FrameAddressTaken = false;
    228     ReturnAddressTaken = false;
    229     AdjustsStack = false;
    230     HasCalls = false;
    231     StackProtectorIdx = -1;
    232     FunctionContextIdx = -1;
    233     MaxCallFrameSize = 0;
    234     CSIValid = false;
    235     LocalFrameSize = 0;
    236     LocalFrameMaxAlign = 0;
    237     UseLocalStackAllocationBlock = false;
    238   }
    239 
    240   /// hasStackObjects - Return true if there are any stack objects in this
    241   /// function.
    242   ///
    243   bool hasStackObjects() const { return !Objects.empty(); }
    244 
    245   /// hasVarSizedObjects - This method may be called any time after instruction
    246   /// selection is complete to determine if the stack frame for this function
    247   /// contains any variable sized objects.
    248   ///
    249   bool hasVarSizedObjects() const { return HasVarSizedObjects; }
    250 
    251   /// getStackProtectorIndex/setStackProtectorIndex - Return the index for the
    252   /// stack protector object.
    253   ///
    254   int getStackProtectorIndex() const { return StackProtectorIdx; }
    255   void setStackProtectorIndex(int I) { StackProtectorIdx = I; }
    256 
    257   /// getFunctionContextIndex/setFunctionContextIndex - Return the index for the
    258   /// function context object. This object is used for SjLj exceptions.
    259   int getFunctionContextIndex() const { return FunctionContextIdx; }
    260   void setFunctionContextIndex(int I) { FunctionContextIdx = I; }
    261 
    262   /// isFrameAddressTaken - This method may be called any time after instruction
    263   /// selection is complete to determine if there is a call to
    264   /// \@llvm.frameaddress in this function.
    265   bool isFrameAddressTaken() const { return FrameAddressTaken; }
    266   void setFrameAddressIsTaken(bool T) { FrameAddressTaken = T; }
    267 
    268   /// isReturnAddressTaken - This method may be called any time after
    269   /// instruction selection is complete to determine if there is a call to
    270   /// \@llvm.returnaddress in this function.
    271   bool isReturnAddressTaken() const { return ReturnAddressTaken; }
    272   void setReturnAddressIsTaken(bool s) { ReturnAddressTaken = s; }
    273 
    274   /// getObjectIndexBegin - Return the minimum frame object index.
    275   ///
    276   int getObjectIndexBegin() const { return -NumFixedObjects; }
    277 
    278   /// getObjectIndexEnd - Return one past the maximum frame object index.
    279   ///
    280   int getObjectIndexEnd() const { return (int)Objects.size()-NumFixedObjects; }
    281 
    282   /// getNumFixedObjects - Return the number of fixed objects.
    283   unsigned getNumFixedObjects() const { return NumFixedObjects; }
    284 
    285   /// getNumObjects - Return the number of objects.
    286   ///
    287   unsigned getNumObjects() const { return Objects.size(); }
    288 
    289   /// mapLocalFrameObject - Map a frame index into the local object block
    290   void mapLocalFrameObject(int ObjectIndex, int64_t Offset) {
    291     LocalFrameObjects.push_back(std::pair<int, int64_t>(ObjectIndex, Offset));
    292     Objects[ObjectIndex + NumFixedObjects].PreAllocated = true;
    293   }
    294 
    295   /// getLocalFrameObjectMap - Get the local offset mapping for a for an object
    296   std::pair<int, int64_t> getLocalFrameObjectMap(int i) {
    297     assert (i >= 0 && (unsigned)i < LocalFrameObjects.size() &&
    298             "Invalid local object reference!");
    299     return LocalFrameObjects[i];
    300   }
    301 
    302   /// getLocalFrameObjectCount - Return the number of objects allocated into
    303   /// the local object block.
    304   int64_t getLocalFrameObjectCount() { return LocalFrameObjects.size(); }
    305 
    306   /// setLocalFrameSize - Set the size of the local object blob.
    307   void setLocalFrameSize(int64_t sz) { LocalFrameSize = sz; }
    308 
    309   /// getLocalFrameSize - Get the size of the local object blob.
    310   int64_t getLocalFrameSize() const { return LocalFrameSize; }
    311 
    312   /// setLocalFrameMaxAlign - Required alignment of the local object blob,
    313   /// which is the strictest alignment of any object in it.
    314   void setLocalFrameMaxAlign(unsigned Align) { LocalFrameMaxAlign = Align; }
    315 
    316   /// getLocalFrameMaxAlign - Return the required alignment of the local
    317   /// object blob.
    318   unsigned getLocalFrameMaxAlign() const { return LocalFrameMaxAlign; }
    319 
    320   /// getUseLocalStackAllocationBlock - Get whether the local allocation blob
    321   /// should be allocated together or let PEI allocate the locals in it
    322   /// directly.
    323   bool getUseLocalStackAllocationBlock() {return UseLocalStackAllocationBlock;}
    324 
    325   /// setUseLocalStackAllocationBlock - Set whether the local allocation blob
    326   /// should be allocated together or let PEI allocate the locals in it
    327   /// directly.
    328   void setUseLocalStackAllocationBlock(bool v) {
    329     UseLocalStackAllocationBlock = v;
    330   }
    331 
    332   /// isObjectPreAllocated - Return true if the object was pre-allocated into
    333   /// the local block.
    334   bool isObjectPreAllocated(int ObjectIdx) const {
    335     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    336            "Invalid Object Idx!");
    337     return Objects[ObjectIdx+NumFixedObjects].PreAllocated;
    338   }
    339 
    340   /// getObjectSize - Return the size of the specified object.
    341   ///
    342   int64_t getObjectSize(int ObjectIdx) const {
    343     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    344            "Invalid Object Idx!");
    345     return Objects[ObjectIdx+NumFixedObjects].Size;
    346   }
    347 
    348   /// setObjectSize - Change the size of the specified stack object.
    349   void setObjectSize(int ObjectIdx, int64_t Size) {
    350     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    351            "Invalid Object Idx!");
    352     Objects[ObjectIdx+NumFixedObjects].Size = Size;
    353   }
    354 
    355   /// getObjectAlignment - Return the alignment of the specified stack object.
    356   unsigned getObjectAlignment(int ObjectIdx) const {
    357     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    358            "Invalid Object Idx!");
    359     return Objects[ObjectIdx+NumFixedObjects].Alignment;
    360   }
    361 
    362   /// setObjectAlignment - Change the alignment of the specified stack object.
    363   void setObjectAlignment(int ObjectIdx, unsigned Align) {
    364     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    365            "Invalid Object Idx!");
    366     Objects[ObjectIdx+NumFixedObjects].Alignment = Align;
    367     ensureMaxAlignment(Align);
    368   }
    369 
    370   /// getObjectAllocation - Return the underlying Alloca of the specified
    371   /// stack object if it exists. Returns 0 if none exists.
    372   const Value* getObjectAllocation(int ObjectIdx) const {
    373     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    374            "Invalid Object Idx!");
    375     return Objects[ObjectIdx+NumFixedObjects].Alloca;
    376   }
    377 
    378   /// NeedsStackProtector - Returns true if the object may need stack
    379   /// protectors.
    380   bool MayNeedStackProtector(int ObjectIdx) const {
    381     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    382            "Invalid Object Idx!");
    383     return Objects[ObjectIdx+NumFixedObjects].MayNeedSP;
    384   }
    385 
    386   /// getObjectOffset - Return the assigned stack offset of the specified object
    387   /// from the incoming stack pointer.
    388   ///
    389   int64_t getObjectOffset(int ObjectIdx) const {
    390     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    391            "Invalid Object Idx!");
    392     assert(!isDeadObjectIndex(ObjectIdx) &&
    393            "Getting frame offset for a dead object?");
    394     return Objects[ObjectIdx+NumFixedObjects].SPOffset;
    395   }
    396 
    397   /// setObjectOffset - Set the stack frame offset of the specified object.  The
    398   /// offset is relative to the stack pointer on entry to the function.
    399   ///
    400   void setObjectOffset(int ObjectIdx, int64_t SPOffset) {
    401     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    402            "Invalid Object Idx!");
    403     assert(!isDeadObjectIndex(ObjectIdx) &&
    404            "Setting frame offset for a dead object?");
    405     Objects[ObjectIdx+NumFixedObjects].SPOffset = SPOffset;
    406   }
    407 
    408   /// getStackSize - Return the number of bytes that must be allocated to hold
    409   /// all of the fixed size frame objects.  This is only valid after
    410   /// Prolog/Epilog code insertion has finalized the stack frame layout.
    411   ///
    412   uint64_t getStackSize() const { return StackSize; }
    413 
    414   /// setStackSize - Set the size of the stack...
    415   ///
    416   void setStackSize(uint64_t Size) { StackSize = Size; }
    417 
    418   /// getOffsetAdjustment - Return the correction for frame offsets.
    419   ///
    420   int getOffsetAdjustment() const { return OffsetAdjustment; }
    421 
    422   /// setOffsetAdjustment - Set the correction for frame offsets.
    423   ///
    424   void setOffsetAdjustment(int Adj) { OffsetAdjustment = Adj; }
    425 
    426   /// getMaxAlignment - Return the alignment in bytes that this function must be
    427   /// aligned to, which is greater than the default stack alignment provided by
    428   /// the target.
    429   ///
    430   unsigned getMaxAlignment() const { return MaxAlignment; }
    431 
    432   /// ensureMaxAlignment - Make sure the function is at least Align bytes
    433   /// aligned.
    434   void ensureMaxAlignment(unsigned Align) {
    435     if (MaxAlignment < Align) MaxAlignment = Align;
    436   }
    437 
    438   /// AdjustsStack - Return true if this function adjusts the stack -- e.g.,
    439   /// when calling another function. This is only valid during and after
    440   /// prolog/epilog code insertion.
    441   bool adjustsStack() const { return AdjustsStack; }
    442   void setAdjustsStack(bool V) { AdjustsStack = V; }
    443 
    444   /// hasCalls - Return true if the current function has any function calls.
    445   bool hasCalls() const { return HasCalls; }
    446   void setHasCalls(bool V) { HasCalls = V; }
    447 
    448   /// getMaxCallFrameSize - Return the maximum size of a call frame that must be
    449   /// allocated for an outgoing function call.  This is only available if
    450   /// CallFrameSetup/Destroy pseudo instructions are used by the target, and
    451   /// then only during or after prolog/epilog code insertion.
    452   ///
    453   unsigned getMaxCallFrameSize() const { return MaxCallFrameSize; }
    454   void setMaxCallFrameSize(unsigned S) { MaxCallFrameSize = S; }
    455 
    456   /// CreateFixedObject - Create a new object at a fixed location on the stack.
    457   /// All fixed objects should be created before other objects are created for
    458   /// efficiency. By default, fixed objects are immutable. This returns an
    459   /// index with a negative value.
    460   ///
    461   int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable);
    462 
    463 
    464   /// isFixedObjectIndex - Returns true if the specified index corresponds to a
    465   /// fixed stack object.
    466   bool isFixedObjectIndex(int ObjectIdx) const {
    467     return ObjectIdx < 0 && (ObjectIdx >= -(int)NumFixedObjects);
    468   }
    469 
    470   /// isImmutableObjectIndex - Returns true if the specified index corresponds
    471   /// to an immutable object.
    472   bool isImmutableObjectIndex(int ObjectIdx) const {
    473     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    474            "Invalid Object Idx!");
    475     return Objects[ObjectIdx+NumFixedObjects].isImmutable;
    476   }
    477 
    478   /// isSpillSlotObjectIndex - Returns true if the specified index corresponds
    479   /// to a spill slot..
    480   bool isSpillSlotObjectIndex(int ObjectIdx) const {
    481     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    482            "Invalid Object Idx!");
    483     return Objects[ObjectIdx+NumFixedObjects].isSpillSlot;
    484   }
    485 
    486   /// isDeadObjectIndex - Returns true if the specified index corresponds to
    487   /// a dead object.
    488   bool isDeadObjectIndex(int ObjectIdx) const {
    489     assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    490            "Invalid Object Idx!");
    491     return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL;
    492   }
    493 
    494   /// CreateStackObject - Create a new statically sized stack object, returning
    495   /// a nonnegative identifier to represent it.
    496   ///
    497   int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS,
    498                         bool MayNeedSP = false, const Value *Alloca = 0) {
    499     assert(Size != 0 && "Cannot allocate zero size stack objects!");
    500     Objects.push_back(StackObject(Size, Alignment, 0, false, isSS, MayNeedSP,
    501                                   Alloca));
    502     int Index = (int)Objects.size() - NumFixedObjects - 1;
    503     assert(Index >= 0 && "Bad frame index!");
    504     ensureMaxAlignment(Alignment);
    505     return Index;
    506   }
    507 
    508   /// CreateSpillStackObject - Create a new statically sized stack object that
    509   /// represents a spill slot, returning a nonnegative identifier to represent
    510   /// it.
    511   ///
    512   int CreateSpillStackObject(uint64_t Size, unsigned Alignment) {
    513     CreateStackObject(Size, Alignment, true, false);
    514     int Index = (int)Objects.size() - NumFixedObjects - 1;
    515     ensureMaxAlignment(Alignment);
    516     return Index;
    517   }
    518 
    519   /// RemoveStackObject - Remove or mark dead a statically sized stack object.
    520   ///
    521   void RemoveStackObject(int ObjectIdx) {
    522     // Mark it dead.
    523     Objects[ObjectIdx+NumFixedObjects].Size = ~0ULL;
    524   }
    525 
    526   /// CreateVariableSizedObject - Notify the MachineFrameInfo object that a
    527   /// variable sized object has been created.  This must be created whenever a
    528   /// variable sized object is created, whether or not the index returned is
    529   /// actually used.
    530   ///
    531   int CreateVariableSizedObject(unsigned Alignment) {
    532     HasVarSizedObjects = true;
    533     Objects.push_back(StackObject(0, Alignment, 0, false, false, true, 0));
    534     ensureMaxAlignment(Alignment);
    535     return (int)Objects.size()-NumFixedObjects-1;
    536   }
    537 
    538   /// getCalleeSavedInfo - Returns a reference to call saved info vector for the
    539   /// current function.
    540   const std::vector<CalleeSavedInfo> &getCalleeSavedInfo() const {
    541     return CSInfo;
    542   }
    543 
    544   /// setCalleeSavedInfo - Used by prolog/epilog inserter to set the function's
    545   /// callee saved information.
    546   void setCalleeSavedInfo(const std::vector<CalleeSavedInfo> &CSI) {
    547     CSInfo = CSI;
    548   }
    549 
    550   /// isCalleeSavedInfoValid - Has the callee saved info been calculated yet?
    551   bool isCalleeSavedInfoValid() const { return CSIValid; }
    552 
    553   void setCalleeSavedInfoValid(bool v) { CSIValid = v; }
    554 
    555   /// getPristineRegs - Return a set of physical registers that are pristine on
    556   /// entry to the MBB.
    557   ///
    558   /// Pristine registers hold a value that is useless to the current function,
    559   /// but that must be preserved - they are callee saved registers that have not
    560   /// been saved yet.
    561   ///
    562   /// Before the PrologueEpilogueInserter has placed the CSR spill code, this
    563   /// method always returns an empty set.
    564   BitVector getPristineRegs(const MachineBasicBlock *MBB) const;
    565 
    566   /// print - Used by the MachineFunction printer to print information about
    567   /// stack objects. Implemented in MachineFunction.cpp
    568   ///
    569   void print(const MachineFunction &MF, raw_ostream &OS) const;
    570 
    571   /// dump - Print the function to stderr.
    572   void dump(const MachineFunction &MF) const;
    573 };
    574 
    575 } // End llvm namespace
    576 
    577 #endif
    578