LLVM  15.0.0git
XCoreMachineFunctionInfo.h
Go to the documentation of this file.
1 //===- XCoreMachineFunctionInfo.h - XCore machine function info -*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares XCore-specific per-machine-function information.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
14 #define LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
15 
19 #include <cassert>
20 #include <utility>
21 #include <vector>
22 
23 namespace llvm {
24 
25 /// XCoreFunctionInfo - This class is derived from MachineFunction private
26 /// XCore target-specific information for each MachineFunction.
28  bool LRSpillSlotSet = false;
29  int LRSpillSlot;
30  bool FPSpillSlotSet = false;
31  int FPSpillSlot;
32  bool EHSpillSlotSet = false;
33  int EHSpillSlot[2];
34  unsigned ReturnStackOffset;
35  bool ReturnStackOffsetSet = false;
36  int VarArgsFrameIndex = 0;
37  mutable int CachedEStackSize = -1;
38  std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>>
39  SpillLabels;
40 
41  virtual void anchor();
42 
43 public:
44  XCoreFunctionInfo() = default;
45 
47 
51  const override;
52 
53  ~XCoreFunctionInfo() override = default;
54 
55  void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
56  int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
57 
59  bool hasLRSpillSlot() { return LRSpillSlotSet; }
60  int getLRSpillSlot() const {
61  assert(LRSpillSlotSet && "LR Spill slot not set");
62  return LRSpillSlot;
63  }
64 
66  bool hasFPSpillSlot() { return FPSpillSlotSet; }
67  int getFPSpillSlot() const {
68  assert(FPSpillSlotSet && "FP Spill slot not set");
69  return FPSpillSlot;
70  }
71 
72  const int* createEHSpillSlot(MachineFunction &MF);
73  bool hasEHSpillSlot() { return EHSpillSlotSet; }
74  const int* getEHSpillSlot() const {
75  assert(EHSpillSlotSet && "EH Spill slot not set");
76  return EHSpillSlot;
77  }
78 
79  void setReturnStackOffset(unsigned value) {
80  assert(!ReturnStackOffsetSet && "Return stack offset set twice");
81  ReturnStackOffset = value;
82  ReturnStackOffsetSet = true;
83  }
84 
85  unsigned getReturnStackOffset() const {
86  assert(ReturnStackOffsetSet && "Return stack offset not set");
87  return ReturnStackOffset;
88  }
89 
90  bool isLargeFrame(const MachineFunction &MF) const;
91 
92  std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>> &
94  return SpillLabels;
95  }
96 };
97 
98 } // end namespace llvm
99 
100 #endif // LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::XCoreFunctionInfo::createLRSpillSlot
int createLRSpillSlot(MachineFunction &MF)
Definition: XCoreMachineFunctionInfo.cpp:41
llvm::XCoreFunctionInfo::hasFPSpillSlot
bool hasFPSpillSlot()
Definition: XCoreMachineFunctionInfo.h:66
llvm::XCoreFunctionInfo::hasEHSpillSlot
bool hasEHSpillSlot()
Definition: XCoreMachineFunctionInfo.h:73
MachineBasicBlock.h
llvm::XCoreFunctionInfo::createFPSpillSlot
int createFPSpillSlot(MachineFunction &MF)
Definition: XCoreMachineFunctionInfo.cpp:59
llvm::XCoreFunctionInfo::getLRSpillSlot
int getLRSpillSlot() const
Definition: XCoreMachineFunctionInfo.h:60
llvm::XCoreFunctionInfo::getFPSpillSlot
int getFPSpillSlot() const
Definition: XCoreMachineFunctionInfo.h:67
llvm::XCoreFunctionInfo::setVarArgsFrameIndex
void setVarArgsFrameIndex(int off)
Definition: XCoreMachineFunctionInfo.h:55
llvm::XCoreFunctionInfo::XCoreFunctionInfo
XCoreFunctionInfo(MachineFunction &MF)
Definition: XCoreMachineFunctionInfo.h:46
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:63
llvm::DenseMap
Definition: DenseMap.h:716
llvm::XCoreFunctionInfo::getSpillLabels
std::vector< std::pair< MachineBasicBlock::iterator, CalleeSavedInfo > > & getSpillLabels()
Definition: XCoreMachineFunctionInfo.h:93
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::XCoreFunctionInfo::XCoreFunctionInfo
XCoreFunctionInfo()=default
llvm::XCoreFunctionInfo::isLargeFrame
bool isLargeFrame(const MachineFunction &MF) const
Definition: XCoreMachineFunctionInfo.cpp:25
llvm::XCoreFunctionInfo::clone
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
Definition: XCoreMachineFunctionInfo.cpp:18
llvm::XCoreFunctionInfo::~XCoreFunctionInfo
~XCoreFunctionInfo() override=default
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::XCoreFunctionInfo
XCoreFunctionInfo - This class is derived from MachineFunction private XCore target-specific informat...
Definition: XCoreMachineFunctionInfo.h:27
llvm::XCoreFunctionInfo::hasLRSpillSlot
bool hasLRSpillSlot()
Definition: XCoreMachineFunctionInfo.h:59
llvm::XCoreFunctionInfo::setReturnStackOffset
void setReturnStackOffset(unsigned value)
Definition: XCoreMachineFunctionInfo.h:79
llvm::XCoreFunctionInfo::getVarArgsFrameIndex
int getVarArgsFrameIndex() const
Definition: XCoreMachineFunctionInfo.h:56
MachineFrameInfo.h
llvm::XCoreFunctionInfo::getReturnStackOffset
unsigned getReturnStackOffset() const
Definition: XCoreMachineFunctionInfo.h:85
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:142
llvm::XCoreFunctionInfo::createEHSpillSlot
const int * createEHSpillSlot(MachineFunction &MF)
Definition: XCoreMachineFunctionInfo.cpp:72
MachineFunction.h
llvm::MachineFunctionInfo
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
Definition: MachineFunction.h:95
llvm::XCoreFunctionInfo::getEHSpillSlot
const int * getEHSpillSlot() const
Definition: XCoreMachineFunctionInfo.h:74