mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-02 23:26:31 +00:00
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:
@@ -29,6 +29,7 @@
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
@@ -431,18 +432,9 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
|
||||
|
||||
// Otherwise we could not reparse it to exactly the same value, so we must
|
||||
// output the string in hexadecimal format!
|
||||
//
|
||||
// Behave nicely in the face of C TBAA rules... see:
|
||||
// http://www.nullstone.com/htmls/category/aliastyp.htm
|
||||
//
|
||||
union {
|
||||
double D;
|
||||
uint64_t U;
|
||||
} V;
|
||||
V.D = CFP->getValue();
|
||||
assert(sizeof(double) == sizeof(uint64_t) &&
|
||||
"assuming that double is 64 bits!");
|
||||
Out << "0x" << utohexstr(V.U);
|
||||
Out << "0x" << utohexstr(DoubleToBits(CFP->getValue()));
|
||||
|
||||
} else if (isa<ConstantAggregateZero>(CV)) {
|
||||
Out << "zeroinitializer";
|
||||
|
Reference in New Issue
Block a user