From 87d1f47cb697bf05bf4a7c09b44ae6c893563d89 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 15 Jul 2009 17:40:42 +0000 Subject: [PATCH] Revert 75798 to fix llvm build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75805 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Constants.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 9f544a72059..5c7c288ce9e 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -255,6 +255,20 @@ ConstantInt *ConstantInt::get(const APInt& V) { // ConstantFP //===----------------------------------------------------------------------===// +static const fltSemantics *TypeToFloatSemantics(const Type *Ty) { + if (Ty == Type::FloatTy) + return &APFloat::IEEEsingle; + if (Ty == Type::DoubleTy) + return &APFloat::IEEEdouble; + if (Ty == Type::X86_FP80Ty) + return &APFloat::x87DoubleExtended; + else if (Ty == Type::FP128Ty) + return &APFloat::IEEEquad; + + assert(Ty == Type::PPC_FP128Ty && "Unknown FP format"); + return &APFloat::PPCDoubleDouble; +} + ConstantFP::ConstantFP(const Type *Ty, const APFloat& V) : Constant(Ty, ConstantFPVal, 0, 0), Val(V) { assert(&V.getSemantics() == TypeToFloatSemantics(Ty) && -- 2.34.1