diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2023-05-24 08:49:30 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2023-05-24 16:40:11 -0400 |
commit | 46a594b949082fc47ced0e8278f162ddbe79db1a (patch) | |
tree | 71194489190c943f2184413966db7a10279c581d /gcc/gimple-range-cache.cc | |
parent | ec2e86274427a402d2de2199ba550f7295ea9b5f (diff) | |
download | gcc-46a594b949082fc47ced0e8278f162ddbe79db1a.zip gcc-46a594b949082fc47ced0e8278f162ddbe79db1a.tar.gz gcc-46a594b949082fc47ced0e8278f162ddbe79db1a.tar.bz2 |
Make ssa_cache and ssa_lazy_cache virtual.
Making them virtual allows us to interchangebly use the caches.
* gimple-range-cache.cc (ssa_cache::dump): Use get_range.
(ssa_cache::dump_range_query): Delete.
(ssa_lazy_cache::dump_range_query): Delete.
(ssa_lazy_cache::get_range): Move from header file.
(ssa_lazy_cache::clear_range): ditto.
(ssa_lazy_cache::clear): Ditto.
* gimple-range-cache.h (class ssa_cache): Virtualize.
(class ssa_lazy_cache): Inherit and virtualize.
Diffstat (limited to 'gcc/gimple-range-cache.cc')
-rw-r--r-- | gcc/gimple-range-cache.cc | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index e069241..f25abaf 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -626,7 +626,7 @@ ssa_cache::dump (FILE *f) // Invoke dump_range_query which is a private virtual version of // get_range. This avoids performance impacts on general queries, // but allows sharing of the dump routine. - if (dump_range_query (r, ssa_name (x)) && !r.varying_p ()) + if (get_range (r, ssa_name (x)) && !r.varying_p ()) { if (print_header) { @@ -648,23 +648,14 @@ ssa_cache::dump (FILE *f) fputc ('\n', f); } -// Virtual private get_range query for dumping. +// Return true if NAME has an active range in the cache. bool -ssa_cache::dump_range_query (vrange &r, tree name) const +ssa_lazy_cache::has_range (tree name) const { - return get_range (r, name); + return bitmap_bit_p (active_p, SSA_NAME_VERSION (name)); } -// Virtual private get_range query for dumping. - -bool -ssa_lazy_cache::dump_range_query (vrange &r, tree name) const -{ - return get_range (r, name); -} - - // Set range of NAME to R in a lazy cache. Return FALSE if it did not already // have a range. @@ -684,6 +675,32 @@ ssa_lazy_cache::set_range (tree name, const vrange &r) return false; } +// Return TRUE if NAME has a range, and return it in R. + +bool +ssa_lazy_cache::get_range (vrange &r, tree name) const +{ + if (!bitmap_bit_p (active_p, SSA_NAME_VERSION (name))) + return false; + return ssa_cache::get_range (r, name); +} + +// Remove NAME from the active range list. + +void +ssa_lazy_cache::clear_range (tree name) +{ + bitmap_clear_bit (active_p, SSA_NAME_VERSION (name)); +} + +// Remove all ranges from the active range list. + +void +ssa_lazy_cache::clear () +{ + bitmap_clear (active_p); +} + // -------------------------------------------------------------------------- |