This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] function.[ch]: Remove current_function_contains_functions.


Hi,

Attached is a patch to remove current_function_contains_functions as
it is unused.

It was introduced in Mar 1995.

The last use was removed when tree-ssa was merged into mainline.

Removing the macro triggers a chain of clean-up opportunities.  With
the macro removed, nobody reads contains_functions of struct function,
so the patch removes all writes to the member, which are all in
push_function_context_to.

Once we remove all references to contains_functions, we can remove the
member from struct function.

Once we remove all those writes to contains_functions,
push_function_context_to does not need to take any argument, but for
now, I am using ATTRIBUTE_UNUSED to be symmetric with
pop_function_context_from.

Kazu Hirata

2005-04-08  Kazu Hirata  <kazu@cs.umass.edu>

	* function.c (push_function_context_to): Don't set
	contains_functions.
	* function.h (function): Remove contains_functions.
	(current_function_contains_functions): Remove.

Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.608
diff -u -d -p -r1.608 function.c
--- function.c	14 Mar 2005 02:55:01 -0000	1.608
+++ function.c	8 Apr 2005 01:48:37 -0000
@@ -242,21 +242,10 @@ find_function_data (tree decl)
    variables.  */
 
 void
-push_function_context_to (tree context)
+push_function_context_to (tree context ATTRIBUTE_UNUSED)
 {
   struct function *p;
 
-  if (context)
-    {
-      if (context == current_function_decl)
-	cfun->contains_functions = 1;
-      else
-	{
-	  struct function *containing = find_function_data (context);
-	  containing->contains_functions = 1;
-	}
-    }
-
   if (cfun == 0)
     init_dummy_function_start ();
   p = cfun;
Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.141
diff -u -d -p -r1.141 function.h
--- function.h	14 Mar 2005 02:55:03 -0000	1.141
+++ function.h	8 Apr 2005 01:48:37 -0000
@@ -380,9 +380,6 @@ struct function GTY(())
      function.  */
   unsigned int has_nonlocal_goto : 1;
 
-  /* Nonzero if function being compiled contains nested functions.  */
-  unsigned int contains_functions : 1;
-
   /* Nonzero if the current function is a thunk, i.e., a lightweight
      function implemented by the output_mi_thunk hook) that just
      adjusts one of its arguments and forwards to another
@@ -452,7 +449,6 @@ extern int trampolines_created;
 #define current_function_calls_setjmp (cfun->calls_setjmp)
 #define current_function_calls_alloca (cfun->calls_alloca)
 #define current_function_calls_eh_return (cfun->calls_eh_return)
-#define current_function_contains_functions (cfun->contains_functions)
 #define current_function_is_thunk (cfun->is_thunk)
 #define current_function_args_info (cfun->args_info)
 #define current_function_args_size (cfun->args_size)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]