From c59a0a1d196f5124abbbd7089d2c82aa0553ed87 Mon Sep 17 00:00:00 2001
From: Nathan Froyd <froydnj@codesourcery.com>
Date: Fri, 23 Jul 2010 14:31:20 +0000
Subject: [PATCH] builtins.def (BUILT_IN_ARGS_INFO): Remove.

	* builtins.def (BUILT_IN_ARGS_INFO): Remove.
	* ipa-pure-const.c (special_builtlin_state): Remove
	BUILT_IN_ARGS_INFO case.
	* tree-stdarg.c (execute_optimize_stdarg): Likewise.
	* builtins.c (expand_builtin): Likewise.
	(expand_builtin_args_info): Remove.
	* doc/tm.texi (__builtin_args_info): Remove.
	(__builtin_next_arg): Adjust to not refer to __builtin_args_info.
	* doc/tm.text.in: Likewise.

From-SVN: r162463
---
 gcc/ChangeLog        | 12 ++++++++++++
 gcc/builtins.c       | 36 ------------------------------------
 gcc/builtins.def     |  1 -
 gcc/doc/tm.texi      | 27 +--------------------------
 gcc/doc/tm.texi.in   | 27 +--------------------------
 gcc/ipa-pure-const.c |  1 -
 gcc/tree-stdarg.c    |  1 -
 7 files changed, 14 insertions(+), 91 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eacb59ca7bce..4873ccdbbd85 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-23  Nathan Froyd  <froydnj@codesourcery.com>
+
+	* builtins.def (BUILT_IN_ARGS_INFO): Remove.
+	* ipa-pure-const.c (special_builtlin_state): Remove
+	BUILT_IN_ARGS_INFO case.
+	* tree-stdarg.c (execute_optimize_stdarg): Likewise.
+	* builtins.c (expand_builtin): Likewise.
+	(expand_builtin_args_info): Remove.
+	* doc/tm.texi (__builtin_args_info): Remove.
+	(__builtin_next_arg): Adjust to not refer to __builtin_args_info.
+	* doc/tm.text.in: Likewise.
+
 2010-07-23  Richard Guenther  <rguenther@suse.de>
 
 	* lto-symtab.c (lto_symtab_merge): Use gtc_mode enum
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 40327e0e858c..9b6fb1033b17 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -111,7 +111,6 @@ static rtx expand_builtin_sincos (tree);
 static rtx expand_builtin_cexpi (tree, rtx, rtx);
 static rtx expand_builtin_int_roundingfn (tree, rtx);
 static rtx expand_builtin_int_roundingfn_2 (tree, rtx);
-static rtx expand_builtin_args_info (tree);
 static rtx expand_builtin_next_arg (void);
 static rtx expand_builtin_va_start (tree);
 static rtx expand_builtin_va_end (tree);
@@ -4398,38 +4397,6 @@ expand_builtin_saveregs (void)
   return val;
 }
 
-/* __builtin_args_info (N) returns word N of the arg space info
-   for the current function.  The number and meanings of words
-   is controlled by the definition of CUMULATIVE_ARGS.  */
-
-static rtx
-expand_builtin_args_info (tree exp)
-{
-  int nwords = sizeof (CUMULATIVE_ARGS) / sizeof (int);
-  int *word_ptr = (int *) &crtl->args.info;
-
-  gcc_assert (sizeof (CUMULATIVE_ARGS) % sizeof (int) == 0);
-
-  if (call_expr_nargs (exp) != 0)
-    {
-      if (!host_integerp (CALL_EXPR_ARG (exp, 0), 0))
-	error ("argument of %<__builtin_args_info%> must be constant");
-      else
-	{
-	  HOST_WIDE_INT wordnum = tree_low_cst (CALL_EXPR_ARG (exp, 0), 0);
-
-	  if (wordnum < 0 || wordnum >= nwords)
-	    error ("argument of %<__builtin_args_info%> out of range");
-	  else
-	    return GEN_INT (word_ptr[wordnum]);
-	}
-    }
-  else
-    error ("missing argument in %<__builtin_args_info%>");
-
-  return const0_rtx;
-}
-
 /* Expand a call to __builtin_next_arg.  */
 
 static rtx
@@ -5925,9 +5892,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
     case BUILT_IN_SAVEREGS:
       return expand_builtin_saveregs ();
 
