}
+// Construct an ssa_lazy_cache. If OB is specified, us it, otherwise use
+// a local bitmap obstack.
+
+ssa_lazy_cache::ssa_lazy_cache (bitmap_obstack *ob)
+{
+ if (!ob)
+ {
+ bitmap_obstack_initialize (&m_bitmaps);
+ m_ob = &m_bitmaps;
+ }
+ else
+ m_ob = ob;
+ active_p = BITMAP_ALLOC (m_ob);
+}
+
+// Destruct an sa_lazy_cache. Free the bitmap if it came from a different
+// obstack, or release the obstack if it was a local one.
+
+ssa_lazy_cache::~ssa_lazy_cache ()
+{
+ if (m_ob == &m_bitmaps)
+ bitmap_obstack_release (&m_bitmaps);
+ else
+ BITMAP_FREE (active_p);
+}
+
// Return true if NAME has an active range in the cache.
bool
class ssa_lazy_cache : public ssa_cache
{
public:
- inline ssa_lazy_cache ()
- {
- bitmap_obstack_initialize (&m_bitmaps);
- active_p = BITMAP_ALLOC (&m_bitmaps);
- }
- inline ~ssa_lazy_cache () { bitmap_obstack_release (&m_bitmaps); }
+ ssa_lazy_cache (bitmap_obstack *ob = NULL);
+ ~ssa_lazy_cache ();
inline bool empty_p () const { return bitmap_empty_p (active_p); }
virtual bool has_range (tree name) const;
virtual bool set_range (tree name, const vrange &r);
void merge (const ssa_lazy_cache &);
protected:
bitmap_obstack m_bitmaps;
+ bitmap_obstack *m_ob;
bitmap active_p;
};
dom_ranger::dom_ranger () : m_global ()
{
+ bitmap_obstack_initialize (&m_bitmaps);
m_freelist.create (0);
m_freelist.truncate (0);
m_bb.create (0);
}
m_bb.release ();
m_freelist.release ();
+ bitmap_obstack_release (&m_bitmaps);
}
// Implement range of EXPR on stmt S, and return it in R.
if (!m_freelist.is_empty ())
e_cache = m_freelist.pop ();
else
- e_cache = new ssa_lazy_cache;
+ e_cache = new ssa_lazy_cache (&m_bitmaps);
gcc_checking_assert (e_cache->empty_p ());
// If there is a single pred, check if there are any ranges on
void pre_bb (basic_block bb);
void post_bb (basic_block bb);
protected:
+ bitmap_obstack m_bitmaps;
void range_in_bb (vrange &r, basic_block bb, tree name);
DISABLE_COPY_AND_ASSIGN (dom_ranger);
ssa_cache m_global;