aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-23 21:16:53 +0000
committerDale Johannesen <dalej@apple.com>2009-03-23 21:16:53 +0000
commit0a92eac9ca4726f6abae09da011f6b6c708efb42 (patch)
tree70fbe0beb7dc9d7c44f2216bcc8cb4822f7460e5 /lib/VMCore/AsmWriter.cpp
parent57da1444be3551bf85ce27482effddd21a32068c (diff)
downloadexternal_llvm-0a92eac9ca4726f6abae09da011f6b6c708efb42.zip
external_llvm-0a92eac9ca4726f6abae09da011f6b6c708efb42.tar.gz
external_llvm-0a92eac9ca4726f6abae09da011f6b6c708efb42.tar.bz2
Fix internal representation of fp80 to be the
same as a normal i80 {low64, high16} rather than its own {high64, low16}. A depressing number of places know about this; I think I got them all. Bitcode readers and writers convert back to the old form to avoid breaking compatibility. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 1d52d63..3f8be47 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -797,9 +797,29 @@ static void WriteConstantInt(raw_ostream &Out, const Constant *CV,
// Some form of long double. These appear as a magic letter identifying
// the type, then a fixed number of hex digits.
Out << "0x";
- if (&CFP->getValueAPF().getSemantics() == &APFloat::x87DoubleExtended)
+ if (&CFP->getValueAPF().getSemantics() == &APFloat::x87DoubleExtended) {
Out << 'K';
- else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEquad)
+ // api needed to prevent premature destruction
+ APInt api = CFP->getValueAPF().bitcastToAPInt();
+ const uint64_t* p = api.getRawData();
+ uint64_t word = p[1];
+ int shiftcount=12;
+ int width = api.getBitWidth();
+ for (int j=0; j<width; j+=4, shiftcount-=4) {
+ unsigned int nibble = (word>>shiftcount) & 15;
+ if (nibble < 10)
+ Out << (unsigned char)(nibble + '0');
+ else
+ Out << (unsigned char)(nibble - 10 + 'A');
+ if (shiftcount == 0 && j+4 < width) {
+ word = *p;
+ shiftcount = 64;
+ if (width-j-4 < 64)
+ shiftcount = width-j-4;
+ }
+ }
+ return;
+ } else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEquad)
Out << 'L';
else if (&CFP->getValueAPF().getSemantics() == &APFloat::PPCDoubleDouble)
Out << 'M';