Pretty-printing comments for literal floating point in .s files.

Dump the hex representation to the comment stream as well as the float
value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2012-03-23 23:06:47 +00:00
parent 00ca888ccc
commit 7c0bc008f1

View File

@ -1764,7 +1764,9 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
if (CFP->getType()->isFloatTy()) {
if (AP.isVerbose()) {
float Val = CFP->getValueAPF().convertToFloat();
AP.OutStreamer.GetCommentOS() << "float " << Val << '\n';
uint64_t IntVal = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
AP.OutStreamer.GetCommentOS() << "float " << Val << '\n'
<< " (" << format("0x%x", IntVal) << ")\n";
}
uint64_t Val = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
AP.OutStreamer.EmitIntValue(Val, 4, AddrSpace);
@ -1776,7 +1778,9 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
if (CFP->getType()->isDoubleTy()) {
if (AP.isVerbose()) {
double Val = CFP->getValueAPF().convertToDouble();
AP.OutStreamer.GetCommentOS() << "double " << Val << '\n';
uint64_t IntVal = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
AP.OutStreamer.GetCommentOS() << "double " << Val << '\n'
<< " (" << format("0x%lx", IntVal) << ")\n";
}
uint64_t Val = CFP->getValueAPF().bitcastToAPInt().getZExtValue();