> +
>  /* Create a new temporary name with PREFIX.  Returns an identifier.  */
>  
>  static GTY(()) unsigned int tmp_var_id_num;
> @@ -470,6 +521,18 @@ internal_get_tmp_var (tree val, tree *pr
>  
>    t = lookup_tmp_var (val, is_formal);
>  
> +  if (is_formal)
> +    {
> +      tree u = find_single_nonscalar_decl (val);
> +
> +      if (u && DECL_UNDERLYING_NONSCALAR_DECL (u))
> +     u = DECL_UNDERLYING_NONSCALAR_DECL (u);
> +      gcc_assert (!DECL_UNDERLYING_NONSCALAR_DECL (t)
> +               || DECL_UNDERLYING_NONSCALAR_DECL (t) == u);
> +      if (u && lang_hooks.types_compatible_p (TREE_TYPE (u), TREE_TYPE (t)))
> +     DECL_UNDERLYING_NONSCALAR_DECL (t) = u;
> +    }
> +


First, i'd rather see this named something that implies it's only used
for restrict.  Otherwise, people are going to start using it for other
things (the other possible uses i can think of, which possibly include
debug info, are already taken care of by DECL_VALUE_EXPR and
DECL_DEBUG_EXPR).

second, how often does this actually set anything useful with restrict
types (I assume the value is not interesting in any other cases)?

ISTM you'd be better off doing what we do with DECL_VALUE_EXPR,
DECL_DEBUG_EXPR, and DECL_INIT_PRIORITY, which is to use 1 bit to say
whether it has an "underlying nonscalar decl", and a side hashtable to
store the actual value.

I say this because I imagine the number of DECL's which are restrict
qualified, and thus, should have an underlying nonscalar-decl, is very
small, and yet, you've added a field that is there for *all* decl's with
rtl attached to them.

This would also solve your field-decl problem, since you could throw the
bit in the common part.

--Dan

Reply via email to