[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderInternals.h

Chris Lattner lattner at cs.uiuc.edu
Thu Jan 15 11:56:01 PST 2004


Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.95 -> 1.96
ReaderInternals.h updated: 1.73 -> 1.74

---
Log message:

Fix PR73


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

Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.95 llvm/lib/Bytecode/Reader/Reader.cpp:1.96
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.95	Thu Jan 15 00:13:09 2004
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Thu Jan 15 11:55:01 2004
@@ -499,7 +499,8 @@
     BCR_TRACE(2, "Function of type: " << Ty << "\n");
   }
 
-  align32(Buf, End);
+  if (hasInconsistentModuleGlobalInfo)
+    align32(Buf, End);
 
   // Now that the function signature list is set up, reverse it so that we can 
   // remove elements efficiently from the back of the vector.
@@ -530,6 +531,7 @@
   hasExtendedLinkageSpecs = true;
   hasOldStyleVarargs = false;
   hasVarArgCallPadding = false;
+  hasInconsistentModuleGlobalInfo = false;
   FirstDerivedTyID = 14;
 
   switch (RevisionNum) {
@@ -539,15 +541,22 @@
     hasExtendedLinkageSpecs = false;
     hasOldStyleVarargs = true;
     hasVarArgCallPadding = true;
+    hasInconsistentModuleGlobalInfo = true;
+
     break;
   case 0:               //  LLVM 1.0, 1.1 release version
     // Compared to rev #2, we added support for weak linkage, a more dense
     // encoding, and better varargs support.
 
     // Base LLVM 1.0 bytecode format.
+    hasInconsistentModuleGlobalInfo = true;
     break;
   case 1:               // LLVM 1.2 release version
     // LLVM 1.2 added explicit support for emitting strings efficiently.
+
+    // Also, it fixed the problem where the size of the ModuleGlobalInfo block
+    // included the size for the alignment at the end, where the rest of the
+    // blocks did not.
     break;
 
   default:


Index: llvm/lib/Bytecode/Reader/ReaderInternals.h
diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.73 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.74
--- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.73	Thu Jan 15 00:13:09 2004
+++ llvm/lib/Bytecode/Reader/ReaderInternals.h	Thu Jan 15 11:55:01 2004
@@ -97,6 +97,10 @@
 
   bool usesOldStyleVarargs;         // Does this module USE old style varargs?
 
+  // LLVM 1.0 & 1.1 had an explicit alignment of data only for the
+  // ModuleGlobalInfo block.  This was fixed to be like all other blocks in 1.2
+  bool hasInconsistentModuleGlobalInfo;
+
   typedef std::vector<ValueList*> ValueTable;
   ValueTable Values;
   ValueTable ModuleValues;





More information about the llvm-commits mailing list