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
This commit is contained in:
Chris Lattner 2003-04-22 18:15:10 +00:00
parent e0b235cd97
commit 76e3896881
2 changed files with 7 additions and 2 deletions

View 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");

View 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);