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: Help with BLOCK vs BIND_EXPR trees


On Tue, Jun 16, 2009 at 1:50 PM, Jerry Quinn<jlquinn@optonline.net> wrote:
> (trying again)
> Hi, all. ?I have a basic question about GENERIC trees.
>
> I'm playing with writing a front end, and find the distinction between
> BLOCK and BIND_EXPR to be somewhat confusing. ?In particular, I'm trying
> to get a handle on how to represent a function in GENERIC form.
>
> On the surface the texi docs and code comments don't seem to agree:
>
> Section on function trees say FUNCTION_DECL represents a function, and
> that DECL_INITIAL is not empty. ?But it doesn't say what should be
> contained there. ?It says DECL_SAVED_TREE should contain the body of the
> function.
>
> The comments in tree.h say that DECL_INITIAL holds the body of a
> function, with a BLOCK tree at the root.
>
> BLOCK nodes are described under TREE_SSA->GIMPLE, though these nodes are
> part of GENERIC if I understand correctly. ?At least, the docs say that
> any tree code found in tree.def is part of GENERIC. ?In this section, it says
> that block scopes and variables are declared in BIND_EXPR nodes.
>
> Can someone please clarify how these things are supposed to fit together in
> GENERIC form, assuming the default conversion to GIMPLE will be used?

BIND_EXPRs are containers for local variables in the GENERIC
function body (they persist until GIMPLE is lowered).  BLOCKs
represent the scope tree of the function (which also refers to
local variables).  The BLOCK tree is kept live throughout the
compilation and is used to generate proper debug information
for example.

Richard.


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