C/C++ PATCH: Move back_end_hook to common code

Mark Mitchell mark@codesourcery.com
Tue Oct 17 22:45:00 GMT 2000


This patch allows users of the C front-end to take advantage of the
back_end_hook variable.

It also appears that const_int_htab was being initialized too late, so
I moved that earlier.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-10-17  Mark Mitchell  <mark@codesourcery.com>

	* c-common.c (back_end_hook): New variable.
	* c-common.h (back_end_hook): Declare it.
	* c-lang.c (finish_file): Use it.

	* emit-rtl.c (init_emit_once): Initialize the const_int_htab
	earlier.

2000-10-17  Mark Mitchell  <mark@codesourcery.com>

	* cp-tree.h (back_end_hook): Remove declaration.
	* decl2.c (back_end_hook): Remove definition.

	* dump.c (dequeue_and_dump): Dump TREE_USED.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.174
diff -c -p -r1.174 c-common.c
*** c-common.c	2000/10/17 18:16:14	1.174
--- c-common.c	2000/10/18 05:41:41
*************** int (*lang_statement_code_p)           P
*** 158,163 ****
--- 158,167 ----
     any action required right before expand_function_end is called.  */
  void (*lang_expand_function_end)       PARAMS ((void));
  
+ /* If this variable is defined to a non-NULL value, it will be called
+    after the file has been completely parsed.  */
+ void (*back_end_hook) PARAMS ((tree));
+ 
  /* Nonzero means the expression being parsed will never be evaluated.
     This is a count, since unevaluated expressions can nest.  */
  int skip_evaluation;
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.h,v
retrieving revision 1.44
diff -c -p -r1.44 c-common.h
*** c-common.h	2000/10/17 09:34:20	1.44
--- c-common.h	2000/10/18 05:41:42
*************** extern tree c_add_case_label            
*** 697,702 ****
--- 697,708 ----
  
  extern tree build_function_call			PARAMS ((tree, tree));
  
+ /* If this variable is defined to a non-NULL value, it will be called
+    after the file has been completely parsed.  The argument will be
+    the GLOBAL_NAMESPACE in C++, or the list of top-level declarations
+    in C.  */
+ extern void (*back_end_hook) PARAMS ((tree));
+ 
  #ifdef RTX_CODE
  
  extern struct rtx_def *c_expand_expr            PARAMS ((tree, rtx,
*************** struct c_fileinfo *get_fileinfo			PARAMS
*** 720,722 ****
--- 726,730 ----
  extern void dump_time_statistics		PARAMS ((void));
  
  #endif
+ 
+ 
Index: c-lang.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-lang.c,v
retrieving revision 1.33
diff -c -p -r1.33 c-lang.c
*** c-lang.c	2000/09/17 07:38:10	1.33
--- c-lang.c	2000/10/18 05:41:42
*************** finish_file ()
*** 242,247 ****
--- 242,250 ----
        assemble_destructor (IDENTIFIER_POINTER (fnname));
      }
  #endif
+   
+   if (back_end_hook)
+     (*back_end_hook) (getdecls ());
  }
  
  /* Called during diagnostic message formatting process to print a
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.151
diff -c -p -r1.151 emit-rtl.c
*** emit-rtl.c	2000/10/13 06:26:24	1.151
--- emit-rtl.c	2000/10/18 05:41:45
*************** init_emit_once (line_numbers)
*** 4008,4013 ****
--- 4008,4019 ----
    enum machine_mode mode;
    enum machine_mode double_mode;
  
+   /* Initialize the CONST_INT hash table.  */
+   const_int_htab = htab_create (37, const_int_htab_hash, 
+ 				const_int_htab_eq, NULL);
+   ggc_add_root (&const_int_htab, 1, sizeof (const_int_htab), 
+ 		rtx_htab_mark);
+ 
    no_line_numbers = ! line_numbers;
  
    /* Compute the word and byte modes.  */
*************** init_emit_once (line_numbers)
*** 4191,4202 ****
    ggc_add_rtx_root (&static_chain_rtx, 1);
    ggc_add_rtx_root (&static_chain_incoming_rtx, 1);
    ggc_add_rtx_root (&return_address_pointer_rtx, 1);
- 
-   /* Initialize the CONST_INT hash table.  */
-   const_int_htab = htab_create (37, const_int_htab_hash, 
- 				const_int_htab_eq, NULL);
-   ggc_add_root (&const_int_htab, 1, sizeof (const_int_htab), 
- 		rtx_htab_mark);
  }
  
  /* Query and clear/ restore no_line_numbers.  This is used by the
--- 4197,4202 ----
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.534
diff -c -p -r1.534 cp-tree.h
*** cp-tree.h	2000/10/07 01:46:41	1.534
--- cp-tree.h	2000/10/18 05:41:52
*************** extern int flag_access_control;
*** 1170,1181 ****
  
  extern int flag_check_new;
  
- /* If this variable is defined to a non-NULL value, it will be called
-    after the file has been completely parsed.  The argument will be
-    the GLOBAL_NAMESPACE.  */
- 
- extern void (*back_end_hook) PARAMS ((tree));
- 
  
  /* C++ language-specific tree codes.  */
  #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
--- 1170,1175 ----
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.403
diff -c -p -r1.403 decl2.c
*** decl2.c	2000/10/17 06:52:06	1.403
--- decl2.c	2000/10/18 05:41:57
*************** int flag_permissive;
*** 490,500 ****
  
  int flag_enforce_eh_specs = 1;
  
- /* If this variable is defined to a non-NULL value, it will be called
-    after the file has been completely parsed.  */
- 
- void (*back_end_hook) PARAMS ((tree));
- 
  /* The variant of the C language being processed.  */
  
  c_language_kind c_language = clk_cplusplus;
--- 490,495 ----
Index: cp/dump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/dump.c,v
retrieving revision 1.47
diff -c -p -r1.47 dump.c
*** dump.c	2000/06/23 01:14:39	1.47
--- dump.c	2000/10/18 05:41:59
*************** dequeue_and_dump (di)
*** 555,560 ****
--- 555,563 ----
  	  if (DECL_FIELD_OFFSET (t))
  	    dump_child ("bpos", bit_position (t));
  	}
+       else if (TREE_CODE (t) == VAR_DECL 
+ 	       || TREE_CODE (t) == PARM_DECL)
+ 	dump_int (di, "used", TREE_USED (t));
        break;
  
      case FUNCTION_DECL:


More information about the Gcc-patches mailing list