From 1283d86b63a424be993dffa25616567376bced1e Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Wed, 7 Jan 2004 05:31:12 +0000 Subject: [PATCH] Minor cleanups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10711 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAllocLinearScan.cpp | 32 +++--------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 49e33d86f5d..4897be41bb0 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -34,17 +34,15 @@ namespace { Statistic<> numReloaded("ra-linearscan", "Number of registers reloaded"); class RA : public MachineFunctionPass { - public: - typedef std::vector IntervalPtrs; - private: MachineFunction* mf_; const TargetMachine* tm_; const MRegisterInfo* mri_; - MachineBasicBlock* currentMbb_; + MachineFunction::iterator currentMbb_; MachineBasicBlock::iterator currentInstr_; typedef LiveIntervals::Intervals Intervals; const Intervals* li_; + typedef std::vector IntervalPtrs; IntervalPtrs active_, inactive_; typedef std::vector Regs; @@ -57,9 +55,6 @@ namespace { unsigned regUse_[MRegisterInfo::FirstVirtualRegister]; unsigned regUseBackup_[MRegisterInfo::FirstVirtualRegister]; - typedef LiveIntervals::MachineBasicBlockPtrs MachineBasicBlockPtrs; - MachineBasicBlockPtrs mbbs_; - typedef std::map Virt2PhysMap; Virt2PhysMap v2pMap_; @@ -204,30 +199,11 @@ bool RA::runOnMachineFunction(MachineFunction &fn) { active_.clear(); inactive_.clear(); - mbbs_ = getAnalysis().getOrderedMachineBasicBlockPtrs(); v2pMap_.clear(); v2ssMap_.clear(); memset(regUse_, 0, sizeof(regUse_)); memset(regUseBackup_, 0, sizeof(regUseBackup_)); - DEBUG( - unsigned i = 0; - for (MachineBasicBlockPtrs::iterator - mbbi = mbbs_.begin(), mbbe = mbbs_.end(); - mbbi != mbbe; ++mbbi) { - MachineBasicBlock* mbb = *mbbi; - std::cerr << mbb->getBasicBlock()->getName() << '\n'; - for (MachineBasicBlock::iterator - ii = mbb->begin(), ie = mbb->end(); - ii != ie; ++ii) { - MachineInstr* instr = *ii; - - std::cerr << i++ << "\t"; - instr->print(std::cerr, *tm_); - } - } - ); - // FIXME: this will work only for the X86 backend. I need to // device an algorthm to select the minimal (considering register // aliasing) number of temp registers to reserve so that we have 2 @@ -316,10 +292,8 @@ bool RA::runOnMachineFunction(MachineFunction &fn) { DEBUG(printVirt2PhysMap()); DEBUG(std::cerr << "Rewrite machine code:\n"); - for (MachineBasicBlockPtrs::iterator - mbbi = mbbs_.begin(), mbbe = mbbs_.end(); mbbi != mbbe; ++mbbi) { + for (currentMbb_ = mf_->begin(); currentMbb_ != mf_->end(); ++currentMbb_) { instrAdded_ = 0; - currentMbb_ = *mbbi; for (currentInstr_ = currentMbb_->begin(); currentInstr_ != currentMbb_->end(); ++currentInstr_) {