GCC Middle and Back End API 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"
Functions | |
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_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) |
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, handled_component_p(), INDIRECT_REF_P, NULL_TREE, TREE_CODE, and TREE_OPERAND.
Referenced by walk_stmt_load_store_addr_ops().
|
static |
Helper function for walk_gimple_stmt. Walk operands of a GIMPLE_ASM.
References alloca, gimple_asm_input_op(), gimple_asm_label_op(), gimple_asm_ninputs(), gimple_asm_nlabels(), gimple_asm_noutputs(), gimple_asm_output_op(), i, NULL, NULL_TREE, parse_input_constraint(), parse_output_constraint(), TREE_PURPOSE, TREE_STRING_POINTER, TREE_VALUE, and walk_tree.
Referenced by 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 as_a(), 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(), execute_omp_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().
gimple * walk_gimple_seq | ( | gimple_seq | seq, |
walk_stmt_fn | callback_stmt, | ||
walk_tree_fn | callback_op, | ||
struct walk_stmt_info * | wi ) |
Like walk_gimple_seq_mod, but ensure that the head of SEQ isn't changed by the callbacks.
References gcc_assert, and walk_gimple_seq_mod().
Referenced by add_taskreg_looptemp_clauses(), adjust_region_code(), copy_gimple_seq_and_replace_locals(), diagnose_omp_structured_block_errors(), diagnose_sb_1(), diagnose_tm_1(), diagnose_tm_blocks(), duplicate_remap_omp_clause_seq(), gimplify_adjust_omp_clauses(), inline_forbidden_p(), lower_omp_taskreg(), lower_transaction(), make_loops_gang_single(), maybe_warn_implicit_fallthrough(), maybe_warn_switch_unreachable_and_auto_init(), omp_find_stores_stmt(), and transform_kernels_loop_clauses().
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-2025 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, 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().
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 as_a(), gcc_assert, 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().
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 ) |
For the statement STMT call the callbacks VISIT_LOAD, VISIT_STORE and VISIT_ADDR if non-NULL on loads, store and address-taken operands passing the STMT, the base of the operand, the operand itself containing the base and DATA to it. The base will be either a decl, an indirect reference (including TARGET_MEM_REF) or the argument of an address expression. Returns the results of these callbacks or'ed.
References CONSTRUCTOR_ELTS, dyn_cast(), FOR_EACH_CONSTRUCTOR_VALUE, get_base_loadstore(), gimple_asm_input_op(), gimple_asm_ninputs(), gimple_asm_noutputs(), gimple_asm_output_op(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_single_p(), gimple_call_arg(), gimple_call_chain(), gimple_call_lhs(), gimple_call_num_args(), gimple_call_return_slot_opt_p(), gimple_goto_dest(), gimple_num_ops(), gimple_op(), gimple_phi_arg_def(), gimple_phi_num_args(), gimple_return_retval(), handled_component_p(), i, is_gimple_assign(), NULL_TREE, OBJ_TYPE_REF_OBJECT, parse_input_constraint(), parse_output_constraint(), TREE_ADDRESSABLE, TREE_CODE, TREE_OPERAND, TREE_PURPOSE, TREE_STRING_POINTER, TREE_TYPE, and TREE_VALUE.
Referenced by add_scope_conflicts_1(), compute_live_vars_1(), gimple_ior_addresses_taken(), ipa_analyze_params_uses_in_bb(), cgraph_node::record_stmt_references(), scan_function(), verify_non_ssa_vars(), visit_bb(), and 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 ) |
Like walk_stmt_load_store_addr_ops but with NULL visit_addr. IPA-CP should make a faster clone for this case.
References NULL, and walk_stmt_load_store_addr_ops().
Referenced by check_stmt(), ipa_icf_gimple::func_checker::classify_operands(), compute_dependence_clique(), find_replaceable_in_bb(), gimple_infer_range::gimple_infer_range(), infer_nonnull_range_by_dereference(), and insert_trap().