mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-13 13:00:24 +00:00
Print out 'float' constants correctly
llvm-svn: 4607
This commit is contained in:
parent
8674baf660
commit
d57a4ec976
@ -535,6 +535,7 @@ void CWriter::printModule(Module *M) {
|
|||||||
|
|
||||||
<< "\n\n/* Support for floating point constants */\n"
|
<< "\n\n/* Support for floating point constants */\n"
|
||||||
<< "typedef unsigned long long ConstantDoubleTy;\n"
|
<< "typedef unsigned long long ConstantDoubleTy;\n"
|
||||||
|
<< "typedef unsigned int ConstantFloatTy;\n"
|
||||||
|
|
||||||
<< "\n\n/* Global Declarations */\n";
|
<< "\n\n/* Global Declarations */\n";
|
||||||
|
|
||||||
@ -772,9 +773,17 @@ void CWriter::printFunction(Function *F) {
|
|||||||
double Val = FPC->getValue();
|
double Val = FPC->getValue();
|
||||||
|
|
||||||
FPConstantMap[FPC] = FPCounter; // Number the FP constants
|
FPConstantMap[FPC] = FPCounter; // Number the FP constants
|
||||||
|
|
||||||
|
if (FPC->getType() == Type::DoubleTy)
|
||||||
Out << " const ConstantDoubleTy FloatConstant" << FPCounter++
|
Out << " const ConstantDoubleTy FloatConstant" << FPCounter++
|
||||||
<< " = 0x" << std::hex << *(unsigned long long*)&Val << std::dec
|
<< " = 0x" << std::hex << *(unsigned long long*)&Val << std::dec
|
||||||
<< "; /* " << Val << " */\n";
|
<< "; /* " << Val << " */\n";
|
||||||
|
else if (FPC->getType() == Type::FloatTy)
|
||||||
|
Out << " const ConstantFloatTy FloatConstant" << FPCounter++
|
||||||
|
<< " = 0x" << std::hex << *(unsigned*)&Val << std::dec
|
||||||
|
<< "; /* " << Val << " */\n";
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown float type!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Out << "\n";
|
Out << "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user