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

Reid Spencer reid at x10sys.com
Fri Jan 26 00:10:42 PST 2007



Changes in directory llvm/lib/Bytecode/Reader:

Analyzer.cpp updated: 1.28 -> 1.29
Reader.cpp updated: 1.224 -> 1.225
---
Log message:

For PR761: http://llvm.org/PR761 :
Remove the Endianness and PointerSize fields from the ModuleHeader and
replace it with the DataLayout field.


---
Diffs of the changes:  (+11 -25)

 Analyzer.cpp |    8 ++------
 Reader.cpp   |   28 +++++++++-------------------
 2 files changed, 11 insertions(+), 25 deletions(-)


Index: llvm/lib/Bytecode/Reader/Analyzer.cpp
diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.28 llvm/lib/Bytecode/Reader/Analyzer.cpp:1.29
--- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.28	Fri Jan 12 13:20:46 2007
+++ llvm/lib/Bytecode/Reader/Analyzer.cpp	Fri Jan 26 02:10:24 2007
@@ -142,14 +142,10 @@
   }
 
   virtual void handleVersionInfo(
-    unsigned char RevisionNum,        ///< Byte code revision number
-    Module::Endianness Endianness,    ///< Endianness indicator
-    Module::PointerSize PointerSize   ///< PointerSize indicator
+    unsigned char RevisionNum        ///< Byte code revision number
   ) {
     if (os)
-      *os << "    RevisionNum: " << int(RevisionNum)
-         << " Endianness: " << Endianness
-         << " PointerSize: " << PointerSize << "\n";
+      *os << "    RevisionNum: " << int(RevisionNum) << "\n";
     bca.version = RevisionNum;
   }
 


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.224 llvm/lib/Bytecode/Reader/Reader.cpp:1.225
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.224	Thu Jan 18 18:07:16 2007
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Fri Jan 26 02:10:24 2007
@@ -2014,6 +2014,13 @@
   if (Handler)
     Handler->handleTargetTriple(triple);
   
+  // Read the data layout string and place into the module.
+  std::string datalayout = read_str();
+  TheModule->setDataLayout(datalayout);
+  // FIXME: Implement
+  // if (Handler)
+    // Handler->handleDataLayout(datalayout);
+
   if (At != BlockEnd) {
     // If the file has section info in it, read the section names now.
     unsigned NumSections = read_vbr_uint();
@@ -2045,31 +2052,14 @@
 /// Parse the version information and decode it by setting flags on the
 /// Reader that enable backward compatibility of the reader.
 void BytecodeReader::ParseVersionInfo() {
-  unsigned Version = read_vbr_uint();
-
-  // Unpack version number: low four bits are for flags, top bits = version
-  Module::Endianness  Endianness;
-  Module::PointerSize PointerSize;
-  Endianness  = (Version & 1) ? Module::BigEndian : Module::LittleEndian;
-  PointerSize = (Version & 2) ? Module::Pointer64 : Module::Pointer32;
-
-  bool hasNoEndianness = Version & 4;
-  bool hasNoPointerSize = Version & 8;
-
-  RevisionNum = Version >> 4;
+  unsigned RevisionNum = read_vbr_uint();
 
   // We don't provide backwards compatibility in the Reader any more. To
   // upgrade, the user should use llvm-upgrade.
   if (RevisionNum < 7)
     error("Bytecode formats < 7 are no longer supported. Use llvm-upgrade.");
 
-  if (hasNoEndianness) Endianness  = Module::AnyEndianness;
-  if (hasNoPointerSize) PointerSize = Module::AnyPointerSize;
-
-  TheModule->setEndianness(Endianness);
-  TheModule->setPointerSize(PointerSize);
-
-  if (Handler) Handler->handleVersionInfo(RevisionNum, Endianness, PointerSize);
+  if (Handler) Handler->handleVersionInfo(RevisionNum);
 }
 
 /// Parse a whole module.






More information about the llvm-commits mailing list