[llvm-commits] [llvm-gcc-4.2] r46004 - in /llvm-gcc-4.2/trunk/gcc: config/i386/i386.c config/i386/llvm-i386-target.h llvm-abi.h

Chris Lattner clattner at apple.com
Tue Jan 15 08:22:50 PST 2008


> URL: http://llvm.org/viewvc/llvm-project?rev=46004&view=rev
> Log:
> Make use of existing gcc facility to determine if an aggregate  
> argument should be passed ByVal in x86-64 mode.

Nice.

> +/* Target hook for llvm-abi.h. It returns true if an aggregate of the
> +   specified type should be passed in memory. This is only called for
> +   x86-64. */
> +int llvm_x86_64_should_pass_aggregate_in_memory(tree type) {
> +  int needed_intregs, needed_sseregs;
> +  enum machine_mode mode = type_natural_mode (type);
> +  return !examine_argument(mode, type, 1, &needed_intregs,  
> &needed_sseregs);

Please document what this is doing:

/* if examine_argument says that this arg takes 0 registers, it is  
passed in memory, pass with byval. */

or something.

> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Tue Jan 15  
> 02:18:25 2008
> @@ -62,8 +62,11 @@
>     }                                                           \
>   }
>
> +extern int llvm_x86_64_should_pass_aggregate_in_memory(tree);
> +
> #define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X)          \
> -  (!TARGET_64BIT)
> +  ((!TARGET_64BIT)                                              \
> +  ? true : llvm_x86_64_should_pass_aggregate_in_memory(X))

How about: (!TARGET_64BIT ||  
llvm_x86_64_should_pass_aggregate_in_memory(X))

-Chris



More information about the llvm-commits mailing list