[cfe-commits] r49898 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/CodeGen/CodeGenTypes.cpp

Chris Lattner clattner at apple.com
Thu Apr 17 22:43:22 PDT 2008


On Apr 17, 2008, at 10:41 PM, Nate Begeman wrote:
> 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.

Please initialize DoubleWidth/DoubleAlign in the TargetInfo to 64/32.

-Chris

>
>
> 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;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list