|
| | predicate (predicate_id *p_, location_t loc) |
| | predicate (bool empty_val) |
| | predicate (const predicate &rhs) |
| | ~predicate () |
| predicate & | operator= (const predicate &) |
| bool | is_empty () const |
| bool | is_true () const |
| bool | is_false () const |
| bool | empty_val () const |
| const pred_chain_union | chain () const |
| void | init_from_control_deps (const vec< edge > *, unsigned, bool) |
| void | dump (FILE *) const |
| void | dump (FILE *, gimple *, const char *) const |
| void | debug () const |
| void | normalize (gimple *=NULL, bool=false) |
| void | simplify (gimple *=NULL, bool=false) |
| bool | superset_of (const predicate &) const |
| bool | drop_conjuncts_implied_by (const vec< pred_info > &) |
| virtual void | gen_transform (FILE *, int, const char *, bool, int, const char *, capture_info *, dt_operand **=0, int=0, const char *=nullptr) |
A predicate operand. Predicates are leafs in the AST.
Represents a complex Boolean predicate expression.
| bool predicate::drop_conjuncts_implied_by |
( |
const vec< pred_info > & | edge_conds | ) |
|
Remove from every chain in *THIS any (comparison) conjunct whose domain is
a superset of every predicate in EDGE_CONDS, i.e. a conjunct implied by all
of them. Returns true if any conjunct was removed. If all the conjuncts
of a chain are removed the chain is TRUE, and with it the whole predicate,
which is then left empty with M_CVAL set.
References chain(), i, m_cval, m_preds, subset_of(), tcc_comparison, and TREE_CODE_CLASS.
Referenced by uninit_analysis::is_use_guarded().
Return true if the domain defined by the predicate chain PREDS is
a subset of the domain of *THIS. Return false if PREDS's domain
is not a subset of any of the sub-domains of *THIS (corresponding
to each individual chains in it), even though it may be still be
a subset of whole domain of *THIS which is the union (ORed) of all
its subdomains. In other words, the result is conservative.
References chain(), i, m_preds, and subset_of().
Referenced by superset_of().
| void predicate::init_from_control_deps |
( |
const vec< edge > * | dep_chains, |
|
|
unsigned | num_chains, |
|
|
bool | is_use ) |
Convert the chains of control dependence edges into a set of predicates.
A control dependence chain is represented by a vector edges. DEP_CHAINS
points to an array of NUM_CHAINS dependence chains. One edge in
a dependence chain is mapped to predicate expression represented by
pred_info type. One dependence chain is converted to a composite
predicate that is the result of AND operation of pred_info mapped to
each edge. A composite predicate is represented by a vector of
pred_info. Sets M_PREDS to the resulting composite predicates.
References CASE_CHAIN, CASE_HIGH, CASE_LOW, cfun, chain(), pred_info::cond_code, DEBUG_PREDICATE_ANALYZER, dump(), dump_file, dump_pred_info(), dyn_cast(), EDGE_COUNT, empty_block_p(), FOR_EACH_EDGE, format_edge_vecs(), fputc(), gcc_assert, get_cases_for_edge(), get_pred_info_from_cond_edge(), gimple_switch_index(), gsi_last_bb(), i, pred_info::invert, is_empty(), m_cval, m_preds, operand_equal_p(), pred_info::pred_lhs, pred_info::pred_rhs, single_succ_p(), stmt_can_throw_internal(), wi::to_widest(), TREE_TYPE, and wide_int_to_tree().
Referenced by uninit_analysis::init_from_phi_def(), and uninit_analysis::init_use_preds().
Attempt to normalize predicate chains by following UD chains by
building up a big tree of either IOR operations or AND operations,
and converting the IOR tree into a pred_chain_union or the BIT_AND
tree into a pred_chain.
Example:
_3 = _2 RELOP1 _1;
_6 = _5 RELOP2 _4;
_9 = _8 RELOP3 _7;
_10 = _3 | _6;
_12 = _9 | _0;
_t = _10 | _12;
then _t != 0 will be normalized into a pred_chain_union
(_2 RELOP1 _1) OR (_5 RELOP2 _4) OR (_8 RELOP3 _7) OR (_0 != 0)
Similarly given:
_3 = _2 RELOP1 _1;
_6 = _5 RELOP2 _4;
_9 = _8 RELOP3 _7;
_10 = _3 & _6;
_12 = _9 & _0;
then _t != 0 will be normalized into a pred_chain:
(_2 RELOP1 _1) AND (_5 RELOP2 _4) AND (_8 RELOP3 _7) AND (_0 != 0)
Normalize predicate PRED:
1) if PRED can no longer be normalized, append it to *THIS.
2) otherwise if PRED is of the form x != 0, follow x's definition
and put normalized predicates into WORK_LIST.
References pred_info::cond_code, get_pred_info_from_cmp(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_phi_arg_def(), gimple_phi_num_args(), i, integer_zerop(), pred_info::invert, is_degenerate_phi(), is_gimple_min_invariant(), is_neq_zero_form_p(), pred_info::pred_lhs, pred_info::pred_rhs, push_pred(), push_to_worklist(), SSA_NAME_DEF_STMT, tcc_comparison, TREE_CODE, and TREE_CODE_CLASS.
Return true if the domain defined by *THIS is a superset of PREDS's
domain.
Avoid building generic trees (and rely on the folding capability
of the compiler), and instead perform brute force comparison of
individual predicate chains (this won't be a computationally costly
since the chains are pretty short). Returning false does not
necessarily mean *THIS is not a superset of *PREDS, only that
it need not be since the analysis cannot prove it.
References i, includes(), m_preds, and predicate().
Referenced by uninit_analysis::is_use_guarded().