1 //===- XCoreMachineFunctionInfo.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 LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
15 #define LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
17 #include "llvm/CodeGen/MachineBasicBlock.h"
18 #include "llvm/CodeGen/MachineFrameInfo.h"
19 #include "llvm/CodeGen/MachineFunction.h"
26 /// XCoreFunctionInfo - This class is derived from MachineFunction private
27 /// XCore target-specific information for each MachineFunction.
28 class XCoreFunctionInfo : public MachineFunctionInfo {
29 bool LRSpillSlotSet = false;
31 bool FPSpillSlotSet = false;
33 bool EHSpillSlotSet = false;
35 unsigned ReturnStackOffset;
36 bool ReturnStackOffsetSet = false;
37 int VarArgsFrameIndex = 0;
38 mutable int CachedEStackSize = -1;
39 std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>>
42 virtual void anchor();
45 XCoreFunctionInfo() = default;
47 explicit XCoreFunctionInfo(MachineFunction &MF) {}
49 ~XCoreFunctionInfo() override = default;
51 void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
52 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
54 int createLRSpillSlot(MachineFunction &MF);
55 bool hasLRSpillSlot() { return LRSpillSlotSet; }
56 int getLRSpillSlot() const {
57 assert(LRSpillSlotSet && "LR Spill slot not set");
61 int createFPSpillSlot(MachineFunction &MF);
62 bool hasFPSpillSlot() { return FPSpillSlotSet; }
63 int getFPSpillSlot() const {
64 assert(FPSpillSlotSet && "FP Spill slot not set");
68 const int* createEHSpillSlot(MachineFunction &MF);
69 bool hasEHSpillSlot() { return EHSpillSlotSet; }
70 const int* getEHSpillSlot() const {
71 assert(EHSpillSlotSet && "EH Spill slot not set");
75 void setReturnStackOffset(unsigned value) {
76 assert(!ReturnStackOffsetSet && "Return stack offset set twice");
77 ReturnStackOffset = value;
78 ReturnStackOffsetSet = true;
81 unsigned getReturnStackOffset() const {
82 assert(ReturnStackOffsetSet && "Return stack offset not set");
83 return ReturnStackOffset;
86 bool isLargeFrame(const MachineFunction &MF) const;
88 std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>> &
94 } // end namespace llvm
96 #endif // LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H