diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2023-03-28 11:32:21 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2023-04-26 15:17:08 -0400 |
commit | 8a3590e5ce8fcc6b381d9572edbca6157bd67cfd (patch) | |
tree | b1176591e8dd60847e5220355cbe6cdc6884f8f1 /gcc/gimple-range-cache.cc | |
parent | b6dea04fca6f249c553cb18d670a0845cd0579f8 (diff) | |
download | gcc-8a3590e5ce8fcc6b381d9572edbca6157bd67cfd.zip gcc-8a3590e5ce8fcc6b381d9572edbca6157bd67cfd.tar.gz gcc-8a3590e5ce8fcc6b381d9572edbca6157bd67cfd.tar.bz2 |
Rename ssa_global_cache to ssa_cache and add has_range
This renames the ssa_global_cache to be ssa_cache. The original use was
to function as a global cache, but its uses have expanded. Remove all mention
of "global" from the class and methods. Also add a has_range method.
* gimple-range-cache.cc (ssa_cache::ssa_cache): Rename.
(ssa_cache::~ssa_cache): Rename.
(ssa_cache::has_range): New.
(ssa_cache::get_range): Rename.
(ssa_cache::set_range): Rename.
(ssa_cache::clear_range): Rename.
(ssa_cache::clear): Rename.
(ssa_cache::dump): Rename and use get_range.
(ranger_cache::get_global_range): Use get_range and set_range.
(ranger_cache::range_of_def): Use get_range.
* gimple-range-cache.h (class ssa_cache): Rename class and methods.
(class ranger_cache): Use ssa_cache.
* gimple-range-path.cc (path_range_query::path_range_query): Use
ssa_cache.
(path_range_query::get_cache): Use get_range.
(path_range_query::set_cache): Use set_range.
* gimple-range-path.h (class path_range_query): Use ssa_cache.
* gimple-range.cc (assume_query::assume_range_p): Use get_range.
(assume_query::range_of_expr): Use get_range.
(assume_query::assume_query): Use set_range.
(assume_query::calculate_op): Use get_range and set_range.
* gimple-range.h (class assume_query): Use ssa_cache.
Diffstat (limited to 'gcc/gimple-range-cache.cc')
-rw-r--r-- | gcc/gimple-range-cache.cc | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 868d2dd..6de96f6 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -530,27 +530,38 @@ block_range_cache::dump (FILE *f, basic_block bb, bool print_varying) // ------------------------------------------------------------------------- -// Initialize a global cache. +// Initialize an ssa cache. -ssa_global_cache::ssa_global_cache () +ssa_cache::ssa_cache () { m_tab.create (0); m_range_allocator = new obstack_vrange_allocator; } -// Deconstruct a global cache. +// Deconstruct an ssa cache. -ssa_global_cache::~ssa_global_cache () +ssa_cache::~ssa_cache () { m_tab.release (); delete m_range_allocator; } +// Return TRUE if the global range of NAME has a cache entry. + +bool +ssa_cache::has_range (tree name) const +{ + unsigned v = SSA_NAME_VERSION (name); + if (v >= m_tab.length ()) + return false; + return m_tab[v] != NULL; +} + // Retrieve the global range of NAME from cache memory if it exists. // Return the value in R. bool -ssa_global_cache::get_global_range (vrange &r, tree name) const +ssa_cache::get_range (vrange &r, tree name) const { unsigned v = SSA_NAME_VERSION (name); if (v >= m_tab.length ()) @@ -563,11 +574,11 @@ ssa_global_cache::get_global_range (vrange &r, tree name) const return true; } -// Set the range for NAME to R in the global cache. +// Set the range for NAME to R in the ssa cache. // Return TRUE if there was already a range set, otherwise false. bool -ssa_global_cache::set_global_range (tree name, const vrange &r) +ssa_cache::set_range (tree name, const vrange &r) { unsigned v = SSA_NAME_VERSION (name); if (v >= m_tab.length ()) @@ -584,7 +595,7 @@ ssa_global_cache::set_global_range (tree name, const vrange &r) // Set the range for NAME to R in the global cache. void -ssa_global_cache::clear_global_range (tree name) +ssa_cache::clear_range (tree name) { unsigned v = SSA_NAME_VERSION (name); if (v >= m_tab.length ()) @@ -592,19 +603,19 @@ ssa_global_cache::clear_global_range (tree name) m_tab[v] = NULL; } -// Clear the global cache. +// Clear the ssa cache. void -ssa_global_cache::clear () +ssa_cache::clear () { if (m_tab.address ()) memset (m_tab.address(), 0, m_tab.length () * sizeof (vrange *)); } -// Dump the contents of the global cache to F. +// Dump the contents of the ssa cache to F. void -ssa_global_cache::dump (FILE *f) +ssa_cache::dump (FILE *f) { /* Cleared after the table header has been printed. */ bool print_header = true; @@ -613,7 +624,7 @@ ssa_global_cache::dump (FILE *f) if (!gimple_range_ssa_p (ssa_name (x))) continue; Value_Range r (TREE_TYPE (ssa_name (x))); - if (get_global_range (r, ssa_name (x)) && !r.varying_p ()) + if (get_range (r, ssa_name (x)) && !r.varying_p ()) { if (print_header) { @@ -877,7 +888,7 @@ ranger_cache::dump_bb (FILE *f, basic_block bb) bool ranger_cache::get_global_range (vrange &r, tree name) const { - if (m_globals.get_global_range (r, name)) + if (m_globals.get_range (r, name)) return true; gimple_range_global (r, name); return false; @@ -902,7 +913,7 @@ ranger_cache::get_global_range (vrange &r, tree name, bool ¤t_p) || m_temporal->current_p (name, m_gori.depend1 (name), m_gori.depend2 (name)); else - m_globals.set_global_range (name, r); + m_globals.set_range (name, r); // If the existing value was not current, mark it as always current. if (!current_p) @@ -915,7 +926,7 @@ ranger_cache::get_global_range (vrange &r, tree name, bool ¤t_p) void ranger_cache::set_global_range (tree name, const vrange &r) { - if (m_globals.set_global_range (name, r)) + if (m_globals.set_range (name, r)) { // If there was already a range set, propagate the new value. basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (name)); @@ -954,7 +965,7 @@ ranger_cache::range_of_def (vrange &r, tree name, basic_block bb) gcc_checking_assert (!bb || bb == gimple_bb (SSA_NAME_DEF_STMT (name))); // Pick up the best global range available. - if (!m_globals.get_global_range (r, name)) + if (!m_globals.get_range (r, name)) { // If that fails, try to calculate the range using just global values. gimple *s = SSA_NAME_DEF_STMT (name); |