1 //===- XCoreMachineFunctionInfo.h - XCore machine function info -*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file declares XCore-specific per-machine-function information.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
14 #define LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
16 #include "llvm/CodeGen/MachineBasicBlock.h"
17 #include "llvm/CodeGen/MachineFrameInfo.h"
18 #include "llvm/CodeGen/MachineFunction.h"
25 /// XCoreFunctionInfo - This class is derived from MachineFunction private
26 /// XCore target-specific information for each MachineFunction.
27 class XCoreFunctionInfo
: public MachineFunctionInfo
{
28 bool LRSpillSlotSet
= false;
30 bool FPSpillSlotSet
= false;
32 bool EHSpillSlotSet
= false;
34 unsigned ReturnStackOffset
;
35 bool ReturnStackOffsetSet
= false;
36 int VarArgsFrameIndex
= 0;
37 mutable int CachedEStackSize
= -1;
38 std::vector
<std::pair
<MachineBasicBlock::iterator
, CalleeSavedInfo
>>
41 virtual void anchor();
44 XCoreFunctionInfo() = default;
46 explicit XCoreFunctionInfo(MachineFunction
&MF
) {}
48 ~XCoreFunctionInfo() override
= default;
50 void setVarArgsFrameIndex(int off
) { VarArgsFrameIndex
= off
; }
51 int getVarArgsFrameIndex() const { return VarArgsFrameIndex
; }
53 int createLRSpillSlot(MachineFunction
&MF
);
54 bool hasLRSpillSlot() { return LRSpillSlotSet
; }
55 int getLRSpillSlot() const {
56 assert(LRSpillSlotSet
&& "LR Spill slot not set");
60 int createFPSpillSlot(MachineFunction
&MF
);
61 bool hasFPSpillSlot() { return FPSpillSlotSet
; }
62 int getFPSpillSlot() const {
63 assert(FPSpillSlotSet
&& "FP Spill slot not set");
67 const int* createEHSpillSlot(MachineFunction
&MF
);
68 bool hasEHSpillSlot() { return EHSpillSlotSet
; }
69 const int* getEHSpillSlot() const {
70 assert(EHSpillSlotSet
&& "EH Spill slot not set");
74 void setReturnStackOffset(unsigned value
) {
75 assert(!ReturnStackOffsetSet
&& "Return stack offset set twice");
76 ReturnStackOffset
= value
;
77 ReturnStackOffsetSet
= true;
80 unsigned getReturnStackOffset() const {
81 assert(ReturnStackOffsetSet
&& "Return stack offset not set");
82 return ReturnStackOffset
;
85 bool isLargeFrame(const MachineFunction
&MF
) const;
87 std::vector
<std::pair
<MachineBasicBlock::iterator
, CalleeSavedInfo
>> &
93 } // end namespace llvm
95 #endif // LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H