[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

Chris Lattner clattner at apple.com
Mon Dec 11 15:32:40 PST 2006


> Implement correct bitcast of int<->float and long<->double by using a
> union to perform the bitcast.
> @@ -1508,6 +1508,16 @@
>  /// type name is found, emit its declaration...
>  ///
>  void CWriter::printModuleTypes(const SymbolTable &ST) {
> +  Out << "/* Helper union for bitcasts */\n";
> +  Out << "typedef union {\n";
> +  Out << "  unsigned int  UInt;\n";
> +  Out << "    signed int  SInt;\n";
> +  Out << "  unsigned long ULong;\n";
> +  Out << "    signed long SLong;\n";
> +  Out << "          float Float;\n";
> +  Out << "         double Double;\n";
> +  Out << "} llvmBitCastUnion;\n"

This is wrong for 32-bit targets.  ULong should be 'unsigned long  
long'.  SLong should be 'signed long long'.

Thanks Reid,

-Chris




More information about the llvm-commits mailing list