GCC Middle and Back End API Reference
gimple-walk.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "stmt.h"
Include dependency graph for gimple-walk.cc:

Functions

gimplewalk_gimple_seq_mod (gimple_seq *pseq, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
 
gimplewalk_gimple_seq (gimple_seq seq, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
 
static tree walk_gimple_asm (gasm *stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
 
tree walk_gimple_op (gimple *stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
 
tree walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
 
static tree get_base_loadstore (tree op)
 
bool walk_stmt_load_store_addr_ops (gimple *stmt, void *data, walk_stmt_load_store_addr_fn visit_load, walk_stmt_load_store_addr_fn visit_store, walk_stmt_load_store_addr_fn visit_addr)
 
bool walk_stmt_load_store_ops (gimple *stmt, void *data, walk_stmt_load_store_addr_fn visit_load, walk_stmt_load_store_addr_fn visit_store)
 

Function Documentation

◆ get_base_loadstore()

static tree get_base_loadstore ( tree op)
static
From a tree operand OP return the base of a load or store operation
or NULL_TREE if OP is not a load or a store.   

References DECL_P, ggc_alloc(), handled_component_p(), INDIRECT_REF_P, NULL_TREE, TREE_CODE, and TREE_OPERAND.

Referenced by walk_stmt_load_store_addr_ops().

◆ walk_gimple_asm()

◆ walk_gimple_op()

tree walk_gimple_op ( gimple * stmt,
walk_tree_fn callback_op,
struct walk_stmt_info * wi )
Helper function of WALK_GIMPLE_STMT.  Walk every tree operand in
STMT.  CALLBACK_OP and WI are as in WALK_GIMPLE_STMT.

CALLBACK_OP is called on each operand of STMT via walk_tree.
Additional parameters to walk_tree must be stored in WI.  For each operand
OP, walk_tree is called as:

     walk_tree (&OP, CALLBACK_OP, WI, WI->PSET)

If CALLBACK_OP returns non-NULL for an operand, the remaining
operands are not scanned.

The return value is that returned by the last call to walk_tree, or
NULL_TREE if no CALLBACK_OP is specified.   

References ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_class(), gimple_assume_guard_ptr(), gimple_call_arg(), gimple_call_arg_ptr(), gimple_call_chain_ptr(), gimple_call_fn_ptr(), gimple_call_lhs(), gimple_call_lhs_ptr(), gimple_call_num_args(), gimple_catch_types_ptr(), gimple_eh_filter_types_ptr(), gimple_num_ops(), gimple_omp_atomic_load_lhs_ptr(), gimple_omp_atomic_load_rhs_ptr(), gimple_omp_atomic_store_val_ptr(), gimple_omp_continue_control_def_ptr(), gimple_omp_continue_control_use_ptr(), gimple_omp_critical_clauses_ptr(), gimple_omp_critical_name_ptr(), gimple_omp_for_clauses_ptr(), gimple_omp_for_collapse(), gimple_omp_for_final_ptr(), gimple_omp_for_incr_ptr(), gimple_omp_for_index_ptr(), gimple_omp_for_initial_ptr(), gimple_omp_ordered_clauses_ptr(), gimple_omp_parallel_child_fn_ptr(), gimple_omp_parallel_clauses_ptr(), gimple_omp_parallel_data_arg_ptr(), gimple_omp_return_lhs_ptr(), gimple_omp_scan_clauses_ptr(), gimple_omp_sections_clauses_ptr(), gimple_omp_sections_control_ptr(), gimple_omp_single_clauses_ptr(), gimple_omp_target_child_fn_ptr(), gimple_omp_target_clauses_ptr(), gimple_omp_target_data_arg_ptr(), gimple_omp_task_arg_align_ptr(), gimple_omp_task_arg_size_ptr(), gimple_omp_task_child_fn_ptr(), gimple_omp_task_clauses_ptr(), gimple_omp_task_copy_fn_ptr(), gimple_omp_task_data_arg_ptr(), gimple_omp_teams_clauses_ptr(), gimple_op_ptr(), gimple_phi_arg_def_ptr(), gimple_phi_num_args(), gimple_phi_result_ptr(), GIMPLE_SINGLE_RHS, gimple_statement_structure(), gimple_transaction_label_norm_ptr(), gimple_transaction_label_over_ptr(), gimple_transaction_label_uninst_ptr(), i, is_gimple_reg(), is_gimple_reg_type(), NULL, NULL_TREE, TREE_TYPE, walk_gimple_asm(), and walk_tree.

Referenced by check_array_bounds_dom_walker::before_dom_children(), convert_tramp_reference_stmt(), discover_nonconstant_array_refs(), eliminate_local_variables_stmt(), execute_oacc_device_lower(), insert_debug_temp_for_var_def(), ipa_simd_modify_function_body(), lower_emutls_stmt(), lower_omp_1(), lower_omp_regimplify_operands(), move_stmt_r(), note_simd_array_uses(), optimize_va_list_gpr_fpr_size(), remap_gimple_stmt(), vect_detect_hybrid_slp(), verify_gimple_in_cfg(), and walk_gimple_stmt().

◆ walk_gimple_seq()

◆ walk_gimple_seq_mod()

gimple * walk_gimple_seq_mod ( gimple_seq * pseq,
walk_stmt_fn callback_stmt,
walk_tree_fn callback_op,
struct walk_stmt_info * wi )
Gimple walk support.

   Copyright (C) 2007-2024 Free Software Foundation, Inc.
   Contributed by Aldy Hernandez <aldyh@redhat.com>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Walk all the statements in the sequence *PSEQ calling walk_gimple_stmt
on each one.  WI is as in walk_gimple_stmt.

If walk_gimple_stmt returns non-NULL, the walk is stopped, and the
value is stored in WI->CALLBACK_RESULT.  Also, the statement that
produced the value is returned if this statement has not been
removed by a callback (wi->removed_stmt).  If the statement has
been removed, NULL is returned.

Otherwise, all the statements are walked and NULL returned.   

References g, gcc_assert, ggc_alloc(), gsi_end_p(), gsi_next(), gsi_start(), gsi_stmt(), NULL, NULL_TREE, and walk_gimple_stmt().

Referenced by diagnose_omp_structured_block_errors(), diagnose_sb_2(), execute_lower_coro_builtins(), execute_lower_tm(), expand_FALLTHROUGH(), lower_omp_for_scan(), lower_transaction(), move_stmt_r(), omp_oacc_kernels_decompose(), scan_omp(), scan_omp_simd_scan(), walk_body(), walk_gimple_seq(), and walk_gimple_stmt().

◆ walk_gimple_stmt()

tree walk_gimple_stmt ( gimple_stmt_iterator * gsi,
walk_stmt_fn callback_stmt,
walk_tree_fn callback_op,
struct walk_stmt_info * wi )
Walk the current statement in GSI (optionally using traversal state
stored in WI).  If WI is NULL, no state is kept during traversal.
The callback CALLBACK_STMT is called.  If CALLBACK_STMT indicates
that it has handled all the operands of the statement, its return
value is returned.  Otherwise, the return value from CALLBACK_STMT
is discarded and its operands are scanned.

If CALLBACK_STMT is NULL or it didn't handle the operands,
CALLBACK_OP is called on each operand of the statement via
walk_gimple_op.  If walk_gimple_op returns non-NULL for any
operand, the remaining operands are not scanned.  In this case, the
return value from CALLBACK_OP is returned.

In any other case, NULL_TREE is returned.   

References gcc_assert, ggc_alloc(), gimple_assume_body_ptr(), gimple_bind_body_ptr(), gimple_catch_handler_ptr(), gimple_eh_else_e_body_ptr(), gimple_eh_else_n_body_ptr(), gimple_eh_filter_failure_ptr(), gimple_has_location(), gimple_has_substatements(), gimple_location(), gimple_omp_body_ptr(), gimple_omp_for_pre_body_ptr(), gimple_transaction_body_ptr(), gimple_try_cleanup_ptr(), gimple_try_eval_ptr(), gimple_wce_cleanup_ptr(), gsi_stmt(), input_location, NULL, walk_gimple_op(), and walk_gimple_seq_mod().

Referenced by create_dispatcher_calls(), dump_enumerated_decls(), execute_omp_device_lower(), find_partitioned_var_uses(), lower_assumption(), move_block_to_fn(), and walk_gimple_seq_mod().

◆ walk_stmt_load_store_addr_ops()

bool walk_stmt_load_store_addr_ops ( gimple * stmt,
void * data,
walk_stmt_load_store_addr_fn visit_load,
walk_stmt_load_store_addr_fn visit_store,
walk_stmt_load_store_addr_fn visit_addr )

◆ walk_stmt_load_store_ops()

bool walk_stmt_load_store_ops ( gimple * stmt,
void * data,
walk_stmt_load_store_addr_fn visit_load,
walk_stmt_load_store_addr_fn visit_store )