GCC Middle and Back End API Reference
int_range< N, RESIZABLE > Class Template Referencefinalabstract

#include <value-range.h>

Inheritance diagram for int_range< N, RESIZABLE >:
Collaboration diagram for int_range< N, RESIZABLE >:

Public Member Functions

 int_range ()
 
 int_range (tree type, const wide_int &, const wide_int &, value_range_kind=VR_RANGE)
 
 int_range (tree type)
 
 int_range (const int_range &)
 
 int_range (const irange &)
 
 ~int_range () final override
 
int_rangeoperator= (const int_range &)
 
void set (tree type, const wide_int &, const wide_int &, value_range_kind=VR_RANGE)
 
virtual void set_nonzero (tree type) override
 
virtual void set_zero (tree type) override
 
virtual void set_nonnegative (tree type) override
 
virtual void set_varying (tree type) override
 
virtual void set_undefined () override
 
virtual bool supports_type_p (const_tree type) const override
 
virtual tree type () const override
 
unsigned num_pairs () const
 
wide_int lower_bound (unsigned=0) const
 
wide_int upper_bound (unsigned) const
 
wide_int upper_bound () const
 
virtual tree lbound () const override
 
virtual tree ubound () const override
 
virtual bool zero_p () const override
 
virtual bool nonzero_p () const override
 
virtual bool singleton_p (tree *result=NULL) const override
 
bool singleton_p (wide_int &) const
 
bool contains_p (const wide_int &) const
 
bool nonnegative_p () const
 
bool nonpositive_p () const
 
virtual bool union_ (const vrange &) override
 
virtual bool intersect (const vrange &) override
 
void invert ()
 
bool operator== (const irange &) const
 
bool operator== (const vrange &) const
 
bool operator!= (const irange &r) const
 
bool operator!= (const vrange &r) const
 
virtual bool fits_p (const vrange &r) const override
 
virtual void accept (const vrange_visitor &v) const override
 
virtual void accept (const class vrange_visitor &v) const =0
 
virtual void update_bitmask (const class irange_bitmask &) override
 
virtual irange_bitmask get_bitmask () const override
 
wide_int get_nonzero_bits () const
 
void set_nonzero_bits (const wide_int &bits)
 
bool varying_p () const
 
bool undefined_p () const
 
void dump (FILE *) const
 

Static Public Member Functions

static bool supports_p (const_tree type)
 

Protected Member Functions

 int_range (tree, tree, value_range_kind=VR_RANGE)
 
virtual void set (tree, tree, value_range_kind=VR_RANGE) override
 
virtual bool contains_p (tree cst) const override
 
void maybe_resize (int needed)
 
bool irange_contains_p (const irange &) const
 
bool irange_single_pair_union (const irange &r)
 
void normalize_kind ()
 
void verify_range ()
 

Protected Attributes

wide_intm_base
 
enum value_range_kind m_kind: 8
 
enum value_range_discriminator m_discriminator: 4
 

Static Protected Attributes

static const int HARD_MAX_RANGES = 255
 

Private Member Functions

bool intersect (const wide_int &lb, const wide_int &ub)
 
bool varying_compatible_p () const
 
bool intersect_bitmask (const irange &r)
 
bool union_bitmask (const irange &r)
 
bool set_range_from_bitmask ()
 
bool union_append (const irange &r)
 

Private Attributes

wide_int m_ranges [N *2]
 
unsigned char m_num_ranges
 
bool m_resizable
 
unsigned char m_max_ranges
 
tree m_type
 
irange_bitmask m_bitmask
 

Constructor & Destructor Documentation

◆ int_range() [1/6]

template<unsigned N, bool RESIZABLE>
int_range< N, RESIZABLE >::int_range ( )
inline

◆ int_range() [2/6]

template<unsigned N, bool RESIZABLE>
int_range< N, RESIZABLE >::int_range ( tree type,
const wide_int & wmin,
const wide_int & wmax,
value_range_kind kind = VR_RANGE )

References irange::set().

◆ int_range() [3/6]

template<unsigned N, bool RESIZABLE>
int_range< N, RESIZABLE >::int_range ( tree type)

