diff options
author | Jim Laskey <jlaskey@mac.com> | 2005-08-17 19:34:49 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2005-08-17 19:34:49 +0000 |
commit | cb6682fa44e13262bdef7dd22b4ba90f8c2e7b97 (patch) | |
tree | 7007ebf49e8bf80c2f04c0df03980f65ddd88077 /lib/CodeGen/AsmPrinter.cpp | |
parent | 8482dd894d7d64134f999d8e62bc9adf5cb239a9 (diff) |
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
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 497e9c89fa..d907d67b5a 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -15,6 +15,7 @@ #include "llvm/Constants.h" #include "llvm/Instruction.h" #include "llvm/Support/Mangler.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetMachine.h" using namespace llvm; @@ -222,39 +223,27 @@ void AsmPrinter::emitGlobalConstant(const Constant *CV) { // precision... double Val = CFP->getValue(); if (CFP->getType() == Type::DoubleTy) { - union DU { // Abide by C TBAA rules - double FVal; - uint64_t UVal; - } U; - U.FVal = Val; - if (Data64bitsDirective) - O << Data64bitsDirective << U.UVal << "\t" << CommentString + O << Data64bitsDirective << DoubleToBits(Val) << "\t" << CommentString << " double value: " << Val << "\n"; else if (TD.isBigEndian()) { - O << Data32bitsDirective << unsigned(U.UVal >> 32) + O << Data32bitsDirective << unsigned(DoubleToBits(Val) >> 32) << "\t" << CommentString << " double most significant word " << Val << "\n"; - O << Data32bitsDirective << unsigned(U.UVal) + O << Data32bitsDirective << unsigned(DoubleToBits(Val)) << "\t" << CommentString << " double least significant word " << Val << "\n"; } else { - O << Data32bitsDirective << unsigned(U.UVal) + O << Data32bitsDirective << unsigned(DoubleToBits(Val)) << "\t" << CommentString << " double least significant word " << Val << "\n"; - O << Data32bitsDirective << unsigned(U.UVal >> 32) + O << Data32bitsDirective << unsigned(DoubleToBits(Val) >> 32) << "\t" << CommentString << " double most significant word " << Val << "\n"; } return; } else { - union FU { // Abide by C TBAA rules - float FVal; - int32_t UVal; - } U; - U.FVal = (float)Val; - - O << Data32bitsDirective << U.UVal << "\t" << CommentString + O << Data32bitsDirective << FloatToBits(Val) << "\t" << CommentString << " float " << Val << "\n"; return; } |