]> granicus.if.org Git - llvm/commitdiff
Add support for reading and writing pointersize/endianness to and from bytecode
authorChris Lattner <sabre@nondot.org>
Tue, 22 Apr 2003 18:15:10 +0000 (18:15 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 22 Apr 2003 18:15:10 +0000 (18:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5839 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Reader/Reader.cpp
lib/Bytecode/Writer/Writer.cpp

index 5eb3861064e2652706e80ed48e08f79691926807..fd4fd6fb0e186ed3a9c22e736d63f12ef1435d2b 100644 (file)
@@ -526,6 +526,11 @@ bool BytecodeParser::ParseVersionInfo(const uchar *&Buf, const uchar *EndBuf) {
     return true;
   }
 
+  TheModule->setEndianness(isBigEndian ? Module::BigEndian :
+                                         Module::LittleEndian);
+  TheModule->setPointerSize(hasLongPointers ? Module::Pointer64 : 
+                                              Module::Pointer32);
+
   BCR_TRACE(1, "Bytecode Rev = " << (unsigned)RevisionNum << "\n");
   BCR_TRACE(1, "BigEndian/LongPointers = " << isBigEndian << ","
                << hasLongPointers << "\n");
index 03a6c4668e9283aeae7ce0dc4fac77d86388f679..f97d7e232b5d7a9b0a0dd88e02b39ea38ccaf3a4 100644 (file)
@@ -43,8 +43,8 @@ BytecodeWriter::BytecodeWriter(std::deque<unsigned char> &o, const Module *M)
   // Emit the top level CLASS block.
   BytecodeBlock ModuleBlock(BytecodeFormat::Module, Out);
 
-  bool isBigEndian = true;
-  bool hasLongPointers = true;
+  bool isBigEndian = M->isBigEndian();
+  bool hasLongPointers = M->has64BitPointers();
 
   // Output the version identifier... we are currently on bytecode version #2
   unsigned Version = (2 << 4) | isBigEndian | (hasLongPointers << 1);