llvm.org GIT mirror llvm / ee72651
previous patch was a little too tricky for its own good. Don't try to overload UserInInstr. Explicitly check Allocatable. The early exit in the condition will mean the performance impact of the extra test should be minimal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113016 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Grosbach 10 years ago
1 changed file(s) with 7 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
111111
112112 // Allocatable - vector of allocatable physical registers.
113113 BitVector Allocatable;
114
115 // Reserved - vector of reserved physical registers.
116 BitVector Reserved;
117114
118115 // SkippedInstrs - Descriptors of instructions whose clobber list was
119116 // ignored because all registers were spilled. It is still necessary to
500497 // First try to find a completely free register.
501498 for (TargetRegisterClass::iterator I = AOB; I != AOE; ++I) {
502499 unsigned PhysReg = *I;
503 if (PhysRegState[PhysReg] == regFree && !UsedInInstr.test(PhysReg))
500 if (PhysRegState[PhysReg] == regFree && !UsedInInstr.test(PhysReg) &&
501 Allocatable.test(PhysReg))
504502 return assignVirtToPhysReg(LRE, PhysReg);
505503 }
506504
509507
510508 unsigned BestReg = 0, BestCost = spillImpossible;
511509 for (TargetRegisterClass::iterator I = AOB; I != AOE; ++I) {
510 if (!Allocatable.test(*I))
511 continue;
512512 unsigned Cost = calcSpillCost(*I);
513513 // Cost is 0 when all aliases are already disabled.
514514 if (Cost == 0)
711711 }
712712
713713 // Restore UsedInInstr to a state usable for allocating normal virtual uses.
714 UsedInInstr = Reserved;
714 UsedInInstr.reset();
715715 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
716716 MachineOperand &MO = MI->getOperand(i);
717717 if (!MO.isReg() || (MO.isDef() && !MO.isEarlyClobber())) continue;
837837 }
838838
839839 // Track registers used by instruction.
840 UsedInInstr = Reserved;
840 UsedInInstr.reset();
841841
842842 // First scan.
843843 // Mark physreg uses and early clobbers as used.
915915
916916 // Track registers defined by instruction - early clobbers and tied uses at
917917 // this point.
918 UsedInInstr = Reserved;
918 UsedInInstr.reset();
919919 if (hasEarlyClobbers) {
920920 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
921921 MachineOperand &MO = MI->getOperand(i);
10131013
10141014 UsedInInstr.resize(TRI->getNumRegs());
10151015 Allocatable = TRI->getAllocatableSet(*MF);
1016 Reserved = TRI->getReservedRegs(*MF);
10171016
10181017 // initialize the virtual->physical register map to have a 'null'
10191018 // mapping for all virtual registers