[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Jim Laskey
jlaskey at apple.com
Wed Aug 17 12:24:51 PDT 2005
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.19 -> 1.20
---
Log message:
Culling out use of unions for converting FP to bits and vice versa.
---
Diffs of the changes: (+7 -18)
AsmPrinter.cpp | 25 +++++++------------------
1 files changed, 7 insertions(+), 18 deletions(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.19 llvm/lib/CodeGen/AsmPrinter.cpp:1.20
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.19 Sun Aug 7 23:26:32 2005
+++ llvm/lib/CodeGen/AsmPrinter.cpp Wed Aug 17 14:24:40 2005
@@ -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 @@
// 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;
}
More information about the llvm-commits
mailing list