[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderInternals.h
Chris Lattner
lattner at cs.uiuc.edu
Sun Aug 24 08:50:35 PDT 2003
Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.58 -> 1.59
ReaderInternals.h updated: 1.38 -> 1.39
---
Log message:
Allow modules to have 'any' pointer size and endianness. Luckily, we had
some space for extra flags, so we don't need to bump the revision number.
---
Diffs of the changes:
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.58 llvm/lib/Bytecode/Reader/Reader.cpp:1.59
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.58 Mon Aug 18 09:29:50 2003
+++ llvm/lib/Bytecode/Reader/Reader.cpp Sun Aug 24 08:47:32 2003
@@ -498,9 +498,15 @@
if (read_vbr(Buf, EndBuf, Version)) return true;
// Unpack version number: low four bits are for flags, top bits = version
- isBigEndian = Version & 1;
- hasLongPointers = Version & 2;
- RevisionNum = Version >> 4;
+ 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;
// Default values for the current bytecode version
HasImplicitZeroInitializer = true;
@@ -515,11 +521,14 @@
//
if (Version != 14) return true; // Unknown revision 0 flags?
HasImplicitZeroInitializer = false;
- isBigEndian = hasLongPointers = true;
+ Endianness = Module::BigEndian;
+ PointerSize = Module::Pointer64;
hasInternalMarkerOnly = true;
+ hasNoEndianness = hasNoPointerSize = false;
break;
case 1:
- // Version #1 has two bit fields: isBigEndian and hasLongPointers
+ // Version #1 has four bit fields: isBigEndian, hasLongPointers,
+ // hasNoEndianness, and hasNoPointerSize.
hasInternalMarkerOnly = true;
break;
case 2:
@@ -531,14 +540,14 @@
return true;
}
- TheModule->setEndianness(isBigEndian ? Module::BigEndian :
- Module::LittleEndian);
- TheModule->setPointerSize(hasLongPointers ? Module::Pointer64 :
- Module::Pointer32);
+ if (hasNoEndianness) Endianness = Module::AnyEndianness;
+ if (hasNoPointerSize) PointerSize = Module::AnyPointerSize;
+ TheModule->setEndianness(Endianness);
+ TheModule->setPointerSize(PointerSize);
BCR_TRACE(1, "Bytecode Rev = " << (unsigned)RevisionNum << "\n");
- BCR_TRACE(1, "BigEndian/LongPointers = " << isBigEndian << ","
- << hasLongPointers << "\n");
+ BCR_TRACE(1, "Endianness/PointerSize = " << Endianness << ","
+ << PointerSize << "\n");
BCR_TRACE(1, "HasImplicitZeroInit = " << HasImplicitZeroInitializer << "\n");
return false;
}
Index: llvm/lib/Bytecode/Reader/ReaderInternals.h
diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.38 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.39
--- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.38 Wed Jun 18 14:22:30 2003
+++ llvm/lib/Bytecode/Reader/ReaderInternals.h Sun Aug 24 08:47:32 2003
@@ -86,7 +86,6 @@
unsigned char RevisionNum; // The rev # itself
unsigned char FirstDerivedTyID; // First variable index to use for type
bool HasImplicitZeroInitializer; // Is entry 0 of every slot implicity zeros?
- bool isBigEndian, hasLongPointers;// Information about the target compiled for
bool hasInternalMarkerOnly; // Only types of linkage are intern/external
typedef std::vector<ValueList*> ValueTable;
More information about the llvm-commits
mailing list