diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-08-17 07:45:14 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-08-17 07:45:14 +0000 |
commit | c3e436427b9542ba028c5728c0163f236262de05 (patch) | |
tree | 6c32db506d6d25a7d8429a71ee967df2157ff57d /llvm/lib/Bytecode/Reader/Reader.cpp | |
parent | 0b85d03b57df85bdf1e75db1f60cab465fe95903 (diff) | |
download | bcm5719-llvm-c3e436427b9542ba028c5728c0163f236262de05.tar.gz bcm5719-llvm-c3e436427b9542ba028c5728c0163f236262de05.zip |
Bytecode File Format Changes:
- File format version number bumped to 4
- Writer will now align nothing
- Reader now only expects alignment for version 3 or earlier
llvm-svn: 15875
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | llvm/lib/Bytecode/Reader/Reader.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index 9ca641932af..85a890dbc43 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -72,12 +72,14 @@ inline void BytecodeReader::checkPastBlockEnd(const char * block_name) { /// Align the buffer position to a 32 bit boundary inline void BytecodeReader::align32() { - BufPtr Save = At; - At = (const unsigned char *)((unsigned long)(At+3) & (~3UL)); - if (At > Save) - if (Handler) Handler->handleAlignment(At - Save); - if (At > BlockEnd) - error("Ran out of data while aligning!"); + if (hasAlignment) { + BufPtr Save = At; + At = (const unsigned char *)((unsigned long)(At+3) & (~3UL)); + if (At > Save) + if (Handler) Handler->handleAlignment(At - Save); + if (At > BlockEnd) + error("Ran out of data while aligning!"); + } } /// Read a whole unsigned integer @@ -1886,6 +1888,7 @@ void BytecodeReader::ParseVersionInfo() { hasLongBlockHeaders = false; has32BitTypes = false; hasNoDependentLibraries = false; + hasAlignment = false; switch (RevisionNum) { case 0: // LLVM 1.0, 1.1 release version @@ -1937,6 +1940,14 @@ void BytecodeReader::ParseVersionInfo() { // FALL THROUGH case 3: // LLVM 1.3 release version + /// LLVM 1.3 and earlier caused alignment bytes to be written on some block + /// boundaries and at the end of some strings. In extreme cases (e.g. lots + /// of GEP references to a constant array), this can increase the file size + /// by 30% or more. In version 1.4 alignment is done away with completely. + hasAlignment = true; + + // FALL THROUGH + case 4: break; default: |