References irange::set_varying().

◆ int_range() [4/6]

template<unsigned N, bool RESIZABLE>
int_range< N, RESIZABLE >::int_range ( const int_range< N, RESIZABLE > & other)

References irange::operator=().

◆ int_range() [5/6]

template<unsigned N, bool RESIZABLE>
int_range< N, RESIZABLE >::int_range ( const irange & other)

References irange::operator=().

◆ ~int_range()

template<unsigned N, bool RESIZABLE>
int_range< N, RESIZABLE >::~int_range ( )
inlinefinaloverride

◆ int_range() [6/6]

template<unsigned N, bool RESIZABLE>
int_range< N, RESIZABLE >::int_range ( tree min,
tree max,
value_range_kind kind = VR_RANGE )
protected

References irange::set().

Member Function Documentation

◆ accept() [1/2]

void irange::accept ( const vrange_visitor & v) const
overridevirtualinherited

◆ accept() [2/2]

virtual void vrange::accept ( const class vrange_visitor & v) const
pure virtualinherited

◆ contains_p() [1/2]

bool irange::contains_p ( const wide_int & cst) const
inherited
Return 1 if CST is inside value range.
       0 if CST is not inside value range.

Benchmark compile/20001226-1.c compilation time after changing this
function.   

References wi::bit_and(), irange_bitmask::get_nonzero_bits(), wi::le_p(), irange::lower_bound(), wi::lt_p(), irange::m_bitmask, irange::m_num_ranges, r, TYPE_SIGN, vrange::undefined_p(), irange_bitmask::unknown_p(), and irange::upper_bound().

Referenced by irange::contains_p(), expr_not_equal_to(), cfn_signbit::op1_range(), and irange::set_range_from_bitmask().

◆ contains_p() [2/2]

bool irange::contains_p ( tree cst) const
inlineoverrideprotectedvirtualinherited

Implements vrange.

References irange::contains_p(), and wi::to_wide().

◆ dump()

◆ fits_p()

bool irange::fits_p ( const vrange & r) const
overridevirtualinherited

Implements vrange.

References as_a(), irange::m_max_ranges, and r.

◆ get_bitmask()

◆ get_nonzero_bits()

◆ intersect() [1/2]

◆ intersect() [2/2]

◆ intersect_bitmask()

◆ invert()

◆ irange_contains_p()

bool irange::irange_contains_p ( const irange & r) const
protectedinherited

◆ irange_single_pair_union()

◆ lbound()

tree irange::lbound ( ) const
overridevirtualinherited

Implements vrange.

References irange::lower_bound(), and wide_int_to_tree().

◆ lower_bound()

wide_int irange::lower_bound ( unsigned pair = 0) const
inlineinherited

References gcc_checking_assert, irange::m_base, irange::m_num_ranges, and irange::num_pairs().

Referenced by check_for_binary_op_overflow(), compare_nonzero_chars(), compute_distributive_range(), irange::contains_p(), strlen_pass::count_nonzero_bytes_addr(), determine_value_range(), dr_step_indicator(), expr_to_aff_combination(), find_case_label_range(), operator_cast::fold_pair(), cfn_clz::fold_range(), cfn_ctz::fold_range(), operator_cast::fold_range(), operator_equal::fold_range(), operator_ge::fold_range(), operator_gt::fold_range(), operator_le::fold_range(), operator_logical_and::fold_range(), operator_lshift::fold_range(), operator_lt::fold_range(), operator_not_equal::fold_range(), pointer_plus_operator::fold_range(), range_operator::fold_range(), irange::get_bitmask(), get_legacy_range(), strlen_pass::get_len_or_size(), get_range_strlen_dynamic(), get_ref_base_and_extent(), handle_printf_call(), irange::intersect(), irange::invert(), irange::lbound(), operator_bitwise_and::lhs_op1_relation(), operator_plus::lhs_op1_relation(), operator_rshift::lhs_op1_relation(), irange::nonnegative_p(), operator_abs::op1_range(), operator_bitwise_and::op1_range(), operator_equal::op1_range(), operator_ge::op1_range(), operator_gt::op1_range(), operator_le::op1_range(), operator_lshift::op1_range(), operator_lt::op1_range(), operator_not_equal::op1_range(), operator_trunc_mod::op1_range(), operator_ge::op2_range(), operator_gt::op2_range(), operator_le::op2_range(), operator_lt::op2_range(), operator_trunc_mod::op2_range(), irange::operator==(), operator_minus::overflow_free_p(), operator_mult::overflow_free_p(), operator_plus::overflow_free_p(), range_fits_type_p(), phi_group::refine_using_relation(), operator_bitwise_and::simple_op1_range_solver(), simplify_conversion_using_ranges(), simplify_using_ranges::simplify_div_or_mod_using_ranges(), irange::singleton_p(), irange::singleton_p(), test_for_singularity(), simplify_using_ranges::two_valued_val_range_p(), irange::verify_range(), vr_set_zero_nonzero_bits(), and irange::zero_p().

