// 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)
{
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.
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);
+}
+
// --------------------------------------------------------------------------
public:
ssa_cache ();
~ssa_cache ();
- bool has_range (tree name) const;
- bool get_range (vrange &r, tree name) const;
- bool set_range (tree name, const vrange &r);
- void clear_range (tree name);
- void clear ();
+ virtual bool has_range (tree name) const;
+ virtual bool get_range (vrange &r, tree name) const;
+ virtual bool set_range (tree name, const vrange &r);
+ virtual void clear_range (tree name);
+ virtual void clear ();
void dump (FILE *f = stderr);
protected:
- virtual bool dump_range_query (vrange &r, tree name) const;
vec<vrange_storage *> m_tab;
vrange_allocator *m_range_allocator;
};
// This is the same as global cache, except it maintains an active bitmap
// rather than depending on a zero'd out vector of pointers. This is better
// for sparsely/lightly used caches.
-// It could be made a fully derived class, but at this point there doesnt seem
-// to be a need to take the performance hit for it.
-class ssa_lazy_cache : protected ssa_cache
+class ssa_lazy_cache : public ssa_cache
{
public:
inline ssa_lazy_cache () { active_p = BITMAP_ALLOC (NULL); }
inline ~ssa_lazy_cache () { BITMAP_FREE (active_p); }
- bool set_range (tree name, const vrange &r);
- inline bool get_range (vrange &r, tree name) const;
- inline void clear_range (tree name)
- { bitmap_clear_bit (active_p, SSA_NAME_VERSION (name)); } ;
- inline void clear () { bitmap_clear (active_p); }
- inline void dump (FILE *f = stderr) { ssa_cache::dump (f); }
+ virtual bool has_range (tree name) const;
+ virtual bool set_range (tree name, const vrange &r);
+ virtual bool get_range (vrange &r, tree name) const;
+ virtual void clear_range (tree name);
+ virtual void clear ();
protected:
- virtual bool dump_range_query (vrange &r, tree name) const;
bitmap active_p;
};
-// 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);
-}
-
// This class provides all the caches a global ranger may need, and makes
// them available for gori-computes to query so outgoing edges can be
// properly calculated.