-    case BUILT_IN_ARGS_INFO:
-      return expand_builtin_args_info (exp);
-
     case BUILT_IN_VA_ARG_PACK:
       /* All valid uses of __builtin_va_arg_pack () are removed during
 	 inlining.  */
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 4e4eb3edc032..ab0d018cb280 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -606,7 +606,6 @@ DEF_GCC_BUILTIN        (BUILT_IN_AGGREGATE_INCOMING_ADDRESS, "aggregate_incoming
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_ALLOCA, "alloca", BT_FN_PTR_SIZE, ATTR_MALLOC_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_APPLY, "apply", BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_APPLY_ARGS, "apply_args", BT_FN_PTR_VAR, ATTR_NULL)
-DEF_GCC_BUILTIN        (BUILT_IN_ARGS_INFO, "args_info", BT_FN_INT_INT, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_BSWAP32, "bswap32", BT_FN_UINT32_UINT32, ATTR_CONST_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_BSWAP64, "bswap64", BT_FN_UINT64_UINT64, ATTR_CONST_NOTHROW_LIST)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_CLEAR_CACHE, "__clear_cache", BT_FN_VOID_PTR_PTR, ATTR_NOTHROW_LIST)
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 78f2f2f3ed4b..30210ecc0aeb 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5007,33 +5007,8 @@ to use them for its own purposes.
 @c 10feb93
 @end defmac
 
-@defmac __builtin_args_info (@var{category})
-Use this built-in function to find the first anonymous arguments in
-registers.
-
-In general, a machine may have several categories of registers used for
-arguments, each for a particular category of data types.  (For example,
-on some machines, floating-point registers are used for floating-point
-arguments while other arguments are passed in the general registers.)
-To make non-varargs functions use the proper calling convention, you
-have defined the @code{CUMULATIVE_ARGS} data type to record how many
-registers in each category have been used so far
-
-@code{__builtin_args_info} accesses the same data structure of type
-@code{CUMULATIVE_ARGS} after the ordinary argument layout is finished
-with it, with @var{category} specifying which word to access.  Thus, the
-value indicates the first unused register in a given category.
-
-Normally, you would use @code{__builtin_args_info} in the implementation
-of @code{va_start}, accessing each category just once and storing the
-value in the @code{va_list} object.  This is because @code{va_list} will
-have to update the values, and there is no way to alter the
-values accessed by @code{__builtin_args_info}.
-@end defmac
-
 @defmac __builtin_next_arg (@var{lastarg})
-This is the equivalent of @code{__builtin_args_info}, for stack
-arguments.  It returns the address of the first anonymous stack
+This builtin returns the address of the first anonymous stack
 argument, as type @code{void *}.  If @code{ARGS_GROW_DOWNWARD}, it
 returns the address of the location above the first anonymous stack
 argument.  Use it in @code{va_start} to initialize the pointer for
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 2f35a429c524..b5c75d3ec90f 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -5007,33 +5007,8 @@ to use them for its own purposes.
 @c 10feb93
 @end defmac
 
-@defmac __builtin_args_info (@var{category})
-Use this built-in function to find the first anonymous arguments in
-registers.
-
-In general, a machine may have several categories of registers used for
-arguments, each for a particular category of data types.  (For example,
-on some machines, floating-point registers are used for floating-point
-arguments while other arguments are passed in the general registers.)
-To make non-varargs functions use the proper calling convention, you
-have defined the @code{CUMULATIVE_ARGS} data type to record how many
-registers in each category have been used so far
-
-@code{__builtin_args_info} accesses the same data structure of type
-@code{CUMULATIVE_ARGS} after the ordinary argument layout is finished
-with it, with @var{category} specifying which word to access.  Thus, the
-value indicates the first unused register in a given category.
-
-Normally, you would use @code{__builtin_args_info} in the implementation
-of @code{va_start}, accessing each category just once and storing the
-value in the @code{va_list} object.  This is because @code{va_list} will
-have to update the values, and there is no way to alter the
-values accessed by @code{__builtin_args_info}.
-@end defmac
-
 @defmac __builtin_next_arg (@var{lastarg})
-This is the equivalent of @code{__builtin_args_info}, for stack
-arguments.  It returns the address of the first anonymous stack
+This builtin returns the address of the first anonymous stack
 argument, as type @code{void *}.  If @code{ARGS_GROW_DOWNWARD}, it
 returns the address of the location above the first anonymous stack
 argument.  Use it in @code{va_start} to initialize the pointer for
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 4a29e100df21..1ff15bf22e60 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -446,7 +446,6 @@ special_builtlin_state (enum pure_const_state_e *state, bool *looping,
 	case BUILT_IN_FRAME_ADDRESS:
 	case BUILT_IN_APPLY:
 	case BUILT_IN_APPLY_ARGS:
-	case BUILT_IN_ARGS_INFO:
 	  *looping = false;
 	  *state = IPA_CONST;
 	  return true;
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index dae14f54a600..5c9b35cd44d6 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -636,7 +636,6 @@ execute_optimize_stdarg (void)
 	      break;
 	      /* If old style builtins are used, don't optimize anything.  */
 	    case BUILT_IN_SAVEREGS:
-	    case BUILT_IN_ARGS_INFO:
 	    case BUILT_IN_NEXT_ARG:
 	      va_list_escapes = true;
 	      continue;
-- 
GitLab