◆ maybe_resize()

◆ nonnegative_p()

bool irange::nonnegative_p ( ) const
inherited

◆ nonpositive_p()

bool irange::nonpositive_p ( ) const
inherited

◆ nonzero_p()

bool irange::nonzero_p ( ) const
inlineoverridevirtualinherited

◆ normalize_kind()

◆ num_pairs()

◆ operator!=() [1/2]

bool irange::operator!= ( const irange & r) const
inlineinherited

References r.

◆ operator!=() [2/2]

bool vrange::operator!= ( const vrange & r) const
inlineinherited

References r.

◆ operator=()

template<unsigned N, bool RESIZABLE>
int_range< N, RESIZABLE > & int_range< N, RESIZABLE >::operator= ( const int_range< N, RESIZABLE > & src)

References irange::operator=().

◆ operator==() [1/2]

◆ operator==() [2/2]

bool vrange::operator== ( const vrange & src) const
inherited

◆ set() [1/2]

void irange::set ( tree type,
const wide_int & min,
const wide_int & max,
value_range_kind kind = VR_RANGE )
inherited
Set value range to the canonical form of {VRTYPE, MIN, MAX, EQUIV}.
This means adjusting VRTYPE, MIN and MAX representing the case of a
wrapping range with MAX < MIN covering [MIN, type_max] U [type_min, MAX]
as anti-rage ~[MAX+1, MIN-1].  Likewise for wrapping anti-ranges.
In corner cases where MAX+1 or MIN-1 wraps this will fall back
to varying.
This routine exists to ease canonicalization in the case where we
extract ranges from var + CST op limit.   

References wi::add(), gcc_checking_assert, irange::m_base, irange::m_bitmask, vrange::m_kind, irange::m_max_ranges, irange::m_num_ranges, irange::m_type, wi::max_value(), wi::min_value(), irange_bitmask::set_unknown(), SIGNED, wi::sub(), irange::type(), TYPE_PRECISION, TYPE_SIGN, irange::verify_range(), VR_ANTI_RANGE, VR_RANGE, VR_UNDEFINED, and VR_VARYING.

Referenced by find_unswitching_predicates_for_bb(), int_range< N, RESIZABLE >::int_range(), int_range< N, RESIZABLE >::int_range(), simplify_using_ranges::legacy_fold_cond_overflow(), phi_group::refine_using_relation(), irange::set(), irange::set_nonnegative(), irange::set_nonzero(), irange::set_range_from_bitmask(), irange::set_zero(), split_constant_offset(), and unswitch_predicate::unswitch_predicate().

◆ set() [2/2]

void irange::set ( tree min,
tree max,
value_range_kind kind = VR_RANGE )
overrideprotectedvirtualinherited

◆ set_nonnegative()

void irange::set_nonnegative ( tree type)
overridevirtualinherited

◆ set_nonzero()

◆ set_nonzero_bits()

void vrange::set_nonzero_bits ( const wide_int & bits)
inherited

◆ set_range_from_bitmask()

◆ set_undefined()

◆ set_varying()

◆ set_zero()

void irange::set_zero ( tree type)
inlineoverridevirtualinherited

◆ singleton_p() [1/2]

◆ singleton_p() [2/2]

