Hi Revital,

Thank you very much.. This is very helpful. I was about to lost myself
in the code. I will try to experiment with your advices.

Also, having the opportunity, I would like to ask you if there is any
function to use for deleting a tree (most particularly a statement or
variable declaration tree) or it would be enough to assign it as NULL
(which does not seems to be a gentle solution).

Thanks,
Ferad Zyulkyarov

On 12/5/06, Revital1 Eres <[EMAIL PROTECTED]> wrote:

> I try to change the front-end tree structure of a c/c++ program as a
> side effect of execution of a pragma. The operations that are involved
> is to walk through in a tree (i.e "C" block), insertion of a tree
> (i.e. statement, block, declaration) in the abstract syntax tree and
> deletion of a tree (i.e. statement, block, declaration).

You can access the function's tree through it's call-graph node. (the
call-graph
node has a pointer to the function's tree declaration), than use
block_stmt_iterator (bsi) to iterate through the function's basic blocks;
each statement in the basic block can be recursively traversed via
walk_tree () function.  (see cgraph_create_edges () in cgraphunit.c).
build1 () function (tree.h) can be used to construct a new tree node.

Hope it helps,
Revital


Reply via email to