diff mbox series

calls.c: Remove some dead code and target hooks

Message ID 20211020141821.36beiyh45lqacmon@arm.com
State New
Headers show
Series calls.c: Remove some dead code and target hooks | expand

Commit Message

Alex Coplan Oct. 20, 2021, 2:18 p.m. UTC
Hi all,

Looking at calls.c:initialize_argument_information, I spotted some dead
code that seems to have been left behind from when MPX support was
removed.

This patch removes that code as well as the associated target hooks
(which appear to be unused).

Bootstrapped and regtested on aarch64-linux-gnu and x86_64-linux-gnu, no
regressions.

OK for trunk?

Thanks,
Alex

gcc/ChangeLog:

	* calls.c (initialize_argument_information): Remove some dead
	code, remove handling for function_arg returning const_int.
	* doc/tm.texi: Delete documentation for unused target hooks.
	* doc/tm.texi.in: Likewise.
	* target.def (load_bounds_for_arg): Delete.
	(store_bounds_for_arg): Delete.
	(load_returned_bounds): Delete.
	(store_returned_bounds): Delete.
	* targhooks.c (default_load_bounds_for_arg): Delete.
	(default_store_bounds_for_arg): Delete.
	(default_load_returned_bounds): Delete.
	(default_store_returned_bounds): Delete.
	* targhooks.h (default_load_bounds_for_arg): Delete.
	(default_store_bounds_for_arg): Delete.
	(default_load_returned_bounds): Delete.
	(default_store_returned_bounds): Delete.

Comments

Jeff Law Oct. 20, 2021, 7:48 p.m. UTC | #1
On 10/20/2021 8:18 AM, Alex Coplan via Gcc-patches wrote:
> Hi all,
>
> Looking at calls.c:initialize_argument_information, I spotted some dead
> code that seems to have been left behind from when MPX support was
> removed.
>
> This patch removes that code as well as the associated target hooks
> (which appear to be unused).
>
> Bootstrapped and regtested on aarch64-linux-gnu and x86_64-linux-gnu, no
> regressions.
>
> OK for trunk?
>
> Thanks,
> Alex
>
> gcc/ChangeLog:
>
> 	* calls.c (initialize_argument_information): Remove some dead
> 	code, remove handling for function_arg returning const_int.
> 	* doc/tm.texi: Delete documentation for unused target hooks.
> 	* doc/tm.texi.in: Likewise.
> 	* target.def (load_bounds_for_arg): Delete.
> 	(store_bounds_for_arg): Delete.
> 	(load_returned_bounds): Delete.
> 	(store_returned_bounds): Delete.
> 	* targhooks.c (default_load_bounds_for_arg): Delete.
> 	(default_store_bounds_for_arg): Delete.
> 	(default_load_returned_bounds): Delete.
> 	(default_store_returned_bounds): Delete.
> 	* targhooks.h (default_load_bounds_for_arg): Delete.
> 	(default_store_bounds_for_arg): Delete.
> 	(default_load_returned_bounds): Delete.
> 	(default_store_returned_bounds): Delete.
OK. Thanks for taking care of this.

jeff
diff mbox series

Patch

diff --git a/gcc/calls.c b/gcc/calls.c
index e50d3fc3b62..27b59f26ad3 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -1287,8 +1287,6 @@  initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
   args_size->constant = 0;
   args_size->var = 0;
 
-  bitmap_obstack_initialize (NULL);
-
   /* In this loop, we consider args in the order they are written.
      We fill up ARGS from the back.  */
 
@@ -1297,7 +1295,6 @@  initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
     int j = i;
     call_expr_arg_iterator iter;
     tree arg;
-    bitmap slots = NULL;
 
     if (struct_value_addr_value)
       {
@@ -1324,13 +1321,8 @@  initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
 	j--;
 	argpos++;
       }
-
-    if (slots)
-      BITMAP_FREE (slots);
   }
 
