diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-09 01:35:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-09 01:35:21 +0000 |
commit | 96aef893383a6ffcc6d6955c5d969f0fd57831c2 (patch) | |
tree | 46dc414b0a98b86414d975a7dbc559c245133a92 /lib/CodeGen/LiveVariables.cpp | |
parent | 64667b6418786edd2fceb022b3da0d3ad38221c2 (diff) |
Only do stuff for the REAL number of physical registers we have, not 1024.
This speeds up live variables a lot, from .60/.39s -> .47/.26s in LLC, for
the first/second pass respectively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11216 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveVariables.cpp')
-rw-r--r-- | lib/CodeGen/LiveVariables.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 45b9ba8f2b..eafbb1c18a 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -158,17 +158,18 @@ void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) { } bool LiveVariables::runOnMachineFunction(MachineFunction &MF) { + const TargetInstrInfo &TII = MF.getTarget().getInstrInfo(); + RegInfo = MF.getTarget().getRegisterInfo(); + assert(RegInfo && "Target doesn't have register information?"); + // First time though, initialize AllocatablePhysicalRegisters for the target if (AllocatablePhysicalRegisters.empty()) { - const MRegisterInfo &MRI = *MF.getTarget().getRegisterInfo(); - assert(&MRI && "Target doesn't have register information?"); - // Make space, initializing to false... - AllocatablePhysicalRegisters.resize(MRegisterInfo::FirstVirtualRegister); + AllocatablePhysicalRegisters.resize(RegInfo->getNumRegs()); // Loop over all of the register classes... - for (MRegisterInfo::regclass_iterator RCI = MRI.regclass_begin(), - E = MRI.regclass_end(); RCI != E; ++RCI) + for (MRegisterInfo::regclass_iterator RCI = RegInfo->regclass_begin(), + E = RegInfo->regclass_end(); RCI != E; ++RCI) // Loop over all of the allocatable registers in the function... for (TargetRegisterClass::iterator I = (*RCI)->allocation_order_begin(MF), E = (*RCI)->allocation_order_end(MF); I != E; ++I) @@ -191,9 +192,6 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) { PhysRegInfo = PhysRegInfoA; PhysRegUsed = PhysRegUsedA; - const TargetInstrInfo &TII = MF.getTarget().getInstrInfo(); - RegInfo = MF.getTarget().getRegisterInfo(); - /// Get some space for a respectable number of registers... VirtRegInfo.resize(64); @@ -294,7 +292,7 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) { // Loop over PhysRegInfo, killing any registers that are available at the // end of the basic block. This also resets the PhysRegInfo map. - for (unsigned i = 0, e = MRegisterInfo::FirstVirtualRegister; i != e; ++i) + for (unsigned i = 0, e = RegInfo->getNumRegs(); i != e; ++i) if (PhysRegInfo[i]) HandlePhysRegDef(i, 0); } |