GCC Middle and Back End API Reference
irange Class Referenceabstract

#include <value-range.h>

Inheritance diagram for irange:
Collaboration diagram for irange:

Public Member Functions

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 ()
 
irangeoperator= (const irange &)
 
bool operator== (const irange &) const
 
bool operator!= (const irange &r) const
 
virtual bool fits_p (const vrange &r) const override
 
virtual void accept (const vrange_visitor &v) const override
 
virtual void update_bitmask (const class irange_bitmask &) override
 
virtual irange_bitmask get_bitmask () const override
 
virtual void accept (const class vrange_visitor &v) const =0
 
wide_int get_nonzero_bits () const
 
void set_nonzero_bits (const wide_int &bits)
 
bool varying_p () const
 
bool undefined_p () const
 
bool operator== (const vrange &) const
 
bool operator!= (const vrange &r) const
 
void dump (FILE *) const
 

Static Public Member Functions

static bool supports_p (const_tree type)
 

Protected Member Functions

void maybe_resize (int needed)
 
virtual void set (tree, tree, value_range_kind=VR_RANGE) override
 
virtual bool contains_p (tree cst) const override
 
 irange (wide_int *, unsigned nranges, bool resizable)
 
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 varying_compatible_p () const
 
bool intersect_bitmask (const irange &r)
 
bool union_bitmask (const irange &r)
 
bool set_range_from_bitmask ()
 
bool intersect (const wide_int &lb, const wide_int &ub)
 
bool union_append (const irange &r)
 

Private Attributes

unsigned char m_num_ranges
 
bool m_resizable
 
unsigned char m_max_ranges
 
tree m_type
 
irange_bitmask m_bitmask
 

Friends

class irange_storage
 
class vrange_printer
 

Constructor & Destructor Documentation

◆ irange()

irange::irange ( wide_int * base,
unsigned nranges,
bool resizable )
inlineprotected

References m_base, and set_undefined().

Member Function Documentation

◆ accept() [1/2]

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

◆ 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
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(), lower_bound(), wi::lt_p(), m_bitmask, m_num_ranges, r, TYPE_SIGN, vrange::undefined_p(), irange_bitmask::unknown_p(), and upper_bound().

Referenced by contains_p(), expr_not_equal_to(), and set_range_from_bitmask().

◆ contains_p() [2/2]

bool irange::contains_p ( tree cst) const
inlineoverrideprotectedvirtual

Implements vrange.

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

◆ dump()

◆ fits_p()

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

Implements vrange.

References as_a(), 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
protected

◆ irange_single_pair_union()

◆ lbound()

tree irange::lbound ( ) const
overridevirtual

Implements vrange.

References lower_bound(), and wide_int_to_tree().

◆ lower_bound()

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

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

Referenced by check_for_binary_op_overflow(), compare_nonzero_chars(), compute_distributive_range(), 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(), get_bitmask(), get_legacy_range(), strlen_pass::get_len_or_size(), get_range_strlen_dynamic(), get_ref_base_and_extent(), handle_printf_call(), intersect(), invert(), lbound(), operator_bitwise_and::lhs_op1_relation(), operator_plus::lhs_op1_relation(), operator_rshift::lhs_op1_relation(), nonnegative_p(), operator_abs::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_ge::op2_range(), operator_gt::op2_range(), operator_le::op2_range(), operator_lt::op2_range(), 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(), singleton_p(), singleton_p(), test_for_singularity(), simplify_using_ranges::two_valued_val_range_p(), verify_range(), vr_set_zero_nonzero_bits(), and zero_p().

◆ maybe_resize()

void irange::maybe_resize ( int needed)
inlineprotected

◆ nonnegative_p()

bool irange::nonnegative_p ( ) const

References wi::ge_p(), lower_bound(), and TYPE_SIGN.

◆ nonpositive_p()

bool irange::nonpositive_p ( ) const

References wi::le_p(), TYPE_SIGN, and upper_bound().

◆ nonzero_p()

bool irange::nonzero_p ( ) const
inlineoverridevirtual

◆ normalize_kind()

◆ num_pairs()

◆ operator!=() [1/2]

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

References r.

◆ operator!=() [2/2]

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

References r.

◆ 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 )
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, m_base, m_bitmask, vrange::m_kind, m_max_ranges, m_num_ranges, m_type, wi::max_value(), wi::min_value(), irange_bitmask::set_unknown(), SIGNED, wi::sub(), type(), TYPE_PRECISION, TYPE_SIGN, 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(), set(), set_nonnegative(), set_nonzero(), set_range_from_bitmask(), 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 )
overrideprotectedvirtual

◆ set_nonnegative()

void irange::set_nonnegative ( tree type)
overridevirtual

◆ 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)
inlineoverridevirtual

◆ singleton_p() [1/2]

◆ singleton_p() [2/2]

bool irange::singleton_p ( wide_int & w) const

◆ supports_p()

◆ supports_type_p()

bool irange::supports_type_p ( const_tree type) const
overridevirtual

Implements vrange.

References supports_p().

◆ type()

◆ ubound()

tree irange::ubound ( ) const
overridevirtual

Implements vrange.

References 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(), frange::contains_p(), 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(), get_bitmask(), vrange::get_nonzero_bits(), get_range_strlen_dynamic(), get_ref_base_and_extent(), get_shift_range(), get_size_range(), handle_printf_call(), frange::intersect(), intersect(), intersect(), prange::intersect(), unsupported_range::intersect(), intersect_bitmask(), invert(), prange::invert(), ipa_vr_operation_and_type_effects(), irange_contains_p(), 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_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(), nonzero_p(), 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_bitwise_xor::op1_range(), operator_equal::op1_range(), operator_equal::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_lt::op1_range(), operator_lt::op1_range(), operator_lt::op1_range(), operator_mult::op1_range(), operator_not_equal::op1_range(), operator_not_equal::op1_range(), operator_rshift::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(), 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_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_(), union_(), prange::union_(), unsupported_range::union_(), union_bitmask(), unswitch_predicate::unswitch_predicate(), 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()

bool irange::union_append ( const irange & r)
private

◆ union_bitmask()

◆ update_bitmask()

◆ upper_bound() [1/2]

◆ upper_bound() [2/2]

wide_int irange::upper_bound ( unsigned pair) const
inline

References gcc_checking_assert, m_base, m_num_ranges, and 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_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_ge::op2_range(), operator_gt::op2_range(), operator_le::op2_range(), operator_lt::op2_range(), 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(), 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(), 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(), intersect(), prange::intersect(), unsupported_range::intersect(), invert(), prange::invert(), ipa_vr_operation_and_type_effects(), irange_contains_p(), 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(), 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_(), union_(), prange::union_(), unsupported_range::union_(), unswitch_predicate::unswitch_predicate(), value_range::varying_p(), and vr_set_zero_nonzero_bits().

◆ verify_range()

◆ zero_p()

Friends And Related Symbol Documentation

◆ irange_storage

friend class irange_storage
friend

◆ vrange_printer

friend class vrange_printer
friend

Field Documentation

◆ HARD_MAX_RANGES

const int irange::HARD_MAX_RANGES = 255
staticprotected

Referenced by maybe_resize().

◆ m_base

◆ m_bitmask

◆ m_discriminator

◆ m_kind

◆ m_max_ranges

unsigned char irange::m_max_ranges
private

◆ m_num_ranges

◆ m_resizable

bool irange::m_resizable
private

Referenced by maybe_resize().

◆ m_type


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