[v1,13/16] Remove unused target_clone parsing code.

Message ID 20250203130421.2192732-15-alfie.richards@arm.com
State New
Headers
Series FMV refactor and ACLE compliance. |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Build failed

Commit Message

Alfie Richards Feb. 3, 2025, 1:04 p.m. UTC
  This removes the target_clone parsing code that was replaced with
get_clone_versions.

gcc/ChangeLog:

	* multiple_target.cc (get_attr_str): Removed.
	(separate_attrs): Removed.
	* tree.cc (get_target_clone_attr_len): Removed.
	* tree.h (get_target_clone_attr_len): Removed.
---
 gcc/multiple_target.cc | 61 ------------------------------------------
 gcc/tree.cc            | 26 ------------------
 gcc/tree.h             |  1 -
 3 files changed, 88 deletions(-)
  

Patch

diff --git a/gcc/multiple_target.cc b/gcc/multiple_target.cc
index 6aeceadbfd1..4f748a81f9b 100644
--- a/gcc/multiple_target.cc
+++ b/gcc/multiple_target.cc
@@ -177,67 +177,6 @@  create_dispatcher_calls (struct cgraph_node *node)
     }
 }
 
-/* Create string with attributes separated by TARGET_CLONES_ATTR_SEPARATOR.
-   Return number of attributes.  */
-
-static int
-get_attr_str (tree arglist, char *attr_str)
-{
-  tree arg;
-  size_t str_len_sum = 0;
-  int argnum = 0;
-
-  for (arg = arglist; arg; arg = TREE_CHAIN (arg))
-    {
-      const char *str = TREE_STRING_POINTER (TREE_VALUE (arg));
-      size_t len = strlen (str);
-      for (const char *p = strchr (str, TARGET_CLONES_ATTR_SEPARATOR);
-	   p;
-	   p = strchr (p + 1, TARGET_CLONES_ATTR_SEPARATOR))
-	argnum++;
-      memcpy (attr_str + str_len_sum, str, len);
-      attr_str[str_len_sum + len]
-	= TREE_CHAIN (arg) ? TARGET_CLONES_ATTR_SEPARATOR : '\0';
-      str_len_sum += len + 1;
-      argnum++;
-    }
-  return argnum;
-}
-
-/* Return number of attributes separated by TARGET_CLONES_ATTR_SEPARATOR
-   and put them into ARGS.
-   If there is no DEFAULT attribute return -1.
-   If there is an empty string in attribute return -2.
-   If there are multiple DEFAULT attributes return -3.
-   */
-
-static int
-separate_attrs (char *attr_str, char **attrs, int attrnum)
-{
-  int i = 0;
-  int default_count = 0;
-  static const char separator_str[] = { TARGET_CLONES_ATTR_SEPARATOR, 0 };
-
-  for (char *attr = strtok (attr_str, separator_str);
-       attr != NULL; attr = strtok (NULL, separator_str))
-    {
-      if (strcmp (attr, "default") == 0)
-	{
-	  default_count++;
-	  continue;
-	}
-      attrs[i++] = attr;
-    }
-  if (default_count == 0)
-    return -1;
-  else if (default_count > 1)
-    return -3;
-  else if (i + default_count < attrnum)
-    return -2;
-
-  return i;
-}
-
 /*  Creates target clone of NODE.  */
 
 static cgraph_node *
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 346522d01c0..9856f190367 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -15273,32 +15273,6 @@  get_attr_nonstring_decl (tree expr, tree *ref)
   return NULL_TREE;
 }
 
-/* Return length of attribute names string,
-   if arglist chain > 1, -1 otherwise.  */
-
-int
-get_target_clone_attr_len (tree arglist)
-{
-  tree arg;
-  int str_len_sum = 0;
-  int argnum = 0;
-
-  for (arg = arglist; arg; arg = TREE_CHAIN (arg))
-    {
-      const char *str = TREE_STRING_POINTER (TREE_VALUE (arg));
-      size_t len = strlen (str);
-      str_len_sum += len + 1;
-      for (const char *p = strchr (str, TARGET_CLONES_ATTR_SEPARATOR);
-	   p;
-	   p = strchr (p + 1, TARGET_CLONES_ATTR_SEPARATOR))
-	argnum++;
-      argnum++;
-    }
-  if (argnum <= 1)
-    return -1;
-  return str_len_sum;
-}
-
 /* Returns an auto_vec of string_slices containing the version strings from
    ARGLIST.  DEFAULT_COUNT is incremented for each default version found.  */
 
diff --git a/gcc/tree.h b/gcc/tree.h
index aea1cf078a0..df64d9cc847 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -7035,7 +7035,6 @@  extern unsigned fndecl_dealloc_argno (tree);
    object or pointer.  Otherwise return null.  */
 extern tree get_attr_nonstring_decl (tree, tree * = NULL);
 
-extern int get_target_clone_attr_len (tree);
 auto_vec<string_slice>
 get_clone_versions (const tree, int * = NULL);
 auto_vec<string_slice>