1 //===-- XCoreMachineFuctionInfo.h - XCore machine function info -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares XCore-specific per-machine-function information.
12 //===----------------------------------------------------------------------===//
14 #ifndef XCOREMACHINEFUNCTIONINFO_H
15 #define XCOREMACHINEFUNCTIONINFO_H
17 #include "llvm/CodeGen/MachineFrameInfo.h"
18 #include "llvm/CodeGen/MachineFunction.h"
23 // Forward declarations
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();
36 unsigned ReturnStackOffset;
37 bool ReturnStackOffsetSet;
38 int VarArgsFrameIndex;
39 mutable int CachedEStackSize;
40 std::vector<std::pair<MCSymbol*, CalleeSavedInfo> > SpillLabels;
44 LRSpillSlotSet(false),
45 FPSpillSlotSet(false),
46 EHSpillSlotSet(false),
47 ReturnStackOffsetSet(false),
49 CachedEStackSize(-1) {}
51 explicit XCoreFunctionInfo(MachineFunction &MF) :
52 LRSpillSlotSet(false),
53 FPSpillSlotSet(false),
54 EHSpillSlotSet(false),
55 ReturnStackOffsetSet(false),
57 CachedEStackSize(-1) {}
59 ~XCoreFunctionInfo() {}
61 void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
62 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
64 int createLRSpillSlot(MachineFunction &MF);
65 bool hasLRSpillSlot() { return LRSpillSlotSet; }
66 int getLRSpillSlot() const {
67 assert(LRSpillSlotSet && "LR Spill slot not set");
71 int createFPSpillSlot(MachineFunction &MF);
72 bool hasFPSpillSlot() { return FPSpillSlotSet; }
73 int getFPSpillSlot() const {
74 assert(FPSpillSlotSet && "FP Spill slot not set");
78 const int* createEHSpillSlot(MachineFunction &MF);
79 bool hasEHSpillSlot() { return EHSpillSlotSet; }
80 const int* getEHSpillSlot() const {
81 assert(EHSpillSlotSet && "EH Spill slot not set");
85 void setReturnStackOffset(unsigned value) {
86 assert(!ReturnStackOffsetSet && "Return stack offset set twice");
87 ReturnStackOffset = value;
88 ReturnStackOffsetSet = true;
91 unsigned getReturnStackOffset() const {
92 assert(ReturnStackOffsetSet && "Return stack offset not set");
93 return ReturnStackOffset;
96 bool isLargeFrame(const MachineFunction &MF) const;
98 std::vector<std::pair<MCSymbol*, CalleeSavedInfo> > &getSpillLabels() {
102 } // End llvm namespace
104 #endif // XCOREMACHINEFUNCTIONINFO_H