GCC Middle and Back End API Reference
dom_opt_dom_walker Class Reference
Inheritance diagram for dom_opt_dom_walker:
Collaboration diagram for dom_opt_dom_walker:

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_copiesm_const_and_copies
 
class avail_exprs_stackm_avail_exprs_stack
 
gcondm_dummy_cond
 
jump_threaderm_threader
 
gimple_rangerm_ranger
 
dom_jt_statem_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
 

Member Enumeration Documentation

◆ reachability

enum dom_walker::reachability
inherited
Enumerator
ALL_BLOCKS 
REACHABLE_BLOCKS 
REACHABLE_BLOCKS_PRESERVING_FLAGS 

Constructor & Destructor Documentation

◆ dom_opt_dom_walker()

dom_opt_dom_walker::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 )
inline

Member Function Documentation

◆ after_dom_children()

void dom_opt_dom_walker::after_dom_children ( basic_block bb)
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(), and basic_block_def::index.

◆ bb_reachable()

bool dom_walker::bb_reachable ( struct function * fun,
basic_block bb )
privateinherited

◆ before_dom_children()

◆ fold_cond()

edge dom_opt_dom_walker::fold_cond ( gcond * cond)
private
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.

◆ optimize_stmt()

edge dom_opt_dom_walker::optimize_stmt ( basic_block bb,
gimple_stmt_iterator * si,
bool * removed_p )
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_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_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(), 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().

◆ propagate_unreachable_to_edges()

void dom_walker::propagate_unreachable_to_edges ( basic_block bb,
FILE * dump_file,
dump_flags_t dump_flags )
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, dom_walker::m_unreachable_dom, basic_block_def::preds, basic_block_def::succs, and TDF_DETAILS.

Referenced by dom_walker::walk().

◆ set_global_ranges_from_unreachable_edges()

void dom_opt_dom_walker::set_global_ranges_from_unreachable_edges ( basic_block bb)
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(), range_query::gori_ssa(), gsi_last_bb(), m_ranger, maybe_set_nonzero_bits(), r, gimple_ranger::range_on_edge(), set_range_info(), single_pred_edge_ignoring_loop_edges(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, and TREE_TYPE.

◆ test_for_singularity()

void dom_opt_dom_walker::test_for_singularity ( gimple * stmt,
avail_exprs_stack * avail_exprs_stack )
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(), TREE_CODE, and TREE_TYPE.

◆ walk()

Field Documentation

◆ m_avail_exprs_stack

class avail_exprs_stack* dom_opt_dom_walker::m_avail_exprs_stack
private

◆ m_bb_to_rpo

int* dom_walker::m_bb_to_rpo
privateinherited

◆ m_const_and_copies

class const_and_copies* dom_opt_dom_walker::m_const_and_copies
private

◆ m_dom_direction

enum cdi_direction dom_walker::m_dom_direction
privateinherited

Referenced by dom_walker::walk().

◆ m_dummy_cond

gcond* dom_opt_dom_walker::m_dummy_cond
private

◆ m_ranger

gimple_ranger* dom_opt_dom_walker::m_ranger
private

◆ m_reachability

enum reachability dom_walker::m_reachability
privateinherited

◆ m_state

dom_jt_state* dom_opt_dom_walker::m_state
private

◆ m_threader

jump_threader* dom_opt_dom_walker::m_threader
private

◆ m_unreachable_dom

basic_block dom_walker::m_unreachable_dom
privateinherited

◆ m_user_bb_to_rpo

bool dom_walker::m_user_bb_to_rpo
privateinherited

◆ STOP

const edge dom_walker::STOP = (edge)-1
staticinherited

The documentation for this class was generated from the following file: