aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-10 05:54:33 +0000
committerChris Lattner <sabre@nondot.org>2007-02-10 05:54:33 +0000
commit06f94d59026b5de5b22a47c01dd452d8a8bbeaa7 (patch)
tree3de6417f0bfaca27f1519c39202a292e84258d6a
parent77aae264a00671527842c9e0826abed43d1f77b1 (diff)
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%). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34132 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Bytecode/Writer/SlotCalculator.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp
index b239aeb767..00df27f7c6 100644
--- a/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/lib/Bytecode/Writer/SlotCalculator.cpp
@@ -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();