Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

667 lines
24 KiB

  1. //===-- llvm/CodeGen/LiveInterval.h - Interval representation ---*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file implements the LiveRange and LiveInterval classes. Given some
  11. // numbering of each the machine instructions an interval [i, j) is said to be a
  12. // live interval for register v if there is no instruction with number j' >= j
  13. // such that v is live at j' and there is no instruction with number i' < i such
  14. // that v is live at i'. In this implementation intervals can have holes,
  15. // i.e. an interval might look like [1,20), [50,65), [1000,1001). Each
  16. // individual range is represented as an instance of LiveRange, and the whole
  17. // interval is represented as an instance of LiveInterval.
  18. //
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_CODEGEN_LIVEINTERVAL_H
  21. #define LLVM_CODEGEN_LIVEINTERVAL_H
  22. #include "llvm/ADT/IntEqClasses.h"
  23. #include "llvm/CodeGen/SlotIndexes.h"
  24. #include "llvm/Support/AlignOf.h"
  25. #include "llvm/Support/Allocator.h"
  26. #include <cassert>
  27. #include <climits>
  28. namespace llvm {
  29. class CoalescerPair;
  30. class LiveIntervals;
  31. class MachineInstr;
  32. class MachineRegisterInfo;
  33. class TargetRegisterInfo;
  34. class raw_ostream;
  35. /// VNInfo - Value Number Information.
  36. /// This class holds information about a machine level values, including
  37. /// definition and use points.
  38. ///
  39. class VNInfo {
  40. public:
  41. typedef BumpPtrAllocator Allocator;
  42. /// The ID number of this value.
  43. unsigned id;
  44. /// The index of the defining instruction.
  45. SlotIndex def;
  46. /// VNInfo constructor.
  47. VNInfo(unsigned i, SlotIndex d)
  48. : id(i), def(d)
  49. { }
  50. /// VNInfo construtor, copies values from orig, except for the value number.
  51. VNInfo(unsigned i, const VNInfo &orig)
  52. : id(i), def(orig.def)
  53. { }
  54. /// Copy from the parameter into this VNInfo.
  55. void copyFrom(VNInfo &src) {
  56. def = src.def;
  57. }
  58. /// Returns true if this value is defined by a PHI instruction (or was,
  59. /// PHI instrucions may have been eliminated).
  60. /// PHI-defs begin at a block boundary, all other defs begin at register or
  61. /// EC slots.
  62. bool isPHIDef() const { return def.isBlock(); }
  63. /// Returns true if this value is unused.
  64. bool isUnused() const { return !def.isValid(); }
  65. /// Mark this value as unused.
  66. void markUnused() { def = SlotIndex(); }
  67. };
  68. /// LiveRange structure - This represents a simple register range in the
  69. /// program, with an inclusive start point and an exclusive end point.
  70. /// These ranges are rendered as [start,end).
  71. struct LiveRange {
  72. SlotIndex start; // Start point of the interval (inclusive)
  73. SlotIndex end; // End point of the interval (exclusive)
  74. VNInfo *valno; // identifier for the value contained in this interval.
  75. LiveRange() : valno(0) {}
  76. LiveRange(SlotIndex S, SlotIndex E, VNInfo *V)
  77. : start(S), end(E), valno(V) {
  78. assert(S < E && "Cannot create empty or backwards range");
  79. }
  80. /// contains - Return true if the index is covered by this range.
  81. ///
  82. bool contains(SlotIndex I) const {
  83. return start <= I && I < end;
  84. }
  85. /// containsRange - Return true if the given range, [S, E), is covered by
  86. /// this range.
  87. bool containsRange(SlotIndex S, SlotIndex E) const {
  88. assert((S < E) && "Backwards interval?");
  89. return (start <= S && S < end) && (start < E && E <= end);
  90. }
  91. bool operator<(const LiveRange &LR) const {
  92. return start < LR.start || (start == LR.start && end < LR.end);
  93. }
  94. bool operator==(const LiveRange &LR) const {
  95. return start == LR.start && end == LR.end;
  96. }
  97. void dump() const;
  98. void print(raw_ostream &os) const;
  99. };
  100. template <> struct isPodLike<LiveRange> { static const bool value = true; };
  101. raw_ostream& operator<<(raw_ostream& os, const LiveRange &LR);
  102. inline bool operator<(SlotIndex V, const LiveRange &LR) {
  103. return V < LR.start;
  104. }
  105. inline bool operator<(const LiveRange &LR, SlotIndex V) {
  106. return LR.start < V;
  107. }
  108. /// LiveInterval - This class represents some number of live ranges for a
  109. /// register or value. This class also contains a bit of register allocator
  110. /// state.
  111. class LiveInterval {
  112. public:
  113. typedef SmallVector<LiveRange,4> Ranges;
  114. typedef SmallVector<VNInfo*,4> VNInfoList;
  115. const unsigned reg; // the register or stack slot of this interval.
  116. float weight; // weight of this interval
  117. Ranges ranges; // the ranges in which this register is live
  118. VNInfoList valnos; // value#'s
  119. struct InstrSlots {
  120. enum {
  121. LOAD = 0,
  122. USE = 1,
  123. DEF = 2,
  124. STORE = 3,
  125. NUM = 4
  126. };
  127. };
  128. LiveInterval(unsigned Reg, float Weight)
  129. : reg(Reg), weight(Weight) {}
  130. typedef Ranges::iterator iterator;
  131. iterator begin() { return ranges.begin(); }
  132. iterator end() { return ranges.end(); }
  133. typedef Ranges::const_iterator const_iterator;
  134. const_iterator begin() const { return ranges.begin(); }
  135. const_iterator end() const { return ranges.end(); }
  136. typedef VNInfoList::iterator vni_iterator;
  137. vni_iterator vni_begin() { return valnos.begin(); }
  138. vni_iterator vni_end() { return valnos.end(); }
  139. typedef VNInfoList::const_iterator const_vni_iterator;
  140. const_vni_iterator vni_begin() const { return valnos.begin(); }
  141. const_vni_iterator vni_end() const { return valnos.end(); }
  142. /// advanceTo - Advance the specified iterator to point to the LiveRange
  143. /// containing the specified position, or end() if the position is past the
  144. /// end of the interval. If no LiveRange contains this position, but the
  145. /// position is in a hole, this method returns an iterator pointing to the
  146. /// LiveRange immediately after the hole.
  147. iterator advanceTo(iterator I, SlotIndex Pos) {
  148. assert(I != end());
  149. if (Pos >= endIndex())
  150. return end();
  151. while (I->end <= Pos) ++I;
  152. return I;
  153. }
  154. /// find - Return an iterator pointing to the first range that ends after
  155. /// Pos, or end(). This is the same as advanceTo(begin(), Pos), but faster
  156. /// when searching large intervals.
  157. ///
  158. /// If Pos is contained in a LiveRange, that range is returned.
  159. /// If Pos is in a hole, the following LiveRange is returned.
  160. /// If Pos is beyond endIndex, end() is returned.
  161. iterator find(SlotIndex Pos);
  162. const_iterator find(SlotIndex Pos) const {
  163. return const_cast<LiveInterval*>(this)->find(Pos);
  164. }
  165. void clear() {
  166. valnos.clear();
  167. ranges.clear();
  168. }
  169. bool hasAtLeastOneValue() const { return !valnos.empty(); }
  170. bool containsOneValue() const { return valnos.size() == 1; }
  171. unsigned getNumValNums() const { return (unsigned)valnos.size(); }
  172. /// getValNumInfo - Returns pointer to the specified val#.
  173. ///
  174. inline VNInfo *getValNumInfo(unsigned ValNo) {
  175. return valnos[ValNo];
  176. }
  177. inline const VNInfo *getValNumInfo(unsigned ValNo) const {
  178. return valnos[ValNo];
  179. }
  180. /// containsValue - Returns true if VNI belongs to this interval.
  181. bool containsValue(const VNInfo *VNI) const {
  182. return VNI && VNI->id < getNumValNums() && VNI == getValNumInfo(VNI->id);
  183. }
  184. /// getNextValue - Create a new value number and return it. MIIdx specifies
  185. /// the instruction that defines the value number.
  186. VNInfo *getNextValue(SlotIndex def, VNInfo::Allocator &VNInfoAllocator) {
  187. VNInfo *VNI =
  188. new (VNInfoAllocator) VNInfo((unsigned)valnos.size(), def);
  189. valnos.push_back(VNI);
  190. return VNI;
  191. }
  192. /// createDeadDef - Make sure the interval has a value defined at Def.
  193. /// If one already exists, return it. Otherwise allocate a new value and
  194. /// add liveness for a dead def.
  195. VNInfo *createDeadDef(SlotIndex Def, VNInfo::Allocator &VNInfoAllocator);
  196. /// Create a copy of the given value. The new value will be identical except
  197. /// for the Value number.
  198. VNInfo *createValueCopy(const VNInfo *orig,
  199. VNInfo::Allocator &VNInfoAllocator) {
  200. VNInfo *VNI =
  201. new (VNInfoAllocator) VNInfo((unsigned)valnos.size(), *orig);
  202. valnos.push_back(VNI);
  203. return VNI;
  204. }
  205. /// RenumberValues - Renumber all values in order of appearance and remove
  206. /// unused values.
  207. void RenumberValues(LiveIntervals &lis);
  208. /// MergeValueNumberInto - This method is called when two value nubmers
  209. /// are found to be equivalent. This eliminates V1, replacing all
  210. /// LiveRanges with the V1 value number with the V2 value number. This can
  211. /// cause merging of V1/V2 values numbers and compaction of the value space.
  212. VNInfo* MergeValueNumberInto(VNInfo *V1, VNInfo *V2);
  213. /// MergeValueInAsValue - Merge all of the live ranges of a specific val#
  214. /// in RHS into this live interval as the specified value number.
  215. /// The LiveRanges in RHS are allowed to overlap with LiveRanges in the
  216. /// current interval, it will replace the value numbers of the overlaped
  217. /// live ranges with the specified value number.
  218. void MergeRangesInAsValue(const LiveInterval &RHS, VNInfo *LHSValNo);
  219. /// MergeValueInAsValue - Merge all of the live ranges of a specific val#
  220. /// in RHS into this live interval as the specified value number.
  221. /// The LiveRanges in RHS are allowed to overlap with LiveRanges in the
  222. /// current interval, but only if the overlapping LiveRanges have the
  223. /// specified value number.
  224. void MergeValueInAsValue(const LiveInterval &RHS,
  225. const VNInfo *RHSValNo, VNInfo *LHSValNo);
  226. bool empty() const { return ranges.empty(); }
  227. /// beginIndex - Return the lowest numbered slot covered by interval.
  228. SlotIndex beginIndex() const {
  229. assert(!empty() && "Call to beginIndex() on empty interval.");
  230. return ranges.front().start;
  231. }
  232. /// endNumber - return the maximum point of the interval of the whole,
  233. /// exclusive.
  234. SlotIndex endIndex() const {
  235. assert(!empty() && "Call to endIndex() on empty interval.");
  236. return ranges.back().end;
  237. }
  238. bool expiredAt(SlotIndex index) const {
  239. return index >= endIndex();
  240. }
  241. bool liveAt(SlotIndex index) const {
  242. const_iterator r = find(index);
  243. return r != end() && r->start <= index;
  244. }
  245. /// killedAt - Return true if a live range ends at index. Note that the kill
  246. /// point is not contained in the half-open live range. It is usually the
  247. /// getDefIndex() slot following its last use.
  248. bool killedAt(SlotIndex index) const {
  249. const_iterator r = find(index.getRegSlot(true));
  250. return r != end() && r->end == index;
  251. }
  252. /// getLiveRangeContaining - Return the live range that contains the
  253. /// specified index, or null if there is none.
  254. const LiveRange *getLiveRangeContaining(SlotIndex Idx) const {
  255. const_iterator I = FindLiveRangeContaining(Idx);
  256. return I == end() ? 0 : &*I;
  257. }
  258. /// getLiveRangeContaining - Return the live range that contains the
  259. /// specified index, or null if there is none.
  260. LiveRange *getLiveRangeContaining(SlotIndex Idx) {
  261. iterator I = FindLiveRangeContaining(Idx);
  262. return I == end() ? 0 : &*I;
  263. }
  264. /// getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
  265. VNInfo *getVNInfoAt(SlotIndex Idx) const {
  266. const_iterator I = FindLiveRangeContaining(Idx);
  267. return I == end() ? 0 : I->valno;
  268. }
  269. /// getVNInfoBefore - Return the VNInfo that is live up to but not
  270. /// necessarilly including Idx, or NULL. Use this to find the reaching def
  271. /// used by an instruction at this SlotIndex position.
  272. VNInfo *getVNInfoBefore(SlotIndex Idx) const {
  273. const_iterator I = FindLiveRangeContaining(Idx.getPrevSlot());
  274. return I == end() ? 0 : I->valno;
  275. }
  276. /// FindLiveRangeContaining - Return an iterator to the live range that
  277. /// contains the specified index, or end() if there is none.
  278. iterator FindLiveRangeContaining(SlotIndex Idx) {
  279. iterator I = find(Idx);
  280. return I != end() && I->start <= Idx ? I : end();
  281. }
  282. const_iterator FindLiveRangeContaining(SlotIndex Idx) const {
  283. const_iterator I = find(Idx);
  284. return I != end() && I->start <= Idx ? I : end();
  285. }
  286. /// overlaps - Return true if the intersection of the two live intervals is
  287. /// not empty.
  288. bool overlaps(const LiveInterval& other) const {
  289. if (other.empty())
  290. return false;
  291. return overlapsFrom(other, other.begin());
  292. }
  293. /// overlaps - Return true if the two intervals have overlapping segments
  294. /// that are not coalescable according to CP.
  295. ///
  296. /// Overlapping segments where one interval is defined by a coalescable
  297. /// copy are allowed.
  298. bool overlaps(const LiveInterval &Other, const CoalescerPair &CP,
  299. const SlotIndexes&) const;
  300. /// overlaps - Return true if the live interval overlaps a range specified
  301. /// by [Start, End).
  302. bool overlaps(SlotIndex Start, SlotIndex End) const;
  303. /// overlapsFrom - Return true if the intersection of the two live intervals
  304. /// is not empty. The specified iterator is a hint that we can begin
  305. /// scanning the Other interval starting at I.
  306. bool overlapsFrom(const LiveInterval& other, const_iterator I) const;
  307. /// addRange - Add the specified LiveRange to this interval, merging
  308. /// intervals as appropriate. This returns an iterator to the inserted live
  309. /// range (which may have grown since it was inserted.
  310. iterator addRange(LiveRange LR) {
  311. return addRangeFrom(LR, ranges.begin());
  312. }
  313. /// extendInBlock - If this interval is live before Kill in the basic block
  314. /// that starts at StartIdx, extend it to be live up to Kill, and return
  315. /// the value. If there is no live range before Kill, return NULL.
  316. VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Kill);
  317. /// join - Join two live intervals (this, and other) together. This applies
  318. /// mappings to the value numbers in the LHS/RHS intervals as specified. If
  319. /// the intervals are not joinable, this aborts.
  320. void join(LiveInterval &Other,
  321. const int *ValNoAssignments,
  322. const int *RHSValNoAssignments,
  323. SmallVector<VNInfo*, 16> &NewVNInfo,
  324. MachineRegisterInfo *MRI);
  325. /// isInOneLiveRange - Return true if the range specified is entirely in the
  326. /// a single LiveRange of the live interval.
  327. bool isInOneLiveRange(SlotIndex Start, SlotIndex End) const {
  328. const_iterator r = find(Start);
  329. return r != end() && r->containsRange(Start, End);
  330. }
  331. /// removeRange - Remove the specified range from this interval. Note that
  332. /// the range must be a single LiveRange in its entirety.
  333. void removeRange(SlotIndex Start, SlotIndex End,
  334. bool RemoveDeadValNo = false);
  335. void removeRange(LiveRange LR, bool RemoveDeadValNo = false) {
  336. removeRange(LR.start, LR.end, RemoveDeadValNo);
  337. }
  338. /// removeValNo - Remove all the ranges defined by the specified value#.
  339. /// Also remove the value# from value# list.
  340. void removeValNo(VNInfo *ValNo);
  341. /// getSize - Returns the sum of sizes of all the LiveRange's.
  342. ///
  343. unsigned getSize() const;
  344. /// Returns true if the live interval is zero length, i.e. no live ranges
  345. /// span instructions. It doesn't pay to spill such an interval.
  346. bool isZeroLength(SlotIndexes *Indexes) const {
  347. for (const_iterator i = begin(), e = end(); i != e; ++i)
  348. if (Indexes->getNextNonNullIndex(i->start).getBaseIndex() <
  349. i->end.getBaseIndex())
  350. return false;
  351. return true;
  352. }
  353. /// isSpillable - Can this interval be spilled?
  354. bool isSpillable() const {
  355. return weight != HUGE_VALF;
  356. }
  357. /// markNotSpillable - Mark interval as not spillable
  358. void markNotSpillable() {
  359. weight = HUGE_VALF;
  360. }
  361. bool operator<(const LiveInterval& other) const {
  362. const SlotIndex &thisIndex = beginIndex();
  363. const SlotIndex &otherIndex = other.beginIndex();
  364. return (thisIndex < otherIndex ||
  365. (thisIndex == otherIndex && reg < other.reg));
  366. }
  367. void print(raw_ostream &OS) const;
  368. void dump() const;
  369. /// \brief Walk the interval and assert if any invariants fail to hold.
  370. ///
  371. /// Note that this is a no-op when asserts are disabled.
  372. #ifdef NDEBUG
  373. void verify() const {}
  374. #else
  375. void verify() const;
  376. #endif
  377. private:
  378. Ranges::iterator addRangeFrom(LiveRange LR, Ranges::iterator From);
  379. void extendIntervalEndTo(Ranges::iterator I, SlotIndex NewEnd);
  380. Ranges::iterator extendIntervalStartTo(Ranges::iterator I, SlotIndex NewStr);
  381. void markValNoForDeletion(VNInfo *V);
  382. LiveInterval& operator=(const LiveInterval& rhs) LLVM_DELETED_FUNCTION;
  383. };
  384. inline raw_ostream &operator<<(raw_ostream &OS, const LiveInterval &LI) {
  385. LI.print(OS);
  386. return OS;
  387. }
  388. /// Helper class for performant LiveInterval bulk updates.
  389. ///
  390. /// Calling LiveInterval::addRange() repeatedly can be expensive on large
  391. /// live ranges because segments after the insertion point may need to be
  392. /// shifted. The LiveRangeUpdater class can defer the shifting when adding
  393. /// many segments in order.
  394. ///
  395. /// The LiveInterval will be in an invalid state until flush() is called.
  396. class LiveRangeUpdater {
  397. LiveInterval *LI;
  398. SlotIndex LastStart;
  399. LiveInterval::iterator WriteI;
  400. LiveInterval::iterator ReadI;
  401. SmallVector<LiveRange, 16> Spills;
  402. void mergeSpills();
  403. public:
  404. /// Create a LiveRangeUpdater for adding segments to LI.
  405. /// LI will temporarily be in an invalid state until flush() is called.
  406. LiveRangeUpdater(LiveInterval *li = 0) : LI(li) {}
  407. ~LiveRangeUpdater() { flush(); }
  408. /// Add a segment to LI and coalesce when possible, just like LI.addRange().
  409. /// Segments should be added in increasing start order for best performance.
  410. void add(LiveRange);
  411. void add(SlotIndex Start, SlotIndex End, VNInfo *VNI) {
  412. add(LiveRange(Start, End, VNI));
  413. }
  414. /// Return true if the LI is currently in an invalid state, and flush()
  415. /// needs to be called.
  416. bool isDirty() const { return LastStart.isValid(); }
  417. /// Flush the updater state to LI so it is valid and contains all added
  418. /// segments.
  419. void flush();
  420. /// Select a different destination live range.
  421. void setDest(LiveInterval *li) {
  422. if (LI != li && isDirty())
  423. flush();
  424. LI = li;
  425. }
  426. /// Get the current destination live range.
  427. LiveInterval *getDest() const { return LI; }
  428. void dump() const;
  429. void print(raw_ostream&) const;
  430. };
  431. inline raw_ostream &operator<<(raw_ostream &OS, const LiveRangeUpdater &X) {
  432. X.print(OS);
  433. return OS;
  434. }
  435. /// LiveRangeQuery - Query information about a live range around a given
  436. /// instruction. This class hides the implementation details of live ranges,
  437. /// and it should be used as the primary interface for examining live ranges
  438. /// around instructions.
  439. ///
  440. class LiveRangeQuery {
  441. VNInfo *EarlyVal;
  442. VNInfo *LateVal;
  443. SlotIndex EndPoint;
  444. bool Kill;
  445. public:
  446. /// Create a LiveRangeQuery for the given live range and instruction index.
  447. /// The sub-instruction slot of Idx doesn't matter, only the instruction it
  448. /// refers to is considered.
  449. LiveRangeQuery(const LiveInterval &LI, SlotIndex Idx)
  450. : EarlyVal(0), LateVal(0), Kill(false) {
  451. // Find the segment that enters the instruction.
  452. LiveInterval::const_iterator I = LI.find(Idx.getBaseIndex());
  453. LiveInterval::const_iterator E = LI.end();
  454. if (I == E)
  455. return;
  456. // Is this an instruction live-in segment?
  457. // If Idx is the start index of a basic block, include live-in segments
  458. // that start at Idx.getBaseIndex().
  459. if (I->start <= Idx.getBaseIndex()) {
  460. EarlyVal = I->valno;
  461. EndPoint = I->end;
  462. // Move to the potentially live-out segment.
  463. if (SlotIndex::isSameInstr(Idx, I->end)) {
  464. Kill = true;
  465. if (++I == E)
  466. return;
  467. }
  468. // Special case: A PHIDef value can have its def in the middle of a
  469. // segment if the value happens to be live out of the layout
  470. // predecessor.
  471. // Such a value is not live-in.
  472. if (EarlyVal->def == Idx.getBaseIndex())
  473. EarlyVal = 0;
  474. }
  475. // I now points to the segment that may be live-through, or defined by
  476. // this instr. Ignore segments starting after the current instr.
  477. if (SlotIndex::isEarlierInstr(Idx, I->start))
  478. return;
  479. LateVal = I->valno;
  480. EndPoint = I->end;
  481. }
  482. /// Return the value that is live-in to the instruction. This is the value
  483. /// that will be read by the instruction's use operands. Return NULL if no
  484. /// value is live-in.
  485. VNInfo *valueIn() const {
  486. return EarlyVal;
  487. }
  488. /// Return true if the live-in value is killed by this instruction. This
  489. /// means that either the live range ends at the instruction, or it changes
  490. /// value.
  491. bool isKill() const {
  492. return Kill;
  493. }
  494. /// Return true if this instruction has a dead def.
  495. bool isDeadDef() const {
  496. return EndPoint.isDead();
  497. }
  498. /// Return the value leaving the instruction, if any. This can be a
  499. /// live-through value, or a live def. A dead def returns NULL.
  500. VNInfo *valueOut() const {
  501. return isDeadDef() ? 0 : LateVal;
  502. }
  503. /// Return the value defined by this instruction, if any. This includes
  504. /// dead defs, it is the value created by the instruction's def operands.
  505. VNInfo *valueDefined() const {
  506. return EarlyVal == LateVal ? 0 : LateVal;
  507. }
  508. /// Return the end point of the last live range segment to interact with
  509. /// the instruction, if any.
  510. ///
  511. /// The end point is an invalid SlotIndex only if the live range doesn't
  512. /// intersect the instruction at all.
  513. ///
  514. /// The end point may be at or past the end of the instruction's basic
  515. /// block. That means the value was live out of the block.
  516. SlotIndex endPoint() const {
  517. return EndPoint;
  518. }
  519. };
  520. /// ConnectedVNInfoEqClasses - Helper class that can divide VNInfos in a
  521. /// LiveInterval into equivalence clases of connected components. A
  522. /// LiveInterval that has multiple connected components can be broken into
  523. /// multiple LiveIntervals.
  524. ///
  525. /// Given a LiveInterval that may have multiple connected components, run:
  526. ///
  527. /// unsigned numComps = ConEQ.Classify(LI);
  528. /// if (numComps > 1) {
  529. /// // allocate numComps-1 new LiveIntervals into LIS[1..]
  530. /// ConEQ.Distribute(LIS);
  531. /// }
  532. class ConnectedVNInfoEqClasses {
  533. LiveIntervals &LIS;
  534. IntEqClasses EqClass;
  535. // Note that values a and b are connected.
  536. void Connect(unsigned a, unsigned b);
  537. unsigned Renumber();
  538. public:
  539. explicit ConnectedVNInfoEqClasses(LiveIntervals &lis) : LIS(lis) {}
  540. /// Classify - Classify the values in LI into connected components.
  541. /// Return the number of connected components.
  542. unsigned Classify(const LiveInterval *LI);
  543. /// getEqClass - Classify creates equivalence classes numbered 0..N. Return
  544. /// the equivalence class assigned the VNI.
  545. unsigned getEqClass(const VNInfo *VNI) const { return EqClass[VNI->id]; }
  546. /// Distribute - Distribute values in LIV[0] into a separate LiveInterval
  547. /// for each connected component. LIV must have a LiveInterval for each
  548. /// connected component. The LiveIntervals in Liv[1..] must be empty.
  549. /// Instructions using LIV[0] are rewritten.
  550. void Distribute(LiveInterval *LIV[], MachineRegisterInfo &MRI);
  551. };
  552. }
  553. #endif