diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2023-05-24 19:47:02 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2023-05-25 07:24:52 +0200 |
commit | c1c564629f3277e6ac79822ad4e1896fc5d9d450 (patch) | |
tree | 9162fff9b3856a5227be5e022281312afe662af4 /gcc/value-range.h | |
parent | d6b756447cd58bcca20e6892790582308b869817 (diff) | |
download | gcc-c1c564629f3277e6ac79822ad4e1896fc5d9d450.zip gcc-c1c564629f3277e6ac79822ad4e1896fc5d9d450.tar.gz gcc-c1c564629f3277e6ac79822ad4e1896fc5d9d450.tar.bz2 |
Add an frange::set_nan() variant that takes a nan_state.
Generalize frange::set_nan() to take a nan_state and make current
set_nan() methods syntactic sugar.
This is in preparation for better streaming of NANs for LTO/IPA.
gcc/ChangeLog:
* value-range.h (frange::set_nan): New.
Diffstat (limited to 'gcc/value-range.h')
-rw-r--r-- | gcc/value-range.h | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h index b8cc2a0..39023e7 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -327,6 +327,7 @@ public: const nan_state &, value_range_kind = VR_RANGE); void set_nan (tree type); void set_nan (tree type, bool sign); + void set_nan (tree type, const nan_state &); virtual void set_varying (tree type) override; virtual void set_undefined () override; virtual bool union_ (const vrange &) override; @@ -1219,17 +1220,18 @@ frange_val_is_max (const REAL_VALUE_TYPE &r, const_tree type) return real_identical (&max, &r); } -// Build a signless NAN of type TYPE. +// Build a NAN with a state of NAN. inline void -frange::set_nan (tree type) +frange::set_nan (tree type, const nan_state &nan) { + gcc_checking_assert (nan.pos_p () || nan.neg_p ()); if (HONOR_NANS (type)) { m_kind = VR_NAN; m_type = type; - m_pos_nan = true; - m_neg_nan = true; + m_neg_nan = nan.neg_p (); + m_pos_nan = nan.pos_p (); if (flag_checking) verify_range (); } @@ -1237,22 +1239,22 @@ frange::set_nan (tree type) set_undefined (); } +// Build a signless NAN of type TYPE. + +inline void +frange::set_nan (tree type) +{ + nan_state nan (true); + set_nan (type, nan); +} + // Build a NAN of type TYPE with SIGN. inline void frange::set_nan (tree type, bool sign) { - if (HONOR_NANS (type)) - { - m_kind = VR_NAN; - m_type = type; - m_neg_nan = sign; - m_pos_nan = !sign; - if (flag_checking) - verify_range (); - } - else - set_undefined (); + nan_state nan (/*pos=*/!sign, /*neg=*/sign); + set_nan (type, nan); } // Return TRUE if range is known to be finite. |