GCC Middle and Back End API Reference
vr-values.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "insn-codes.h"
#include "tree.h"
#include "gimple.h"
#include "ssa.h"
#include "optabs-tree.h"
#include "gimple-pretty-print.h"
#include "diagnostic-core.h"
#include "flags.h"
#include "fold-const.h"
#include "calls.h"
#include "cfganal.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-niter.h"
#include "tree-ssa-loop.h"
#include "intl.h"
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "tree-ssa-propagate.h"
#include "tree-chrec.h"
#include "omp-general.h"
#include "case-cfn-macros.h"
#include "alloc-pool.h"
#include "attribs.h"
#include "range.h"
#include "vr-values.h"
#include "cfghooks.h"
#include "range-op.h"
#include "gimple-range.h"
Include dependency graph for vr-values.cc:

Functions

static bool check_for_binary_op_overflow (range_query *query, enum tree_code subcode, tree type, tree op0, tree op1, bool *ovf, gimple *s=NULL)
static bool get_scev_info (vrange &r, tree name, gimple *stmt, class loop *l, tree &init, tree &step, enum ev_direction &dir)
static bool induction_variable_may_overflow_p (tree type, const wide_int &step, const widest_int &nit)
static void range_from_loop_direction (irange &r, tree type, const irange &begin, const irange &end, ev_direction dir)
bool range_of_var_in_loop (vrange &v, tree name, class loop *l, gimple *stmt, range_query *query)
static bool vr_set_zero_nonzero_bits (const tree expr_type, const irange *vr, wide_int *may_be_nonzero, wide_int *must_be_nonzero)
static tree test_for_singularity (enum tree_code cond_code, tree op0, tree op1, const irange *vr)
bool range_fits_type_p (const irange *vr, unsigned dest_precision, signop dest_sgn)
static bool simplify_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt)

Function Documentation

◆ check_for_binary_op_overflow()

bool check_for_binary_op_overflow ( range_query * query,
enum tree_code subcode,
tree type,
tree op0,
tree op1,
bool * ovf,
gimple * s = NULL )
static
Helper function for simplify_internal_call_using_ranges and
extract_range_basic.  Return true if OP0 SUBCODE OP1 for
SUBCODE {PLUS,MINUS,MULT}_EXPR is known to never overflow or
always overflow.  Set *OVF to true if it is known to always
overflow.   

References wi::add(), arith_overflowed_p(), gcc_unreachable, i, irange_val_max(), irange_val_min(), irange::lower_bound(), wi::mul(), NULL, relation_oracle::query(), range_query::range_of_expr(), range_query::relation(), irange::set_varying(), wi::smax(), wi::smin(), wi::sub(), tree_int_cst_sgn(), TREE_TYPE, TYPE_SIGN, TYPE_UNSIGNED, types_compatible_p(), vrange::undefined_p(), irange::upper_bound(), VREL_EQ, VREL_GE, VREL_GT, VREL_LT, VREL_VARYING, and wide_int_to_tree().

Referenced by simplify_using_ranges::simplify_internal_call_using_ranges().

◆ get_scev_info()

bool get_scev_info ( vrange & r,
tree name,
gimple * stmt,
class loop * l,
tree & init,
tree & step,
enum ev_direction & dir )
static
Set INIT, STEP, and DIRECTION to the corresponding values of NAME
within LOOP, and return TRUE.  Otherwise return FALSE, and set R to
the conservative range of NAME within the loop.   

References analyze_scalar_evolution(), EV_DIR_UNKNOWN, evolution_part_in_loop_num(), get_chrec_loop(), initial_condition_in_loop_num(), instantiate_parameters(), is_gimple_constant(), is_gimple_min_invariant(), NULL, loop::num, r, scev_direction(), scev_probably_wraps_p(), TREE_CODE, and TREE_TYPE.

Referenced by range_of_var_in_loop().

◆ induction_variable_may_overflow_p()

bool induction_variable_may_overflow_p ( tree type,
const wide_int & step,
const widest_int & nit )
static
Return TRUE if STEP * NIT may overflow when calculated in TYPE.   

References wi::fits_to_tree_p(), wi::gts_p(), wi::mul(), SIGNED, and TYPE_SIGN.

Referenced by range_of_var_in_loop().

◆ range_fits_type_p()

◆ range_from_loop_direction()

void range_from_loop_direction ( irange & r,
tree type,
const irange & begin,
const irange & end,
ev_direction dir )
static
Set R to the range from BEGIN to END, assuming the direction of the
loop is DIR.   

References begin(), end(), EV_DIR_GROWS, wi::ge_p(), r, and TYPE_SIGN.

Referenced by range_of_var_in_loop().

◆ range_of_var_in_loop()

bool range_of_var_in_loop ( vrange & v,
tree name,
class loop * l,
gimple * stmt,
range_query * query )

◆ simplify_conversion_using_ranges()

◆ test_for_singularity()

tree test_for_singularity ( enum tree_code cond_code,
tree op0,
tree op1,
const irange * vr )
static
We are comparing trees OP0 and OP1 using COND_CODE.  OP0 has
a known value range VR.

If there is one and only one value which will satisfy the
conditional, then return that value.  Else return NULL.   

References build_int_cst(), compare_values(), fold_build2, is_gimple_min_invariant(), irange::lower_bound(), NULL, operand_equal_p(), TREE_TYPE, TYPE_MAX_VALUE, TYPE_MIN_VALUE, irange::upper_bound(), and wide_int_to_tree().

Referenced by dom_opt_dom_walker::optimize_stmt(), and simplify_using_ranges::simplify_compare_using_ranges_1().

◆ vr_set_zero_nonzero_bits()

bool vr_set_zero_nonzero_bits ( const tree expr_type,
const irange * vr,
wide_int * may_be_nonzero,
wide_int * must_be_nonzero )
static
irange wrapper for wi_set_zero_nonzero_bits.

Return TRUE if VR was a constant range and we were able to compute
the bit masks.   

References irange::lower_bound(), wi::minus_one(), TYPE_PRECISION, vrange::undefined_p(), irange::upper_bound(), vrange::varying_p(), wi_set_zero_nonzero_bits(), and wi::zero().

Referenced by simplify_using_ranges::simplify_bit_ops_using_ranges().