diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-22 18:15:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-22 18:15:10 +0000 |
commit | 76e38968818e06e48b96aac07369d0c752d5a761 (patch) | |
tree | a17dd00a9ea2c207e54068d795c21ae29aaa815c /lib/Bytecode | |
parent | e0b235cd97ffcc2480aaf5f617c47cbc4bbfba24 (diff) | |
download | external_llvm-76e38968818e06e48b96aac07369d0c752d5a761.zip external_llvm-76e38968818e06e48b96aac07369d0c752d5a761.tar.gz external_llvm-76e38968818e06e48b96aac07369d0c752d5a761.tar.bz2 |
Add support for reading and writing pointersize/endianness to and from bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5839 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 5 | ||||
-rw-r--r-- | lib/Bytecode/Writer/Writer.cpp | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 5eb3861..fd4fd6f 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -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"); diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index 03a6c46..f97d7e2 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -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); |