From 241d0209a765c97c684b120527e185f17723f650 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Fri, 22 Jun 2012 16:46:44 +0000 Subject: [PATCH] Remove LiveIntervals::trackingRegUnits(). With regunit liveness permanently enabled, this function would always return true. Also remove now obsolete code for checking physreg interference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159006 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/LiveIntervalAnalysis.h | 5 -- lib/CodeGen/LiveIntervalAnalysis.cpp | 2 +- lib/CodeGen/RegAllocPBQP.cpp | 58 +++------------------ lib/CodeGen/RegisterCoalescer.cpp | 24 ++------- 4 files changed, 13 insertions(+), 76 deletions(-) diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h index fa7dca9198c..3519a5deba2 100644 --- a/include/llvm/CodeGen/LiveIntervalAnalysis.h +++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h @@ -347,11 +347,6 @@ namespace llvm { return RegUnitIntervals[Unit]; } - /// trackingRegUnits - Does LiveIntervals curently track register units? - /// This function will be removed when regunit tracking is permanently - /// enabled. - bool trackingRegUnits() const { return !RegUnitIntervals.empty(); } - private: /// computeIntervals - Compute live intervals. void computeIntervals(); diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index 2aea1e105cb..1a50210d566 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -1188,7 +1188,7 @@ private: // Collect ranges for register units. These live ranges are computed on // demand, so just skip any that haven't been computed yet. - if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.trackingRegUnits()) + if (TargetRegisterInfo::isPhysicalRegister(Reg)) for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units) if (LiveInterval *LI = LIS.getCachedRegUnit(*Units)) collectRanges(MO, LI, Entering, Internal, Exiting, OldIdx); diff --git a/lib/CodeGen/RegAllocPBQP.cpp b/lib/CodeGen/RegAllocPBQP.cpp index 57593336570..d0db26b2089 100644 --- a/lib/CodeGen/RegAllocPBQP.cpp +++ b/lib/CodeGen/RegAllocPBQP.cpp @@ -236,64 +236,20 @@ std::auto_ptr PBQPBuilder::build(MachineFunction *mf, continue; // vregLI overlaps fixed regunit interference. - if (LIS->trackingRegUnits()) { - bool Interference = false; - for (MCRegUnitIterator Units(preg, tri); Units.isValid(); ++Units) { - if (vregLI->overlaps(LIS->getRegUnit(*Units))) { - Interference = true; - break; - } + bool Interference = false; + for (MCRegUnitIterator Units(preg, tri); Units.isValid(); ++Units) { + if (vregLI->overlaps(LIS->getRegUnit(*Units))) { + Interference = true; + break; } - if (Interference) - continue; } + if (Interference) + continue; // preg is usable for this virtual register. vrAllowed.push_back(preg); } - RegSet overlappingPRegs; - - // Record physical registers whose ranges overlap. - for (RegSet::const_iterator pregItr = pregs.begin(), - pregEnd = pregs.end(); - pregItr != pregEnd; ++pregItr) { - unsigned preg = *pregItr; - if (!LIS->hasInterval(preg)) - continue; - const LiveInterval *pregLI = &LIS->getInterval(preg); - - if (pregLI->empty()) { - continue; - } - - if (vregLI->overlaps(*pregLI)) - overlappingPRegs.insert(preg); - } - - for (RegSet::const_iterator pregItr = overlappingPRegs.begin(), - pregEnd = overlappingPRegs.end(); - pregItr != pregEnd; ++pregItr) { - unsigned preg = *pregItr; - - // Remove the register from the allowed set. - VRAllowed::iterator eraseItr = - std::find(vrAllowed.begin(), vrAllowed.end(), preg); - - if (eraseItr != vrAllowed.end()) { - vrAllowed.erase(eraseItr); - } - - // Also remove any aliases. - for (MCRegAliasIterator AI(preg, tri, false); AI.isValid(); ++AI) { - VRAllowed::iterator eraseItr = - std::find(vrAllowed.begin(), vrAllowed.end(), *AI); - if (eraseItr != vrAllowed.end()) { - vrAllowed.erase(eraseItr); - } - } - } - // Construct the node. PBQP::Graph::NodeItr node = g.addNode(PBQP::Vector(vrAllowed.size() + 1, 0)); diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index de58b82d3a3..4f302773170 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -1100,26 +1100,12 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) { // Deny any overlapping intervals. This depends on all the reserved // register live ranges to look like dead defs. - if (LIS->trackingRegUnits()) { - for (MCRegUnitIterator UI(CP.getDstReg(), TRI); UI.isValid(); ++UI) - if (RHS.overlaps(LIS->getRegUnit(*UI))) { - DEBUG(dbgs() << "\t\tInterference: " << PrintRegUnit(*UI, TRI) << '\n'); - return false; - } - } else { - for (MCRegAliasIterator AS(CP.getDstReg(), TRI, true); AS.isValid(); ++AS) { - if (!LIS->hasInterval(*AS)) { - // Make sure at least DstReg itself exists before attempting a join. - if (*AS == CP.getDstReg()) - LIS->getOrCreateInterval(CP.getDstReg()); - continue; - } - if (RHS.overlaps(LIS->getInterval(*AS))) { - DEBUG(dbgs() << "\t\tInterference: " << PrintReg(*AS, TRI) << '\n'); - return false; - } + for (MCRegUnitIterator UI(CP.getDstReg(), TRI); UI.isValid(); ++UI) + if (RHS.overlaps(LIS->getRegUnit(*UI))) { + DEBUG(dbgs() << "\t\tInterference: " << PrintRegUnit(*UI, TRI) << '\n'); + return false; } - } + // Skip any value computations, we are not adding new values to the // reserved register. Also skip merging the live ranges, the reserved // register live range doesn't need to be accurate as long as all the -- 2.34.1