diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-14 21:55:52 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-14 21:55:52 +0000 |
commit | e97dda4fc58ee401ebb4aa9153d10f8ce8ba9a70 (patch) | |
tree | f976c793f2f88348819ea9e0fcc18eda808c211c /lib/CodeGen/RegAllocFast.cpp | |
parent | 26c699565424e93e9d0d0495d7e914d89071d6e0 (diff) |
Avoid scanning the long tail of physreg operands on calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocFast.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocFast.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp index 0e92996d94..11dbfccb6b 100644 --- a/lib/CodeGen/RegAllocFast.cpp +++ b/lib/CodeGen/RegAllocFast.cpp @@ -663,12 +663,18 @@ void RAFast::AllocateBasicBlock(MachineBasicBlock &MBB) { // First scan. // Mark physreg uses and early clobbers as used. + // Find the end of the virtreg operands + unsigned VirtOpEnd = 0; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); if (!MO.isReg()) continue; unsigned Reg = MO.getReg(); - if (!Reg || !TargetRegisterInfo::isPhysicalRegister(Reg) || - ReservedRegs.test(Reg)) continue; + if (!Reg) continue; + if (TargetRegisterInfo::isVirtualRegister(Reg)) { + VirtOpEnd = i+1; + continue; + } + if (ReservedRegs.test(Reg)) continue; if (MO.isUse()) { usePhysReg(MO); } else if (MO.isEarlyClobber()) { @@ -677,11 +683,10 @@ void RAFast::AllocateBasicBlock(MachineBasicBlock &MBB) { } } - // Second scan. // Allocate virtreg uses and early clobbers. // Collect VirtKills - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + for (unsigned i = 0; i != VirtOpEnd; ++i) { MachineOperand &MO = MI->getOperand(i); if (!MO.isReg()) continue; unsigned Reg = MO.getReg(); |