This is the mail archive of the gcc-patches@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: [tree-ssa] Fix variables getting out of their scope


Hello,

> > > > Changelog:
> > > > 	* tree-flow.h (struct block_tree): New.
> > > > 	(block_tree): Declare.
> > > >
> > > Why is this necessary?  Why not use the existing BLOCK_* macros?  As we
> > > build the CFG we annotate statements with the BLOCK that contains them. 
> > 
> > I am not quite sure what you refer to here? Neither stmt_ann_d nor
> > bb_ann_d contain anything that seems related.
> > 
> Sorry, I wasn't very clear.  What I mean is that instead of creating a
> new struct block_tree, we could just record the BLOCK where each
> statement belongs.
> 
> When you start building the basic blocks for the function, you start
> pointing all statements to DECL_INITIAL (fndecl).  Then every time you
> find a BIND_EXPR statement, you set the current block to be
> BIND_EXPR_BLOCK(stmt) so that statements inside that BIND_EXPR get
> associated with the new block.
> 
> In stmt_ann_d and bb_ann_d you just need a 'tree' field to record the
> block where the statement/block belongs to.

yes, it could also be done this way, although it seems mostly equivalent
to what I do.  I was reusing the stuff from the big ugly patch where
this tree is also used for handling eh constructs.

Should I rework it to be done your way?

Zdenek


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