bool irange::singleton_p ( wide_int & w) const
inherited

◆ supports_p()

◆ supports_type_p()

bool irange::supports_type_p ( const_tree type) const
overridevirtualinherited

Implements vrange.

References irange::supports_p().

◆ type()

◆ ubound()

tree irange::ubound ( ) const
overridevirtualinherited

Implements vrange.

References irange::upper_bound(), and wide_int_to_tree().

◆ undefined_p()

bool vrange::undefined_p ( ) const
inlineinherited

References vrange::m_kind, and VR_UNDEFINED.

Referenced by inchash::add_vrange(), adjust_equivalence_range(), gimple_range_op_handler::calc_op1(), gimple_range_op_handler::calc_op2(), array_bounds_checker::check_array_ref(), check_for_binary_op_overflow(), frange::clear_nan(), frange::combine_zeros(), compare_nonzero_chars(), compute_distributive_range(), gori_compute::compute_operand_range(), gori_compute::compute_operand_range_switch(), frange::contains_p(), irange::contains_p(), prange::contains_p(), strlen_pass::count_nonzero_bytes_addr(), determine_value_range(), dr_step_indicator(), empty_range_varying(), expr_not_equal_to(), expr_to_aff_combination(), find_case_label_range(), find_case_label_ranges(), find_range_for_lhs(), frange::flush_denormals_to_zero(), cfn_clrsb::fold_range(), cfn_clz::fold_range(), cfn_ctz::fold_range(), cfn_ffs::fold_range(), cfn_popcount::fold_range(), operator_addr_expr::fold_range(), operator_equal::fold_range(), operator_equal::fold_range(), operator_equal::fold_range(), operator_logical_not::fold_range(), operator_lshift::fold_range(), operator_not_equal::fold_range(), operator_not_equal::fold_range(), operator_not_equal::fold_range(), operator_rshift::fold_range(), range_op_handler::fold_range(), irange::get_bitmask(), get_bool_state(), vrange::get_nonzero_bits(), get_range_strlen_dynamic(), get_ref_base_and_extent(), get_shift_range(), get_size_range(), handle_printf_call(), frange::intersect(), irange::intersect(), irange::intersect(), prange::intersect(), unsupported_range::intersect(), irange::intersect_bitmask(), irange::invert(), prange::invert(), ipa_vr_operation_and_type_effects(), irange::irange_contains_p(), irange::irange_single_pair_union(), frange::known_isfinite(), simplify_using_ranges::legacy_fold_cond_overflow(), operator_bitwise_and::lhs_op1_relation(), operator_cast::lhs_op1_relation(), operator_cast::lhs_op1_relation(), operator_cast::lhs_op1_relation(), operator_cast::lhs_op1_relation(), operator_identity::lhs_op1_relation(), operator_identity::lhs_op1_relation(), operator_minus::lhs_op1_relation(), operator_plus::lhs_op1_relation(), operator_rshift::lhs_op1_relation(), frange::lower_bound(), prange::lower_bound(), frange::maybe_isinf(), frange::maybe_isnan(), frange::maybe_isnan(), frange::nan_signbit_p(), irange::nonzero_p(), operator_equal::op1_op2_relation(), operator_equal::op1_op2_relation(), operator_equal::op1_op2_relation(), operator_ge::op1_op2_relation(), operator_ge::op1_op2_relation(), operator_ge::op1_op2_relation(), operator_gt::op1_op2_relation(), operator_gt::op1_op2_relation(), operator_gt::op1_op2_relation(), operator_le::op1_op2_relation(), operator_le::op1_op2_relation(), operator_le::op1_op2_relation(), operator_lt::op1_op2_relation(), operator_lt::op1_op2_relation(), operator_lt::op1_op2_relation(), operator_not_equal::op1_op2_relation(), operator_not_equal::op1_op2_relation(), operator_not_equal::op1_op2_relation(), foperator_div::op1_range(), foperator_unordered_ge::op1_range(), foperator_unordered_gt::op1_range(), foperator_unordered_le::op1_range(), foperator_unordered_lt::op1_range(), operator_addr_expr::op1_range(), operator_addr_expr::op1_range(), operator_bitwise_and::op1_range(), operator_bitwise_not::op1_range(), operator_bitwise_or::op1_range(), operator_bitwise_xor::op1_range(), operator_cast::op1_range(), operator_cast::op1_range(), operator_cast::op1_range(), operator_cast::op1_range(), operator_equal::op1_range(), operator_equal::op1_range(), operator_exact_divide::op1_range(), operator_ge::op1_range(), operator_ge::op1_range(), operator_ge::op1_range(), operator_gt::op1_range(), operator_gt::op1_range(), operator_gt::op1_range(), operator_le::op1_range(), operator_le::op1_range(), operator_le::op1_range(), operator_lshift::op1_range(), operator_lt::op1_range(), operator_lt::op1_range(), operator_lt::op1_range(), operator_minus::op1_range(), operator_minus::op1_range(), operator_mult::op1_range(), operator_mult::op1_range(), operator_not_equal::op1_range(), operator_not_equal::op1_range(), operator_plus::op1_range(), operator_plus::op1_range(), operator_rshift::op1_range(), operator_trunc_mod::op1_range(), pointer_or_operator::op1_range(), range_op_handler::op1_range(), foperator_div::op2_range(), foperator_unordered_ge::op2_range(), foperator_unordered_gt::op2_range(), foperator_unordered_le::op2_range(), foperator_unordered_lt::op2_range(), operator_ge::op2_range(), operator_ge::op2_range(), operator_ge::op2_range(), operator_gt::op2_range(), operator_gt::op2_range(), operator_gt::op2_range(), operator_le::op2_range(), operator_le::op2_range(), operator_le::op2_range(), operator_lt::op2_range(), operator_lt::op2_range(), operator_lt::op2_range(), operator_minus::op2_range(), operator_minus::op2_range(), operator_trunc_mod::op2_range(), range_op_handler::op2_range(), frange::operator==(), prange::operator==(), operator_minus::overflow_free_p(), operator_mult::overflow_free_p(), operator_plus::overflow_free_p(), phi_group::phi_group(), phi_analyzer::process_phi(), range_fits_type_p(), range_includes_zero_p(), fur_source::register_outgoing_edges(), vrange::set_nonzero_bits(), set_nonzero_range_from_mask(), irange::set_range_from_bitmask(), set_switch_stmt_execution_predicate(), frange::signbit_p(), simplify_using_ranges::simplify(), simplify_using_ranges::simplify_bit_ops_using_ranges(), simplify_using_ranges::simplify_casted_compare(), simplify_using_ranges::simplify_compare_using_ranges_1(), simplify_conversion_using_ranges(), simplify_using_ranges::simplify_div_or_mod_using_ranges(), simplify_using_ranges::simplify_float_conversion_using_ranges(), simplify_using_ranges::simplify_switch_using_ranges(), size_must_be_zero_p(), split_constant_offset(), simplify_using_ranges::two_valued_val_range_p(), frange::type(), prange::type(), value_range::undefined_p(), frange::union_(), irange::union_(), prange::union_(), unsupported_range::union_(), irange::union_bitmask(), unswitch_predicate::unswitch_predicate(), irange::update_bitmask(), prange::update_bitmask(), update_known_bitmask(), frange::update_nan(), frange::update_nan(), frange::update_nan(), frange::upper_bound(), prange::upper_bound(), prange::varying_compatible_p(), vect_get_range_info(), frange::verify_range(), and vr_set_zero_nonzero_bits().

