From ef09c63e7ba5dd5410655f71d35eb7245893b1f1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 31 Jan 2004 21:27:19 +0000 Subject: [PATCH] Finegrainify namespacification, use new MRegisterInfo::isVirtualRegister method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11037 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/LiveVariables.cpp | 2 +- lib/CodeGen/RegAllocLocal.cpp | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 845af13a30b..45b9ba8f2bc 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -58,7 +58,7 @@ MachineBasicBlock *LiveVariables::getIndexMachineBasicBlock(unsigned Idx) { } LiveVariables::VarInfo &LiveVariables::getVarInfo(unsigned RegIdx) { - assert(RegIdx >= MRegisterInfo::FirstVirtualRegister && + assert(MRegisterInfo::isVirtualRegister(RegIdx) && "getVarInfo: not a virtual register!"); RegIdx -= MRegisterInfo::FirstVirtualRegister; if (RegIdx >= VirtRegInfo.size()) { diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index 5ffe5afc4db..680bda7cdca 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -25,8 +25,7 @@ #include "Support/Debug.h" #include "Support/Statistic.h" #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumSpilled ("ra-local", "Number of registers spilled"); @@ -75,14 +74,14 @@ namespace { std::vector VirtRegModified; void markVirtRegModified(unsigned Reg, bool Val = true) { - assert(Reg >= MRegisterInfo::FirstVirtualRegister && "Illegal VirtReg!"); + assert(MRegisterInfo::isVirtualRegister(Reg) && "Illegal VirtReg!"); Reg -= MRegisterInfo::FirstVirtualRegister; if (VirtRegModified.size() <= Reg) VirtRegModified.resize(Reg+1); VirtRegModified[Reg] = Val; } bool isVirtRegModified(unsigned Reg) const { - assert(Reg >= MRegisterInfo::FirstVirtualRegister && "Illegal VirtReg!"); + assert(MRegisterInfo::isVirtualRegister(Reg) && "Illegal VirtReg!"); assert(Reg - MRegisterInfo::FirstVirtualRegister < VirtRegModified.size() && "Illegal virtual register!"); return VirtRegModified[Reg - MRegisterInfo::FirstVirtualRegister]; @@ -524,7 +523,7 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) { KE = LV->killed_end(MI); KI != KE; ++KI) { unsigned VirtReg = KI->second; unsigned PhysReg = VirtReg; - if (VirtReg >= MRegisterInfo::FirstVirtualRegister) { + if (MRegisterInfo::isVirtualRegister(VirtReg)) { std::map::iterator I = Virt2PhysRegMap.find(VirtReg); assert(I != Virt2PhysRegMap.end()); @@ -602,7 +601,7 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) { KE = LV->dead_end(MI); KI != KE; ++KI) { unsigned VirtReg = KI->second; unsigned PhysReg = VirtReg; - if (VirtReg >= MRegisterInfo::FirstVirtualRegister) { + if (MRegisterInfo::isVirtualRegister(VirtReg)) { std::map::iterator I = Virt2PhysRegMap.find(VirtReg); assert(I != Virt2PhysRegMap.end()); @@ -668,8 +667,7 @@ bool RA::runOnMachineFunction(MachineFunction &Fn) { return true; } -FunctionPass *createLocalRegisterAllocator() { +FunctionPass *llvm::createLocalRegisterAllocator() { return new RA(); } -} // End llvm namespace