diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2024-02-22 09:18:46 +0100 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2024-04-28 21:03:00 +0200 |
commit | fd4cf7a092bb2ce21c0d8246c17c0b7f82de440c (patch) | |
tree | 65905f542f5a027c19b8923e348f5f0744671469 /gcc/value-range.cc | |
parent | ba1a8e8eed963c0253c6e5550c8bccc264c5d469 (diff) | |
download | gcc-fd4cf7a092bb2ce21c0d8246c17c0b7f82de440c.zip gcc-fd4cf7a092bb2ce21c0d8246c17c0b7f82de440c.tar.gz gcc-fd4cf7a092bb2ce21c0d8246c17c0b7f82de440c.tar.bz2 |
Move bitmask routines to vrange base class.
Any range can theoretically have a bitmask of set bits. This patch
moves the bitmask accessors to the base class. This cleans up some
users in IPA*, and will provide a cleaner interface when prange is in
place.
gcc/ChangeLog:
* ipa-cp.cc (propagate_bits_across_jump_function): Access bitmask
through base class.
(ipcp_store_vr_results): Same.
* ipa-prop.cc (ipa_compute_jump_functions_for_edge): Same.
(ipcp_get_parm_bits): Same.
(ipcp_update_vr): Same.
* range-op-mixed.h (update_known_bitmask): Change argument to vrange.
* range-op.cc (update_known_bitmask): Same.
* value-range.cc (vrange::update_bitmask): New.
(irange::set_nonzero_bits): Move to vrange class.
(irange::get_nonzero_bits): Same.
* value-range.h (class vrange): Add update_bitmask, get_bitmask,
get_nonzero_bits, and set_nonzero_bits.
(class irange): Make bitmask methods virtual overrides.
(class Value_Range): Add get_bitmask and update_bitmask.
Diffstat (limited to 'gcc/value-range.cc')
-rw-r--r-- | gcc/value-range.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/value-range.cc b/gcc/value-range.cc index ccac517..926f7b7 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -68,6 +68,18 @@ unsupported_range::accept (const vrange_visitor &v) const v.visit (*this); } +void +vrange::update_bitmask (const class irange_bitmask &) +{ +} + +irange_bitmask +vrange::get_bitmask () const +{ + // Return all unknown bits for the given precision. + return irange_bitmask (TYPE_PRECISION (type ())); +} + bool unsupported_range::contains_p (tree) const { @@ -2010,7 +2022,7 @@ irange::get_bitmask () const // normalize the range if anything changed. void -irange::set_nonzero_bits (const wide_int &bits) +vrange::set_nonzero_bits (const wide_int &bits) { gcc_checking_assert (!undefined_p ()); irange_bitmask bm (wi::zero (TYPE_PRECISION (type ())), bits); @@ -2020,7 +2032,7 @@ irange::set_nonzero_bits (const wide_int &bits) // Return the nonzero bits in R. wide_int -irange::get_nonzero_bits () const +vrange::get_nonzero_bits () const { gcc_checking_assert (!undefined_p ()); irange_bitmask bm = get_bitmask (); |