summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-07-22 20:08:25 +0000
committerDavid Greene <greened@obbligato.org>2009-07-22 20:08:25 +0000
commit1e2a04ba99034eabb18e5fa41cddac8dbb871679 (patch)
tree3209a2d776abeb88c23474fe331673a42cf9b695 /llvm/lib/CodeGen/LiveInterval.cpp
parentb3a1fdc363679f753f9bd16eff3cef160b52dcf6 (diff)
downloadbcm5719-llvm-1e2a04ba99034eabb18e5fa41cddac8dbb871679.tar.gz
bcm5719-llvm-1e2a04ba99034eabb18e5fa41cddac8dbb871679.zip
Make some changes suggested by Bill and Evan.
llvm-svn: 76775
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp41
1 files changed, 24 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index 0d2f6ba76a7..04281055510 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/lib/CodeGen/LiveInterval.cpp
@@ -503,23 +503,7 @@ void LiveInterval::join(LiveInterval &Other, const int *LHSValNoAssignments,
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 @@ unsigned LiveInterval::getSize() const {
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 << ")";
}
OpenPOWER on IntegriCloud