mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	Add ability to give hints to the overlaps routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17934 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -76,11 +76,14 @@ namespace llvm { | |||||||
|       : reg(Reg), weight(Weight), NumValues(0) { |       : reg(Reg), weight(Weight), NumValues(0) { | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     typedef Ranges::iterator iterator; |     typedef Ranges::iterator iterator; | ||||||
|     iterator begin() { return ranges.begin(); } |     iterator begin() { return ranges.begin(); } | ||||||
|     iterator end()   { return ranges.end(); } |     iterator end()   { return ranges.end(); } | ||||||
|  |  | ||||||
|  |     typedef Ranges::const_iterator const_iterator; | ||||||
|  |     const_iterator begin() const { return ranges.begin(); } | ||||||
|  |     const_iterator end() const  { return ranges.end(); } | ||||||
|  |  | ||||||
|  |  | ||||||
|     /// advanceTo - Advance the specified iterator to point to the LiveRange |     /// advanceTo - Advance the specified iterator to point to the LiveRange | ||||||
|     /// containing the specified position, or end() if the position is past the |     /// containing the specified position, or end() if the position is past the | ||||||
| @@ -139,7 +142,16 @@ namespace llvm { | |||||||
|     bool joinable(const LiveInterval& other, unsigned CopyIdx) const; |     bool joinable(const LiveInterval& other, unsigned CopyIdx) const; | ||||||
|  |  | ||||||
|  |  | ||||||
|     bool overlaps(const LiveInterval& other) const; |     /// overlaps - Return true if the intersection of the two live intervals is | ||||||
|  |     /// not empty. | ||||||
|  |     bool overlaps(const LiveInterval& other) const { | ||||||
|  |       return overlapsFrom(other, other.begin()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /// overlapsFrom - Return true if the intersection of the two live intervals | ||||||
|  |     /// is not empty.  The specified iterator is a hint that we can begin | ||||||
|  |     /// scanning the Other interval starting at I. | ||||||
|  |     bool overlapsFrom(const LiveInterval& other, const_iterator I) const; | ||||||
|  |  | ||||||
|     /// addRange - Add the specified LiveRange to this interval, merging |     /// addRange - Add the specified LiveRange to this interval, merging | ||||||
|     /// intervals as appropriate.  This returns an iterator to the inserted live |     /// intervals as appropriate.  This returns an iterator to the inserted live | ||||||
|   | |||||||
| @@ -42,6 +42,9 @@ bool LiveInterval::liveAt(unsigned I) const { | |||||||
|   return r->contains(I); |   return r->contains(I); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // overlaps - Return true if the intersection of the two live intervals is | ||||||
|  | // not empty. | ||||||
|  | // | ||||||
| // An example for overlaps(): | // An example for overlaps(): | ||||||
| // | // | ||||||
| // 0: A = ... | // 0: A = ... | ||||||
| @@ -56,11 +59,16 @@ bool LiveInterval::liveAt(unsigned I) const { | |||||||
| // | // | ||||||
| // A->overlaps(C) should return false since we want to be able to join | // A->overlaps(C) should return false since we want to be able to join | ||||||
| // A and C. | // A and C. | ||||||
| bool LiveInterval::overlaps(const LiveInterval& other) const { | // | ||||||
|   Ranges::const_iterator i = ranges.begin(); | bool LiveInterval::overlapsFrom(const LiveInterval& other, | ||||||
|   Ranges::const_iterator ie = ranges.end(); |                                 const_iterator StartPos) const { | ||||||
|   Ranges::const_iterator j = other.ranges.begin(); |   const_iterator i = begin(); | ||||||
|   Ranges::const_iterator je = other.ranges.end(); |   const_iterator ie = end(); | ||||||
|  |   const_iterator j = StartPos; | ||||||
|  |   const_iterator je = other.end(); | ||||||
|  |  | ||||||
|  |   assert((StartPos->start <= i->start || StartPos == other.begin()) && | ||||||
|  |          "Bogus start position hint!"); | ||||||
|  |  | ||||||
|   if (i->start < j->start) { |   if (i->start < j->start) { | ||||||
|     i = std::upper_bound(i, ie, j->start); |     i = std::upper_bound(i, ie, j->start); | ||||||
|   | |||||||
| @@ -76,11 +76,14 @@ namespace llvm { | |||||||
|       : reg(Reg), weight(Weight), NumValues(0) { |       : reg(Reg), weight(Weight), NumValues(0) { | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     typedef Ranges::iterator iterator; |     typedef Ranges::iterator iterator; | ||||||
|     iterator begin() { return ranges.begin(); } |     iterator begin() { return ranges.begin(); } | ||||||
|     iterator end()   { return ranges.end(); } |     iterator end()   { return ranges.end(); } | ||||||
|  |  | ||||||
|  |     typedef Ranges::const_iterator const_iterator; | ||||||
|  |     const_iterator begin() const { return ranges.begin(); } | ||||||
|  |     const_iterator end() const  { return ranges.end(); } | ||||||
|  |  | ||||||
|  |  | ||||||
|     /// advanceTo - Advance the specified iterator to point to the LiveRange |     /// advanceTo - Advance the specified iterator to point to the LiveRange | ||||||
|     /// containing the specified position, or end() if the position is past the |     /// containing the specified position, or end() if the position is past the | ||||||
| @@ -139,7 +142,16 @@ namespace llvm { | |||||||
|     bool joinable(const LiveInterval& other, unsigned CopyIdx) const; |     bool joinable(const LiveInterval& other, unsigned CopyIdx) const; | ||||||
|  |  | ||||||
|  |  | ||||||
|     bool overlaps(const LiveInterval& other) const; |     /// overlaps - Return true if the intersection of the two live intervals is | ||||||
|  |     /// not empty. | ||||||
|  |     bool overlaps(const LiveInterval& other) const { | ||||||
|  |       return overlapsFrom(other, other.begin()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /// overlapsFrom - Return true if the intersection of the two live intervals | ||||||
|  |     /// is not empty.  The specified iterator is a hint that we can begin | ||||||
|  |     /// scanning the Other interval starting at I. | ||||||
|  |     bool overlapsFrom(const LiveInterval& other, const_iterator I) const; | ||||||
|  |  | ||||||
|     /// addRange - Add the specified LiveRange to this interval, merging |     /// addRange - Add the specified LiveRange to this interval, merging | ||||||
|     /// intervals as appropriate.  This returns an iterator to the inserted live |     /// intervals as appropriate.  This returns an iterator to the inserted live | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user