PATCH: Gimplify VA_ARG_EXPR

Jason Merrill jason@redhat.com
Wed Jun 9 22:01:00 GMT 2004


On Wed, 9 Jun 2004 13:07:16 -0700, Richard Henderson <rth@redhat.com> wrote:

> On Wed, Jun 09, 2004 at 01:05:34AM -0400, Jason Merrill wrote:
>> +   tree valist = TREE_OPERAND (*expr_p, 0);
> ...
>> +   valist = build_fold_indirect_ref (valist);
>
> The argument to va_arg_expr isn't a pointer.

If you're referring to the use in ix86_gimplify_va_arg, the expander does
the same thing.  On x86_64 the argument is too a pointer, generated in
stabilize_va_list.

>
>> +   addr = create_tmp_var (ptr_type_node, "addr");
>> +   DECL_POINTER_ALIAS_SET (addr) = get_varargs_alias_set ();
>
> Alias set on the decl and not the type?  Isn't this going to be
> (potentially) broken by gimplification?

The alias bit dates from before I gave up on getting the varargs alias set
to work right now.  I figured it was harmless and might as well leave it in.

>> +   tree t = convert (build_pointer_type (type), null_pointer_node);
>
> fold_convert.

OK, thanks.

>> +       /* Make it easier for the backends by protecting the valist argument
>> +          from multiple evaluations.  */
>> +       valist = stabilize_va_list (valist, 0);
>
> Seems like the min_value thing would be better here.

stabilize_va_list predates this patch.  I tried moving the min_lval bit
from std_gimplify_va_arg_expr to here, but it broke on x86_64 because
valist is an ADDR_EXPR.  I could poke at that some more if you think it's
warranted.

Jason



More information about the Gcc-patches mailing list