diff options
| author | Dale Johannesen <dalej@apple.com> | 2007-09-26 23:20:33 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2007-09-26 23:20:33 +0000 |
| commit | 34aa41c475f1a039300435e257a3bc182336955c (patch) | |
| tree | 9b6e03825b4d7835db4d60641f3197c1744e15bf /llvm/lib | |
| parent | 43b66447f4e27334d14e9da76e787b59b621db9c (diff) | |
| download | bcm5719-llvm-34aa41c475f1a039300435e257a3bc182336955c.tar.gz bcm5719-llvm-34aa41c475f1a039300435e257a3bc182336955c.zip | |
Make temporaries explicit to avoid premature
destruction of compiler-created ones.
llvm-svn: 42383
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 7 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Target/CBackend/CBackend.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 4 |
4 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index fdaa9be5bb6..7999907c185 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -529,11 +529,14 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, if (Ty == Type::FloatTy || Ty == Type::DoubleTy) { Record.push_back(CFP->getValueAPF().convertToAPInt().getZExtValue()); } else if (Ty == Type::X86_FP80Ty) { - const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData(); + // api needed to prevent premature destruction + APInt api = CFP->getValueAPF().convertToAPInt(); + const uint64_t *p = api.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(); + APInt api = CFP->getValueAPF().convertToAPInt(); + const uint64_t *p = api.getRawData(); Record.push_back(p[0]); Record.push_back(p[1]); } else if (Ty == Type::PPC_FP128Ty) { diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index 521386b19fa..88d21af0541 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter.cpp @@ -876,7 +876,9 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) { return; } else if (CFP->getType() == Type::X86_FP80Ty) { // all long double variants are printed as hex - const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData(); + // api needed to prevent premature destruction + APInt api = CFP->getValueAPF().convertToAPInt(); + const uint64_t *p = api.getRawData(); if (TD->isBigEndian()) { O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 48) << "\t" << TAI->getCommentString() diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp index bc085241d05..6eef297dd66 100644 --- a/llvm/lib/Target/CBackend/CBackend.cpp +++ b/llvm/lib/Target/CBackend/CBackend.cpp @@ -1729,7 +1729,9 @@ void CWriter::printFloatingPointConstants(Function &F) { << " = 0x" << std::hex << i << std::dec << "U; /* " << Val << " */\n"; } else if (FPC->getType() == Type::X86_FP80Ty) { - const uint64_t *p = FPC->getValueAPF().convertToAPInt().getRawData(); + // api needed to prevent premature destruction + APInt api = FPC->getValueAPF().convertToAPInt(); + const uint64_t *p = api.getRawData(); Out << "static const ConstantFP80Ty FPConstant" << FPCounter++ << " = { 0x" << std::hex << ((uint16_t)p[1] | (p[0] & 0xffffffffffffLL)<<16) diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index b96fbff88cd..6fb55165be7 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -521,7 +521,9 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV, Out << 'L'; else assert(0 && "Unsupported floating point type"); - const uint64_t* p = CFP->getValueAPF().convertToAPInt().getRawData(); + // api needed to prevent premature destruction + APInt api = CFP->getValueAPF().convertToAPInt(); + const uint64_t* p = api.getRawData(); uint64_t word = *p; int shiftcount=60; int width = CFP->getValueAPF().convertToAPInt().getBitWidth(); |

