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(const Function
&F
,
47 const TargetSubtargetInfo
*STI
) {}
50 clone(BumpPtrAllocator
&Allocator
, MachineFunction
&DestMF
,
51 const DenseMap
<MachineBasicBlock
*, MachineBasicBlock
*> &Src2DstMBB
)
54 ~XCoreFunctionInfo() override
= default;
56 void setVarArgsFrameIndex(int off
) { VarArgsFrameIndex
= off
; }
57 int getVarArgsFrameIndex() const { return VarArgsFrameIndex
; }
59 int createLRSpillSlot(MachineFunction
&MF
);
60 bool hasLRSpillSlot() { return LRSpillSlotSet
; }
61 int getLRSpillSlot() const {
62 assert(LRSpillSlotSet
&& "LR Spill slot not set");
66 int createFPSpillSlot(MachineFunction
&MF
);
67 bool hasFPSpillSlot() { return FPSpillSlotSet
; }
68 int getFPSpillSlot() const {
69 assert(FPSpillSlotSet
&& "FP Spill slot not set");
73 const int* createEHSpillSlot(MachineFunction
&MF
);
74 bool hasEHSpillSlot() { return EHSpillSlotSet
; }
75 const int* getEHSpillSlot() const {
76 assert(EHSpillSlotSet
&& "EH Spill slot not set");
80 void setReturnStackOffset(unsigned value
) {
81 assert(!ReturnStackOffsetSet
&& "Return stack offset set twice");
82 ReturnStackOffset
= value
;
83 ReturnStackOffsetSet
= true;
86 unsigned getReturnStackOffset() const {
87 assert(ReturnStackOffsetSet
&& "Return stack offset not set");
88 return ReturnStackOffset
;
91 bool isLargeFrame(const MachineFunction
&MF
) const;
93 std::vector
<std::pair
<MachineBasicBlock::iterator
, CalleeSavedInfo
>> &
99 } // end namespace llvm
101 #endif // LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H