1 //===-- XCoreMachineFuctionInfo.h - XCore machine function info -*- 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 // This file declares XCore-specific per-machine-function information. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H 15 #define LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H 16 17 #include "llvm/CodeGen/MachineFrameInfo.h" 18 #include "llvm/CodeGen/MachineFunction.h" 19 #include <vector> 20 21 namespace llvm { 22 23 // Forward declarations 24 class Function; 25 26 /// XCoreFunctionInfo - This class is derived from MachineFunction private 27 /// XCore target-specific information for each MachineFunction. 28 class XCoreFunctionInfo : public MachineFunctionInfo { 29 virtual void anchor(); 30 bool LRSpillSlotSet; 31 int LRSpillSlot; 32 bool FPSpillSlotSet; 33 int FPSpillSlot; 34 bool EHSpillSlotSet; 35 int EHSpillSlot[2]; 36 unsigned ReturnStackOffset; 37 bool ReturnStackOffsetSet; 38 int VarArgsFrameIndex; 39 mutable int CachedEStackSize; 40 std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>> 41 SpillLabels; 42 43 public: XCoreFunctionInfo()44 XCoreFunctionInfo() : 45 LRSpillSlotSet(false), 46 FPSpillSlotSet(false), 47 EHSpillSlotSet(false), 48 ReturnStackOffsetSet(false), 49 VarArgsFrameIndex(0), 50 CachedEStackSize(-1) {} 51 XCoreFunctionInfo(MachineFunction & MF)52 explicit XCoreFunctionInfo(MachineFunction &MF) : 53 LRSpillSlotSet(false), 54 FPSpillSlotSet(false), 55 EHSpillSlotSet(false), 56 ReturnStackOffsetSet(false), 57 VarArgsFrameIndex(0), 58 CachedEStackSize(-1) {} 59 ~XCoreFunctionInfo()60 ~XCoreFunctionInfo() {} 61 setVarArgsFrameIndex(int off)62 void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; } getVarArgsFrameIndex()63 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } 64 65 int createLRSpillSlot(MachineFunction &MF); hasLRSpillSlot()66 bool hasLRSpillSlot() { return LRSpillSlotSet; } getLRSpillSlot()67 int getLRSpillSlot() const { 68 assert(LRSpillSlotSet && "LR Spill slot not set"); 69 return LRSpillSlot; 70 } 71 72 int createFPSpillSlot(MachineFunction &MF); hasFPSpillSlot()73 bool hasFPSpillSlot() { return FPSpillSlotSet; } getFPSpillSlot()74 int getFPSpillSlot() const { 75 assert(FPSpillSlotSet && "FP Spill slot not set"); 76 return FPSpillSlot; 77 } 78 79 const int* createEHSpillSlot(MachineFunction &MF); hasEHSpillSlot()80 bool hasEHSpillSlot() { return EHSpillSlotSet; } getEHSpillSlot()81 const int* getEHSpillSlot() const { 82 assert(EHSpillSlotSet && "EH Spill slot not set"); 83 return EHSpillSlot; 84 } 85 setReturnStackOffset(unsigned value)86 void setReturnStackOffset(unsigned value) { 87 assert(!ReturnStackOffsetSet && "Return stack offset set twice"); 88 ReturnStackOffset = value; 89 ReturnStackOffsetSet = true; 90 } 91 getReturnStackOffset()92 unsigned getReturnStackOffset() const { 93 assert(ReturnStackOffsetSet && "Return stack offset not set"); 94 return ReturnStackOffset; 95 } 96 97 bool isLargeFrame(const MachineFunction &MF) const; 98 99 std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>> & getSpillLabels()100 getSpillLabels() { 101 return SpillLabels; 102 } 103 }; 104 } // End llvm namespace 105 106 #endif 107