GCC Middle and Back End API Reference
ipa_predicate Class Reference

#include <ipa-predicate.h>

Public Types

enum  predicate_conditions { false_condition = 0 , not_inlined_condition = 1 , first_dynamic_condition = 2 }

Public Member Functions

 ipa_predicate (bool p=true)
 ipa_predicate (ipa_predicate *)
ipa_predicateoperator&= (const ipa_predicate &)
ipa_predicate operator& (const ipa_predicate &p) const
ipa_predicate or_with (conditions, const ipa_predicate &) const
bool operator== (const ipa_predicate &p2) const
bool operator== (const bool cond) const
bool operator!= (const ipa_predicate &p2) const
bool operator!= (const bool cond) const
bool evaluate (clause_t) const
int probability (conditions, clause_t, vec< inline_param_summary >) const
void dump (FILE *f, conditions, bool nl=true) const
void DEBUG_FUNCTION debug (conditions) const
ipa_predicate remap_after_duplication (clause_t)
ipa_predicate remap_after_inlining (class ipa_fn_summary *, ipa_node_params *params_summary, ipa_fn_summary *, const vec< int > &, const vec< HOST_WIDE_INT > &, clause_t, const ipa_predicate &)
void stream_in (lto_input_block *)
void stream_out (output_block *)

Static Public Member Functions

static ipa_predicate predicate_testing_cond (int i)
static ipa_predicate not_inlined (void)

Static Public Attributes

static const int num_conditions = 32
static const tree_code is_not_constant = ERROR_MARK
static const tree_code changed = IDENTIFIER_NODE
static const tree_code not_sra_candidate = TREE_LIST

Private Member Functions

void set_to_cond (int cond)
void add_clause (conditions conditions, clause_t)

Private Attributes

clause_t m_clause [max_clauses+1]

Static Private Attributes

static const int max_clauses = 8

Member Enumeration Documentation

◆ predicate_conditions


Constructor & Destructor Documentation

◆ ipa_predicate() [1/2]

ipa_predicate::ipa_predicate ( bool p = true)

◆ ipa_predicate() [2/2]

ipa_predicate::ipa_predicate ( ipa_predicate * )

References gcc_unreachable.

Member Function Documentation

◆ add_clause()

void ipa_predicate::add_clause ( conditions conditions,
clause_t new_clause )
Add clause CLAUSE into the predicate P.
When CONDITIONS is NULL do not perform checking whether NEW_CLAUSE
is obviously true.  This is useful only when NEW_CLAUSE is known to be

References changed, expr_eval_ops_equal_p(), false_condition, first_dynamic_condition, gcc_checking_assert, ggc_alloc(), HONOR_NANS(), i, i2, invert_tree_comparison(), is_not_constant, m_clause, max_clauses, not_sra_candidate, num_conditions, types_compatible_p(), and vrp_operand_equal_p().

Referenced by operator&=(), or_with(), and remap_after_duplication().

◆ debug()

void ipa_predicate::debug ( conditions conds) const

References dump(), and ggc_alloc().

◆ dump()

void ipa_predicate::dump ( FILE * f,
conditions conds,
bool nl = true ) const
Dump THIS to F.  CONDS a vector of conditions used when evaluating
ipa_predicates.  When NL is true new line is output at the end of dump.   

References dump_clause(), ggc_alloc(), i, and m_clause.

Referenced by debug(), ipa_dump_fn_summary(), and predicate_for_phi_result().

◆ evaluate()

bool ipa_predicate::evaluate ( clause_t possible_truths) const
Having partial truth assignment in POSSIBLE_TRUTHS, return false
if predicate P is known to be false.   

References false_condition, gcc_assert, gcc_checking_assert, ggc_alloc(), i, m_clause, and max_clauses.

Referenced by estimate_calls_size_and_time(), and ipa_call_context::estimate_size_and_time().

◆ not_inlined()

static ipa_predicate ipa_predicate::not_inlined ( void )

◆ operator!=() [1/2]

bool ipa_predicate::operator!= ( const bool cond) const

◆ operator!=() [2/2]

bool ipa_predicate::operator!= ( const ipa_predicate & p2) const

