changeset 14:566b62a49462

More information about walk_code_tree()
author Thinker K.F. Li <thinker@codemud.net>
date Thu, 09 Sep 2010 18:23:50 +0800
parents 708921504d6d
children cf0d24827624
files src/cospy.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.