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 | test_for_singularity (gimple *, avail_exprs_stack *) |
edge | fold_cond (gcond *cond) |
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 |
gcond * | m_dummy_cond |
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_set_bit, cprop_into_successor_phis(), dbg_cnt(), dump_file, dump_flags, eliminate_redundant_computations(), gcc_checking_assert, 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, NULL, optimize_stmt(), record_edge_info(), record_equivalences_from_incoming_edge(), record_equivalences_from_phis(), set_global_ranges_from_unreachable_edges(), and TDF_DETAILS.
If possible, rewrite the conditional as TRUE or FALSE, and return the taken edge. Otherwise, return NULL.
References boolean_false_node, boolean_true_node, find_taken_edge(), gimple_bb(), gimple_cond_false_p(), gimple_cond_true_p(), m_ranger, and NULL.
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(), 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_convert, 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_cond_set_lhs(), 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_const_and_copies, m_ranger, maybe_clean_or_replace_eh_stmt(), need_eh_cleanup, need_noreturn_fixup, NULL, NULL_TREE, 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(), hashable_expr::rhs, si, hashable_expr::single, SSA_NAME_DEF_STMT, ssa_name_has_boolean_range(), TDF_DETAILS, TDF_SLIM, test_for_singularity(), TREE_CODE, TREE_TYPE, unlink_stmt_vdef(), update_stmt(), 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 |
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(), 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, and TREE_TYPE.
Referenced by before_dom_children().
|
private |
If STMT contains a relational test, try to convert it into an equality test if there is only a single value which can ever make the test true. For example, if the expression hash table contains: TRUE = (i <= 1) And we have a test within statement of i >= 1, then we can safely rewrite the test as i == 1 since there only a single value where the test is true. This is similar to code in VRP.
References as_a(), build_int_cst(), fold_build2, gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_assign_set_rhs2(), gimple_assign_set_rhs_code(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_cond_set_code(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gimple_set_modified(), integer_onep(), is_gimple_assign(), avail_exprs_stack::lookup_avail_expr(), m_dummy_cond, TREE_CODE, and TREE_TYPE.
|
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, basic_block_def::succs, and worklist.
Referenced by array_bounds_checker::check(), eliminate_with_rpo_vn(), find_comparisons(), get_non_trapping(), ipa_analyze_node(), ipcp_transform_function(), rewrite_blocks(), and substitute_and_fold_engine::substitute_and_fold().
|
private |
Referenced by after_dom_children(), before_dom_children(), dom_opt_dom_walker(), and optimize_stmt().
|
privateinherited |
Referenced by dom_walker(), walk(), and ~dom_walker().
|
private |
Referenced by after_dom_children(), before_dom_children(), dom_opt_dom_walker(), and optimize_stmt().
|
privateinherited |
Referenced by dom_walker(), and walk().
|
private |
Referenced by dom_opt_dom_walker(), and test_for_singularity().
|
private |
Referenced by dom_opt_dom_walker(), fold_cond(), optimize_stmt(), and set_global_ranges_from_unreachable_edges().
|
privateinherited |
Referenced by bb_reachable(), dom_walker(), and walk().
|
private |
Referenced by after_dom_children(), before_dom_children(), and dom_opt_dom_walker().
|
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().