Culling out use of unions for converting FP to bits and vice versa.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22838 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Laskey
2005-08-17 19:34:49 +00:00
parent 8482dd894d
commit cb6682fa44
13 changed files with 65 additions and 209 deletions

View File

@@ -247,22 +247,12 @@ void V8Printer::emitGlobalConstant(const Constant *CV) {
switch (CFP->getType()->getTypeID()) {
default: assert(0 && "Unknown floating point type!");
case Type::FloatTyID: {
union FU { // Abide by C TBAA rules
float FVal;
unsigned UVal;
} U;
U.FVal = Val;
O << ".long\t" << U.UVal << "\t! float " << Val << "\n";
O << ".long\t" << FloatToBits(Val) << "\t! float " << Val << "\n";
return;
}
case Type::DoubleTyID: {
union DU { // Abide by C TBAA rules
double FVal;
uint64_t UVal;
} U;
U.FVal = Val;
O << ".word\t0x" << std::hex << (U.UVal >> 32) << std::dec << "\t! double " << Val << "\n";
O << ".word\t0x" << std::hex << (U.UVal & 0xffffffffUL) << std::dec << "\t! double " << Val << "\n";
O << ".word\t0x" << std::hex << (DoubleToBits(Val) >> 32) << std::dec << "\t! double " << Val << "\n";
O << ".word\t0x" << std::hex << (DoubleToBits(Val) & 0xffffffffUL) << std::dec << "\t! double " << Val << "\n";
return;
}
}