gccint: Statement and operand traversals
1
1 12.12 Statement and operand traversals
1 ======================================
1
1 There are two functions available for walking statements and sequences:
1 'walk_gimple_stmt' and 'walk_gimple_seq', accordingly, and a third
1 function for walking the operands in a statement: 'walk_gimple_op'.
1
1 -- GIMPLE function: tree walk_gimple_stmt (gimple_stmt_iterator *gsi,
1 walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct
1 walk_stmt_info *wi)
1 This function is used to walk the current statement in 'GSI',
1 optionally using traversal state stored in 'WI'. If 'WI' is
1 'NULL', no state is kept during the traversal.
1
1 The callback 'CALLBACK_STMT' is called. If 'CALLBACK_STMT' returns
1 true, it means that the callback function has handled all the
1 operands of the statement and it is not necessary to walk its
1 operands.
1
1 If 'CALLBACK_STMT' is 'NULL' or it returns false, 'CALLBACK_OP' is
1 called on each operand of the statement via 'walk_gimple_op'. If
1 'walk_gimple_op' returns non-'NULL' for any operand, the remaining
1 operands are not scanned.
1
1 The return value is that returned by the last call to
1 'walk_gimple_op', or 'NULL_TREE' if no 'CALLBACK_OP' is specified.
1
1 -- GIMPLE function: tree walk_gimple_op (gimple stmt, walk_tree_fn
1 callback_op, struct walk_stmt_info *wi)
1 Use this function to walk the operands of statement 'STMT'. Every
1 operand is walked via 'walk_tree' with optional state information
1 in 'WI'.
1
1 'CALLBACK_OP' is called on each operand of 'STMT' via 'walk_tree'.
1 Additional parameters to 'walk_tree' must be stored in 'WI'. For
1 each operand 'OP', 'walk_tree' is called as:
1
1 walk_tree (&OP, CALLBACK_OP, WI, PSET)
1
1 If 'CALLBACK_OP' returns non-'NULL' for an operand, the remaining
1 operands are not scanned. The return value is that returned by the
1 last call to 'walk_tree', or 'NULL_TREE' if no 'CALLBACK_OP' is
1 specified.
1
1 -- GIMPLE function: tree walk_gimple_seq (gimple_seq seq, walk_stmt_fn
1 callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info
1 *wi)
1 This function walks all the statements in the sequence 'SEQ'
1 calling 'walk_gimple_stmt' on each one. 'WI' is as in
1 'walk_gimple_stmt'. If 'walk_gimple_stmt' returns non-'NULL', the
1 walk is stopped and the value returned. Otherwise, all the
1 statements are walked and 'NULL_TREE' returned.
1