Statement and operand traversals#
There are two functions available for walking statements and
sequences: walk_gimple_stmt and walk_gimple_seq,
accordingly, and a third function for walking the operands in a
statement: walk_gimple_op.
-
tree walk_gimple_stmt(gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)#
This function is used to walk the current statement in
GSI, optionally using traversal state stored inWI. IfWIisNULL, no state is kept during the traversal.The callback
CALLBACK_STMTis called. IfCALLBACK_STMTreturns true, it means that the callback function has handled all the operands of the statement and it is not necessary to walk its operands.If
CALLBACK_STMTisNULLor it returns false,CALLBACK_OPis called on each operand of the statement viawalk_gimple_op. Ifwalk_gimple_opreturns non-NULLfor any operand, the remaining operands are not scanned.The return value is that returned by the last call to
walk_gimple_op, orNULL_TREEif noCALLBACK_OPis specified.
-
tree walk_gimple_op(gimple stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)#
Use this function to walk the operands of statement
STMT. Every operand is walked viawalk_treewith optional state information inWI.CALLBACK_OPis called on each operand ofSTMTviawalk_tree. Additional parameters towalk_treemust be stored inWI. For each operandOP,walk_treeis called as:walk_tree (&OP, CALLBACK_OP, WI, PSET)
If
CALLBACK_OPreturns non-NULLfor an operand, the remaining operands are not scanned. The return value is that returned by the last call towalk_tree, orNULL_TREEif noCALLBACK_OPis specified.
-
tree walk_gimple_seq(gimple_seq seq, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)#
This function walks all the statements in the sequence
SEQcallingwalk_gimple_stmton each one.WIis as inwalk_gimple_stmt. Ifwalk_gimple_stmtreturns non-NULL, the walk is stopped and the value returned. Otherwise, all the statements are walked andNULL_TREEreturned.