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 XCOREMACHINEFUNCTIONINFO_H 15 #define 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<MCSymbol*, CalleeSavedInfo> > SpillLabels; 41 42 public: 43 XCoreFunctionInfo() : 44 LRSpillSlotSet(false), 45 FPSpillSlotSet(false), 46 EHSpillSlotSet(false), 47 ReturnStackOffsetSet(false), 48 VarArgsFrameIndex(0), 49 CachedEStackSize(-1) {} 50 51 explicit XCoreFunctionInfo(MachineFunction &MF) : 52 LRSpillSlotSet(false), 53 FPSpillSlotSet(false), 54 EHSpillSlotSet(false), 55 VarArgsFrameIndex(0), 56 CachedEStackSize(-1) {} 57 58 ~XCoreFunctionInfo() {} 59 60 void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; } 61 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } 62 63 int createLRSpillSlot(MachineFunction &MF); 64 bool hasLRSpillSlot() { return LRSpillSlotSet; } 65 int getLRSpillSlot() const { 66 assert(LRSpillSlotSet && "LR Spill slot not set"); 67 return LRSpillSlot; 68 } 69 70 int createFPSpillSlot(MachineFunction &MF); 71 bool hasFPSpillSlot() { return FPSpillSlotSet; } 72 int getFPSpillSlot() const { 73 assert(FPSpillSlotSet && "FP Spill slot not set"); 74 return FPSpillSlot; 75 } 76 77 const int* createEHSpillSlot(MachineFunction &MF); 78 bool hasEHSpillSlot() { return EHSpillSlotSet; } 79 const int* getEHSpillSlot() const { 80 assert(EHSpillSlotSet && "EH Spill slot not set"); 81 return EHSpillSlot; 82 } 83 84 void setReturnStackOffset(unsigned value) { 85 assert(!ReturnStackOffsetSet && "Return stack offset set twice"); 86 ReturnStackOffset = value; 87 ReturnStackOffsetSet = true; 88 } 89 90 unsigned getReturnStackOffset() const { 91 assert(ReturnStackOffsetSet && "Return stack offset not set"); 92 return ReturnStackOffset; 93 } 94 95 bool isLargeFrame(const MachineFunction &MF) const; 96 97 std::vector<std::pair<MCSymbol*, CalleeSavedInfo> > &getSpillLabels() { 98 return SpillLabels; 99 } 100 }; 101 } // End llvm namespace 102 103 #endif // XCOREMACHINEFUNCTIONINFO_H 104