Manipulating the tree Structure

Andrea Callia D'Iddio
Mon Mar 12 16:41:00 GMT 2007

Great! thank you! I tested with your code and it works... but I'm
still a bit confused.
Could you help me with this simple example?
Suppose that I obtained a tree structure with the following command:

tree stmt = bsi_stmt (si);

and suppose I want to execute the following task:

For each tree statement t:
  IF t is an assignment, then output variable name
  ELSE IF t is an IF statement then output the IF condition
  ELSE ...

how can I do this task?
Can you give me some reference?
Thanks to all,


On 3/12/07, Tehila Meyzels <> wrote:
> The key is whether the tree_code is "MODIFY_EXPR", which is (copied from
> tree.def):
> /* Assignment expression.  Operand 0 is the what to set; 1, the new value.
> */
> DEFTREECODE (MODIFY_EXPR, "modify_expr", tcc_expression, 2)
> So, I think you should do something like:
> enum tree_code code = TREE_CODE (stmt);
> switch (code)
> {
>       case MODIFY_EXPR:
> ...
> }
> Good luck,
> Tehila.

More information about the Gcc mailing list