LLVM API Documentation

XCoreMachineFunctionInfo.h
Go to the documentation of this file.
00001 //===-- XCoreMachineFuctionInfo.h - XCore machine function info -*- 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 XCore-specific per-machine-function information.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
00015 #define LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
00016 
00017 #include "llvm/CodeGen/MachineFrameInfo.h"
00018 #include "llvm/CodeGen/MachineFunction.h"
00019 #include <vector>
00020 
00021 namespace llvm {
00022 
00023 // Forward declarations
00024 class Function;
00025 
00026 /// XCoreFunctionInfo - This class is derived from MachineFunction private
00027 /// XCore target-specific information for each MachineFunction.
00028 class XCoreFunctionInfo : public MachineFunctionInfo {
00029   virtual void anchor();
00030   bool LRSpillSlotSet;
00031   int LRSpillSlot;
00032   bool FPSpillSlotSet;
00033   int FPSpillSlot;
00034   bool EHSpillSlotSet;
00035   int EHSpillSlot[2];
00036   unsigned ReturnStackOffset;
00037   bool ReturnStackOffsetSet;
00038   int VarArgsFrameIndex;
00039   mutable int CachedEStackSize;
00040   std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>>
00041   SpillLabels;
00042 
00043 public:
00044   XCoreFunctionInfo() :
00045     LRSpillSlotSet(false),
00046     FPSpillSlotSet(false),
00047     EHSpillSlotSet(false),
00048     ReturnStackOffsetSet(false),
00049     VarArgsFrameIndex(0),
00050     CachedEStackSize(-1) {}
00051   
00052   explicit XCoreFunctionInfo(MachineFunction &MF) :
00053     LRSpillSlotSet(false),
00054     FPSpillSlotSet(false),
00055     EHSpillSlotSet(false),
00056     ReturnStackOffsetSet(false),
00057     VarArgsFrameIndex(0),
00058     CachedEStackSize(-1) {}
00059   
00060   ~XCoreFunctionInfo() {}
00061   
00062   void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
00063   int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
00064 
00065   int createLRSpillSlot(MachineFunction &MF);
00066   bool hasLRSpillSlot() { return LRSpillSlotSet; }
00067   int getLRSpillSlot() const {
00068     assert(LRSpillSlotSet && "LR Spill slot not set");
00069     return LRSpillSlot;
00070   }
00071 
00072   int createFPSpillSlot(MachineFunction &MF);
00073   bool hasFPSpillSlot() { return FPSpillSlotSet; }
00074   int getFPSpillSlot() const {
00075     assert(FPSpillSlotSet && "FP Spill slot not set");
00076     return FPSpillSlot;
00077   }
00078 
00079   const int* createEHSpillSlot(MachineFunction &MF);
00080   bool hasEHSpillSlot() { return EHSpillSlotSet; }
00081   const int* getEHSpillSlot() const {
00082     assert(EHSpillSlotSet && "EH Spill slot not set");
00083     return EHSpillSlot;
00084   }
00085 
00086   void setReturnStackOffset(unsigned value) {
00087     assert(!ReturnStackOffsetSet && "Return stack offset set twice");
00088     ReturnStackOffset = value;
00089     ReturnStackOffsetSet = true;
00090   }
00091 
00092   unsigned getReturnStackOffset() const {
00093     assert(ReturnStackOffsetSet && "Return stack offset not set");
00094     return ReturnStackOffset;
00095   }
00096 
00097   bool isLargeFrame(const MachineFunction &MF) const;
00098 
00099   std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>> &
00100   getSpillLabels() {
00101     return SpillLabels;
00102   }
00103 };
00104 } // End llvm namespace
00105 
00106 #endif