]> gcc.gnu.org Git - gcc.git/commitdiff
Provide support for copying unsupported ranges.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 16 May 2023 20:20:54 +0000 (22:20 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Wed, 17 May 2023 14:08:48 +0000 (16:08 +0200)
The unsupported_range class is provided for completness sake.  It is a
way to set VARYING/UNDEFINED ranges for unsupported ranges (currently
anything not float, integer, or pointer).  You can't do anything with
them, except set_varying, and set_undefined.  We will trap on any
other operation.

This patch provides a way to copy them, just in case they creep in.
This could happen in IPA under certain circumstances.

gcc/ChangeLog:

* value-range.cc (vrange::operator=): Add a stub to copy
unsupported ranges.
* value-range.h (is_a <unsupported_range>): New.
(Value_Range::operator=): Support copying unsupported ranges.

gcc/value-range.cc
gcc/value-range.h

index 93c44a68365b19d298c2e3857ec39457bca1f1d8..45b1e655967ab894442eb0de491225d65dc23311 100644 (file)
@@ -203,7 +203,10 @@ vrange::operator= (const vrange &src)
   else if (is_a <frange> (src))
     as_a <frange> (*this) = as_a <frange> (src);
   else
-    gcc_unreachable ();
+    {
+      gcc_checking_assert (is_a <unsupported_range> (src));
+      m_kind = src.m_kind;
+    }
   return *this;
 }
 
index 0da2a42764a90e53716eb16ebd7cf3ec78c4d80f..ab982d184022bf2fff60a4fe8f71ce1b891675cc 100644 (file)
@@ -460,6 +460,13 @@ is_a <frange> (vrange &v)
   return v.m_discriminator == VR_FRANGE;
 }
 
+template <>
+inline bool
+is_a <unsupported_range> (vrange &v)
+{
+  return v.m_discriminator == VR_UNKNOWN;
+}
+
 // For resizable ranges, resize the range up to HARD_MAX_RANGES if the
 // NEEDED pairs is greater than the current capacity of the range.
 
@@ -624,6 +631,11 @@ Value_Range::operator= (const vrange &r)
       m_frange = as_a <frange> (r);
       m_vrange = &m_frange;
     }
+  else if (is_a <unsupported_range> (r))
+    {
+      m_unsupported = as_a <unsupported_range> (r);
+      m_vrange = &m_unsupported;
+    }
   else
     gcc_unreachable ();
 
This page took 0.070686 seconds and 5 git commands to generate.