diff options
author | Chris Lattner <sabre@nondot.org> | 2008-06-30 18:32:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-06-30 18:32:54 +0000 |
commit | b7cfe88e88cb4f46308de89cf3f0c81bfe624128 (patch) | |
tree | f167ab0cf639ac9c700baf35135bc4f69b797152 /lib/CodeGen/CodeGenTypes.cpp | |
parent | 3301cb103d5f32056d62f13bde036988f7cf1330 (diff) |
Make a few related changes:
1) add a new ASTContext::getFloatTypeSemantics method.
2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places.
3) Change the TargetInfo.h get*Format methods to return their
fltSemantics byref instead of by pointer.
4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which
sometimes expand specially and othertimes fall back to libm.
5) Add support for __builtin_nan("") to codegen, cases that don't pass
in an empty string are currently lowered to libm calls.
6) Fix codegen of __builtin_infl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52914 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenTypes.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenTypes.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index 9074e8179c..41ec2dd0f7 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -168,18 +168,18 @@ const llvm::Type *CodeGenTypes::ConvertReturnType(QualType T) { return ConvertType(T); } -static const llvm::Type* getTypeForFormat(const llvm::fltSemantics * format) { - if (format == &llvm::APFloat::IEEEsingle) +static const llvm::Type* getTypeForFormat(const llvm::fltSemantics &format) { + if (&format == &llvm::APFloat::IEEEsingle) return llvm::Type::FloatTy; - if (format == &llvm::APFloat::IEEEdouble) + if (&format == &llvm::APFloat::IEEEdouble) return llvm::Type::DoubleTy; - if (format == &llvm::APFloat::IEEEquad) + if (&format == &llvm::APFloat::IEEEquad) return llvm::Type::FP128Ty; - if (format == &llvm::APFloat::PPCDoubleDouble) + if (&format == &llvm::APFloat::PPCDoubleDouble) return llvm::Type::PPC_FP128Ty; - if (format == &llvm::APFloat::x87DoubleExtended) + if (&format == &llvm::APFloat::x87DoubleExtended) return llvm::Type::X86_FP80Ty; - assert(9 && "Unknown float format!"); + assert(0 && "Unknown float format!"); return 0; } @@ -218,11 +218,9 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { static_cast<unsigned>(Context.getTypeSize(T))); case BuiltinType::Float: - return getTypeForFormat(Context.Target.getFloatFormat()); case BuiltinType::Double: - return getTypeForFormat(Context.Target.getDoubleFormat()); case BuiltinType::LongDouble: - return getTypeForFormat(Context.Target.getLongDoubleFormat()); + return getTypeForFormat(Context.getFloatTypeSemantics(T)); } break; } |