[llvm] r187438 - Down-scale slot index distance to save bits.
Andrew Trick
atrick at apple.com
Tue Jul 30 12:59:19 PDT 2013
Author: atrick
Date: Tue Jul 30 14:59:19 2013
New Revision: 187438
URL: http://llvm.org/viewvc/llvm-project?rev=187438&view=rev
Log:
Down-scale slot index distance to save bits.
Modified:
llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=187438&r1=187437&r2=187438&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Tue Jul 30 14:59:19 2013
@@ -218,6 +218,13 @@ namespace llvm {
return other.getIndex() - getIndex();
}
+ /// Return the scaled distance from this index to the given one, where all
+ /// slots on the same instruction have zero distance.
+ int getInstrDistance(SlotIndex other) const {
+ return (other.listEntry()->getIndex() - listEntry()->getIndex())
+ / Slot_Count;
+ }
+
/// isBlock - Returns true if this is a block boundary slot.
bool isBlock() const { return getSlot() == Slot_Block; }
Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=187438&r1=187437&r2=187438&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Jul 30 14:59:19 2013
@@ -419,7 +419,7 @@ void RAGreedy::enqueue(LiveInterval *LI)
// Allocate original local ranges in linear instruction order. Since they
// are singly defined, this produces optimal coloring in the absence of
// global interference and other constraints.
- Prio = LI->beginIndex().distance(Indexes->getLastIndex());
+ Prio = LI->beginIndex().getInstrDistance(Indexes->getLastIndex());
}
else {
// Allocate global and split ranges in long->short order. Long ranges that
More information about the llvm-commits
mailing list