# HG changeset patch # User Thinker K.F. Li # Date 1284027830 -28800 # Node ID 566b62a49462efc89ee873d6d3cc15d11bcf8537 # Parent 708921504d6da794da3ab14866ab4ddf9a525861 More information about walk_code_tree() diff -r 708921504d6d -r 566b62a49462 src/cospy.c --- a/src/cospy.c Thu Sep 09 18:16:50 2010 +0800 +++ b/src/cospy.c Thu Sep 09 18:23:50 2010 +0800 @@ -110,6 +110,12 @@ } } +/*! \brief Trival tree of GIMPLE code with a callback. + * + * walk_code_free() would call the function given by cb with + * expression and data as arguments. The cb is called only for the + * node with tree code value given by accept_code. + */ static void walk_code_tree(tree expr, int accept_code, void (*cb)(tree, void *), void *data) { @@ -193,6 +199,7 @@ break; case BIND_EXPR: + /* See BIND_EXPR in tree.def */ child = BIND_EXPR_BODY(expr); walk_code_tree(child, accept_code, cb, data); break; @@ -293,6 +300,7 @@ break; case STATEMENT_LIST: + /* See STATEMENT_LIST in tree.def of GCC */ for(stmt_itr = tsi_start(expr); !tsi_end_p(stmt_itr); tsi_next(&stmt_itr)) { @@ -377,7 +385,6 @@ bind = DECL_SAVED_TREE(fn); /* BIND_EXPR */ body = BIND_EXPR_BODY(bind); walk_code_tree(body, CALL_EXPR, found_call, NULL); - printf("%d:%d\n", TREE_CODE(body), BIND_EXPR); } /*! \brief This function is called before running all_passes.