Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / lib / Target / XCore / XCoreMachineFunctionInfo.h
bloba89b4f786eb6e854ac92f25810b69bf30d44130a
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.
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"
19 #include <cassert>
20 #include <utility>
21 #include <vector>
23 namespace llvm {
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;
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;
41 virtual void anchor();
43 public:
44 XCoreFunctionInfo() = default;
46 explicit XCoreFunctionInfo(const Function &F,
47 const TargetSubtargetInfo *STI) {}
49 MachineFunctionInfo *
50 clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
51 const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
52 const override;
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");
63 return LRSpillSlot;
66 int createFPSpillSlot(MachineFunction &MF);
67 bool hasFPSpillSlot() { return FPSpillSlotSet; }
68 int getFPSpillSlot() const {
69 assert(FPSpillSlotSet && "FP Spill slot not set");
70 return FPSpillSlot;
73 const int* createEHSpillSlot(MachineFunction &MF);
74 bool hasEHSpillSlot() { return EHSpillSlotSet; }
75 const int* getEHSpillSlot() const {
76 assert(EHSpillSlotSet && "EH Spill slot not set");
77 return EHSpillSlot;
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>> &
94 getSpillLabels() {
95 return SpillLabels;
99 } // end namespace llvm
101 #endif // LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H