◆ union_()

◆ union_append()

◆ union_bitmask()

◆ update_bitmask()

◆ upper_bound() [1/2]

◆ upper_bound() [2/2]

wide_int irange::upper_bound ( unsigned pair) const
inlineinherited

References gcc_checking_assert, irange::m_base, irange::m_num_ranges, and irange::num_pairs().

Referenced by check_for_binary_op_overflow(), compute_distributive_range(), strlen_pass::count_nonzero_bytes_addr(), determine_value_range(), dr_step_indicator(), expr_to_aff_combination(), find_case_label_range(), operator_cast::fold_pair(), cfn_clz::fold_range(), cfn_ctz::fold_range(), cfn_ffs::fold_range(), operator_cast::fold_range(), operator_equal::fold_range(), operator_ge::fold_range(), operator_gt::fold_range(), operator_le::fold_range(), operator_logical_and::fold_range(), operator_lt::fold_range(), operator_not_equal::fold_range(), pointer_plus_operator::fold_range(), range_operator::fold_range(), get_legacy_range(), get_range_strlen_dynamic(), get_ref_base_and_extent(), handle_printf_call(), operator_plus::lhs_op1_relation(), operator_abs::op1_range(), operator_bitwise_and::op1_range(), operator_equal::op1_range(), operator_ge::op1_range(), operator_gt::op1_range(), operator_le::op1_range(), operator_lshift::op1_range(), operator_lt::op1_range(), operator_not_equal::op1_range(), operator_trunc_mod::op1_range(), operator_ge::op2_range(), operator_gt::op2_range(), operator_le::op2_range(), operator_lt::op2_range(), operator_trunc_mod::op2_range(), irange::operator==(), operator_minus::overflow_free_p(), operator_mult::overflow_free_p(), operator_plus::overflow_free_p(), range_fits_type_p(), phi_group::refine_using_relation(), operator_bitwise_and::simple_op1_range_solver(), simplify_conversion_using_ranges(), simplify_using_ranges::simplify_div_or_mod_using_ranges(), test_for_singularity(), simplify_using_ranges::two_valued_val_range_p(), and vr_set_zero_nonzero_bits().

