diff mbox series

[3/5] RISC-V: Remove unused function in riscv_subset_list [NFC]

Message ID 20240108134738.998804-4-kito.cheng@sifive.com
State New
Headers show
Series RISC-V: Relax the -march string for accept any order | expand

Commit Message

Kito Cheng Jan. 8, 2024, 1:47 p.m. UTC
gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc
	(riscv_subset_list::parse_std_ext): Remove.
	(riscv_subset_list::parse_multiletter_ext): Remove.
	* config/riscv/riscv-subset.h
	(riscv_subset_list::parse_std_ext): Remove.
	(riscv_subset_list::parse_multiletter_ext): Remove.
---
 gcc/common/config/riscv/riscv-common.cc | 179 ------------------------
 gcc/config/riscv/riscv-subset.h         |   4 -
 2 files changed, 183 deletions(-)
diff mbox series

Patch

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 891ecfce464..cf1c82c9f5e 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -1059,73 +1059,6 @@  riscv_subset_list::parse_base_ext (const char *p)
   return p;
 }
 
-
-/* Parsing function for standard extensions.
-
-   Return Value:
-     Points to the end of extensions.
-
-   Arguments:
-     `p`: Current parsing position.  */
-
-const char *
-riscv_subset_list::parse_std_ext (const char *p)
-{
-  const char *all_std_exts = riscv_supported_std_ext ();
-  const char *std_exts = all_std_exts;
-
-  unsigned major_version = 0;
-  unsigned minor_version = 0;
-  char std_ext = '\0';
-  bool explicit_version_p = false;
-
-  while (p != NULL && *p)
-    {
-      char subset[2] = {0, 0};
-
-      if (*p == 'x' || *p == 's' || *p == 'z')
-	break;
-
-      if (*p == '_')
-	{
-	  p++;
-	  continue;
-	}
-
-      std_ext = *p;
-
-      /* Checking canonical order.  */
-      const char *prior_std_exts = std_exts;
-
-      while (*std_exts && std_ext != *std_exts)
-	std_exts++;
-
-      subset[0] = std_ext;
-      if (std_ext != *std_exts && standard_extensions_p (subset))
-	{
-	  error_at (m_loc,
-		    "%<-march=%s%>: ISA string is not in canonical order. "
-		    "%<%c%>",
-		    m_arch, *p);
-	  /* Extension ordering is invalid.  Ignore this extension and keep
-	     searching for other issues with remaining extensions.  */
-	  std_exts = prior_std_exts;
-	  p++;
-	  continue;
-	}
-
-      std_exts++;
-
-      p++;
-
-      p = parsing_subset_version (subset, p, &major_version, &minor_version,
-				  /* std_ext_p= */ true, &explicit_version_p);
-
-      add (subset, major_version, minor_version, explicit_version_p, false);
-    }
-  return p;
-}
-
 /* Parsing function for one standard extensions.
 
    Return Value:
@@ -1409,118 +1342,6 @@  riscv_subset_list::parse_single_multiletter_ext (const char *p,
 
 }
 
-/* Parsing function for multi-letter extensions.
-
-   Return Value:
-     Points to the end of extensions.
-
-   Arguments:
-     `p`: Current parsing position.
-     `ext_type`: What kind of extensions, 's', 'z' or 'x'.
-     `ext_type_str`: Full name for kind of extension.  */
-
-const char *
-riscv_subset_list::parse_multiletter_ext (const char *p,
-					  const char *ext_type,
-					  const char *ext_type_str)
-{
-  unsigned major_version = 0;
-  unsigned minor_version = 0;
-  size_t ext_type_len = strlen (ext_type);
-
-  while (*p)
-    {
-      if (*p == '_')
-	{
-	  p++;
-	  continue;
-	}
-
-      if (strncmp (p, ext_type, ext_type_len) != 0)
-	break;
-
-      char *subset = xstrdup (p);
-      char *q = subset;
-      const char *end_of_version;
-      bool explicit_version_p = false;
-      char *ext;
-      char backup;
-      size_t len;
-      size_t end_of_version_pos, i;
-      bool found_any_number = false;
-      bool found_minor_version = false;
-
-      /* Parse until end of this extension including version number.  */
-      while (*++q != '\0' && *q != '_')
-	;
-
-      backup = *q;
-      *q = '\0';
-      len = q - subset;
-      *q = backup;
-
-      end_of_version_pos = len;
-      /* Find the begin of version string.  */
-      for (i = len -1; i > 0; --i)
-	{
-	  if (ISDIGIT (subset[i]))
-	    {
-	      found_any_number = true;
-	      continue;
-	    }
-	  /* Might be version seperator, but need to check one more char,
-	     we only allow <major>p<minor>, so we could stop parsing if found
-	     any more `p`.  */
-	  if (subset[i] == 'p' &&
-	      !found_minor_version &&
-	      found_any_number && ISDIGIT (subset[i-1]))
-	    {
-	      found_minor_version = true;
-	      continue;
-	    }
-
-	  end_of_version_pos = i + 1;
-	  break;
-	}
-
-      backup = subset[end_of_version_pos];
-      subset[end_of_version_pos] = '\0';
-      ext = xstrdup (subset);
-      subset[end_of_version_pos] = backup;
-
-      end_of_version
-	= parsing_subset_version (ext, subset + end_of_version_pos, &major_version, &minor_version,
-				  /* std_ext_p= */ false, &explicit_version_p);
-      free (ext);
-
-      if (end_of_version == NULL)
-	return NULL;
-
-      subset[end_of_version_pos] = '\0';
-
-      if (strlen (subset) == 1)
-	{
-	  error_at (m_loc, "%<-march=%s%>: name of %s must be more than 1 letter",
-		    m_arch, ext_type_str);
-	  free (subset);
-	  return NULL;
-	}
-
-      add (subset, major_version, minor_version, explicit_version_p, false);
-      p += end_of_version - subset;
-      free (subset);
-
-      if (*p != '\0' && *p != '_')
-	{
-	  error_at (m_loc, "%<-march=%s%>: %s must separate with %<_%>",
-		    m_arch, ext_type_str);
-	  return NULL;
-	}
-    }
-
-  return p;
-}
-
 /* Parsing function for a single-letter or multi-letter extensions.
 
    Return Value:
diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h
index a80f9138e5c..ae849e2a302 100644
--- a/gcc/config/riscv/riscv-subset.h
+++ b/gcc/config/riscv/riscv-subset.h
@@ -69,12 +69,8 @@  private:
 
   const char *parse_base_ext (const char *);
 
-  const char *parse_std_ext (const char *);
-
   const char *parse_single_std_ext (const char *, bool);
 
-  const char *parse_multiletter_ext (const char *, const char *,
-				     const char *);
   const char *parse_single_multiletter_ext (const char *, const char *,
 					    const char *, bool);