LLVM API Documentation

PPCMachineFunctionInfo.h

Go to the documentation of this file.
00001 //===-- PPCMachineFunctionInfo.h - Private data used for PowerPC --*- 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 // This file declares the PowerPC specific subclass of MachineFunctionInfo.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef PPC_MACHINE_FUNCTION_INFO_H
00015 #define PPC_MACHINE_FUNCTION_INFO_H
00016 
00017 #include "llvm/CodeGen/MachineFunction.h"
00018 
00019 namespace llvm {
00020 
00021 /// PPCFunctionInfo - This class is derived from MachineFunction private
00022 /// PowerPC target-specific information for each MachineFunction.
00023 class PPCFunctionInfo : public MachineFunctionInfo {
00024 private:
00025   /// FramePointerSaveIndex - Frame index of where the old frame pointer is
00026   /// stored.  Also used as an anchor for instructions that need to be altered
00027   /// when using frame pointers (dyna_add, dyna_sub.)
00028   int FramePointerSaveIndex;
00029   
00030   /// ReturnAddrSaveIndex - Frame index of where the return address is stored.
00031   ///
00032   int ReturnAddrSaveIndex;
00033 
00034   /// MustSaveLR - Indicates whether LR is defined (or clobbered) in the current
00035   /// function.  This is only valid after the initial scan of the function by
00036   /// PEI.
00037   bool MustSaveLR;
00038 
00039   /// SpillsCR - Indicates whether CR is spilled in the current function.
00040   bool SpillsCR;
00041 
00042   /// LRStoreRequired - The bool indicates whether there is some explicit use of
00043   /// the LR/LR8 stack slot that is not obvious from scanning the code.  This
00044   /// requires that the code generator produce a store of LR to the stack on
00045   /// entry, even though LR may otherwise apparently not be used.
00046   bool LRStoreRequired;
00047 
00048   /// MinReservedArea - This is the frame size that is at least reserved in a
00049   /// potential caller (parameter+linkage area).
00050   unsigned MinReservedArea;
00051 
00052   /// TailCallSPDelta - Stack pointer delta used when tail calling. Maximum
00053   /// amount the stack pointer is adjusted to make the frame bigger for tail
00054   /// calls. Used for creating an area before the register spill area.
00055   int TailCallSPDelta;
00056 
00057   /// HasFastCall - Does this function contain a fast call. Used to determine
00058   /// how the caller's stack pointer should be calculated (epilog/dynamicalloc).
00059   bool HasFastCall;
00060 
00061 public:
00062   PPCFunctionInfo(MachineFunction &MF) 
00063     : FramePointerSaveIndex(0),
00064       ReturnAddrSaveIndex(0),
00065       SpillsCR(false),
00066       LRStoreRequired(false),
00067       MinReservedArea(0),
00068       TailCallSPDelta(0),
00069       HasFastCall(false) {}
00070 
00071   int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }
00072   void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }
00073   
00074   int getReturnAddrSaveIndex() const { return ReturnAddrSaveIndex; }
00075   void setReturnAddrSaveIndex(int idx) { ReturnAddrSaveIndex = idx; }
00076 
00077   unsigned getMinReservedArea() const { return MinReservedArea; }
00078   void setMinReservedArea(unsigned size) { MinReservedArea = size; }
00079 
00080   int getTailCallSPDelta() const { return TailCallSPDelta; }
00081   void setTailCallSPDelta(int size) { TailCallSPDelta = size; }
00082 
00083   /// MustSaveLR - This is set when the prolog/epilog inserter does its initial
00084   /// scan of the function. It is true if the LR/LR8 register is ever explicitly
00085   /// defined/clobbered in the machine function (e.g. by calls and movpctolr,
00086   /// which is used in PIC generation), or if the LR stack slot is explicitly
00087   /// referenced by builtin_return_address.
00088   void setMustSaveLR(bool U) { MustSaveLR = U; }
00089   bool mustSaveLR() const    { return MustSaveLR; }
00090 
00091   void setSpillsCR()       { SpillsCR = true; }
00092   bool isCRSpilled() const { return SpillsCR; }
00093 
00094   void setLRStoreRequired() { LRStoreRequired = true; }
00095   bool isLRStoreRequired() const { return LRStoreRequired; }
00096 
00097   void setHasFastCall() { HasFastCall = true; }
00098   bool hasFastCall() const { return HasFastCall;}
00099 };
00100 
00101 } // end of namespace llvm
00102 
00103 
00104 #endif