This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Merging stmt_ann_d into tree_statement_list_node


Hello,

> > 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.)

I would go just for having

union
{
  struct stmt_list_node *container;	/* For gimple statements.  */
  tree_ann_t ann;			/* For everything else.  */
}

(Plus some GTY annotations around that enable the garbage collector to
recognize this case; as far as my memory serves, I needed something
similar once and it was doable).  This way you won't waste space
for the useless tree_statement_list_node "type field".

Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]