[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp

Chris Lattner sabre at nondot.org
Fri Feb 9 21:54:49 PST 2007



Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.103 -> 1.104
---
Log message:

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%).


---
Diffs of the changes:  (+7 -15)

 SlotCalculator.cpp |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.103 llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.104
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.103	Fri Feb  9 23:45:09 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp	Fri Feb  9 23:54:33 2007
@@ -181,6 +181,13 @@
       }
   }
 
+    
+  // 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 @@
 
 
 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::purgeFunction() {
-  assert((ModuleLevel.size() != 0 ||
-          ModuleTypeLevel != 0) && "Module not incorporated!");
   unsigned NumModuleTypes = ModuleLevel.size();
   
   SC_DEBUG("begin purgeFunction!\n");
@@ -332,10 +328,6 @@
     }
   }
   
-  // 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();






More information about the llvm-commits mailing list