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: PATCH: Generalize tree-dumping infrastructure


Bryce McKinlay wrote:

> Java is happily doing functions as trees, but I suspect it is not 
> exactly the same representation as is used by C/C++? Certainly it 
> looks like something is going to have to change to get Java to use 
> tree-inline (which we would very much like to do).

Yes,  when the C/C++ people implemented representing whole functions
as trees they decided to add a whole slew of new tree types, instead of
re-using the existing ones.  Thus where Java represents a conditional (if)
statement the same way as it represents a conditional expression (using a
COND_EXPR), C/C++ use the new IF_STMT.  I don't understand the
reason for using the new tree nodes - it seems the wrong thing to do,
since it needlessly duplicates code and functionality, unless there
is some significant distinction.  I know C++ has the concept of
"sequence point", but that isn't the same as statement.  If you need to
dinstinguish expressions from statements for error messages or
debugging I would just use a single-bit flag for that.

Maybe I've been using expression languages (like Scheme) too long
to understand the reason for the new nodes.

    --Per




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