-  bitmap_obstack_release (NULL);
-
   /* I counts args in order (to be) pushed; ARGPOS counts in order written.  */
   for (argpos = 0; argpos < num_actuals; i--, argpos++)
     {
@@ -1493,9 +1485,6 @@  initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
 
       args[i].reg = targetm.calls.function_arg (args_so_far, arg);
 
-      if (args[i].reg && CONST_INT_P (args[i].reg))
-	args[i].reg = NULL;
-
       /* If this is a sibling call and the machine has register windows, the
 	 register window has to be unwinded before calling the routine, so
 	 arguments have to go into the incoming registers.  */
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 902402d7503..990152f5b15 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -4079,12 +4079,6 @@  The return value is usually either a @code{reg} RTX for the hard
 register in which to pass the argument, or zero to pass the argument
 on the stack.
 
-The return value can be a @code{const_int} which means argument is
-passed in a target specific slot with specified number.  Target hooks
-should be used to store or load argument in such case.  See
-@code{TARGET_STORE_BOUNDS_FOR_ARG} and @code{TARGET_LOAD_BOUNDS_FOR_ARG}
-for more information.
-
 The value of the expression can also be a @code{parallel} RTX@.  This is
 used when an argument is passed in multiple locations.  The mode of the
 @code{parallel} should be the mode of the entire argument.  The
@@ -5430,37 +5424,6 @@  defined, then define this hook to return @code{true} if
 Otherwise, you should not define this hook.
 @end deftypefn
 
-@deftypefn {Target Hook} rtx TARGET_LOAD_BOUNDS_FOR_ARG (rtx @var{slot}, rtx @var{arg}, rtx @var{slot_no})
-This hook is used by expand pass to emit insn to load bounds of
-@var{arg} passed in @var{slot}.  Expand pass uses this hook in case
-bounds of @var{arg} are not passed in register.  If @var{slot} is a
-memory, then bounds are loaded as for regular pointer loaded from
-memory.  If @var{slot} is not a memory then @var{slot_no} is an integer
-constant holding number of the target dependent special slot which
-should be used to obtain bounds.  Hook returns RTX holding loaded bounds.
-@end deftypefn
-
-@deftypefn {Target Hook} void TARGET_STORE_BOUNDS_FOR_ARG (rtx @var{arg}, rtx @var{slot}, rtx @var{bounds}, rtx @var{slot_no})
-This hook is used by expand pass to emit insns to store @var{bounds} of
-@var{arg} passed in @var{slot}.  Expand pass uses this hook in case
-@var{bounds} of @var{arg} are not passed in register.  If @var{slot} is a
-memory, then @var{bounds} are stored as for regular pointer stored in
-memory.  If @var{slot} is not a memory then @var{slot_no} is an integer
-constant holding number of the target dependent special slot which
-should be used to store @var{bounds}.
-@end deftypefn
-
-@deftypefn {Target Hook} rtx TARGET_LOAD_RETURNED_BOUNDS (rtx @var{slot})
-This hook is used by expand pass to emit insn to load bounds
-returned by function call in @var{slot}.  Hook returns RTX holding
-loaded bounds.
-@end deftypefn
-
-@deftypefn {Target Hook} void TARGET_STORE_RETURNED_BOUNDS (rtx @var{slot}, rtx @var{bounds})
-This hook is used by expand pass to emit insn to store @var{bounds}
-returned by function call into @var{slot}.
-@end deftypefn
-
 @node Trampolines
 @section Support for Nested Functions
 @cindex support for nested functions
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 86352dc9bd2..193c9bdd853 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -3780,14 +3780,6 @@  These machine description macros help implement varargs:
 
 @hook TARGET_PRETEND_OUTGOING_VARARGS_NAMED
 
-@hook TARGET_LOAD_BOUNDS_FOR_ARG
-
-@hook TARGET_STORE_BOUNDS_FOR_ARG
-
-@hook TARGET_LOAD_RETURNED_BOUNDS
-
-@hook TARGET_STORE_RETURNED_BOUNDS
-
 @node Trampolines
 @section Support for Nested Functions
 @cindex support for nested functions
diff --git a/gcc/target.def b/gcc/target.def
index c5d90cace80..87feeec2ea1 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -4730,45 +4730,6 @@  not generate any instructions in this case.",
 	int *pretend_args_size, int second_time),
  default_setup_incoming_varargs)
 
