diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-12-17 18:13:52 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-12-17 18:13:52 +0000 |
commit | 090100fdb166e87bc539e3e4048d18c721c187d0 (patch) | |
tree | 059a4ae4dcb631b7ba1d28a2e7eec7334634eb55 /include/llvm/CodeGen/MachineLoopRanges.h | |
parent | e63dda51c2b230215837063dba73e9299f8c0aba (diff) |
Add MachineLoopRange comparators for sorting loop lists by number and by area.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineLoopRanges.h')
-rw-r--r-- | include/llvm/CodeGen/MachineLoopRanges.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineLoopRanges.h b/include/llvm/CodeGen/MachineLoopRanges.h index 730b729dba..3f2f24194a 100644 --- a/include/llvm/CodeGen/MachineLoopRanges.h +++ b/include/llvm/CodeGen/MachineLoopRanges.h @@ -42,6 +42,9 @@ private: /// Bit 0 = inside loop block. Map Intervals; + /// Loop area as measured by SlotIndex::distance. + unsigned Area; + /// Create a MachineLoopRange, only accessible to MachineLoopRanges. MachineLoopRange(const MachineLoop*, Allocator&, SlotIndexes&); @@ -50,11 +53,27 @@ public: /// inteructions. bool overlaps(SlotIndex Start, SlotIndex Stop); + /// getNumber - Return the loop number. This is the same as the number of the + /// header block. + unsigned getNumber() const; + + /// getArea - Return the loop area. This number is approximately proportional + /// to the number of instructions in the loop. + unsigned getArea() const { return Area; } + /// getMap - Allow public read-only access for IntervalMapOverlaps. const Map &getMap() { return Intervals; } /// print - Print loop ranges on OS. void print(raw_ostream&) const; + + /// byNumber - Comparator for array_pod_sort that sorts a list of + /// MachineLoopRange pointers by number. + static int byNumber(const void*, const void*); + + /// byAreaDesc - Comparator for array_pod_sort that sorts a list of + /// MachineLoopRange pointers by descending area, then by number. + static int byAreaDesc(const void*, const void*); }; raw_ostream &operator<<(raw_ostream&, const MachineLoopRange&); |