diff options
author | Dale Johannesen <dalej@apple.com> | 2007-09-11 18:32:33 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-09-11 18:32:33 +0000 |
commit | 3f6eb7419de437436265831fce92f62498556e08 (patch) | |
tree | cb752d4a86ec5c5dd783cfc421e30d0cf7600e87 /lib/Bitcode/Writer | |
parent | 6320260e060ce4fc5d199d757b15a0f43be66029 (diff) | |
download | external_llvm-3f6eb7419de437436265831fce92f62498556e08.zip external_llvm-3f6eb7419de437436265831fce92f62498556e08.tar.gz external_llvm-3f6eb7419de437436265831fce92f62498556e08.tar.bz2 |
Add APInt interfaces to APFloat (allows directly
access to bits). Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling
(untested, probably does not work).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer')
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 73f5338..78a16d8 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -527,13 +527,20 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, Code = bitc::CST_CODE_FLOAT; const Type *Ty = CFP->getType(); if (Ty == Type::FloatTy) - Record.push_back(FloatToBits(CFP->getValueAPF().convertToFloat())); + Record.push_back((uint32_t)*CFP->getValueAPF().convertToAPInt(). + getRawData()); else if (Ty == Type::DoubleTy) { - Record.push_back(DoubleToBits(CFP->getValueAPF().convertToDouble())); - // FIXME: make long double constants work. - } else if (Ty == Type::X86_FP80Ty || - Ty == Type::FP128Ty || Ty == Type::PPC_FP128Ty) { - assert (0 && "Long double constants not handled yet."); + Record.push_back(*CFP->getValueAPF().convertToAPInt().getRawData()); + } else if (Ty == Type::X86_FP80Ty) { + const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData(); + Record.push_back(p[0]); + Record.push_back((uint16_t)p[1]); + } else if (Ty == Type::FP128Ty) { + const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData(); + Record.push_back(p[0]); + Record.push_back(p[1]); + } else if (Ty == Type::PPC_FP128Ty) { + assert(0 && "PowerPC long double constants not handled yet."); } else { assert (0 && "Unknown FP type!"); } |