[PATCH] SPARC psABI fix, callee returns struct checking.

Richard Henderson rth@redhat.com
Thu Mar 9 16:54:00 GMT 2006


On Wed, Mar 08, 2006 at 05:38:04PM -0500, Carlos O'Donell wrote:
> @@ -6973,6 +6974,10 @@ c_finish_return (tree retval)
>  	}
>  
>        retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, t);
> +      condition = targetm.calls.struct_value_condition (current_function_decl);
> +      if (condition)
> +	retval = build3 (COND_EXPR, void_type_node, condition,
> +			 retval, integer_zero_node);

This is the wrong place to put this, conceptually.  This sort
of conditional should be expanded at the rtl level, and in a
language independant place.

> @@ -1087,14 +1087,19 @@ gimplify_return_expr (tree stmt, tree *p
>      result_decl = NULL_TREE;
>    else
>      {
> -      result_decl = TREE_OPERAND (ret_expr, 0);
> +      result_decl = ret_expr;
> +      if (TREE_CODE (result_decl) == COND_EXPR)
> +	result_decl = TREE_OPERAND (result_decl, 1);
> +      gcc_assert (TREE_CODE (ret_expr) == MODIFY_EXPR
> +		  || TREE_CODE (ret_expr) == INIT_EXPR
> +		  || TREE_CODE (ret_expr) == COND_EXPR);
> +      result_decl = TREE_OPERAND (result_decl, 0);

Which makes this bit of incorrect hackery unnecessary.

> +;; This pattern checks the instruction at the return address to see if
> +;; it is the expected unimp insn that indicates the structure return
> +;; value pointer is valid.  If it is valid, we adjust the return address
> +;; to skip the unimp instruction and fetch the structure value pointer into the

Why is this one big block?



r~



More information about the Gcc-patches mailing list