From b0f31bf19b9cd0107900728123d4848eae462e6c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 23 Jan 2005 22:45:13 +0000 Subject: Update these register allocators to set the PhysRegUsed info in MachineFunction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19791 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAllocLinearScan.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/RegAllocLinearScan.cpp') diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 0878e466d2..cf7a264e4e 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -48,6 +48,7 @@ namespace { const TargetMachine* tm_; const MRegisterInfo* mri_; LiveIntervals* li_; + bool *PhysRegsUsed; /// handled_ - Intervals are added to the handled_ set in the order of their /// start value. This is uses for backtracking. @@ -139,6 +140,10 @@ bool RA::runOnMachineFunction(MachineFunction &fn) { mri_ = tm_->getRegisterInfo(); li_ = &getAnalysis(); + PhysRegsUsed = new bool[mri_->getNumRegs()]; + std::fill(PhysRegsUsed, PhysRegsUsed+mri_->getNumRegs(), false); + fn.setUsedPhysRegs(PhysRegsUsed); + if (!prt_.get()) prt_.reset(new PhysRegTracker(*mri_)); vrm_.reset(new VirtRegMap(*mf_)); if (!spiller_.get()) spiller_.reset(createSpiller()); @@ -147,6 +152,7 @@ bool RA::runOnMachineFunction(MachineFunction &fn) { linearScan(); + // Rewrite spill code and update the PhysRegsUsed set. spiller_->runOnMachineFunction(*mf_, *vrm_); vrm_.reset(); // Free the VirtRegMap @@ -170,9 +176,10 @@ void RA::initIntervalSets() "interval sets should be empty on initialization"); for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { - if (MRegisterInfo::isPhysicalRegister(i->second.reg)) + if (MRegisterInfo::isPhysicalRegister(i->second.reg)) { + PhysRegsUsed[i->second.reg] = true; fixed_.push_back(std::make_pair(&i->second, i->second.begin())); - else + } else unhandled_.push(&i->second); } } -- cgit v1.2.3-70-g09d2