aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-04-17 20:25:11 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-04-17 20:25:11 +0000
commite52eef8e9a10ada9efc1fed115e5b6eefb22b1da (patch)
treed554e5fce4f632d58ca4e23a3d4eb82cad1b006a /lib/CodeGen
parenteff03db46d5d1df315cf2aa020ccd7f50ab3848e (diff)
Add a register allocation preference field; add a method to compute size of a live interval.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36216 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/LiveInterval.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index 0ca16007b2..45c1dd03da 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -349,6 +349,8 @@ void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments,
ValueNumberInfo.clear();
ValueNumberInfo.append(NewValueNumberInfo.begin(), NewValueNumberInfo.end());
weight += Other.weight;
+ if (Other.preference && !preference)
+ preference = Other.preference;
}
/// MergeRangesInAsValue - Merge all of the intervals in RHS into this live
@@ -467,6 +469,13 @@ void LiveInterval::MergeValueNumberInto(unsigned V1, unsigned V2) {
}
}
+unsigned LiveInterval::getSize() const {
+ unsigned Sum = 0;
+ for (const_iterator I = begin(), E = end(); I != E; ++I)
+ Sum += I->end - I->start;
+ return Sum;
+}
+
std::ostream& llvm::operator<<(std::ostream& os, const LiveRange &LR) {
return os << '[' << LR.start << ',' << LR.end << ':' << LR.ValId << ")";
}