LLVM: include/llvm/CodeGen/LiveIntervalUnion.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_CODEGEN_LIVEINTERVALUNION_H
17#define LLVM_CODEGEN_LIVEINTERVALUNION_H
18
23#include
24#include
25
26namespace llvm {
27
30
31#ifndef NDEBUG
32
34
36#endif
37
38
39
40
41
43
44
45
47
48public:
49
50
51
53
54
56
57
59
60private:
61 unsigned Tag = 0;
62 LiveSegments Segments;
63
64public:
66
67
68
75
76 bool empty() const { return Segments.empty(); }
79
80
82 const Map &getMap() const { return Segments; }
83
84
85 unsigned getTag() const { return Tag; }
86
87
88 bool changedSince(unsigned tag) const { return tag != Tag; }
89
90
92
93
95
96
97 void clear() { Segments.clear(); ++Tag; }
98
99
101
102#ifndef NDEBUG
103
105#endif
106
107
109
110
111
116 ConstSegmentIter LiveUnionI;
118 bool CheckedFirstInterference = false;
119 bool SeenAllInterferences = false;
120 unsigned Tag = 0;
121 unsigned UserTag = 0;
122
123
124
125 unsigned collectInterferingVRegs(unsigned MaxInterferingRegs);
126
127
128 bool isSeenInterference(const LiveInterval *VirtReg) const;
129
130 public:
133 : LiveUnion(&LIU), LR(&LR) {}
136
139 LiveUnion = &NewLiveUnion;
140 LR = &NewLR;
141 InterferingVRegs.clear();
142 CheckedFirstInterference = false;
143 SeenAllInterferences = false;
144 Tag = NewLiveUnion.getTag();
145 UserTag = NewUserTag;
146 }
147
150 if (UserTag == NewUserTag && LR == &NewLR && LiveUnion == &NewLiveUnion &&
152
153 return;
154 }
155 reset(NewUserTag, NewLR, NewLiveUnion);
156 }
157
158
160
161
163 unsigned MaxInterferingRegs = std::numeric_limits::max()) {
164 if (!SeenAllInterferences || MaxInterferingRegs < InterferingVRegs.size())
165 collectInterferingVRegs(MaxInterferingRegs);
166 return InterferingVRegs;
167 }
168 };
169
170
172 unsigned Size = 0;
174
175 public:
178
181 Other.LIUs = nullptr;
182 }
183
185
186
187
189
190 unsigned size() const { return Size; }
191
193
195 assert(static_cast<unsigned>(Unit) < Size && "Unit out of bounds");
196 return LIUs[static_cast<unsigned>(Unit)];
197 }
198
200 assert(static_cast<unsigned>(Unit) < Size && "Unit out of bounds");
201 return LIUs[static_cast<unsigned>(Unit)];
202 }
203 };
204};
205
206}
207
208#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements a coalescing interval map for small objects.
Register const TargetRegisterInfo * TRI
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
This file defines the SmallVector class.
typename Sizer::Allocator Allocator
void init(LiveIntervalUnion::Allocator &, unsigned Size)
~Array()
Definition LiveIntervalUnion.h:177
unsigned size() const
Definition LiveIntervalUnion.h:190
Array(Array &&Other)
Definition LiveIntervalUnion.h:179
const LiveIntervalUnion & operator[](MCRegUnit Unit) const
Definition LiveIntervalUnion.h:199
LiveIntervalUnion & operator[](MCRegUnit Unit)
Definition LiveIntervalUnion.h:194
Array(const Array &)=delete
Query & operator=(const Query &)=delete
Query(const LiveRange &LR, const LiveIntervalUnion &LIU)
Definition LiveIntervalUnion.h:132
void init(unsigned NewUserTag, const LiveRange &NewLR, const LiveIntervalUnion &NewLiveUnion)
Definition LiveIntervalUnion.h:148
const SmallVectorImpl< const LiveInterval * > & interferingVRegs(unsigned MaxInterferingRegs=std::numeric_limits< unsigned >::max())
Definition LiveIntervalUnion.h:162
bool checkInterference()
Definition LiveIntervalUnion.h:159
void reset(unsigned NewUserTag, const LiveRange &NewLR, const LiveIntervalUnion &NewLiveUnion)
Definition LiveIntervalUnion.h:137
Query(const Query &)=delete
SlotIndex startIndex() const
Definition LiveIntervalUnion.h:77
LiveSegments::const_iterator ConstSegmentIter
Const version of SegmentIter.
Definition LiveIntervalUnion.h:55
void clear()
Definition LiveIntervalUnion.h:97
LiveIntervalUnion(Allocator &a)
Definition LiveIntervalUnion.h:65
SegmentIter find(SlotIndex x)
Definition LiveIntervalUnion.h:71
void unify(const LiveInterval &VirtReg, const LiveRange &Range)
ConstSegmentIter begin() const
Definition LiveIntervalUnion.h:72
const LiveInterval * getOneVReg() const
NDEBUG.
SegmentIter begin()
Definition LiveIntervalUnion.h:69
SegmentIter end()
Definition LiveIntervalUnion.h:70
LiveSegments::iterator SegmentIter
Definition LiveIntervalUnion.h:52
unsigned getTag() const
getTag - Return an opaque tag representing the current state of the union.
Definition LiveIntervalUnion.h:85
ConstSegmentIter find(SlotIndex x) const
Definition LiveIntervalUnion.h:74
bool changedSince(unsigned tag) const
changedSince - Return true if the union change since getTag returned tag.
Definition LiveIntervalUnion.h:88
void print(raw_ostream &OS, const TargetRegisterInfo *TRI) const
SlotIndex endIndex() const
Definition LiveIntervalUnion.h:78
const Map & getMap() const
Definition LiveIntervalUnion.h:82
bool empty() const
Definition LiveIntervalUnion.h:76
LiveSegments::Allocator Allocator
Definition LiveIntervalUnion.h:58
LiveSegments Map
Definition LiveIntervalUnion.h:81
ConstSegmentIter end() const
Definition LiveIntervalUnion.h:73
LiveInterval - This class represents the liveness of a register, or stack slot.
This class represents the liveness of a register, stack slot, etc.
Segments::const_iterator const_iterator
SlotIndex - An opaque wrapper around machine indexes.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
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.
SparseBitVector< 128 > LiveVirtRegBitSet
Definition LiveIntervalUnion.h:35