diff mbox series

[COMMITTED,03/23] Add streaming support for prange.

Message ID 20240504083056.139719-4-aldyh@redhat.com
State New
Headers show
Series prange: pointer ranges | expand

Commit Message

Aldy Hernandez May 4, 2024, 8:30 a.m. UTC
gcc/ChangeLog:

	* data-streamer-in.cc (streamer_read_value_range): Add prange support.
	* data-streamer-out.cc (streamer_write_vrange): Same.
---
 gcc/data-streamer-in.cc  | 12 ++++++++++++
 gcc/data-streamer-out.cc | 10 ++++++++++
 2 files changed, 22 insertions(+)
diff mbox series

Patch

diff --git a/gcc/data-streamer-in.cc b/gcc/data-streamer-in.cc
index 3a0d3c6ad0f..12cb10e42c0 100644
--- a/gcc/data-streamer-in.cc
+++ b/gcc/data-streamer-in.cc
@@ -268,6 +268,18 @@  streamer_read_value_range (class lto_input_block *ib, data_in *data_in,
 	}
       return;
     }
+  if (is_a <prange> (vr))
+    {
+      prange &r = as_a <prange> (vr);
+      wide_int lb = streamer_read_wide_int (ib);
+      wide_int ub = streamer_read_wide_int (ib);
+      r.set (type, lb, ub);
+      wide_int value = streamer_read_wide_int (ib);
+      wide_int mask = streamer_read_wide_int (ib);
+      irange_bitmask bm (value, mask);
+      r.update_bitmask (bm);
+      return;
+    }
   gcc_unreachable ();
 }
 
diff --git a/gcc/data-streamer-out.cc b/gcc/data-streamer-out.cc
index 07cc6bd2018..c237e30f704 100644
--- a/gcc/data-streamer-out.cc
+++ b/gcc/data-streamer-out.cc
@@ -450,6 +450,16 @@  streamer_write_vrange (struct output_block *ob, const vrange &v)
 	}
       return;
     }
+  if (is_a <prange> (v))
+    {
+      const prange &r = as_a <prange> (v);
+      streamer_write_wide_int (ob, r.lower_bound ());
+      streamer_write_wide_int (ob, r.upper_bound ());
+      irange_bitmask bm = r.get_bitmask ();
+      streamer_write_wide_int (ob, bm.value ());
+      streamer_write_wide_int (ob, bm.mask ());
+      return;
+    }
   gcc_unreachable ();
 }