-DEFHOOK
-(load_bounds_for_arg,
- "This hook is used by expand pass to emit insn to load bounds of\n\
-@var{arg} passed in @var{slot}.  Expand pass uses this hook in case\n\
-bounds of @var{arg} are not passed in register.  If @var{slot} is a\n\
-memory, then bounds are loaded as for regular pointer loaded from\n\
-memory.  If @var{slot} is not a memory then @var{slot_no} is an integer\n\
-constant holding number of the target dependent special slot which\n\
-should be used to obtain bounds.  Hook returns RTX holding loaded bounds.",
- rtx, (rtx slot, rtx arg, rtx slot_no),
- default_load_bounds_for_arg)
-
-DEFHOOK
-(store_bounds_for_arg,
- "This hook is used by expand pass to emit insns to store @var{bounds} of\n\
-@var{arg} passed in @var{slot}.  Expand pass uses this hook in case\n\
-@var{bounds} of @var{arg} are not passed in register.  If @var{slot} is a\n\
-memory, then @var{bounds} are stored as for regular pointer stored in\n\
-memory.  If @var{slot} is not a memory then @var{slot_no} is an integer\n\
-constant holding number of the target dependent special slot which\n\
-should be used to store @var{bounds}.",
- void, (rtx arg, rtx slot, rtx bounds, rtx slot_no),
- default_store_bounds_for_arg)
-
-DEFHOOK
-(load_returned_bounds,
- "This hook is used by expand pass to emit insn to load bounds\n\
-returned by function call in @var{slot}.  Hook returns RTX holding\n\
-loaded bounds.",
- rtx, (rtx slot),
- default_load_returned_bounds)
-
-DEFHOOK
-(store_returned_bounds,
- "This hook is used by expand pass to emit insn to store @var{bounds}\n\
-returned by function call into @var{slot}.",
- void, (rtx slot, rtx bounds),
- default_store_returned_bounds)
-
 DEFHOOK
 (call_args,
  "While generating RTL for a function call, this target hook is invoked once\n\
@@ -4972,12 +4933,6 @@  The return value is usually either a @code{reg} RTX for the hard\n\
 register in which to pass the argument, or zero to pass the argument\n\
 on the stack.\n\
 \n\
-The return value can be a @code{const_int} which means argument is\n\
-passed in a target specific slot with specified number.  Target hooks\n\
-should be used to store or load argument in such case.  See\n\
-@code{TARGET_STORE_BOUNDS_FOR_ARG} and @code{TARGET_LOAD_BOUNDS_FOR_ARG}\n\
-for more information.\n\
-\n\
 The value of the expression can also be a @code{parallel} RTX@.  This is\n\
 used when an argument is passed in multiple locations.  The mode of the\n\
 @code{parallel} should be the mode of the entire argument.  The\n\
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 812bbe3f16e..0b525bb4606 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -2253,36 +2253,6 @@  default_member_type_forces_blk (const_tree, machine_mode)
   return false;
 }
 
-rtx
-default_load_bounds_for_arg (rtx addr ATTRIBUTE_UNUSED,
-			     rtx ptr ATTRIBUTE_UNUSED,
-			     rtx bnd ATTRIBUTE_UNUSED)
-{
-  gcc_unreachable ();
-}
-
-void
-default_store_bounds_for_arg (rtx val ATTRIBUTE_UNUSED,
-			      rtx addr ATTRIBUTE_UNUSED,
-			      rtx bounds ATTRIBUTE_UNUSED,
-			      rtx to ATTRIBUTE_UNUSED)
-{
-  gcc_unreachable ();
-}
-
-rtx
-default_load_returned_bounds (rtx slot ATTRIBUTE_UNUSED)
-{
-  gcc_unreachable ();
-}
-
-void
-default_store_returned_bounds (rtx slot ATTRIBUTE_UNUSED,
-			       rtx bounds ATTRIBUTE_UNUSED)
-{
-  gcc_unreachable ();
-}
-
 /* Default version of canonicalize_comparison.  */
 
 void
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 92d51992e62..7f7f25a07e6 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -272,10 +272,6 @@  extern bool can_use_doloop_if_innermost (const widest_int &,
 					 const widest_int &,
 					 unsigned int, bool);
 
-extern rtx default_load_bounds_for_arg (rtx, rtx, rtx);
-extern void default_store_bounds_for_arg (rtx, rtx, rtx, rtx);
-extern rtx default_load_returned_bounds (rtx);
-extern void default_store_returned_bounds (rtx,rtx);
 extern bool default_optab_supported_p (int, machine_mode, machine_mode,
 				       optimization_type);
 extern unsigned int default_max_noce_ifcvt_seq_cost (edge);