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 | 9a8d1d9e56ecdc052add3620b478253fda0cb615 (patch) | |
tree | b3af06907b71283efd6ac83b249414f38395864c /clang/lib/AST/ASTContext.cpp | |
parent | 51a685cf270ef7d49db47cd718689fbf0037255a (diff) | |
download | bcm5719-llvm-9a8d1d9e56ecdc052add3620b478253fda0cb615.tar.gz bcm5719-llvm-9a8d1d9e56ecdc052add3620b478253fda0cb615.zip |
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.
llvm-svn: 52914
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 08a2bb1357b..fa12364c52f 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -182,6 +182,20 @@ void ASTContext::InitBuiltinTypes() { // Type Sizing and Analysis //===----------------------------------------------------------------------===// +/// getFloatTypeSemantics - Return the APFloat 'semantics' for the specified +/// scalar floating point type. +const llvm::fltSemantics &ASTContext::getFloatTypeSemantics(QualType T) const { + const BuiltinType *BT = T->getAsBuiltinType(); + assert(BT && "Not a floating point type!"); + switch (BT->getKind()) { + default: assert(0 && "Not a floating point type!"); + case BuiltinType::Float: return Target.getFloatFormat(); + case BuiltinType::Double: return Target.getDoubleFormat(); + case BuiltinType::LongDouble: return Target.getLongDoubleFormat(); + } +} + + /// getTypeSize - Return the size of the specified type, in bits. This method /// does not work on incomplete types. std::pair<uint64_t, unsigned> |