|
GCC Middle and Back End API Reference
|


Public Types | |
| enum | reachability { ALL_BLOCKS , REACHABLE_BLOCKS , REACHABLE_BLOCKS_PRESERVING_FLAGS } |
Public Member Functions | |
| dom_opt_dom_walker (cdi_direction direction, jump_threader *threader, dom_jt_state *state, gimple_ranger *ranger, const_and_copies *const_and_copies, avail_exprs_stack *avail_exprs_stack) | |
| edge | before_dom_children (basic_block) final override |
| void | after_dom_children (basic_block) final override |
| void | walk (basic_block) |
Static Public Attributes | |
| static const edge | STOP = (edge)-1 |
Private Member Functions | |
| edge | optimize_stmt (basic_block, gimple_stmt_iterator *, bool *) |
| void | set_global_ranges_from_unreachable_edges (basic_block) |
| void | fold_cond (gimple *) |
| void | record_equivalences_from_incoming_edge (basic_block) |
| void | eliminate_redundant_computations (gimple_stmt_iterator *) |
| void | record_equivalences_from_stmt (gimple *, int) |
| tree | const_or_copy_of_stmt (gimple *) |
| bool | bb_reachable (struct function *, basic_block) |
| void | propagate_unreachable_to_edges (basic_block, FILE *, dump_flags_t) |
Private Attributes | |
| class const_and_copies * | m_const_and_copies |
| class avail_exprs_stack * | m_avail_exprs_stack |
| jump_threader * | m_threader |
| gimple_ranger * | m_ranger |
| dom_jt_state * | m_state |
| enum cdi_direction | m_dom_direction: 2 |
| enum reachability | m_reachability: 2 |
| bool | m_user_bb_to_rpo |
| basic_block | m_unreachable_dom |
| int * | m_bb_to_rpo |
|
inherited |
|
inline |
|
finaloverridevirtual |
We have finished processing the dominator children of BB, perform any finalization actions in preparation for leaving this node in the dominator tree.
Reimplemented from dom_walker.
References bitmap_clear_bit(), basic_block_def::index, m_avail_exprs_stack, m_const_and_copies, m_state, and m_threader.
|
privateinherited |
Return TRUE if BB is reachable, false otherwise.
References ALL_BLOCKS, CDI_DOMINATORS, dominated_by_p(), ENTRY_BLOCK_PTR_FOR_FN, FOR_EACH_EDGE, m_reachability, m_unreachable_dom, and basic_block_def::preds.
Referenced by walk().
|
finaloverridevirtual |
Reimplemented from dom_walker.
References bitmap_clear_bit(), bitmap_set_bit, cprop_into_successor_phis(), dbg_cnt(), dump_file, dump_flags, eliminate_redundant_computations(), FOR_EACH_SSA_TREE_OPERAND, gcc_checking_assert, gimple_get_lhs(), gimple_set_visited(), gimple_visited_p(), gsi_end_p(), gsi_last_bb(), gsi_next(), gsi_prev(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), basic_block_def::index, m_avail_exprs_stack, m_const_and_copies, m_state, names_without_foldable_uses, NULL, optimize_stmt(), record_edge_info(), record_equivalences_from_incoming_edge(), record_equivalences_from_phis(), set_global_ranges_from_unreachable_edges(), SSA_NAME_VERSION, SSA_OP_USE, TDF_DETAILS, and TREE_CODE.
Return the constant STMT computes, and barring that, an operand its result is equivalent to. NULL if neither.
References gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_class(), GIMPLE_BINARY_RHS, is_gimple_assign(), m_ranger, NULL_TREE, and VREL_EQ.
Referenced by eliminate_redundant_computations().
|
private |
Search for redundant computations in STMT. If any are found, then replace them with the variable holding the result of the computation. If safe, record this expression into the tables.
References boolean_type_node, const_or_copy_of_stmt(), dump_file, dump_flags, dyn_cast(), fold_convert, gcc_assert, gcc_checking_assert, gcc_unreachable, gimple_assign_lhs(), gimple_call_lhs(), gimple_get_lhs(), gimple_phi_result(), gimple_set_modified(), gimple_switch_index(), gimple_vdef(), gsi_stmt(), is_gimple_assign(), is_gimple_call(), is_gimple_min_invariant(), m_avail_exprs_stack, m_const_and_copies, may_propagate_copy_into_stmt(), opt_stats_d::num_exprs_considered, opt_stats_d::num_re, opt_stats, print_generic_expr(), print_gimple_expr(), propagate_tree_value_into_stmt(), simple_iv_increment_p(), SSA_NAME_OCCURS_IN_ABNORMAL_PHI, TDF_DETAILS, TREE_CODE, TREE_TYPE, and useless_type_conversion_p().
Referenced by before_dom_children(), and optimize_stmt().
|
private |
Fold the conditional STMT with range info.
References dyn_cast(), gimple_set_modified(), m_ranger, and simplify::simplify().
Referenced by optimize_stmt().
|
private |
Optimize the statement in block BB pointed to by iterator SI. We try to perform some simplistic global redundancy elimination and constant propagation: 1- To detect global redundancy, we keep track of expressions that have been computed in this block and its dominators. If we find that the same expression is computed more than once, we eliminate repeated computations by using the target of the first one. 2- Constant values and copy assignments. This is used to do very simplistic constant and copy propagation. When a constant or copy assignment is found, we map the value on the RHS of the assignment to the variable in the LHS in the CONST_AND_COPIES table. 3- Very simple redundant store elimination is performed. 4- We can simplify a condition to a constant or from a relational condition to an equality condition.
References as_a(), bitmap_set_bit, boolean_type_node, cfg_altered, cprop_into_stmt(), DECL_HARD_REGISTER, dom_valueize(), dump_file, dump_flags, dyn_cast(), eliminate_redundant_computations(), expr_hash_elt::expr(), EXPR_SINGLE, find_taken_edge(), fndecl_built_in_p(), fold_binary_loc(), fold_cond(), fold_stmt(), gcc_unreachable, gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_single_p(), gimple_bb(), gimple_build_assign(), gimple_call_fndecl(), gimple_call_lhs(), gimple_call_noreturn_p(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_make_false(), gimple_cond_make_true(), gimple_cond_rhs(), gimple_goto_dest(), gimple_has_side_effects(), gimple_location(), gimple_modified_p(), gimple_set_modified(), gimple_set_vuse(), gimple_switch_index(), gimple_vuse(), gsi_remove(), gsi_stmt(), basic_block_def::index, integer_onep(), integer_zero_node, integer_zerop(), is_gimple_assign(), is_gimple_call(), hashable_expr::kind, m_avail_exprs_stack, m_ranger, maybe_clean_or_replace_eh_stmt(), need_eh_cleanup, need_noreturn_fixup, NULL, NULL_TREE, opt_stats_d::num_stmts, operand_equal_p(), hashable_expr::ops, opt_stats, print_gimple_stmt(), propagate_tree_value_into_stmt(), recompute_tree_invariant_for_addr_expr(), record_equivalences_from_stmt(), reduce_vector_comparison_to_scalar_comparison(), refs_same_for_tbaa_p(), release_defs(), si, SSA_NAME_DEF_STMT, TDF_DETAILS, TDF_SLIM, TREE_CODE, unlink_stmt_vdef(), and update_stmt_if_modified().
Referenced by before_dom_children().
|
privateinherited |
BB has been determined to be unreachable. Propagate that property to incoming and outgoing edges of BB as appropriate.
References CDI_DOMINATORS, dominated_by_p(), dump_file, dump_flags, FOR_EACH_EDGE, basic_block_def::index, m_unreachable_dom, basic_block_def::preds, basic_block_def::succs, and TDF_DETAILS.
Referenced by walk().
|
private |
Record any equivalences created by the incoming edge to BB. If BB has more than one incoming edge, then no equivalence is created.
References CDI_DOMINATORS, get_immediate_dominator(), m_avail_exprs_stack, m_const_and_copies, m_state, record_temporary_equivalences(), and single_pred_edge_ignoring_loop_edges().
Referenced by before_dom_children().
|
private |
STMT, a GIMPLE_ASSIGN, may create certain equivalences, in either the available expressions table or the const_and_copies table. Detect and record those equivalences. We handle only very simple copy equivalences here. The heavy lifing is done by eliminate_redundant_computations.
References build1(), dom_valueize(), dump_file, dump_flags, fold_build2, fold_convert, gcc_assert, gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_assign_single_p(), gimple_build_assign(), gimple_has_volatile_ops(), gimple_references_memory_p(), gimple_set_vuse(), gimple_vdef(), is_gimple_assign(), is_gimple_min_invariant(), is_gimple_reg(), m_avail_exprs_stack, print_generic_expr(), ptr_type_node, set_ssa_name_value(), SSA_NAME_DEF_STMT, TDF_DETAILS, TREE_CODE, TREE_TYPE, and unshare_expr().
Referenced by optimize_stmt().
|
private |
Set global ranges that can be determined from the C->M edge:
<bb C>:
...
if (something)
goto <bb N>;
else
goto <bb M>;
<bb N>:
__builtin_unreachable ();
<bb M>:
References all_uses_feed_or_dominated_by_stmt(), assert_unreachable_fallthru_edge_p(), FOR_EACH_GORI_EXPORT_NAME, gimple_bb(), gimple_cond_lhs(), gimple_cond_rhs(), gsi_last_bb(), m_ranger, maybe_set_nonzero_bits(), r, set_range_info(), single_pred_edge_ignoring_loop_edges(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, TREE_CODE, and TREE_TYPE.
Referenced by before_dom_children().
|
inherited |
Recursively walk the dominator tree. BB is the basic block we are currently visiting.
References after_dom_children(), bb_reachable(), before_dom_children(), CDI_DOMINATORS, cfun, dump_file, dump_flags, EDGE_COUNT, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, first_dom_son(), FOR_EACH_EDGE, free(), i, last_basic_block_for_fn, m_bb_to_rpo, m_dom_direction, m_reachability, m_unreachable_dom, m_user_bb_to_rpo, n_basic_blocks_for_fn, next_dom_son(), NULL, pre_and_rev_post_order_compute(), basic_block_def::preds, propagate_unreachable_to_edges(), REACHABLE_BLOCKS, set_all_edges_as_executable(), sort_bbs_postorder(), STOP, and basic_block_def::succs.
Referenced by eliminate_with_rpo_vn(), ipcp_transform_function(), and substitute_and_fold_engine::substitute_and_fold().
|
private |
|
privateinherited |
Referenced by dom_walker(), walk(), and ~dom_walker().
|
private |
|
privateinherited |
Referenced by dom_walker(), and walk().
|
private |
|
privateinherited |
Referenced by bb_reachable(), dom_walker(), and walk().
|
private |
|
private |
Referenced by after_dom_children(), and dom_opt_dom_walker().
|
privateinherited |
Referenced by bb_reachable(), dom_walker(), propagate_unreachable_to_edges(), and walk().
|
privateinherited |
Referenced by dom_walker(), walk(), and ~dom_walker().
Referenced by rewrite_update_dom_walker::before_dom_children(), and walk().