GCC Middle and Back End API Reference
|
#include <gimple-predicate-analysis.h>
Public Types | |
enum | op_type { OP_PREDICATE , OP_EXPR , OP_CAPTURE , OP_C_EXPR , OP_IF , OP_WITH } |
Public Member Functions | |
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 |
virtual void | gen_transform (FILE *, int, const char *, bool, int, const char *, capture_info *, dt_operand **=0, int=0) |
Data Fields | |
predicate_id * | p |
enum op_type | type |
location_t | location |
Private Member Functions | |
bool | includes (const pred_chain &) const |
void | push_pred (const pred_info &) |
void | normalize (pred_chain *, pred_info, tree_code, pred_chain *, hash_set< tree > *) |
void | normalize (const pred_info &) |
void | normalize (const pred_chain &) |
bool | simplify_2 () |
bool | simplify_3 () |
bool | simplify_4 () |
Private Attributes | |
pred_chain_union | m_preds |
bool | m_cval |
A predicate operand. Predicates are leafs in the AST.
Represents a complex Boolean predicate expression.
|
inherited |
|
inline |
|
inline |
|
inline |
predicate::~predicate | ( | ) |
Release resources in *THIS.
References i.
|
inline |
References m_preds.
Referenced by uninit_analysis::overlap().
void predicate::debug | ( | ) | const |
Dump predicates in *THIS to stderr.
void predicate::dump | ( | FILE * | f | ) | const |
Dump predicates in *THIS to F.
References dump_pred_chain(), i, and chain::length.
void predicate::dump | ( | FILE * | f, |
gimple * | stmt, | ||
const char * | msg ) const |
Dump predicates in *THIS for STMT prepended by MSG to F.
References fputc(), msg, and print_gimple_stmt().
|
inlinevirtualinherited |
Reimplemented in c_expr, capture, and expr.
Referenced by capture::gen_transform().
|
private |
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 i, and subset_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, pred_info::cond_code, DEBUG_PREDICATE_ANALYZER, 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(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_switch_index(), gsi_last_bb(), i, pred_info::invert, is_empty(), operand_equal_p(), pred_info::pred_lhs, pred_info::pred_rhs, single_succ_p(), and stmt_can_throw_internal().
Referenced by uninit_analysis::init_from_phi_def(), and uninit_analysis::init_use_preds().
|
inline |
References m_preds.
Referenced by uninit_analysis::init_from_phi_def(), uninit_analysis::init_use_preds(), is_false(), is_true(), and uninit_analysis::is_use_guarded().
|
inline |
References is_empty(), and m_cval.
Referenced by uninit_analysis::is_use_guarded().
|
inline |
References is_empty(), and m_cval.
Referenced by uninit_analysis::is_use_guarded().
|
private |
Normalize a single predicate PRED_CHAIN and append it to *THIS.
References hash_set< KeyId, Lazy, Traits >::add(), gcc_assert, i, chain::length, normalize(), and vNULL.
|
private |
Normalize PRED and store the normalized predicates in THIS->M_PREDS.
References get_pred_info_from_cmp(), gimple_assign_rhs_code(), is_neq_zero_form_p(), normalize(), pred_info::pred_lhs, SSA_NAME_DEF_STMT, tcc_comparison, TREE_CODE_CLASS, and vNULL.
Normalize predicate chains in THIS.
References dump_file, dump_flags, i, normalize(), and TDF_DETAILS.
Referenced by uninit_analysis::is_use_guarded(), and normalize().
|
private |
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_to_worklist(), SSA_NAME_DEF_STMT, tcc_comparison, TREE_CODE, and TREE_CODE_CLASS.
|
private |
Store a PRED in *THIS.
References vNULL.
Simplify predicates in *THIS.
References changed, dump_file, dump_flags, i, simplify_1a(), simplify_1b(), and TDF_DETAILS.
Referenced by uninit_analysis::is_use_guarded().
|
private |
Implements rule 2 for the OR predicate PREDS: 2) (X AND Y) OR (!X AND Y) is equivalent to Y.
References i, pred_equal_p(), and pred_neg_p().
|
private |
Implement rule 3 for the OR predicate PREDS: 3) x OR (!x AND y) is equivalent to x OR y.
References i, and pred_neg_p().
|
private |
Implement rule 4 for the OR predicate PREDS: 2) ((x AND y) != 0) OR (x != 0 AND y != 0) is equivalent to (x != 0 AND y != 0).
References gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), i, is_empty(), is_neq_zero_form_p(), pred_expr_equal_p(), pred_info::pred_lhs, SSA_NAME_DEF_STMT, and vNULL.
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, and m_preds.
Referenced by uninit_analysis::is_use_guarded().
|
inherited |
|
private |
Referenced by empty_val(), is_false(), and is_true().
|
private |
Referenced by chain(), is_empty(), and superset_of().
predicate_id* predicate::p |
Referenced by cmp_operand(), and dt_operand::gen_predicate().
|
inherited |