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: TREE_USED for BLOCK


On Tue, 2004-07-06 at 15:02, Richard Kenner wrote:
> No, not really.  I didn't think there *were* any BLOCKs other than those
> in BIND_EXPR, so I was asking what those were.

This is how things worked in GCC2...

BLOCKs are used for all scoping info.  Every time the C compiler sees a
{ } pair, it calls push_scope/pop_scope (formerly pushlevel/poplevel),
and that creates a new BLOCK.  The debugging output files scan the BLOCK
tree to emit debug info for variables.  See for instance dbxout_block. 
The BLOCK tree is stored in a FUNCTION_DECL's DECL_INITIAL field.

BIND_EXPRs are special in that they have BLOCKs, but the blocks are not
emitted by the front ends, they are emitted by the middle-end.  When a
front end emits a BLOCK, it is inserted at the current point in the
BLOCK tree being constructed.  When the middle-end emits a BIND_EXPR
BLOCK, it needs to be inserted into the middle of an existing BLOCK tree
at an appropriate point.  BIND_EXPRS are used primarily for statement
expressions in the C front end, and may be used for other reasons by
other front ends.

In current sources, things are a bit different.  It may be that BLOCKs
always get inserted into BIND_EXPRs now.  I haven't needed to look at
this code anytime recently.

> Also, it looked like those always have TREE_USED set anyway.

I see that a lot of things have changed recently.  However, there are
still places that are creating BLOCK tree that are not immediately
setting the TREE_USED bit.  See for instance expand_call_inline in
tree-inline.c.  But it may be that this doesn't matter anymore.

The statement expression support works very differently now.  It would
have to in a post tree-ssa world.  In the new code it seems the BLOCK
for a statement expression will always have TREE_USED set, and
expand_expr no longer checks for TREE_USED.

There are still uses of it in the debug output files, but these are
probably useless now.  You could try deleting all of the code that
sets/check TREE_USED to see if anything breaks.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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