diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2024-06-13 15:35:55 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2024-06-14 15:16:38 -0400 |
commit | d40034c489c3d4ae149759ba051ef1d661a6c243 (patch) | |
tree | 72ceffcdf1be5819c7eb30fabf5034667c054e00 /gcc | |
parent | 80c6b6a21b5d3e4f7c5fddbe88e344b608ffb010 (diff) | |
download | gcc-d40034c489c3d4ae149759ba051ef1d661a6c243.zip gcc-d40034c489c3d4ae149759ba051ef1d661a6c243.tar.gz gcc-d40034c489c3d4ae149759ba051ef1d661a6c243.tar.bz2 |
Add merge facility to ssa_lazy_cache.
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/gimple-range-cache.cc | 18 | ||||
-rw-r--r-- | gcc/gimple-range-cache.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index a511a2c..efaae2e 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -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 diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h index c7499f9..63410d5 100644 --- a/gcc/gimple-range-cache.h +++ b/gcc/gimple-range-cache.h @@ -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; }; |