This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: function-at-a-time processing in C
- To: chelf at codesourcery dot com
- Subject: Re: function-at-a-time processing in C
- From: Per Bothner <per at bothner dot com>
- Date: 14 Jun 2000 11:28:49 -0700
- Cc: gcc-patches at gcc dot gnu dot org
- References: <200006141729.KAA03434@heartofgold.stanford.edu>
Benjamin Chelf <chelf@codesourcery.com> writes:
> + DEFTREECODE (EXPR_STMT, "expr_stmt", 'e', 1)
> + DEFTREECODE (COMPOUND_STMT, "compound_stmt", 'e', 1)
> + DEFTREECODE (DECL_STMT, "decl_stmt", 'e', 1)
> + DEFTREECODE (IF_STMT, "if_stmt", 'e', 3)
> + DEFTREECODE (FOR_STMT, "for_stmt", 'e', 4)
> + DEFTREECODE (WHILE_STMT, "while_stmt", 'e', 2)
> + DEFTREECODE (DO_STMT, "do_stmt", 'e', 2)
This has serious problems.
First, where is the documentation? Yes, I can figure these out
from my knowledge of C, but I still want documentation.
Second, why is there an IF_STMT? What does it do that COND_EXPR
doesn't do?
Third, why are there separate FOR_STMT, WHILE_STMT, DO_STMT?
They are all variants of each other. In fact, they are all special
cases of LOOP_EXPR. Using separate tree codes means useless extra code,
and more difficulty writing optimizers.
> + /* A SCOPE_STMT marks the beginning or end of a scope. If
> + SCOPE_BEGIN_P holds, then this is the start of a scope. If
> + SCOPE_END_P holds, then this is the end of a scope. If
> + SCOPE_NULLIFIED_P holds then there turned out to be no variables in
> + this scope. The SCOPE_STMT_BLOCK is the BLOCK containing the
> + variables declared in this scope. */
> + DEFTREECODE (SCOPE_STMT, "scope_stmt", 'e', 1)
This is strange way to represent a scope.
> + DEFTREECODE (CASE_LABEL, "case_label", 'e', 2)
What are the two operands?
A final problem is that Java (when using the source code parser)
also represents methods as trees. Java should use the same tree
nodes as C/C++. That means java/java-tree.def should be partially
merged with tree.def - though that is primarily the job of the
Java people.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/