[tree-ssa] verify_stmts and verify_ssa

Richard Henderson rth@redhat.com
Fri Nov 21 06:03:00 GMT 2003


On Fri, Nov 21, 2003 at 02:41:53AM +0100, Jan Hubicka wrote:
> +       if (TREE_CODE (x) == ARRAY_REF
> + 	  || TREE_CODE (x) == COMPONENT_REF
> + 	  || TREE_CODE (x) == REALPART_EXPR
> + 	  || TREE_CODE (x) == IMAGPART_EXPR)
> + 	x = TREE_OPERAND (x, 0);

This must be a while loop.  At least for the ARRAY_REF and
COMPONENT_REF parts.

> +       if (TREE_CODE (x) == STRING_CST
> + 	  || TREE_CODE (x) == LABEL_DECL
> + 	  || TREE_CODE (x) == FUNCTION_DECL)
> + 	return NULL;
> +       if (!TREE_ADDRESSABLE (x))
> +         return x;

You'd better have a VAR_DECL or PARM_DECL here.

> +   if ((TREE_CODE (t) == ARRAY_REF
> +        || TREE_CODE (t) == COMPONENT_REF)
> +       && DECL_P (TREE_OPERAND (t, 0))
> +       && is_gimple_min_invariant (TREE_OPERAND (t, 1)))

Again a while loop.  Here you have to be more clever though,
since you've got to check is_gimple_min_invariant for each
ARRAY_REF index.  Also, is_gimple_min_invariant is wrong to
apply to the FIELD_DECL of a COMPONENT_REF; I'm surprised
nothing went wrong.



r~



More information about the Gcc-patches mailing list