[llvm-commits] [llvm] r54781 - in /llvm/trunk: lib/CodeGen/MachineInstr.cpp utils/TableGen/RegisterInfoEmitter.cpp
Owen Anderson
resistor at mac.com
Thu Aug 14 11:34:23 PDT 2008
Author: resistor
Date: Thu Aug 14 13:34:18 2008
New Revision: 54781
URL: http://llvm.org/viewvc/llvm-project?rev=54781&view=rev
Log:
Speed up addRegisterDead by adding more fast checks before performing the expensive
subregister query, and by increasing the size of the subregister hashtable so
that there are fewer collisions.
Modified:
llvm/trunk/lib/CodeGen/MachineInstr.cpp
llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=54781&r1=54780&r2=54781&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Aug 14 13:34:18 2008
@@ -834,7 +834,9 @@
// There exists a super-register that's marked dead.
if (RegInfo->isSuperRegister(IncomingReg, Reg))
return true;
- if (RegInfo->isSubRegister(IncomingReg, Reg))
+ if (RegInfo->getSubRegisters(IncomingReg) &&
+ RegInfo->getSuperRegisters(Reg) &&
+ RegInfo->isSubRegister(IncomingReg, Reg))
DeadOps.push_back(i);
}
}
Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=54781&r1=54780&r2=54781&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Thu Aug 14 13:34:18 2008
@@ -473,10 +473,12 @@
NumSubRegs += RegisterSubRegs[Regs[i].TheDef].size();
}
- unsigned SubregHashTableSize = NextPowerOf2(2 * NumSubRegs);
+ unsigned SubregHashTableSize = 2 * NextPowerOf2(2 * NumSubRegs);
unsigned* SubregHashTable = new unsigned[2 * SubregHashTableSize];
std::fill(SubregHashTable, SubregHashTable + 2 * SubregHashTableSize, ~0U);
+ unsigned hashMisses = 0;
+
for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
Record* R = Regs[i].TheDef;
for (std::set<Record*>::iterator I = RegisterSubRegs[R].begin(),
@@ -491,6 +493,8 @@
SubregHashTable[index*2+1] != ~0U) {
index = (index + ProbeAmt) & (SubregHashTableSize-1);
ProbeAmt += 2;
+
+ hashMisses++;
}
SubregHashTable[index*2] = i;
@@ -498,10 +502,12 @@
}
}
+ OS << "\n\n // Number of hash collisions: " << hashMisses << "\n";
+
if (SubregHashTableSize) {
std::string Namespace = Regs[0].TheDef->getValueAsString("Namespace");
- OS << "\n\n const unsigned SubregHashTable[] = { ";
+ OS << " const unsigned SubregHashTable[] = { ";
for (unsigned i = 0; i < SubregHashTableSize - 1; ++i) {
if (i != 0)
// Insert spaces for nice formatting.
@@ -527,7 +533,7 @@
OS << " const unsigned SubregHashTableSize = "
<< SubregHashTableSize << ";\n";
} else {
- OS << "\n\n const unsigned SubregHashTable[] = { ~0U, ~0U };\n"
+ OS << " const unsigned SubregHashTable[] = { ~0U, ~0U };\n"
<< " const unsigned SubregHashTableSize = 1;\n";
}
More information about the llvm-commits
mailing list