Hi Adnrew,

> > 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.
> 
> does that buy us much?

I have to try, but it seems to be the lowest hanging fruit as far as
the instruction chain infrastructure goes.

> Then why not simply shorten this to:
> 
> 1) put stmt annoation directly in the tree_statement_list_node
> 
> 2) replace stmt_ann_t pointer in stmt with a pointer to its BSI, or the
> tree_statement_list_node.  This makes bsi_from_stmt O(1) immediately.
> 
> 3) all stmts now have access to the stmt_ann directly in the
> stmt_list_node, nothing changes except get_stmt_ann() returns the
> address of the stmt ann within the tree_stmt_list_node.
> 
> 4) For fake stmts you will have to allocate a fake tree_stmt_list_node
> which isnt linked with anything, and set the bsi pointer to that... then
> you have the annotation and access to it from the stmt.
> 
> that seems like a quicker more direct approach then phasing it in
> slowly, with less impact to anyone, and gives you immediate benefits. I
> would think the patch to do this would be fairly small and
> non-intrusive.

This looks like a better approach.  How would we do your step 1?  We
have var_ann and tree_ann in addition to stmt_ann.  Shall we put a
type field at the beginning of tree_statement_list_node+stmt_ann_d so
that an annotation node can identify itself?  (Since all these tree
annotations already have a field for annotation type, it's more like
appending tree_statement_list_node to stmt_ann_d.)

Kazu Hirata

Reply via email to