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

Chris Lattner sabre at nondot.org
Thu Feb 8 23:53:36 PST 2007



Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.157 -> 1.158
WriterInternals.h updated: 1.29 -> 1.30
---
Log message:

remove dead code, the outputConstants function is now only called at module scope.


---
Diffs of the changes:  (+6 -14)

 Writer.cpp        |   18 +++++-------------
 WriterInternals.h |    2 +-
 2 files changed, 6 insertions(+), 14 deletions(-)


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.157 llvm/lib/Bytecode/Writer/Writer.cpp:1.158
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.157	Fri Feb  9 01:51:47 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Fri Feb  9 01:53:20 2007
@@ -826,7 +826,7 @@
   outputModuleInfoBlock(M);
 
   // Output module level constants, used for global variable initializers
-  outputConstants(false);
+  outputConstants();
 
   // Do the whole module now! Process each function at a time...
   for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
@@ -904,30 +904,22 @@
   return Ty != Type::LabelTy && Ty != Type::VoidTy && !isa<OpaqueType>(Ty);
 }
 
-void BytecodeWriter::outputConstants(bool isFunction) {
+void BytecodeWriter::outputConstants() {
   BytecodeBlock CPool(BytecodeFormat::ConstantPoolBlockID, *this,
                       true  /* Elide block if empty */);
 
   unsigned NumPlanes = Table.getNumPlanes();
 
-  if (isFunction)
-    // Output the type plane before any constants!
-    outputTypes(Table.getModuleTypeLevel());
-  else
-    // Output module-level string constants before any other constants.
-    outputConstantStrings();
+  // Output module-level string constants before any other constants.
+  outputConstantStrings();
 
   for (unsigned pno = 0; pno != NumPlanes; pno++) {
     const std::vector<const Value*> &Plane = Table.getPlane(pno);
     if (!Plane.empty()) {              // Skip empty type planes...
       unsigned ValNo = 0;
-      if (isFunction)                  // Don't re-emit module constants
-        ValNo += Table.getModuleLevel(pno);
-
       if (hasNullValue(Plane[0]->getType())) {
         // Skip zero initializer
-        if (ValNo == 0)
-          ValNo = 1;
+        ValNo = 1;
       }
 
       // Write out constants in the plane


Index: llvm/lib/Bytecode/Writer/WriterInternals.h
diff -u llvm/lib/Bytecode/Writer/WriterInternals.h:1.29 llvm/lib/Bytecode/Writer/WriterInternals.h:1.30
--- llvm/lib/Bytecode/Writer/WriterInternals.h:1.29	Mon Feb  5 14:47:20 2007
+++ llvm/lib/Bytecode/Writer/WriterInternals.h	Fri Feb  9 01:53:20 2007
@@ -35,7 +35,7 @@
   BytecodeWriter(std::vector<unsigned char> &o, const Module *M);
 
 private:
-  void outputConstants(bool isFunction);
+  void outputConstants();
   void outputConstantStrings();
   void outputFunction(const Function *F);
   void outputCompactionTable();






More information about the llvm-commits mailing list