GCC Middle and Back End API 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"
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 | find_case_label_ranges (gswitch *stmt, const irange *vr, size_t *min_idx1, size_t *max_idx1, size_t *min_idx2, size_t *max_idx2) |
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) |
|
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(), range_query::range_of_expr(), irange::set_varying(), wi::smax(), wi::smin(), wi::sub(), TREE_TYPE, TYPE_SIGN, vrange::undefined_p(), irange::upper_bound(), and wide_int_to_tree().
Referenced by simplify_using_ranges::simplify_internal_call_using_ranges().
|
static |
Searches the case label vector VEC for the ranges of CASE_LABELs that are used in range VR. The indices are placed in MIN_IDX1, MAX_IDX, MIN_IDX2 and MAX_IDX2. If the ranges of CASE_LABELs are empty then MAX_IDX1 < MIN_IDX1. Returns true if the default label is not needed.
References CASE_HIGH, CASE_LOW, find_case_label_range(), gcc_checking_assert, get_legacy_range(), gimple_switch_label(), gimple_switch_num_labels(), i, NULL_TREE, tree_int_cst_compare(), vrange::undefined_p(), vrange::varying_p(), and VR_RANGE.
Referenced by simplify_using_ranges::simplify_switch_using_ranges().
|
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().
|
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().
Return whether the value range *VR fits in an integer type specified by PRECISION and UNSIGNED_P.
References wi::ext(), INTEGRAL_TYPE_P, irange::lower_bound(), wi::lts_p(), POINTER_TYPE_P, SIGNED, irange::type(), TYPE_PRECISION, TYPE_SIGN, vrange::undefined_p(), UNSIGNED, irange::upper_bound(), and vrange::varying_p().
Referenced by nop_conversion_for_offset_p(), simplify_using_ranges::simplify_casted_compare(), and simplify_using_ranges::simplify_float_conversion_using_ranges().
|
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::gt_p(), r, and TYPE_SIGN.
Referenced by range_of_var_in_loop().
bool range_of_var_in_loop | ( | vrange & | v, |
tree | name, | ||
class loop * | l, | ||
gimple * | stmt, | ||
range_query * | query ) |
Set V to the range of NAME in STMT within LOOP. Return TRUE if a range was found.
References as_a(), range_op_handler::fold_range(), wide_int_storage::from(), get_scev_info(), induction_variable_may_overflow_p(), max_loop_iterations(), r, range_from_loop_direction(), range_query::range_of_expr(), TREE_TYPE, TYPE_PRECISION, and TYPE_SIGN.
Referenced by fold_using_range::range_of_ssa_name_with_loop_info().
|
static |
Simplify an integral conversion from an SSA name in STMT.
References cfun, wi::cmp(), CONVERT_EXPR_CODE_P, wi::ext(), fold_stmt(), follow_single_use_edges(), get_range_query(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_set_rhs1(), wi::gtu_p(), INTEGRAL_TYPE_P, is_gimple_assign(), irange::lower_bound(), wi::mask(), path_range_query::range_of_expr(), wi::shifted_mask(), SSA_NAME_DEF_STMT, SSA_NAME_OCCURS_IN_ABNORMAL_PHI, TREE_CODE, TREE_TYPE, TYPE_PRECISION, TYPE_SIGN, vrange::undefined_p(), UNSIGNED, irange::upper_bound(), and vrange::varying_p().
Referenced by simplify_using_ranges::simplify().
|
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. If signed overflow must be undefined for the value to satisfy the conditional, then set *STRICT_OVERFLOW_P to true.
References build_int_cst(), compare_values(), EXPR_P, fold_build2, is_gimple_min_invariant(), irange::lower_bound(), NULL, operand_equal_p(), suppress_warning(), 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().
|
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().