[cfe-commits] r49898 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/CodeGen/CodeGenTypes.cpp
Nate Begeman
natebegeman at mac.com
Thu Apr 17 22:41:32 PDT 2008
Author: sampo
Date: Fri Apr 18 00:41:31 2008
New Revision: 49898
URL: http://llvm.org/viewvc/llvm-project?rev=49898&view=rev
Log:
Allow targets to override double size, alignment, and semantics, and tie this
information into the IR type codegen. This allows a target to codegen the C
'double' type as either double or float.
Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=49898&r1=49897&r2=49898&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Fri Apr 18 00:41:31 2008
@@ -36,6 +36,8 @@
// values are specified by the TargetInfo constructor.
bool CharIsSigned;
unsigned WCharWidth, WCharAlign;
+ unsigned DoubleWidth, DoubleAlign;
+
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
// TargetInfo Constructor. Default initializes all fields.
@@ -103,8 +105,8 @@
const llvm::fltSemantics *getFloatFormat() const { return FloatFormat; }
/// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
- unsigned getDoubleWidth() const { return 64; } // FIXME
- unsigned getDoubleAlign() const { return 32; } // FIXME
+ unsigned getDoubleWidth() const { return DoubleWidth; }
+ unsigned getDoubleAlign() const { return DoubleAlign; }
const llvm::fltSemantics *getDoubleFormat() const { return DoubleFormat; }
/// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=49898&r1=49897&r2=49898&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Fri Apr 18 00:41:31 2008
@@ -215,7 +215,9 @@
static_cast<unsigned>(Context.getTypeSize(T)));
case BuiltinType::Float: return llvm::Type::FloatTy;
- case BuiltinType::Double: return llvm::Type::DoubleTy;
+ case BuiltinType::Double:
+ return (Context.Target.getDoubleFormat() == &llvm::APFloat::IEEEdouble) ?
+ llvm::Type::DoubleTy : llvm::Type::FloatTy;
case BuiltinType::LongDouble:
// FIXME: mapping long double onto double.
return llvm::Type::DoubleTy;
More information about the cfe-commits
mailing list