References ggc_alloc().

◆ operator&()

ipa_predicate ipa_predicate::operator& ( const ipa_predicate & p) const

References ggc_alloc().

◆ operator&=()

ipa_predicate & ipa_predicate::operator&= ( const ipa_predicate & p)
Do THIS &= P.   

References add_clause(), gcc_checking_assert, i, m_clause, max_clauses, and NULL.

◆ operator==() [1/2]

bool ipa_predicate::operator== ( const bool cond) const

◆ operator==() [2/2]

bool ipa_predicate::operator== ( const ipa_predicate & p2) const

◆ or_with()

◆ predicate_testing_cond()

static ipa_predicate ipa_predicate::predicate_testing_cond ( int i)

◆ probability()

int ipa_predicate::probability ( conditions conds,
clause_t possible_truths,
vec< inline_param_summary > inline_param_summary ) const
Return the probability in range 0...REG_BR_PROB_BASE that the predicated
instruction will be recomputed per invocation of the inlined call.   

References inline_param_summary::change_prob, changed, condition::code, false_condition, first_dynamic_condition, gcc_assert, gcc_checking_assert, ggc_alloc(), i, i2, m_clause, MAX, max_clauses, MIN, num_conditions, condition::operand_num, and REG_BR_PROB_BASE.

Referenced by ipa_call_context::estimate_size_and_time(), and ipa_merge_fn_summary_after_inlining().

◆ remap_after_duplication()

ipa_predicate ipa_predicate::remap_after_duplication ( clause_t possible_truths)
Remap predicate THIS of former function to be predicate of duplicated function.
POSSIBLE_TRUTHS is clause of possible truths in the duplicated node,
INFO is inline summary of the duplicated node.   

References add_clause(), ggc_alloc(), m_clause, and NULL.

Referenced by ipa_fn_summary_t::duplicate().

◆ remap_after_inlining()

ipa_predicate ipa_predicate::remap_after_inlining ( class ipa_fn_summary * info,
ipa_node_params * params_summary,
ipa_fn_summary * callee_info,
const vec< int > & operand_map,
const vec< HOST_WIDE_INT > & offset_map,
clause_t possible_truths,
const ipa_predicate & toplev_predicate )
Translate all conditions from callee representation into caller
representation and symbolically evaluate predicate THIS into new predicate.

INFO is ipa_fn_summary of function we are adding predicate into, CALLEE_INFO
is summary of function predicate P is from. OPERAND_MAP is array giving
callee formal IDs the caller formal IDs. POSSSIBLE_TRUTHS is clause of all
callee conditions that may be true in caller context.  TOPLEV_PREDICATE is
predicate under which callee is executed.  OFFSET_MAP is an array of
offsets that need to be added to conditions, negative offset means that
conditions relying on values passed by reference have to be discarded
because they might not be preserved (and should be considered offset zero
for other purposes).   

References add_condition(), condition::agg_contents, ap, condition::by_ref, condition::code, ipa_fn_summary::conds, first_dynamic_condition, gcc_assert, gcc_checking_assert, ggc_alloc(), i, m_clause, max_clauses, num_conditions, condition::offset, condition::operand_num, condition::param_ops, predicate_testing_cond(), condition::type, and condition::val.

Referenced by ipa_merge_fn_summary_after_inlining().

◆ set_to_cond()

void ipa_predicate::set_to_cond ( int cond)

◆ stream_in()

void ipa_predicate::stream_in ( lto_input_block * ib)
Read predicate from IB.   

References gcc_assert, ggc_alloc(), m_clause, max_clauses, and streamer_read_uhwi().

Referenced by inline_read_section(), and read_ipa_call_summary().

◆ stream_out()

void ipa_predicate::stream_out ( output_block * ob)
Write predicate P to OB.   

References gcc_assert, ggc_alloc(), m_clause, max_clauses, and streamer_write_uhwi().

Referenced by ipa_fn_summary_write().

Field Documentation

◆ changed

◆ is_not_constant

◆ m_clause

◆ max_clauses

const int ipa_predicate::max_clauses = 8

◆ not_sra_candidate

◆ num_conditions

const int ipa_predicate::num_conditions = 32

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