aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-02-05 02:52:05 +0000
committerChris Lattner <sabre@nondot.org>2002-02-05 02:52:05 +0000
commit296b7730e355a657df9fc5355c2cbe4985219903 (patch)
tree37432bff2a44226c1f71a625fef34e12062fea4f /lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
parent5e5dfa307a6999cef7cba6d1a594f880ab72c043 (diff)
* Eliminate the LiveVarSet class, making applyTranferFuncForMInst a static
function in the one .cpp file that uses it. Use ValueSet's instead. * Prepare to delete LiveVarSet.h & LiveVarSet.cpp * Eliminate the ValueSet class, making all old member functions into global templates that will eventually be moved to Support. * Eliminate some irrelevant const's git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAlloc/LiveRangeInfo.cpp')
-rw-r--r--lib/CodeGen/RegAlloc/LiveRangeInfo.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
index 590c88fbc4..aef84310d3 100644
--- a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
+++ b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
@@ -12,7 +12,7 @@ using std::cerr;
LiveRangeInfo::LiveRangeInfo(const Method *const M,
const TargetMachine& tm,
std::vector<RegClass *> &RCL)
- : Meth(M), LiveRangeMap(), TM(tm),
+ : Meth(M), TM(tm),
RegClassList(RCL), MRI(tm.getRegInfo())
{ }
@@ -48,18 +48,16 @@ LiveRangeInfo::~LiveRangeInfo() {
// Note: the caller must make sure that L1 and L2 are distinct and both
// LRs don't have suggested colors
//---------------------------------------------------------------------------
-void LiveRangeInfo::unionAndUpdateLRs(LiveRange *const L1, LiveRange *L2)
-{
- assert( L1 != L2);
- L1->setUnion( L2 ); // add elements of L2 to L1
- ValueSet::iterator L2It;
- for( L2It = L2->begin() ; L2It != L2->end(); ++L2It) {
+void LiveRangeInfo::unionAndUpdateLRs(LiveRange *L1, LiveRange *L2) {
+ assert(L1 != L2 && (!L1->hasSuggestedColor() || !L2->hasSuggestedColor()));
+ set_union(*L1, *L2); // add elements of L2 to L1
+ for(ValueSet::iterator L2It = L2->begin(); L2It != L2->end(); ++L2It) {
//assert(( L1->getTypeID() == L2->getTypeID()) && "Merge:Different types");
L1->insert(*L2It); // add the var in L2 to L1
- LiveRangeMap[ *L2It ] = L1; // now the elements in L2 should map
+ LiveRangeMap[*L2It] = L1; // now the elements in L2 should map
//to L1
}
@@ -69,15 +67,15 @@ void LiveRangeInfo::unionAndUpdateLRs(LiveRange *const L1, LiveRange *L2)
// must have the same color.
if(L2->hasSuggestedColor())
- L1->setSuggestedColor( L2->getSuggestedColor() );
+ L1->setSuggestedColor(L2->getSuggestedColor());
- if( L2->isCallInterference() )
+ if (L2->isCallInterference())
L1->setCallInterference();
-
- L1->addSpillCost( L2->getSpillCost() ); // add the spill costs
-
+ // add the spill costs
+ L1->addSpillCost(L2->getSpillCost());
+
delete L2; // delete L2 as it is no longer needed
}
@@ -394,7 +392,7 @@ void LiveRangeInfo::printLiveRanges() {
for( ; HMI != LiveRangeMap.end(); ++HMI) {
if (HMI->first && HMI->second) {
cerr << " " << RAV(HMI->first) << "\t: ";
- HMI->second->printSet(); cerr << "\n";
+ printSet(*HMI->second); cerr << "\n";
}
}
}