[llvm-commits] [llvm] r76775 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp
David Greene
greened at obbligato.org
Wed Jul 22 13:08:25 PDT 2009
Author: greened
Date: Wed Jul 22 15:08:25 2009
New Revision: 76775
URL: http://llvm.org/viewvc/llvm-project?rev=76775&view=rev
Log:
Make some changes suggested by Bill and Evan.
Modified:
llvm/trunk/include/llvm/CodeGen/LiveInterval.h
llvm/trunk/lib/CodeGen/LiveInterval.cpp
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=76775&r1=76774&r2=76775&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Jul 22 15:08:25 2009
@@ -572,6 +572,10 @@
///
unsigned getSize() const;
+ /// ComputeJoinedWeight - Set the weight of a live interval after
+ /// Other has been merged into it.
+ void ComputeJoinedWeight(const LiveInterval &Other);
+
bool operator<(const LiveInterval& other) const {
return beginNumber() < other.beginNumber();
}
Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=76775&r1=76774&r2=76775&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Wed Jul 22 15:08:25 2009
@@ -503,23 +503,7 @@
InsertPos = addRangeFrom(*I, InsertPos);
}
- // If either of these intervals was spilled, the weight is the
- // weight of the non-spilled interval. This can only happen with
- // iterative coalescers.
-
- if (weight == HUGE_VALF && !TargetRegisterInfo::isPhysicalRegister(reg)) {
- // Remove this assert if you have an iterative coalescer
- assert(0 && "Joining to spilled interval");
- weight = Other.weight;
- }
- else if (Other.weight != HUGE_VALF) {
- weight += Other.weight;
- }
- else {
- // Remove this assert if you have an iterative coalescer
- assert(0 && "Joining from spilled interval");
- }
- // Otherwise the weight stays the same
+ ComputeJoinedWeight(Other);
// Update regalloc hint if currently there isn't one.
if (TargetRegisterInfo::isVirtualRegister(reg) &&
@@ -809,6 +793,29 @@
return Sum;
}
+/// ComputeJoinedWeight - Set the weight of a live interval Joined
+/// after Other has been merged into it.
+void LiveInterval::ComputeJoinedWeight(const LiveInterval &Other) {
+ // If either of these intervals was spilled, the weight is the
+ // weight of the non-spilled interval. This can only happen with
+ // iterative coalescers.
+
+ if (weight == HUGE_VALF &&
+ !TargetRegisterInfo::isPhysicalRegister(reg)) {
+ // Remove this assert if you have an iterative coalescer
+ assert(0 && "Joining to spilled interval");
+ weight = Other.weight;
+ }
+ else if (Other.weight != HUGE_VALF) {
+ weight += Other.weight;
+ }
+ else {
+ // Otherwise the weight stays the same
+ // Remove this assert if you have an iterative coalescer
+ assert(0 && "Joining from spilled interval");
+ }
+}
+
std::ostream& llvm::operator<<(std::ostream& os, const LiveRange &LR) {
return os << '[' << LR.start << ',' << LR.end << ':' << LR.valno->id << ")";
}
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=76775&r1=76774&r2=76775&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Jul 22 15:08:25 2009
@@ -1970,23 +1970,7 @@
LHS.addKills(LHSValNo, VNI->kills);
LHS.MergeRangesInAsValue(RHS, LHSValNo);
- // If either of these intervals was spilled, the weight is the
- // weight of the non-spilled interval. This can only happen
- // with iterative coalescers.
- if (LHS.weight == HUGE_VALF && !TargetRegisterInfo::isPhysicalRegister(LHS.reg)) {
- // Remove this assert if you have an iterative coalescer
- assert(0 && "Joining to spilled interval");
- LHS.weight = RHS.weight;
- }
- else if (RHS.weight != HUGE_VALF) {
- LHS.weight += RHS.weight;
- }
- else {
- // Remove this assert if you have an iterative coalescer
- assert(0 && "Joining from spilled interval");
- }
-
- // Otherwise the LHS weight stays the same
+ LHS.ComputeJoinedWeight(RHS);
// Update regalloc hint if both are virtual registers.
if (TargetRegisterInfo::isVirtualRegister(LHS.reg) &&
More information about the llvm-commits
mailing list