Always write FP values correctly.

Adjust for new Module.h interface for dependent libraries.
Excise unused backwards compatibility flag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15220 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2004-07-25 21:36:26 +00:00
parent 7d146e1107
commit ada1618afa

View File

@ -156,9 +156,6 @@ inline void BytecodeReader::read_data(void *Ptr, void *End) {
/// Read a float value in little-endian order /// Read a float value in little-endian order
inline void BytecodeReader::read_float(float& FloatVal) { inline void BytecodeReader::read_float(float& FloatVal) {
if (hasPlatformSpecificFloatingPoint) {
read_data(&FloatVal, &FloatVal+1);
} else {
/// FIXME: This isn't optimal, it has size problems on some platforms /// FIXME: This isn't optimal, it has size problems on some platforms
/// where FP is not IEEE. /// where FP is not IEEE.
union { union {
@ -168,14 +165,10 @@ inline void BytecodeReader::read_float(float& FloatVal) {
FloatUnion.i = At[0] | (At[1] << 8) | (At[2] << 16) | (At[3] << 24); FloatUnion.i = At[0] | (At[1] << 8) | (At[2] << 16) | (At[3] << 24);
At+=sizeof(uint32_t); At+=sizeof(uint32_t);
FloatVal = FloatUnion.f; FloatVal = FloatUnion.f;
}
} }
/// Read a double value in little-endian order /// Read a double value in little-endian order
inline void BytecodeReader::read_double(double& DoubleVal) { inline void BytecodeReader::read_double(double& DoubleVal) {
if (hasPlatformSpecificFloatingPoint) {
read_data(&DoubleVal, &DoubleVal+1);
} else {
/// FIXME: This isn't optimal, it has size problems on some platforms /// FIXME: This isn't optimal, it has size problems on some platforms
/// where FP is not IEEE. /// where FP is not IEEE.
union { union {
@ -187,7 +180,6 @@ inline void BytecodeReader::read_double(double& DoubleVal) {
(uint64_t(At[6]) << 48) | (uint64_t(At[7]) << 56); (uint64_t(At[6]) << 48) | (uint64_t(At[7]) << 56);
At+=sizeof(uint64_t); At+=sizeof(uint64_t);
DoubleVal = DoubleUnion.d; DoubleVal = DoubleUnion.d;
}
} }
/// Read a block header and obtain its type and size /// Read a block header and obtain its type and size
@ -1853,7 +1845,7 @@ void BytecodeReader::ParseModuleGlobalInfo() {
std::string dep_lib; std::string dep_lib;
while( num_dep_libs-- ) { while( num_dep_libs-- ) {
dep_lib = read_str(); dep_lib = read_str();
TheModule->linsert(dep_lib); TheModule->addLibrary(dep_lib);
} }
// Read target triple and place into the module // Read target triple and place into the module
@ -1894,7 +1886,6 @@ void BytecodeReader::ParseVersionInfo() {
hasRestrictedGEPTypes = false; hasRestrictedGEPTypes = false;
hasTypeDerivedFromValue = false; hasTypeDerivedFromValue = false;
hasLongBlockHeaders = false; hasLongBlockHeaders = false;
hasPlatformSpecificFloatingPoint = false;
has32BitTypes = false; has32BitTypes = false;
hasNoDependentLibraries = false; hasNoDependentLibraries = false;
@ -1934,11 +1925,6 @@ void BytecodeReader::ParseVersionInfo() {
/// bits for block type. /// bits for block type.
hasLongBlockHeaders = true; hasLongBlockHeaders = true;
/// LLVM 1.2 and earlier wrote floating point values in a platform specific
/// bit ordering. This was fixed in LLVM 1.3, but we still need to be backwards
/// compatible.
hasPlatformSpecificFloatingPoint = true;
/// LLVM 1.2 and earlier wrote type slot numbers as vbr_uint32. In LLVM 1.3 /// LLVM 1.2 and earlier wrote type slot numbers as vbr_uint32. In LLVM 1.3
/// this has been reduced to vbr_uint24. It shouldn't make much difference /// this has been reduced to vbr_uint24. It shouldn't make much difference
/// since we haven't run into a module with > 24 million types, but for safety /// since we haven't run into a module with > 24 million types, but for safety