This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa]: PRE updates
On Wed, 2003-06-11 at 09:27, Andrew MacLeod wrote:
> SO the code you are looking at above created thge a_5 PHI stmt... Its
> a_5 I am creating the var_ann for, because I just created it out of thin
> air.
>
But wait, var_ann(a_5) *must* be the same as var_ann(a_4) which is
var_ann(a). SSA_NAMEs do not have annotations, their associated
VAR_DECLs do. So, if you are only creating a new SSA_NAME for a
VAR_DECL that has been referenced already, then that VAR_DECL should
already have an annotation.
So, I still wonder why VAR_DECL 'a' didn't have an annotation. It
should.
> Index: tree-cfg.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
> retrieving revision 1.1.4.104
> diff -c -p -r1.1.4.104 tree-cfg.c
> *** tree-cfg.c 9 Jun 2003 22:37:01 -0000 1.1.4.104
> --- tree-cfg.c 11 Jun 2003 13:19:49 -0000
> *************** handle_switch_split (basic_block src, ba
> *** 3677,3684 ****
> --- 3677,3688 ----
> for (; phi; phi = TREE_CHAIN (phi))
> {
> tree new_phi;
> + var_ann_t ann;
> new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (phi)),
> new_bb);
> + ann = create_var_ann (PHI_RESULT (new_phi));
> + ann->has_real_refs = var_ann (PHI_RESULT (phi))->has_real_refs;
> +
>
Hmm, create_var_ann() shouldn't allow creating annotations on
SSA_NAMEs. We may want to change that, but in the current
implementation the above is wrong: var_ann (PHI_RESULT (phi)) will never
access the annotation you just created. The first thing var_ann() does
is peel the SSA_NAME wrapper to get at the VAR_DECL.
Which brings me to the real issue. Is it the case that we want to have
annotations on SSA_NAMEs instead of the _DECLs that they wrap? That is
a non-trivial change because var_ann_d describes attributes for
VAR_DECLs. Those attributes are shared by all the SSA_NAMEs created for
that _DECL.
Diego.