LLVM: include/llvm/CodeGen/LiveStacks.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_CODEGEN_LIVESTACKS_H
16#define LLVM_CODEGEN_LIVESTACKS_H
17
23#include
24#include
25#include <unordered_map>
26
27namespace llvm {
28
35
38
39
40
42
43
44 using SS2IntervalMap = std::unordered_map<int, LiveInterval>;
45 SS2IntervalMap S2IMap;
46
47
48 std::map<int, const TargetRegisterClass *> S2RCMap;
49
50public:
51 using iterator = SS2IntervalMap::iterator;
53
58
59 unsigned getNumIntervals() const { return (unsigned)S2IMap.size(); }
60
62
64 assert(Slot >= 0 && "Spill slot indice must be >= 0");
65 SS2IntervalMap::iterator I = S2IMap.find(Slot);
66 assert(I != S2IMap.end() && "Interval does not exist for stack slot");
67 return I->second;
68 }
69
71 assert(Slot >= 0 && "Spill slot indice must be >= 0");
72 SS2IntervalMap::const_iterator I = S2IMap.find(Slot);
73 assert(I != S2IMap.end() && "Interval does not exist for stack slot");
74 return I->second;
75 }
76
77 bool hasInterval(int Slot) const { return S2IMap.count(Slot); }
78
80 assert(Slot >= 0 && "Spill slot indice must be >= 0");
81 std::map<int, const TargetRegisterClass *>::const_iterator I =
82 S2RCMap.find(Slot);
83 assert(I != S2RCMap.end() &&
84 "Register class info does not exist for stack slot");
85 return I->second;
86 }
87
89
91
94};
95
98
99public:
101
105
108
111
112
114
115
117};
118
128
137}
138
139#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This header defines various interfaces for pass management in LLVM.
Represent the analysis usage information of a pass.
LiveInterval - This class represents the liveness of a register, or stack slot.
Definition LiveStacks.h:119
LiveStacks run(MachineFunction &MF, MachineFunctionAnalysisManager &)
LiveStacks Result
Definition LiveStacks.h:124
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &AM)
LiveStacksPrinterPass(raw_ostream &OS)
Definition LiveStacks.h:133
void print(raw_ostream &O, const Module *=nullptr) const override
print - Implement the dump method.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
static char ID
Definition LiveStacks.h:100
bool runOnMachineFunction(MachineFunction &) override
runOnMachineFunction - pass entry point
LiveStacksWrapperLegacy()
Definition LiveStacks.h:102
const LiveStacks & getLS() const
Definition LiveStacks.h:107
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
LiveStacks & getLS()
Definition LiveStacks.h:106
Definition LiveStacks.h:36
SS2IntervalMap::const_iterator const_iterator
Definition LiveStacks.h:52
LiveInterval & getInterval(int Slot)
Definition LiveStacks.h:63
iterator begin()
Definition LiveStacks.h:56
bool hasInterval(int Slot) const
Definition LiveStacks.h:77
unsigned getNumIntervals() const
Definition LiveStacks.h:59
VNInfo::Allocator & getVNInfoAllocator()
Definition LiveStacks.h:88
SS2IntervalMap::iterator iterator
Definition LiveStacks.h:51
LiveInterval & getOrCreateInterval(int Slot, const TargetRegisterClass *RC)
void print(raw_ostream &O, const Module *M=nullptr) const
print - Implement the dump method.
const TargetRegisterClass * getIntervalRegClass(int Slot) const
Definition LiveStacks.h:79
const_iterator end() const
Definition LiveStacks.h:55
const LiveInterval & getInterval(int Slot) const
Definition LiveStacks.h:70
const_iterator begin() const
Definition LiveStacks.h:54
iterator end()
Definition LiveStacks.h:57
void init(MachineFunction &MF)
init - analysis entry point
MachineFunctionPass(char &ID)
A Module instance is used to store all the information related to an LLVM module.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A set of analyses that are preserved following a run of a transformation pass.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
BumpPtrAllocator Allocator
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI void initializeLiveStacksWrapperLegacyPass(PassRegistry &)
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A CRTP mix-in to automatically provide informational APIs needed for passes.