Only compute the module levels info once per module, instead of once

per function.  This speeds up bcwriting on 447.dealII from 10.16s to 6.81s
(49%).

llvm-svn: 34132
This commit is contained in:
Chris Lattner 2007-02-10 05:54:33 +00:00
parent a6214fea08
commit 82a06ec1ca
1 changed files with 7 additions and 15 deletions

View File

@ -181,6 +181,13 @@ void SlotCalculator::processModule() {
}
}
// Compute the ModuleLevel entries.
ModuleLevel.resize(getNumPlanes());
for (unsigned i = 0, e = getNumPlanes(); i != e; ++i)
ModuleLevel[i] = getPlane(i).size();
ModuleTypeLevel = Types.size();
SC_DEBUG("end processModule!\n");
}
@ -278,17 +285,8 @@ unsigned SlotCalculator::getOrCreateTypeSlot(const Type *Ty) {
void SlotCalculator::incorporateFunction(const Function *F) {
assert((ModuleLevel.empty() ||
ModuleTypeLevel == 0) && "Module already incorporated!");
SC_DEBUG("begin processFunction!\n");
// Update the ModuleLevel entries to be accurate.
ModuleLevel.resize(getNumPlanes());
for (unsigned i = 0, e = getNumPlanes(); i != e; ++i)
ModuleLevel[i] = getPlane(i).size();
ModuleTypeLevel = Types.size();
// Iterate over function arguments, adding them to the value table...
for(Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
I != E; ++I)
@ -309,8 +307,6 @@ void SlotCalculator::incorporateFunction(const Function *F) {
}
void SlotCalculator::purgeFunction() {
assert((ModuleLevel.size() != 0 ||
ModuleTypeLevel != 0) && "Module not incorporated!");
unsigned NumModuleTypes = ModuleLevel.size();
SC_DEBUG("begin purgeFunction!\n");
@ -332,10 +328,6 @@ void SlotCalculator::purgeFunction() {
}
}
// We don't need this state anymore, free it up.
ModuleLevel.clear();
ModuleTypeLevel = 0;
// Finally, remove any type planes defined by the function...
while (Table.size() > NumModuleTypes) {
TypePlane &Plane = Table.back();