[llvm-commits] [llvm] r46104 - /llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
Evan Cheng
evan.cheng at apple.com
Wed Jan 16 16:35:27 PST 2008
Author: evancheng
Date: Wed Jan 16 18:35:26 2008
New Revision: 46104
URL: http://llvm.org/viewvc/llvm-project?rev=46104&view=rev
Log:
Replace std::vector<bool> with BitVector.
Modified:
llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=46104&r1=46103&r2=46104&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Wed Jan 16 18:35:26 2008
@@ -91,13 +91,15 @@
// scavenged. If a virtual register has simply been rematerialized, there
// is no reason to spill it to memory when we need the register back.
//
- std::vector<bool> VirtRegModified;
+ BitVector VirtRegModified;
void markVirtRegModified(unsigned Reg, bool Val = true) {
assert(MRegisterInfo::isVirtualRegister(Reg) && "Illegal VirtReg!");
Reg -= MRegisterInfo::FirstVirtualRegister;
- if (VirtRegModified.size() <= Reg) VirtRegModified.resize(Reg+1);
- VirtRegModified[Reg] = Val;
+ if (Val)
+ VirtRegModified.set(Reg);
+ else
+ VirtRegModified.reset(Reg);
}
bool isVirtRegModified(unsigned Reg) const {
@@ -819,7 +821,9 @@
// initialize the virtual->physical register map to have a 'null'
// mapping for all virtual registers
- Virt2PhysRegMap.grow(MF->getRegInfo().getLastVirtReg());
+ unsigned LastVirtReg = MF->getRegInfo().getLastVirtReg();
+ Virt2PhysRegMap.grow(LastVirtReg);
+ VirtRegModified.resize(LastVirtReg-MRegisterInfo::FirstVirtualRegister);
// Loop over all of the basic blocks, eliminating virtual register references
for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
More information about the llvm-commits
mailing list