Hi Andrew,

> OK, let me word it a different way.  What is create_stmt_ann (stmt)
> going to do with the annotation it creates? You are moving the
> stmt_ann_t pointer from the stmt node to the tree_statement_list_node...
> so there will be nothing in the stmt node to attach the annotation to
> like there is now.

Ah, OK.  I am going to keep

  union tree_ann_d *ann;

in tree_common.  So create_stmt_ann will store a pointer to stmt_ann_d
in ann in tree_common just like before.  In other words, for normal
cases, we would have

  tree_statement_list_node+stmt_ann_d
      |                      ^
      | via stmt             | via ann in tree_common
      v                      |
    MODIFY_EXPR -------------+

For DOM's case, we would have

                           stmt_ann_d
                             ^
                             | via ann in tree_common
                             |
    MODIFY_EXPR -------------+

So stmt_ann_d won't be hanging in space.

> I though the whole point of this exercise was to remove the
> stmt_ann_t pointer from the stmt node, and put it directly in the
> tree_statement_list_node.  Im saying that will not work until you
> either change DOM to not use these fake stmt's, or figure out some
> way of associating a stmt_ann to these fake stmts.

No, I would like to remove stmt_ann_t pointer from the stmt node, but
not yet.  All I want to do in this project is to put
tree_statement_list_node and stmt_ann_d next to each other in memory
while doing necessary adjustments in the compiler.  Nothing more than
that.

Yes, it is nice to get rid of stmt_ann_t pointer from the stmt node,
and I want to eventually get that, but not in this project.  I think
there are so many places that use "stmt" instead of "bsi".  They may
either pass it to subroutines or put it in some internal data
structures, so I would like to do that separately.  So if you like,
the roadmap might be something like

1. Put tree_statement_list_node and stmt_ann_d next to each other in
   memory while doing necessary adjustments.

2. Provide stmt_ann_from_bsi(), a function that gives you stmt_ann
   given bsi.

3. Let everybody use stmt_ann_from_bsi(), replace stmt_ann(), and
   remove the stmt_ann_t pointer from the stmt node (if these are
   possible at all).

4. Hand off to Zdenek for his flat statement project.

I hope this message clarifies things.

Kazu Hirata

Reply via email to