22#ifndef GCC_VALUE_RANGE_H
23#define GCC_VALUE_RANGE_H
79 template <
typename T>
friend bool is_a (
vrange &);
113 void dump (FILE *)
const;
149 void dump (FILE *)
const;
233 if (unknown1 || unknown2)
234 return unknown1 == unknown2;
289 virtual tree type ()
const override;
300 virtual bool zero_p ()
const override;
301 virtual bool nonzero_p ()
const override;
365template<
unsigned N,
bool RESIZABLE = false>
414 bool operator== (const
prange &) const;
544 virtual tree type ()
const override;
550 void set_nan (
tree type,
bool sign);
552 virtual void set_varying (
tree type)
override;
553 virtual void set_undefined ()
override;
554 virtual bool union_ (
const vrange &)
override;
555 virtual bool intersect (
const vrange &)
override;
557 virtual bool singleton_p (
tree *result =
NULL)
const override;
561 virtual bool zero_p ()
const override;
562 virtual bool nonzero_p ()
const override;
563 virtual void set_nonzero (
tree type)
override;
564 virtual void set_zero (
tree type)
override;
565 virtual void set_nonnegative (
tree type)
override;
566 virtual bool fits_p (
const vrange &)
const override;
572 virtual tree lbound ()
const override;
573 virtual tree ubound ()
const override;
576 void update_nan (
bool sign);
580 void flush_denormals_to_zero ();
583 bool known_isfinite ()
const;
584 bool known_isnan ()
const;
585 bool known_isinf ()
const;
588 bool maybe_isinf ()
const;
589 bool signbit_p (
bool &signbit)
const;
590 bool nan_signbit_p (
bool &signbit)
const;
591 bool known_isnormal ()
const;
592 bool known_isdenormal_or_zero ()
const;
595 virtual bool contains_p (
tree cst)
const override;
600 void verify_range ();
601 bool normalize_kind ();
602 bool union_nans (
const frange &);
603 bool intersect_nans (
const frange &);
604 bool combine_zeros (
const frange &,
bool union_p);
651 const T &derived =
static_cast<const T &
> (v);
652 return is_a <T> (
const_cast<T &
> (derived));
660 return static_cast <T &
> (v);
668 return static_cast <const T &
> (v);
715 for (
unsigned i = 0;
i < n; ++
i)
721template<
unsigned N,
bool RESIZABLE>
773 operator const vrange &()
const;
774 void dump (FILE *)
const;
800 void init (
const vrange &);
951value_range::operator
const vrange &()
const
1068 m_resizable (resizable),
1069 m_max_ranges (nranges)
1077template<
unsigned N,
bool RESIZABLE>
1080 :
irange (m_ranges,
N, RESIZABLE)
1084template<
unsigned N,
bool RESIZABLE>
1086 :
irange (m_ranges,
N, RESIZABLE)
1091template<
unsigned N,
bool RESIZABLE>
1093 :
irange (m_ranges,
N, RESIZABLE)
1098template<
unsigned N,
bool RESIZABLE>
1100 :
irange (m_ranges,
N, RESIZABLE)
1105template<
unsigned N,
bool RESIZABLE>
1108 :
irange (m_ranges,
N, RESIZABLE)
1113template<
unsigned N,
bool RESIZABLE>
1115 :
irange (m_ranges,
N, RESIZABLE)
1120template<
unsigned N,
bool RESIZABLE>
1242 if (
r.undefined_p ())
1246 return r.contains_p (zero);
1446 set (min, max, kind);
1550 buf,
sizeof (buf),
false);
1750 signbit =
m_min.sign;
1758 || (nan_sign ==
m_min.sign && nan_sign ==
m_max.sign))
Definition value-range-storage.h:137
Definition value-range.h:527
tree m_type
Definition value-range.h:606
void update_nan(tree)=delete
void set(tree type, const REAL_VALUE_TYPE &, const REAL_VALUE_TYPE &, value_range_kind=VR_RANGE)
Definition value-range.cc:824
void update_nan()
Definition value-range.h:1506
void clear_nan()
Definition value-range.h:1532
REAL_VALUE_TYPE m_min
Definition value-range.h:607
bool known_isfinite() const
Definition value-range.h:1646
bool known_isdenormal_or_zero() const
Definition value-range.h:1670
REAL_VALUE_TYPE m_max
Definition value-range.h:608
void verify_range()
Definition value-range.cc:1205
bool maybe_isinf() const
Definition value-range.h:1683
bool m_neg_nan
Definition value-range.h:610
bool known_isnormal() const
Definition value-range.h:1656
bool nan_signbit_p(bool &signbit) const
Definition value-range.h:1770
virtual void set_varying(tree type) override
Definition value-range.h:1457
bool m_pos_nan
Definition value-range.h:609
bool known_isnan() const
Definition value-range.h:1728
virtual void set_undefined() override
Definition value-range.h:1476
bool maybe_isnan() const
Definition value-range.h:1706
bool normalize_kind()
Definition value-range.cc:847
bool known_isinf() const
Definition value-range.h:1695
const REAL_VALUE_TYPE & upper_bound() const
Definition value-range.h:621
void set_nan(tree type)
Definition value-range.h:1628
frange()
Definition value-range.h:1409
const REAL_VALUE_TYPE & lower_bound() const
Definition value-range.h:614
bool signbit_p(bool &signbit) const
Definition value-range.h:1737
bool contains_p(const REAL_VALUE_TYPE &) const
Definition value-range.cc:1111
static bool supports_p(const_tree type)
Definition value-range.h:537
virtual tree type() const override
Definition value-range.h:1450
nan_state get_nan_state() const
Definition value-range.h:630
Definition value-range.h:367
wide_int m_ranges[N *2]
Definition value-range.h:380
int_range()
Definition value-range.h:1079
int_range(tree type, const wide_int &, const wide_int &, value_range_kind=VR_RANGE)
Definition value-range.h:1106
int_range(tree type)
Definition value-range.h:1099
int_range(const irange &)
Definition value-range.h:1114
int_range(const int_range &)
Definition value-range.h:1085
int_range & operator=(const int_range &)
Definition value-range.h:1122
~int_range() final override
Definition value-range.h:723
Definition value-range.h:134
irange_bitmask(unsigned prec)
Definition value-range.h:137
void dump(FILE *) const
Definition value-range.cc:291
void adjust_range(irange &r) const
Definition value-range.cc:2257
void verify_mask() const
Definition value-range.cc:2481
void set_nonzero_bits(const wide_int &bits)
Definition value-range.h:207
unsigned get_precision() const
Definition value-range.h:189
bool member_p(const wide_int &val) const
Definition value-range.h:218
void set_unknown(unsigned prec)
Definition value-range.h:163
bool unknown_p() const
Definition value-range.h:174
void union_(const irange_bitmask &src)
Definition value-range.h:239
bool operator==(const irange_bitmask &src) const
Definition value-range.h:229
wide_int get_nonzero_bits() const
Definition value-range.h:200
wide_int mask() const
Definition value-range.h:140
bool operator!=(const irange_bitmask &src) const
Definition value-range.h:147
irange_bitmask()
Definition value-range.h:136
wide_int m_mask
Definition value-range.h:159
void intersect(const irange_bitmask &src)
Definition value-range.h:248
wide_int m_value
Definition value-range.h:158
wide_int value() const
Definition value-range.h:139
Definition value-range-storage.h:65
Definition value-range.h:273
void invert()
Definition value-range.cc:2160
bool union_bitmask(const irange &r)
Definition value-range.cc:2440
virtual bool nonzero_p() const override
Definition value-range.h:1030
virtual bool zero_p() const override
Definition value-range.h:1022
bool m_resizable
Definition value-range.h:350
virtual bool supports_type_p(const_tree type) const override
Definition value-range.cc:396
virtual void set_nonzero(tree type) override
Definition value-range.h:1189
unsigned num_pairs() const
Definition value-range.h:975
unsigned char m_max_ranges
Definition value-range.h:351
virtual bool union_(const vrange &) override
Definition value-range.cc:1755
virtual void set_nonnegative(tree type) override
Definition value-range.cc:410
void maybe_resize(int needed)
Definition value-range.h:705
bool union_append(const irange &r)
Definition value-range.cc:1717
virtual void set_varying(tree type) override
Definition value-range.h:1136
virtual tree lbound() const override
Definition value-range.cc:2469
bool intersect_bitmask(const irange &r)
Definition value-range.cc:2407
tree m_type
Definition value-range.h:352
virtual bool intersect(const vrange &) override
Definition value-range.cc:1940
bool nonnegative_p() const
Definition value-range.cc:384
virtual irange_bitmask get_bitmask() const override
Definition value-range.cc:2352
wide_int * m_base
Definition value-range.h:355
static const int HARD_MAX_RANGES
Definition value-range.h:340
bool operator==(const irange &) const
Definition value-range.cc:1557
virtual bool fits_p(const vrange &r) const override
Definition value-range.cc:404
void set(tree type, const wide_int &, const wide_int &, value_range_kind=VR_RANGE)
Definition value-range.cc:1438
unsigned char m_num_ranges
Definition value-range.h:349
virtual void accept(const vrange_visitor &v) const override
Definition value-range.cc:56
bool irange_single_pair_union(const irange &r)
Definition value-range.cc:1650
virtual bool singleton_p(tree *result=NULL) const override
Definition value-range.cc:1594
static bool supports_p(const_tree type)
Definition value-range.h:1040
wide_int upper_bound() const
Definition value-range.h:1179
wide_int lower_bound(unsigned=0) const
Definition value-range.h:1158
irange_bitmask m_bitmask
Definition value-range.h:353
virtual void set_undefined() override
Definition value-range.h:1129
virtual tree ubound() const override
Definition value-range.cc:2475
bool nonpositive_p() const
Definition value-range.cc:390
irange & operator=(const irange &)
Definition value-range.cc:1317
void verify_range()
Definition value-range.cc:1515
virtual void set_zero(tree type) override
Definition value-range.h:1215
virtual void update_bitmask(const class irange_bitmask &) override
Definition value-range.cc:2333
bool contains_p(const wide_int &) const
Definition value-range.cc:1623
bool set_range_from_bitmask()
Definition value-range.cc:2287
bool irange_contains_p(const irange &) const
Definition value-range.cc:1894
bool varying_compatible_p() const
Definition value-range.h:988
virtual tree type() const override
Definition value-range.h:981
void normalize_kind()
Definition value-range.h:1224
bool operator!=(const irange &r) const
Definition value-range.h:316
irange(wide_int *, unsigned nranges, bool resizable)
Definition value-range.h:1066
Definition value-range.h:473
bool neg_p() const
Definition value-range.h:516
bool m_neg_nan
Definition value-range.h:481
bool pos_p() const
Definition value-range.h:508
bool m_pos_nan
Definition value-range.h:480
nan_state(bool)
Definition value-range.h:488
Definition value-range-storage.h:104
Definition value-range.h:384
virtual bool supports_type_p(const_tree type) const final override
Definition value-range.h:1299
wide_int m_min
Definition value-range.h:428
prange()
Definition value-range.h:1264
wide_int upper_bound() const
Definition value-range.h:1382
irange_bitmask get_bitmask() const final override
Definition value-range.h:1396
wide_int m_max
Definition value-range.h:429
virtual bool contains_p(tree cst) const final override
Definition value-range.h:1350
tree m_type
Definition value-range.h:427
bool varying_compatible_p() const
Definition value-range.h:1389
virtual void set_varying(tree type) final override
Definition value-range.h:1311
static bool supports_p(const_tree type)
Definition value-range.h:1293
virtual void set_zero(tree type) final override
Definition value-range.h:1337
wide_int lower_bound() const
Definition value-range.h:1375
virtual bool fits_p(const vrange &v) const final override
Definition value-range.h:1402
virtual bool zero_p() const final override
Definition value-range.h:1356
virtual void set_undefined() final override
Definition value-range.h:1305
void verify_range() const
Definition value-range.cc:665
virtual void set_nonzero(tree type) final override
Definition value-range.h:1324
virtual bool nonzero_p() const final override
Definition value-range.h:1362
virtual tree type() const final override
Definition value-range.h:1368
virtual void set(tree, tree, value_range_kind=VR_RANGE) final override
Definition value-range.cc:434
irange_bitmask m_bitmask
Definition value-range.h:430
Definition range-op.h:291
Definition value-range.h:437
unsupported_range & operator=(const unsupported_range &r)
Definition value-range.cc:220
unsupported_range(const unsupported_range &src)
Definition value-range.h:444
unsupported_range()
Definition value-range.h:439
Definition value-range.h:759
void set_zero(tree type)
Definition value-range.h:787
~value_range()
Definition value-range.h:859
bool undefined_p() const
Definition value-range.h:779
bool contains_p(tree cst) const
Definition value-range.h:784
static bool supports_type_p(const_tree type)
Definition value-range.h:959
void accept(const vrange_visitor &v) const
Definition value-range.h:797
bool nonzero_p() const
Definition value-range.h:790
bool varying_p() const
Definition value-range.h:778
vrange * m_vrange
Definition value-range.h:802
tree type()
Definition value-range.h:777
irange_bitmask get_bitmask() const
Definition value-range.h:794
tree ubound() const
Definition value-range.h:793
value_range()
Definition value-range.h:817
bool intersect(const vrange &r)
Definition value-range.h:783
void update_bitmask(const class irange_bitmask &bm)
Definition value-range.h:795
bool union_(const vrange &r)
Definition value-range.h:782
void set_nonzero(tree type)
Definition value-range.h:788
void set_type(tree type)
Definition value-range.h:869
void set_undefined()
Definition value-range.h:781
bool zero_p() const
Definition value-range.h:791
bool operator!=(const value_range &r) const
Definition value-range.h:939
bool singleton_p(tree *result=NULL) const
Definition value-range.h:785
tree lbound() const
Definition value-range.h:792
void set_varying(tree type)
Definition value-range.h:780
vrange & operator=(const vrange &)
Definition value-range.h:915
union value_range::buffer_type m_buffer
bool operator==(const value_range &r) const
Definition value-range.h:933
void init(tree type)
Definition value-range.h:880
Definition value-range-pretty-print.h:25
Definition value-range.h:736
virtual void visit(const unsupported_range &) const
Definition value-range.h:741
virtual void visit(const irange &) const
Definition value-range.h:738
virtual void visit(const frange &) const
Definition value-range.h:740
virtual void visit(const prange &) const
Definition value-range.h:739
Definition value-range.h:78
friend class value_range
Definition value-range.h:80
virtual irange_bitmask get_bitmask() const
Definition value-range.cc:98
vrange(enum value_range_discriminator d)
Definition value-range.h:115
enum value_range_kind m_kind
Definition value-range.h:116
virtual bool singleton_p(tree *result=NULL) const =0
bool operator!=(const vrange &r) const
Definition value-range.h:112
virtual bool supports_type_p(const_tree type) const =0
virtual void set_zero(tree type)=0
virtual bool union_(const vrange &)=0
virtual ~vrange()
Definition value-range.h:100
virtual bool nonzero_p() const =0
virtual bool zero_p() const =0
virtual void set(tree, tree, value_range_kind=VR_RANGE)=0
virtual void set_varying(tree type)=0
bool undefined_p() const
Definition value-range.h:1016
enum value_range_discriminator m_discriminator
Definition value-range.h:117
virtual void set_undefined()=0
virtual bool intersect(const vrange &)=0
virtual void set_nonzero(tree type)=0
virtual void update_bitmask(const class irange_bitmask &)
Definition value-range.cc:93
virtual tree ubound() const =0
friend bool is_a(vrange &)
Definition value-range.h:640
void set_nonzero_bits(const wide_int &bits)
Definition value-range.cc:2386
virtual void set_nonnegative(tree type)=0
virtual void accept(const class vrange_visitor &v) const =0
virtual bool contains_p(tree cst) const =0
vrange & operator=(const vrange &)
Definition value-range.cc:247
virtual tree lbound() const =0
virtual tree type() const =0
void dump(FILE *) const
Definition value-range.cc:280
friend void streamer_write_vrange(struct output_block *, const vrange &)
Definition data-streamer-out.cc:408
wide_int get_nonzero_bits() const
Definition value-range.cc:2396
virtual bool fits_p(const vrange &r) const =0
bool varying_p() const
Definition value-range.h:1010
bool operator==(const vrange &) const
Definition value-range.cc:266
unsigned int get_precision() const
Definition wide-int.h:1252
const union tree_node * const_tree
Definition coretypes.h:98
union tree_node * tree
Definition coretypes.h:97
bool operator==(const nowarn_spec_t &lhs, const nowarn_spec_t &rhs)
Definition diagnostic-spec.h:131
bool operator!=(const nowarn_spec_t &lhs, const nowarn_spec_t &rhs)
Definition diagnostic-spec.h:139
REAL_VALUE_TYPE dconstninf
Definition emit-rtl.cc:113
REAL_VALUE_TYPE dconstinf
Definition emit-rtl.cc:112
void final(rtx_insn *first, FILE *file, int optimize_p)
Definition final.cc:2004
static type_p type(options_p *optsp, bool nested)
Definition gengtype-parse.cc:883
tree_code
Definition genmatch.cc:992
#define N
Definition gensupport.cc:202
Definition fold-const.cc:4328
void add_vrange(const vrange &v, inchash::hash &hstate, unsigned int)
Definition value-range.cc:317
wide_int min_value(machine_mode, signop)
Definition rtl.h:2346
hwi_with_prec minus_one(unsigned int)
Definition wide-int.h:2011
hwi_with_prec zero(unsigned int)
Definition wide-int.h:2018
BINARY_FUNCTION bit_and(const T1 &, const T2 &)
wide_int max_value(machine_mode, signop)
Definition rtl.h:2354
tree_to_wide_ref to_wide(const_tree)
Definition tree.h:6439
hwi_with_prec one(unsigned int)
Definition wide-int.h:2025
poly_int< N, C > r
Definition poly-int.h:774
i
Definition poly-int.h:776
static bool maybe_isnan(const frange &op1, const frange &op2)
Definition range-op-float.cc:239
static bool zero_p(const REAL_VALUE_TYPE &lb, const REAL_VALUE_TYPE &ub)
Definition range-op-float.cc:2266
int real_from_string(REAL_VALUE_TYPE *r, const char *str)
Definition real.cc:2006
bool HONOR_NANS(machine_mode m)
Definition real.cc:5498
REAL_VALUE_TYPE real_value_negate(const REAL_VALUE_TYPE *op0)
Definition real.cc:1115
bool real_isneg(const REAL_VALUE_TYPE *r)
Definition real.cc:1280
bool real_isinf(const REAL_VALUE_TYPE *r)
Definition real.cc:1242
static bool real_isdenormal(const REAL_VALUE_TYPE *r)
Definition real.cc:120
bool real_identical(const REAL_VALUE_TYPE *a, const REAL_VALUE_TYPE *b)
Definition real.cc:1312
bool HONOR_INFINITIES(machine_mode m)
Definition real.cc:5539
bool real_iszero(const REAL_VALUE_TYPE *r)
Definition real.cc:1288
void get_max_float(const struct real_format *fmt, char *buf, size_t len, bool norm_max)
Definition real.cc:5436
#define REAL_MODE_FORMAT(MODE)
Definition real.h:183
#define REAL_VALUE_TYPE
Definition real.h:68
signop
Definition signop.h:28
@ UNSIGNED
Definition signop.h:30
Definition lto-streamer.h:707
Definition gengtype.h:218
Definition gengtype.h:252
#define NULL
Definition system.h:50
#define gcc_unreachable()
Definition system.h:841
#define gcc_checking_assert(EXPR)
Definition system.h:821
tree build_zero_cst(tree type)
Definition tree.cc:2665
#define DECIMAL_FLOAT_TYPE_P(TYPE)
Definition tree.h:680
#define TYPE_PRECISION(NODE)
Definition tree.h:2288
#define SCALAR_FLOAT_TYPE_P(TYPE)
Definition tree.h:648
#define TREE_REAL_CST_PTR(NODE)
Definition tree.h:1155
#define TYPE_UNSIGNED(NODE)
Definition tree.h:949
#define TYPE_MODE(NODE)
Definition tree.h:2297
#define TYPE_SIGN(NODE)
Definition tree.h:952
#define POINTER_TYPE_P(TYPE)
Definition tree.h:700
#define TYPE_P(NODE)
Definition tree.h:226
#define TREE_TYPE(NODE)
Definition tree.h:512
#define INTEGRAL_TYPE_P(TYPE)
Definition tree.h:613
#define error_mark_node
Definition tree.h:4454
Definition value-range.h:803
unsupported_range unsupported
Definition value-range.h:806
buffer_type()
Definition value-range.h:808
prange pointers
Definition value-range.h:807
~buffer_type()
Definition value-range.h:809
frange floats
Definition value-range.h:805
int_range_max ints
Definition value-range.h:804
T & as_a(vrange &v)
Definition value-range.h:657
REAL_VALUE_TYPE frange_val_max(const_tree type)
Definition value-range.h:1580
bool range_includes_zero_p(const vrange &vr)
Definition value-range.h:1052
wide_int irange_val_max(const_tree type)
Definition value-range.h:1257
value_range_kind
Definition value-range.h:29
@ VR_ANTI_RANGE
Definition value-range.h:37
@ VR_RANGE
Definition value-range.h:35
@ VR_LAST
Definition value-range.h:41
@ VR_NAN
Definition value-range.h:39
@ VR_VARYING
Definition value-range.h:33
@ VR_UNDEFINED
Definition value-range.h:31
void dump_value_range(FILE *, const vrange *)
Definition value-range.cc:2488
bool is_a< prange >(vrange &v)
Definition value-range.h:682
bool is_a< unsupported_range >(vrange &v)
Definition value-range.h:696
value_range_discriminator
Definition value-range.h:47
@ VR_UNKNOWN
Definition value-range.h:55
@ VR_IRANGE
Definition value-range.h:49
@ VR_PRANGE
Definition value-range.h:51
@ VR_FRANGE
Definition value-range.h:53
REAL_VALUE_TYPE real_min_representable(const_tree type)
Definition value-range.h:1559
void frange_arithmetic(enum tree_code, tree, REAL_VALUE_TYPE &, const REAL_VALUE_TYPE &, const REAL_VALUE_TYPE &, const REAL_VALUE_TYPE &)
Definition range-op-float.cc:331
int_range< 3, true > int_range_max
Definition value-range.h:733
value_range_kind get_legacy_range(const vrange &, tree &min, tree &max)
Definition value-range.cc:1420
bool is_a< frange >(vrange &v)
Definition value-range.h:689
void frange_nextafter(enum machine_mode, REAL_VALUE_TYPE &, const REAL_VALUE_TYPE &)
Definition range-op-float.cc:298
REAL_VALUE_TYPE real_max_representable(const_tree type)
Definition value-range.h:1545
wide_int irange_val_min(const_tree type)
Definition value-range.h:1250
bool range_compatible_p(tree type1, tree type2)
Definition value-range.h:1791
bool frange_val_is_min(const REAL_VALUE_TYPE &r, const_tree type)
Definition value-range.h:1591
bool contains_zero_p(const irange &r)
Definition value-range.h:1240
bool frange_val_is_max(const REAL_VALUE_TYPE &r, const_tree type)
Definition value-range.h:1600
bool vrp_operand_equal_p(const_tree, const_tree)
Definition value-range.cc:2509
REAL_VALUE_TYPE frange_val_min(const_tree type)
Definition value-range.h:1569
bool is_a< irange >(vrange &v)
Definition value-range.h:675