]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add merge facility to ssa_lazy_cache.
authorAndrew MacLeod <amacleod@redhat.com>
Thu, 13 Jun 2024 19:35:55 +0000 (15:35 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Fri, 14 Jun 2024 19:16:38 +0000 (15:16 -0400)
The ssa_lazy_cache has a routine to merge a range for an ssa-name with
an existing range in the cache.  This adds a method which will merge all
elements of another ssa_lazy_cache.

* gimple-range-cache.cc (ssa_lazy_cache::merge): New.
* gimple-range-cache.h (ssa_lazy_cache::merge): New prototype.

gcc/gimple-range-cache.cc
gcc/gimple-range-cache.h

index a511a2c3a4c27fd187fc4999fb13b1c67bc8435c..efaae2ed928169ec6d183cf2506fd7c8c378b208 100644 (file)
@@ -729,6 +729,24 @@ ssa_lazy_cache::merge_range (tree name, const vrange &r)
   return true;
 }
 
+// Merge all elements of CACHE with this cache.
+// Any names in CACHE that are not in this one are added.
+// Any names in both are merged via merge_range..
+
+void
+ssa_lazy_cache::merge (const ssa_lazy_cache &cache)
+{
+  unsigned x;
+  bitmap_iterator bi;
+  EXECUTE_IF_SET_IN_BITMAP (cache.active_p, 0, x, bi)
+    {
+      tree name = ssa_name (x);
+      Value_Range r(TREE_TYPE (name));
+      cache.get_range (r, name);
+      merge_range (ssa_name (x), r);
+    }
+}
+
 // Return TRUE if NAME has a range, and return it in R.
 
 bool
index c7499f928a94189589b2e329d39522e7aef3dc83..63410d5437e6076a233760a5198d0a73e9356842 100644 (file)
@@ -87,6 +87,7 @@ public:
   virtual bool get_range (vrange &r, tree name) const;
   virtual void clear_range (tree name);
   virtual void clear ();
+  void merge (const ssa_lazy_cache &);
 protected:
   bitmap active_p;
 };