mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 20:59:51 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54781 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a8c763b307
commit
22ae999082
@ -834,7 +834,9 @@ bool MachineInstr::addRegisterDead(unsigned IncomingReg,
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
@ -473,10 +473,12 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
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 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
SubregHashTable[index*2+1] != ~0U) {
|
||||
index = (index + ProbeAmt) & (SubregHashTableSize-1);
|
||||
ProbeAmt += 2;
|
||||
|
||||
hashMisses++;
|
||||
}
|
||||
|
||||
SubregHashTable[index*2] = i;
|
||||
@ -498,10 +502,12 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
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";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user