◆ varying_compatible_p()

◆ varying_p()

bool vrange::varying_p ( ) const
inlineinherited

References vrange::m_kind, and VR_VARYING.

Referenced by gimple_infer_range::add_range(), phi_group::calculate_using_modifier(), array_bounds_checker::check_array_ref(), compare_nonzero_chars(), compute_distributive_range(), gori_compute::compute_operand_range(), frange::contains_p(), prange::contains_p(), unsupported_range::contains_p(), strlen_pass::count_nonzero_bytes_addr(), determine_value_range(), expr_to_aff_combination(), find_case_label_range(), find_case_label_ranges(), operator_cast::fold_range(), operator_logical_not::fold_range(), get_range_strlen_dynamic(), get_ref_base_and_extent(), frange::intersect(), irange::intersect(), prange::intersect(), unsupported_range::intersect(), irange::invert(), prange::invert(), ipa_vr_operation_and_type_effects(), irange::irange_contains_p(), irange::irange_single_pair_union(), frange::known_isfinite(), gori_compute::logical_combine(), frange::maybe_isinf(), ipcp_vr_lattice::meet_with_1(), operator_bitwise_xor::op1_range(), operator_cast::op1_range(), frange::operator==(), prange::operator==(), phi_group::phi_group(), phi_analyzer::process_phi(), range_fits_type_p(), range_includes_zero_p(), simplify_using_ranges::simplify_casted_compare(), simplify_using_ranges::simplify_compare_using_ranges_1(), simplify_conversion_using_ranges(), simplify_using_ranges::simplify_div_or_mod_using_ranges(), simplify_using_ranges::simplify_float_conversion_using_ranges(), simplify_using_ranges::simplify_switch_using_ranges(), simplify_using_ranges::two_valued_val_range_p(), frange::union_(), irange::union_(), prange::union_(), unsupported_range::union_(), unswitch_predicate::unswitch_predicate(), value_range::varying_p(), and vr_set_zero_nonzero_bits().

◆ verify_range()

◆ zero_p()

Field Documentation

◆ HARD_MAX_RANGES

const int irange::HARD_MAX_RANGES = 255
staticprotectedinherited

Referenced by irange::maybe_resize().

◆ m_base

◆ m_bitmask

◆ m_discriminator

◆ m_kind

◆ m_max_ranges

◆ m_num_ranges

◆ m_ranges

template<unsigned N, bool RESIZABLE = false>
wide_int int_range< N, RESIZABLE >::m_ranges[N *2]
private

◆ m_resizable

bool irange::m_resizable
privateinherited

Referenced by irange::maybe_resize().

◆ m_type


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