26 #define DEBUG_TYPE "regalloc"
40 while (SegPos.valid()) {
41 SegPos.insert(RegPos->start, RegPos->end, &VirtReg);
42 if (++RegPos == RegEnd)
44 SegPos.advanceTo(RegPos->start);
51 SegPos.insert(RegEnd->start, RegEnd->end, &VirtReg);
52 for (; RegPos != RegEnd; ++RegPos, ++SegPos)
53 SegPos.insert(RegPos->start, RegPos->end, &VirtReg);
68 assert(SegPos.value() == &VirtReg &&
"Inconsistent LiveInterval");
74 RegPos = Range.
advanceTo(RegPos, SegPos.start());
78 SegPos.advanceTo(RegPos->start);
89 OS <<
" [" <<
SI.start() <<
' ' <<
SI.stop() <<
"):"
99 VisitedVRegs.
set(
SI.value()->reg);
121 if (SeenAllInterferences || InterferingVRegs.size() >= MaxInterferingRegs)
122 return InterferingVRegs.size();
125 if (!CheckedFirstInterference) {
126 CheckedFirstInterference =
true;
129 if (VirtReg->empty() || LiveUnion->empty()) {
130 SeenAllInterferences =
true;
135 VirtRegI = VirtReg->begin();
136 LiveUnionI.setMap(LiveUnion->getMap());
137 LiveUnionI.find(VirtRegI->start);
142 while (LiveUnionI.valid()) {
143 assert(VirtRegI != VirtRegEnd &&
"Reached end of VirtReg");
146 while (VirtRegI->start < LiveUnionI.stop() &&
147 VirtRegI->end > LiveUnionI.start()) {
150 if (VReg != RecentReg && !isSeenInterference(VReg)) {
152 InterferingVRegs.push_back(VReg);
153 if (InterferingVRegs.size() >= MaxInterferingRegs)
154 return InterferingVRegs.
size();
157 if (!(++LiveUnionI).valid()) {
158 SeenAllInterferences =
true;
159 return InterferingVRegs.size();
165 assert(VirtRegI->end <= LiveUnionI.start() &&
"Expected non-overlap");
168 VirtRegI = VirtReg->advanceTo(VirtRegI, LiveUnionI.start());
169 if (VirtRegI == VirtRegEnd)
173 if (VirtRegI->start < LiveUnionI.stop())
177 LiveUnionI.advanceTo(VirtRegI->start);
179 SeenAllInterferences =
true;
180 return InterferingVRegs.size();
192 for (
unsigned i = 0;
i != Size; ++
i)
199 for (
unsigned i = 0;
i != Size; ++
i)
const_iterator begin() const
LiveIntervalUnion(Allocator &a)
LiveInterval - This class represents the liveness of a register, or stack slot.
iterator advanceTo(iterator I, SlotIndex Pos)
advanceTo - Advance the specified iterator to point to the Segment containing the specified position...
const_iterator find(KeyT x) const
find - Return an iterator pointing to the first interval ending at or after x, or end()...
friend class const_iterator
This class represents the liveness of a register, stack slot, etc.
RecyclingAllocator - This class wraps an Allocator, adding the functionality of recycling deleted obj...
Printable PrintReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubRegIdx=0)
Prints virtual and physical registers with or without a TRI instance.
Union of live intervals that are strong candidates for coalescing into a single register (either phys...
void print(raw_ostream &OS, const TargetRegisterInfo *TRI) const
bool isSeenInterference(LiveInterval *VReg) const
NDEBUG.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void unify(LiveInterval &VirtReg, const LiveRange &Range)
void init(LiveIntervalUnion::Allocator &, unsigned Size)
LiveSegments::iterator SegmentIter
void verify(LiveVirtRegBitSet &VisitedVRegs)
unsigned collectInterferingVRegs(unsigned MaxInterferingRegs=UINT_MAX)
void extract(LiveInterval &VirtReg, const LiveRange &Range)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.