diff --git a/Makefile b/Makefile index e39eb831..6cf14be1 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ARCH_TYPE = $(shell arch) ifeq ($(shell llvm-config --version), 3.1svn) LLVM_LIBS=-lLLVMAsmParser -lLLVMInstrumentation -lLLVMLinker \ -lLLVMArchive -lLLVMBitReader -lLLVMDebugInfo -lLLVMJIT -lLLVMipo \ - -lLLVMBitWriter -lLLVMTableGen -lLLVMCBackendInfo \ + -lLLVMBitWriter -lLLVMTableGen \ -lLLVMX86Disassembler -lLLVMX86CodeGen -lLLVMSelectionDAG \ -lLLVMAsmPrinter -lLLVMX86AsmParser -lLLVMX86Desc -lLLVMX86Info \ -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCDisassembler -lLLVMMCParser \ diff --git a/cbackend.cpp b/cbackend.cpp index e39f8461..45d1a791 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -933,6 +933,20 @@ void CWriter::printConstantDataSequential(ConstantDataSequential *CDS, } #endif // LLVM_3_1svn +#ifdef LLVM_3_1svn +static inline std::string ftostr(const APFloat& V) { + std::string Buf; + if (&V.getSemantics() == &APFloat::IEEEdouble) { + raw_string_ostream(Buf) << V.convertToDouble(); + return Buf; + } else if (&V.getSemantics() == &APFloat::IEEEsingle) { + raw_string_ostream(Buf) << (double)V.convertToFloat(); + return Buf; + } + return ""; // error +} +#endif // LLVM_3_1svn + // isFPCSafeToPrint - Returns true if we may assume that CFP may be written out // textually as a double (rather than as a reference to a stack-allocated // variable). We decide this by converting CFP to a string and back into a