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] emit-rtl.c: Remove unused/useless functions.


Hi,

Attached is a patch to remove unused/useless functions in emit-rtl.c.

set_new_last_label_num, which used to be called from
integrate.c:output_inline_function in gcc-3.4, is now unused, so we
remove it.

Once we remove it, nobody sets static variable base_label_num, so we
replace all uses of it with 0 and remove the variable.

Now the only value assigned to static variable last_label_num is 0, so
we remove all the assignments to it, replace all uses of it with 0,
and remove the variable.

restore_emit_status has become empty, so we remove it and the only use
in function.c:pop_function_context_from.

Bootstrapped on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-10-05  Kazu Hirata  <kazu@cs.umass.edu>

	* emit-rtl.c (last_label_num, base_label_num): Remove.
	(max_label_num): Always return label_num.
	(set_new_last_label_num, restore_emit_status): Remove.
	(init_emit): Don't initialize last_label_num.
	* function.c (pop_function_context_from): Don't call
	restore_emit_status.
	* function.h: Remove the prototype for restore_emit_status.
	* rtl.h: Remove the prototype for set_new_last_label_num.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.418
diff -u -p -r1.418 emit-rtl.c
--- emit-rtl.c	30 Sep 2004 21:25:44 -0000	1.418
+++ emit-rtl.c	6 Oct 2004 00:27:24 -0000
@@ -69,17 +69,6 @@ enum machine_mode ptr_mode;	/* Mode whos
 
 static GTY(()) int label_num = 1;
 
-/* Highest label number in current function.
-   Zero means use the value of label_num instead.
-   This is nonzero only when belatedly compiling an inline function.  */
-
-static int last_label_num;
-
-/* Value label_num had when set_new_last_label_num was called.
-   If label_num has not changed since then, last_label_num is valid.  */
-
-static int base_label_num;
-
 /* Nonzero means do not generate NOTEs for source line numbers.  */
 
 static int no_line_numbers;
@@ -1007,8 +996,6 @@ max_reg_num (void)
 int
 max_label_num (void)
 {
-  if (last_label_num && label_num == base_label_num)
-    return last_label_num;
   return label_num;
 }
 
@@ -2135,25 +2122,6 @@ set_new_first_and_last_insn (rtx first, 
 
   cur_insn_uid++;
 }
-
-/* Set the last label number found in the current function.
-   This is used when belatedly compiling an inline function.  */
-
-void
-set_new_last_label_num (int last)
-{
-  base_label_num = label_num;
-  last_label_num = last;
-}
-
-/* Restore all variables describing the current status from the structure *P.
-   This is used after a nested function.  */
-
-void
-restore_emit_status (struct function *p ATTRIBUTE_UNUSED)
-{
-  last_label_num = 0;
-}
 
 /* Go through all the RTL insn bodies and copy any invalid shared
    structure.  This routine should only be called once.  */
@@ -5233,7 +5201,6 @@ init_emit (void)
   reg_rtx_no = LAST_VIRTUAL_REGISTER + 1;
   last_location = UNKNOWN_LOCATION;
   first_label_num = label_num;
-  last_label_num = 0;
   seq_stack = NULL;
 
   /* Init the tables that describe all the pseudo regs.  */
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.579
diff -u -p -r1.579 function.c
--- function.c	1 Oct 2004 07:42:48 -0000	1.579
+++ function.c	6 Oct 2004 00:27:25 -0000
@@ -287,8 +287,6 @@ pop_function_context_from (tree context 
   current_function_decl = p->decl;
   reg_renumber = 0;
 
-  restore_emit_status (p);
-
   lang_hooks.function.leave_nested (p);
 
   /* Reset variables that have known state during rtx generation.  */
Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.135
diff -u -p -r1.135 function.h
--- function.h	1 Oct 2004 07:42:49 -0000	1.135
+++ function.h	6 Oct 2004 00:27:26 -0000
@@ -516,7 +516,6 @@ extern HOST_WIDE_INT get_func_frame_size
 extern struct machine_function * (*init_machine_status) (void);
 
 /* Save and restore status information for a nested function.  */
-extern void restore_emit_status (struct function *);
 extern void free_after_parsing (struct function *);
 extern void free_after_compilation (struct function *);
 
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.512
diff -u -p -r1.512 rtl.h
--- rtl.h	5 Oct 2004 22:55:59 -0000	1.512
+++ rtl.h	6 Oct 2004 00:27:26 -0000
@@ -1959,7 +1959,6 @@ extern void push_topmost_sequence (void)
 extern void pop_topmost_sequence (void);
 extern void reverse_comparison (rtx);
 extern void set_new_first_and_last_insn (rtx, rtx);
-extern void set_new_last_label_num (int);
 extern void unshare_all_rtl (void);
 extern void unshare_all_rtl_again (rtx);
 extern void unshare_all_rtl_in_chain (rtx);


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