summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-14 21:55:52 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-14 21:55:52 +0000
commite68b814c8c89f0e9d85bf7a0e8d7991c40c1bc6b (patch)
treea06e310226130eb68acd2e652f262eba65d743ed /llvm/lib/CodeGen/RegAllocFast.cpp
parent36debf804660c5033139d0a83f729fb9609a78ad (diff)
downloadbcm5719-llvm-e68b814c8c89f0e9d85bf7a0e8d7991c40c1bc6b.tar.gz
bcm5719-llvm-e68b814c8c89f0e9d85bf7a0e8d7991c40c1bc6b.zip
Avoid scanning the long tail of physreg operands on calls
llvm-svn: 103823
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocFast.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index 0e92996d949..11dbfccb6ba 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud