summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Writer/SlotCalculator.cpp
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
commit82a06ec1caf6e048bcce4d19a4d624d510044f1d (patch)
treead1649d3c13fdda04a66bf76290b0129bb3a0e16 /llvm/lib/Bytecode/Writer/SlotCalculator.cpp
parenta6214fea0843093579281aed94b00b809b5f3c1a (diff)
downloadbcm5719-llvm-82a06ec1caf6e048bcce4d19a4d624d510044f1d.tar.gz
bcm5719-llvm-82a06ec1caf6e048bcce4d19a4d624d510044f1d.zip
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
Diffstat (limited to 'llvm/lib/Bytecode/Writer/SlotCalculator.cpp')
-rw-r--r--llvm/lib/Bytecode/Writer/SlotCalculator.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/llvm/lib/Bytecode/Writer/SlotCalculator.cpp b/llvm/lib/Bytecode/Writer/SlotCalculator.cpp
index b239aeb7674..00df27f7c69 100644
--- a/llvm/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud