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 to remove unused langhooks


This patch removes six langhooks.  Five were completely unused.  The
sixth, poplevel, was only used in lhd_clear_binding_stack, so that
function definition was copied to the front ends requiring it (Fortran
and Java), with the default changed to lhd_do_nothing, so that the
poplevel hook could be removed.  The removal of unused set_block
functions meant some front-end binding_level fields only set by those
functions could be removed as well.

Bootstrapped with no regressions on i686-pc-linux-gnu.  (Treelang and
Ada changes untested.)  OK to commit?

(A further five hooks are used but have a trivial default definition
and no front ends give them a nondefault definition:
LANG_HOOKS_SAFE_FROM_P, LANG_HOOKS_TREE_INLINING_START_INLINING,
LANG_HOOKS_TREE_INLINING_END_INLINING, LANG_HOOKS_TYPE_MAX_SIZE,
LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE.  One has a nontrivial default
definition and no front ends give another definition:
LANG_HOOKS_UNSAVE_EXPR_NOW.  Unless there are immediate plans for a
front end to use them or they specifically exist for the sake of an
out-of-tree front end - in which case the comments on them should say
so - I'm inclined to think that they should also cease to be
langhooks.)

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2004-07-11  Joseph S. Myers  <jsm@polyomino.org.uk>

	* langhooks.h (estimate_num_insns, pushlevel, poplevel, set_block,
	maybe_build_cleanup, update_decl_after_saving): Remove hooks.
	* langhooks.c (lhd_clear_binding_stack): Remove.
	* langhooks-def.h (lhd_clear_binding_stack,
	LANG_HOOKS_MAYBE_BUILD_CLEANUP,
	LANG_HOOKS_UPDATE_DECL_AFTER_SAVING,
	LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS, LANG_HOOKS_PUSHLEVEL,
	LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove.
	(LANG_HOOKS_CLEAR_BINDING_STACK): Define to lhd_do_nothing.
	* system.h (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS,
	LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_SET_BLOCK,
	LANG_HOOKS_MAYBE_BUILD_CLEANUP,
	LANG_HOOKS_UPDATE_DECL_AFTER_SAVING, LANG_HOOKS_POPLEVEL): Poison.
	* tree.h (poplevel): Don't declare.
	* c-lang.c (LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL,
	LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove.
	* objc/objc-lang.c (LANG_HOOKS_CLEAR_BINDING_STACK,
	LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK):
	Remove.

ada:
2004-07-11  Joseph S. Myers  <jsm@polyomino.org.uk>

	* misc.c (LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL,
	LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove.

cp:
2004-07-11  Joseph S. Myers  <jsm@polyomino.org.uk>

	* cp-lang.c (LANG_HOOKS_MAYBE_BUILD_CLEANUP, LANG_HOOKS_PUSHLEVEL,
	LANG_HOOKS_POPLEVEL, LANG_HOOKS_UPDATE_DECL_AFTER_SAVING): Remove.
	* cp-tree.h (poplevel): Declare.
	(set_block): Remove.
	* decl.c (set_block): Remove.

fortran:
2004-07-11  Joseph S. Myers  <jsm@polyomino.org.uk>

	* f95-lang.c (set_block): Remove.
	(gfc_clear_binding_stack): New.
	(LANG_HOOKS_CLEAR_BINDING_STACK): Define.
	(struct binding_level): Remove block_created_by_back_end.
	(clear_binding_level): Likewise.
	(poplevel): Don't handle block_created_by_back_end.

java:
2004-07-11  Joseph S. Myers  <jsm@polyomino.org.uk>

	* java-tree.h (set_block): Remove.
	* lang.c (java_clear_binding_stack): New.
	(LANG_HOOKS_CLEAR_BINDING_STACK): Define.
	* decl.c (struct binding_level): Remove this_block.
	(clear_binding_level): Likewise.
	(poplevel): Don't handle this_block.
	(set_block): Remove.

treelang:
2004-07-11  Joseph S. Myers  <jsm@polyomino.org.uk>

	* treetree.c (set_block): Remove.
	(struct binding_level): Remove block_created_by_back_end.
	(clear_binding_level): Likewise.
	(tree_code_create_function_initial,
	tree_code_create_function_wrapup): Call pushlevel and poplevel
	directly rather than through hooks.
	(poplevel): Don't handle block_created_by_back_end.

diff -rupN GCC.orig/gcc/ada/misc.c GCC/gcc/ada/misc.c
--- GCC.orig/gcc/ada/misc.c	2004-06-28 21:48:05.000000000 +0000
+++ GCC/gcc/ada/misc.c	2004-07-10 10:57:41.000000000 +0000
@@ -123,14 +123,6 @@ static void gnat_adjust_rli		(record_lay
 #define LANG_HOOKS_HONOR_READONLY	true
 #undef LANG_HOOKS_HASH_TYPES
 #define LANG_HOOKS_HASH_TYPES		false
-#undef LANG_HOOKS_CLEAR_BINDING_STACK
-#define LANG_HOOKS_CLEAR_BINDING_STACK	lhd_do_nothing
-#undef LANG_HOOKS_PUSHLEVEL
-#define LANG_HOOKS_PUSHLEVEL		lhd_do_nothing_i
-#undef LANG_HOOKS_POPLEVEL
-#define LANG_HOOKS_POPLEVEL		lhd_do_nothing_iii_return_null_tree
-#undef LANG_HOOKS_SET_BLOCK
-#define LANG_HOOKS_SET_BLOCK		lhd_do_nothing_t
 #undef LANG_HOOKS_GETDECLS
 #define LANG_HOOKS_GETDECLS		lhd_return_null_tree_v
 #undef LANG_HOOKS_PUSHDECL
diff -rupN GCC.orig/gcc/c-lang.c GCC/gcc/c-lang.c
--- GCC.orig/gcc/c-lang.c	2004-07-09 16:49:22.000000000 +0000
+++ GCC/gcc/c-lang.c	2004-07-10 11:22:40.000000000 +0000
@@ -66,8 +66,6 @@ enum c_language_kind c_language = clk_c;
 #define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
 #undef LANG_HOOKS_PARSE_FILE
 #define LANG_HOOKS_PARSE_FILE c_common_parse_file
-#undef LANG_HOOKS_CLEAR_BINDING_STACK
-#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing
 #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
 #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion
 #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
@@ -136,15 +134,9 @@ enum c_language_kind c_language = clk_c;
 
 /* The C front end's scoping structure is very different from
    that expected by the language-independent code; it is best
-   to disable all of pushlevel, poplevel, set_block, and getdecls.
+   to disable getdecls.
    This means it must also provide its own write_globals.  */
 
-#undef LANG_HOOKS_PUSHLEVEL
-#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i
-#undef LANG_HOOKS_POPLEVEL
-#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree
-#undef LANG_HOOKS_SET_BLOCK
-#define LANG_HOOKS_SET_BLOCK lhd_do_nothing_t
 #undef LANG_HOOKS_GETDECLS
 #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
 #undef LANG_HOOKS_WRITE_GLOBALS
diff -rupN GCC.orig/gcc/cp/cp-lang.c GCC/gcc/cp/cp-lang.c
--- GCC.orig/gcc/cp/cp-lang.c	2004-07-06 07:45:56.000000000 +0000
+++ GCC/gcc/cp/cp-lang.c	2004-07-10 11:23:17.000000000 +0000
@@ -76,8 +76,6 @@ static void cxx_initialize_diagnostics (
 #define LANG_HOOKS_PARSE_FILE c_common_parse_file
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL cxx_dup_lang_specific_decl
-#undef LANG_HOOKS_MAYBE_BUILD_CLEANUP
-#define LANG_HOOKS_MAYBE_BUILD_CLEANUP cxx_maybe_build_cleanup
 #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
 #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion
 #undef LANG_HOOKS_UNSAFE_FOR_REEVAL
@@ -100,16 +98,10 @@ static void cxx_initialize_diagnostics (
 #define LANG_HOOKS_DECL_PRINTABLE_NAME	cxx_printable_name
 #undef LANG_HOOKS_PRINT_ERROR_FUNCTION
 #define LANG_HOOKS_PRINT_ERROR_FUNCTION	cxx_print_error_function
-#undef LANG_HOOKS_PUSHLEVEL
-#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i
-#undef LANG_HOOKS_POPLEVEL
-#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree
 #undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
 #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL cxx_warn_unused_global_decl
 #undef LANG_HOOKS_WRITE_GLOBALS
 #define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing
-#undef LANG_HOOKS_UPDATE_DECL_AFTER_SAVING
-#define LANG_HOOKS_UPDATE_DECL_AFTER_SAVING cp_update_decl_after_saving
 
 
 #undef LANG_HOOKS_FUNCTION_INIT
diff -rupN GCC.orig/gcc/cp/cp-tree.h GCC/gcc/cp/cp-tree.h
--- GCC.orig/gcc/cp/cp-tree.h	2004-07-08 08:27:44.000000000 +0000
+++ GCC/gcc/cp/cp-tree.h	2004-07-10 11:01:50.000000000 +0000
@@ -3672,8 +3672,8 @@ extern void clone_function_decl         
 extern void adjust_clone_args			(tree);
 
 /* decl.c */
+extern tree poplevel				(int, int, int);
 extern void insert_block			(tree);
-extern void set_block				(tree);
 extern tree pushdecl				(tree);
 extern void cxx_init_decl_processing		(void);
 enum cp_tree_node_structure_enum cp_tree_node_structure 
diff -rupN GCC.orig/gcc/cp/decl.c GCC/gcc/cp/decl.c
--- GCC.orig/gcc/cp/decl.c	2004-07-08 08:27:44.000000000 +0000
+++ GCC/gcc/cp/decl.c	2004-07-10 08:37:30.000000000 +0000
@@ -735,16 +735,6 @@ insert_block (tree block)
     = chainon (current_binding_level->blocks, block);
 }
 
-/* Set the BLOCK node for the innermost scope
-   (the one we are currently in).  */
-
-void
-set_block (tree block ATTRIBUTE_UNUSED )
-{
-  /* The RTL expansion machinery requires us to provide this callback,
-     but it is not applicable in function-at-a-time mode.  */
-}
-
 /* Returns nonzero if T is a virtual function table.  */
 
 int
diff -rupN GCC.orig/gcc/fortran/f95-lang.c GCC/gcc/fortran/f95-lang.c
--- GCC.orig/gcc/fortran/f95-lang.c	2004-07-05 08:55:07.000000000 +0000
+++ GCC/gcc/fortran/f95-lang.c	2004-07-10 20:40:34.000000000 +0000
@@ -103,7 +103,7 @@ static bool gfc_mark_addressable (tree);
 void do_function_end (void);
 int global_bindings_p (void);
 void insert_block (tree);
-void set_block (tree);
+static void gfc_clear_binding_stack (void);
 static void gfc_be_parse_file (int);
 static void gfc_expand_function (tree);
 
@@ -123,6 +123,7 @@ static void gfc_expand_function (tree);
 #undef LANG_HOOKS_SIGNED_TYPE
 #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
 #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
+#undef LANG_HOOKS_CLEAR_BINDING_STACK
 
 /* Define lang hooks.  */
 #define LANG_HOOKS_NAME                 "GNU F95"
@@ -141,6 +142,7 @@ static void gfc_expand_function (tree);
 #define LANG_HOOKS_SIGNED_TYPE             gfc_signed_type
 #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gfc_signed_or_unsigned_type
 #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gfc_expand_function
+#define LANG_HOOKS_CLEAR_BINDING_STACK     gfc_clear_binding_stack
 
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
@@ -334,14 +336,6 @@ GTY(())
   /* For each level (except the global one), a chain of BLOCK nodes for all
      the levels that were entered and exited one level down from this one.  */
   tree blocks;
-  /* The back end may need, for its own internal processing, to create a BLOCK
-     node. This field is set aside for this purpose. If this field is non-null
-     when the level is popped, i.e. when poplevel is invoked, we will use such
-     block instead of creating a new one from the 'names' field, that is the
-     ..._DECL nodes accumulated so far.  Typically the routine 'pushlevel'
-     will be called before setting this field, so that if the front-end had
-     inserted ..._DECL nodes in the current block they will not be lost.   */
-  tree block_created_by_back_end;
   /* The binding level containing this one (the enclosing binding level). */
   struct binding_level *level_chain;
 };
@@ -354,7 +348,7 @@ static GTY(()) struct binding_level *cur
 static GTY(()) struct binding_level *global_binding_level;
 
 /* Binding level structures are initialized by copying this one.  */
-static struct binding_level clear_binding_level = { NULL, NULL, NULL, NULL };
+static struct binding_level clear_binding_level = { NULL, NULL, NULL };
 
 /* Return non-zero if we are currently in the global binding level.  */
 
@@ -412,7 +406,6 @@ poplevel (int keep, int reverse, int fun
   tree decl_chain;
   tree subblock_chain = current_binding_level->blocks;
   tree subblock_node;
-  tree block_created_by_back_end;
 
   /* Reverse the list of XXXX_DECL nodes if desired.  Note that the ..._DECL
      nodes chained through the `names' field of current_binding_level are in
@@ -421,24 +414,10 @@ poplevel (int keep, int reverse, int fun
   decl_chain = (reverse) ? nreverse (current_binding_level->names)
     : current_binding_level->names;
 
-  block_created_by_back_end =
-    current_binding_level->block_created_by_back_end;
-  if (block_created_by_back_end != 0)
-    {
-      block_node = block_created_by_back_end;
-
-      /* Check if we are about to discard some information that was gathered
-         by the front-end. Nameley check if the back-end created a new block
-         without calling pushlevel first. To understand why things are lost
-         just look at the next case (i.e. no block created by back-end.  */
-      if ((keep || functionbody) && (decl_chain || subblock_chain))
-	abort ();
-    }
-
   /* If there were any declarations in the current binding level, or if this
      binding level is a function body, or if there are any nested blocks then
      create a BLOCK node to record them for the life of this function.  */
-  else if (keep || functionbody)
+  if (keep || functionbody)
     block_node = build_block (keep ? decl_chain : 0, 0, subblock_chain, 0, 0);
 
   /* Record the BLOCK node just built as the subblock its enclosing scope.  */
@@ -475,9 +454,8 @@ poplevel (int keep, int reverse, int fun
     }
   else if (block_node)
     {
-      if (block_created_by_back_end == NULL)
-	current_binding_level->blocks
-	  = chainon (current_binding_level->blocks, block_node);
+      current_binding_level->blocks
+	= chainon (current_binding_level->blocks, block_node);
     }
 
   /* If we did not make a block for the level just exited, any blocks made for
@@ -505,15 +483,6 @@ insert_block (tree block)
     = chainon (current_binding_level->blocks, block);
 }
 
-/* Set the BLOCK node for the innermost scope
-   (the one we are currently in).  */
-
-void
-set_block (tree block)
-{
-  current_binding_level->block_created_by_back_end = block;
-}
-
 /* Records a ..._DECL node DECL as belonging to the current lexical scope.
    Returns the ..._DECL node. */
 
@@ -562,6 +531,15 @@ pushdecl_top_level (tree x)
 }
 
 
+/* Clear the binding stack.  */
+static void
+gfc_clear_binding_stack (void)
+{
+  while (!global_bindings_p ())
+    poplevel (0, 0, 0);
+}
+
+
 #ifndef CHAR_TYPE_SIZE
 #define CHAR_TYPE_SIZE BITS_PER_UNIT
 #endif
diff -rupN GCC.orig/gcc/java/decl.c GCC/gcc/java/decl.c
--- GCC.orig/gcc/java/decl.c	2004-07-01 08:22:17.000000000 +0000
+++ GCC/gcc/java/decl.c	2004-07-10 20:39:34.000000000 +0000
@@ -299,10 +299,6 @@ struct binding_level GTY(())
        that were entered and exited one level down.  */
     tree blocks;
 
-    /* The BLOCK node for this level, if one has been preallocated.
-       If 0, the BLOCK is allocated (if needed) when the level is popped.  */
-    tree this_block;
-
     /* The binding level which this one is contained in (inherits from).  */
     struct binding_level *level_chain;
 
@@ -348,7 +344,6 @@ static const struct binding_level clear_
     NULL_TREE, /* names */
     NULL_TREE, /* shadowed */
     NULL_TREE, /* blocks */
-    NULL_TREE, /* this_lock */
     NULL_BINDING_LEVEL, /* level_chain */
     LARGEST_PC, /* end_pc */
     0, /* start_pc */
@@ -1276,7 +1271,6 @@ poplevel (int keep, int reverse, int fun
   tree block = 0;
   tree decl;
   tree bind = 0;
-  int block_previously_created;
 
 #if defined(DEBUG_JAVA_BINDING_LEVELS)
   binding_depth--;
@@ -1319,10 +1313,7 @@ poplevel (int keep, int reverse, int fun
      create a BLOCK to record them for the life of this function.  */
 
   block = 0;
-  block_previously_created = (current_binding_level->this_block != 0);
-  if (block_previously_created)
-    block = current_binding_level->this_block;
-  else if (keep || functionbody)
+  if (keep || functionbody)
     {
       block = make_node (BLOCK);
       TREE_TYPE (block) = void_type_node;
@@ -1466,9 +1457,8 @@ poplevel (int keep, int reverse, int fun
     {
       if (block)
 	{
-	  if (!block_previously_created)
-	    current_binding_level->blocks
-	      = chainon (current_binding_level->blocks, block);
+	  current_binding_level->blocks
+	    = chainon (current_binding_level->blocks, block);
 	}
       /* If we did not make a block for the level just exited,
 	 any blocks made for inner levels
@@ -1571,19 +1561,6 @@ insert_block (tree block)
     = chainon (current_binding_level->blocks, block);
 }
 
-/* Set the BLOCK node for the innermost scope
-   (the one we are currently in).  */
-
-void
-set_block (tree block)
-{
-  current_binding_level->this_block = block;
-  current_binding_level->names = chainon (current_binding_level->names,
-					  BLOCK_VARS (block));
-  current_binding_level->blocks = chainon (current_binding_level->blocks,
-					   BLOCK_SUBBLOCKS (block));
-}
-
 /* integrate_decl_tree calls this function. */
 
 void
diff -rupN GCC.orig/gcc/java/java-tree.h GCC/gcc/java/java-tree.h
--- GCC.orig/gcc/java/java-tree.h	2004-07-10 07:51:48.000000000 +0000
+++ GCC/gcc/java/java-tree.h	2004-07-10 08:38:13.000000000 +0000
@@ -1171,7 +1171,6 @@ extern tree getdecls (void);
 extern void pushlevel (int);
 extern tree poplevel (int,int, int);
 extern void insert_block (tree);
-extern void set_block (tree);
 extern tree pushdecl (tree);
 extern void java_init_decl_processing (void);
 extern void java_dup_lang_specific_decl (tree);
diff -rupN GCC.orig/gcc/java/lang.c GCC/gcc/java/lang.c
--- GCC.orig/gcc/java/lang.c	2004-07-08 08:28:06.000000000 +0000
+++ GCC/gcc/java/lang.c	2004-07-10 10:54:53.000000000 +0000
@@ -67,6 +67,7 @@ static bool java_dump_tree (void *, tree
 static void dump_compound_expr (dump_info_p, tree);
 static bool java_decl_ok_for_sibcall (tree);
 static tree java_get_callee_fndecl (tree);
+static void java_clear_binding_stack (void);
 
 #ifndef TARGET_OBJECT_SUFFIX
 # define TARGET_OBJECT_SUFFIX ".o"
@@ -264,6 +265,9 @@ struct language_function GTY(())
 #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
 #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION java_expand_body
 
+#undef LANG_HOOKS_CLEAR_BINDING_STACK
+#define LANG_HOOKS_CLEAR_BINDING_STACK java_clear_binding_stack
+
 /* Each front end provides its own.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
@@ -1160,4 +1164,13 @@ java_get_callee_fndecl (tree call_expr)
   return NULL;
 }
 
+
+/* Clear the binding stack.  */
+static void
+java_clear_binding_stack (void)
+{
+  while (!global_bindings_p ())
+    poplevel (0, 0, 0);
+}
+
 #include "gt-java-lang.h"
diff -rupN GCC.orig/gcc/langhooks-def.h GCC/gcc/langhooks-def.h
--- GCC.orig/gcc/langhooks-def.h	2004-07-08 08:35:40.000000000 +0000
+++ GCC/gcc/langhooks-def.h	2004-07-10 19:55:08.000000000 +0000
@@ -52,7 +52,6 @@ extern tree lhd_do_nothing_iii_return_nu
 extern int lhd_safe_from_p (rtx, tree);
 extern int lhd_staticp (tree);
 extern int lhd_unsafe_for_reeval (tree);
-extern void lhd_clear_binding_stack (void);
 extern void lhd_print_tree_nothing (FILE *, tree, int);
 extern const char *lhd_decl_printable_name (tree, int);
 extern int lhd_types_compatible_p (tree, tree);
@@ -97,7 +96,7 @@ extern int lhd_gimplify_expr (tree *, tr
 #define LANG_HOOKS_INIT			hook_bool_void_false
 #define LANG_HOOKS_FINISH		lhd_do_nothing
 #define LANG_HOOKS_PARSE_FILE		lhd_do_nothing_i
-#define LANG_HOOKS_CLEAR_BINDING_STACK	lhd_clear_binding_stack
+#define LANG_HOOKS_CLEAR_BINDING_STACK	lhd_do_nothing
 #define LANG_HOOKS_INIT_OPTIONS		hook_uint_uint_constcharptrptr_0
 #define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics
 #define LANG_HOOKS_HANDLE_OPTION	hook_int_size_t_constcharptr_int_0
@@ -113,7 +112,6 @@ extern int lhd_gimplify_expr (tree *, tr
 #define LANG_HOOKS_STATICP		lhd_staticp
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t
 #define LANG_HOOKS_UNSAVE_EXPR_NOW	lhd_unsave_expr_now
-#define LANG_HOOKS_MAYBE_BUILD_CLEANUP	lhd_return_null_tree
 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name
 #define LANG_HOOKS_CAN_USE_BIT_FIELDS_P lhd_can_use_bit_fields_p
 #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS false
@@ -130,7 +128,6 @@ extern int lhd_gimplify_expr (tree *, tr
 #define LANG_HOOKS_EXPR_SIZE		lhd_expr_size
 #define LANG_HOOKS_TREE_SIZE		lhd_tree_size
 #define LANG_HOOKS_TYPES_COMPATIBLE_P	lhd_types_compatible_p
-#define LANG_HOOKS_UPDATE_DECL_AFTER_SAVING NULL
 
 #define LANG_HOOKS_FUNCTION_INIT	lhd_do_nothing_f
 #define LANG_HOOKS_FUNCTION_FINAL	lhd_do_nothing_f
@@ -165,8 +162,6 @@ extern int lhd_gimplify_expr (tree *, tr
   lhd_tree_inlining_end_inlining
 #define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
   lhd_tree_inlining_convert_parm_for_inlining
-#define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
-  NULL
 
 #define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
   LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \
@@ -179,8 +174,7 @@ extern int lhd_gimplify_expr (tree *, tr
   LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
   LANG_HOOKS_TREE_INLINING_START_INLINING, \
   LANG_HOOKS_TREE_INLINING_END_INLINING, \
-  LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING, \
-  LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
+  LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
 }
 
 #define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr
@@ -240,11 +234,8 @@ extern tree lhd_make_node (enum tree_cod
 }
 
 /* Declaration hooks.  */
-#define LANG_HOOKS_PUSHLEVEL	pushlevel
-#define LANG_HOOKS_POPLEVEL	poplevel
 #define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
 #define LANG_HOOKS_INSERT_BLOCK	insert_block
-#define LANG_HOOKS_SET_BLOCK	set_block
 #define LANG_HOOKS_PUSHDECL	pushdecl
 #define LANG_HOOKS_GETDECLS	getdecls
 #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
@@ -253,11 +244,8 @@ extern tree lhd_make_node (enum tree_cod
 #define LANG_HOOKS_DECL_OK_FOR_SIBCALL	lhd_decl_ok_for_sibcall
 
 #define LANG_HOOKS_DECLS { \
-  LANG_HOOKS_PUSHLEVEL, \
-  LANG_HOOKS_POPLEVEL, \
   LANG_HOOKS_GLOBAL_BINDINGS_P, \
   LANG_HOOKS_INSERT_BLOCK, \
-  LANG_HOOKS_SET_BLOCK, \
   LANG_HOOKS_PUSHDECL, \
   LANG_HOOKS_GETDECLS, \
   LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
@@ -292,7 +280,6 @@ extern tree lhd_make_node (enum tree_cod
   LANG_HOOKS_STATICP, \
   LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
   LANG_HOOKS_UNSAVE_EXPR_NOW, \
-  LANG_HOOKS_MAYBE_BUILD_CLEANUP, \
   LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
   LANG_HOOKS_CAN_USE_BIT_FIELDS_P, \
   LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS, \
@@ -308,7 +295,6 @@ extern tree lhd_make_node (enum tree_cod
   LANG_HOOKS_GET_CALLEE_FNDECL, \
   LANG_HOOKS_PRINT_ERROR_FUNCTION, \
   LANG_HOOKS_EXPR_SIZE, \
-  LANG_HOOKS_UPDATE_DECL_AFTER_SAVING, \
   LANG_HOOKS_ATTRIBUTE_TABLE, \
   LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
   LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \
diff -rupN GCC.orig/gcc/langhooks.c GCC/gcc/langhooks.c
--- GCC.orig/gcc/langhooks.c	2004-07-09 16:49:23.000000000 +0000
+++ GCC/gcc/langhooks.c	2004-07-10 11:24:41.000000000 +0000
@@ -205,15 +205,6 @@ lhd_can_use_bit_fields_p (void)
   return true;
 }
 
-/* Provide a default routine to clear the binding stack.  This is used
-   by languages that don't need to do anything special.  */
-void
-lhd_clear_binding_stack (void)
-{
-  while (! lang_hooks.decls.global_bindings_p ())
-    lang_hooks.decls.poplevel (0, 0, 0);
-}
-
 /* Type promotion for variable arguments.  */
 tree
 lhd_type_promotes_to (tree type ATTRIBUTE_UNUSED)
diff -rupN GCC.orig/gcc/langhooks.h GCC/gcc/langhooks.h
--- GCC.orig/gcc/langhooks.h	2004-07-08 08:35:40.000000000 +0000
+++ GCC/gcc/langhooks.h	2004-07-10 11:25:12.000000000 +0000
@@ -47,7 +47,6 @@ struct lang_hooks_for_tree_inlining
   int (*start_inlining) (tree);
   void (*end_inlining) (tree);
   tree (*convert_parm_for_inlining) (tree, tree, tree, int);
-  int (*estimate_num_insns) (tree);
 };
 
 struct lang_hooks_for_callgraph
@@ -155,17 +154,6 @@ struct lang_hooks_for_types
 
 struct lang_hooks_for_decls
 {
-  /* Enter a new lexical scope.  Argument is always zero when called
-     from outside the front end.  */
-  void (*pushlevel) (int);
-
-  /* Exit a lexical scope and return a BINDING for that scope.
-     Takes three arguments:
-     KEEP -- nonzero if there were declarations in this scope.
-     REVERSE -- reverse the order of decls before returning them.
-     FUNCTIONBODY -- nonzero if this level is the body of a function.  */
-  tree (*poplevel) (int, int, int);
-
   /* Returns nonzero if we are in the global binding level.  Ada
      returns -1 for an undocumented reason used in stor-layout.c.  */
   int (*global_bindings_p) (void);
@@ -175,9 +163,6 @@ struct lang_hooks_for_decls
      to handle the BLOCK node inside the BIND_EXPR.  */
   void (*insert_block) (tree);
 
-  /* Set the BLOCK node for the current scope level.  */
-  void (*set_block) (tree);
-
   /* Function to add a decl to the current scope level.  Takes one
      argument, a decl to add.  Returns that decl, or, if the same
      symbol is already declared, may return a different decl for that
@@ -332,10 +317,6 @@ struct lang_hooks
      things are cleared out.  */
   tree (*unsave_expr_now) (tree);
 
-  /* Called by expand_expr to build and return the cleanup-expression
-     for the passed TARGET_EXPR.  Return NULL if there is none.  */
-  tree (*maybe_build_cleanup) (tree);
-
   /* Set the DECL_ASSEMBLER_NAME for a node.  If it is the sort of
      thing that the assembler should talk about, set
      DECL_ASSEMBLER_NAME to an appropriate IDENTIFIER_NODE.
@@ -398,9 +379,6 @@ struct lang_hooks
      semantics in cases that it doesn't want to handle specially.  */
   tree (*expr_size) (tree);
 
-  /* Update lang specific fields after duplicating function body.  */
-  void (*update_decl_after_saving) (tree, void *);
-
   /* Pointers to machine-independent attribute tables, for front ends
      using attribs.c.  If one is NULL, it is ignored.  Respectively, a
      table of attributes specific to the language, a table of
diff -rupN GCC.orig/gcc/objc/objc-lang.c GCC/gcc/objc/objc-lang.c
--- GCC.orig/gcc/objc/objc-lang.c	2004-07-08 08:35:40.000000000 +0000
+++ GCC/gcc/objc/objc-lang.c	2004-07-10 10:58:24.000000000 +0000
@@ -57,8 +57,6 @@ enum c_language_kind c_language = clk_ob
 #define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
 #undef LANG_HOOKS_PARSE_FILE
 #define LANG_HOOKS_PARSE_FILE c_common_parse_file
-#undef LANG_HOOKS_CLEAR_BINDING_STACK
-#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing
 #undef LANG_HOOKS_EXPAND_EXPR
 #define LANG_HOOKS_EXPAND_EXPR c_expand_expr
 #undef LANG_HOOKS_EXPAND_DECL
@@ -135,15 +133,9 @@ enum c_language_kind c_language = clk_ob
 
 /* The C front end's scoping structure is very different from
    that expected by the language-independent code; it is best
-   to disable all of pushlevel, poplevel, set_block, and getdecls.
+   to disable getdecls.
    This means it must also provide its own write_globals.  */
 
-#undef LANG_HOOKS_PUSHLEVEL
-#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i
-#undef LANG_HOOKS_POPLEVEL
-#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree
-#undef LANG_HOOKS_SET_BLOCK
-#define LANG_HOOKS_SET_BLOCK lhd_do_nothing_t
 #undef LANG_HOOKS_GETDECLS
 #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
 #undef LANG_HOOKS_WRITE_GLOBALS
diff -rupN GCC.orig/gcc/system.h GCC/gcc/system.h
--- GCC.orig/gcc/system.h	2004-07-09 16:49:24.000000000 +0000
+++ GCC/gcc/system.h	2004-07-10 11:25:52.000000000 +0000
@@ -626,7 +626,11 @@ extern int snprintf (char *, size_t, con
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE	\
-	LANG_HOOKS_MARK_TREE LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES
+	LANG_HOOKS_MARK_TREE LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES \
+	LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
+	LANG_HOOKS_PUSHLEVEL LANG_HOOKS_SET_BLOCK \
+	LANG_HOOKS_MAYBE_BUILD_CLEANUP LANG_HOOKS_UPDATE_DECL_AFTER_SAVING \
+	LANG_HOOKS_POPLEVEL
 
 /* Libiberty macros that are no longer used in GCC.  */
 #undef ANSI_PROTOTYPES
diff -rupN GCC.orig/gcc/tree.h GCC/gcc/tree.h
--- GCC.orig/gcc/tree.h	2004-07-10 07:51:41.000000000 +0000
+++ GCC/gcc/tree.h	2004-07-10 10:59:24.000000000 +0000
@@ -3311,10 +3311,6 @@ extern GTY(()) tree current_file_decl;
 
 extern int all_types_permanent;
 
-/* Exit a binding level.  This function is provided by each language
-   frontend.  */
-extern tree poplevel (int, int, int);
-
 /* Declare a predefined function.  Return the declaration.  This function is
    provided by each language frontend.  */
 extern tree builtin_function (const char *, tree, int, enum built_in_class,
diff -rupN GCC.orig/gcc/treelang/treetree.c GCC/gcc/treelang/treetree.c
--- GCC.orig/gcc/treelang/treetree.c	2004-07-05 08:55:12.000000000 +0000
+++ GCC/gcc/treelang/treetree.c	2004-07-10 20:41:04.000000000 +0000
@@ -135,7 +135,6 @@ void pushlevel (int ignore);
 tree poplevel (int keep, int reverse, int functionbody);
 int global_bindings_p (void);
 void insert_block (tree block);
-void set_block (tree block);
 tree pushdecl (tree decl);
 tree getdecls (void);
 int kept_level_p (void);
@@ -451,7 +450,7 @@ tree_code_create_function_initial (tree 
   /* Function.c requires a push at the start of the function. that
      looks like a bug to me but let's make it happy.  */
 
-  (*lang_hooks.decls.pushlevel) (0);
+  pushlevel (0);
 
   /* Create rtl for the start of a new scope.  */
 
@@ -482,7 +481,7 @@ tree_code_create_function_initial (tree 
 
   /* Add a new level to the debugger symbol table.  */
 
-  (*lang_hooks.decls.pushlevel) (0);
+  pushlevel (0);
 
   /* Create rtl for the start of a new scope.  */
 
@@ -504,7 +503,7 @@ tree_code_create_function_wrapup (locati
 
   /* Get completely built level from debugger symbol table.  */
 
-  block = (*lang_hooks.decls.poplevel) (1, 0, 0);
+  block = poplevel (1, 0, 0);
 
   /* Emit rtl for end of scope.  */
 
@@ -516,7 +515,7 @@ tree_code_create_function_wrapup (locati
 
   /* Pop the level.  */
 
-  block = (*lang_hooks.decls.poplevel) (1, 0, 1);
+  block = poplevel (1, 0, 1);
 
   /* And attach it to the function.  */
 
@@ -1057,14 +1056,6 @@ struct binding_level
   /* For each level (except the global one), a chain of BLOCK nodes for all
      the levels that were entered and exited one level down from this one.  */
   tree blocks;
-  /* The back end may need, for its own internal processing, to create a BLOCK
-     node. This field is set aside for this purpose. If this field is non-null
-     when the level is popped, i.e. when poplevel is invoked, we will use such
-     block instead of creating a new one from the 'names' field, that is the
-     ..._DECL nodes accumulated so far.  Typically the routine 'pushlevel'
-     will be called before setting this field, so that if the front-end had
-     inserted ..._DECL nodes in the current block they will not be lost.   */
-  tree block_created_by_back_end;
   /* The binding level containing this one (the enclosing binding level). */
   struct binding_level *level_chain;
 };
@@ -1077,7 +1068,7 @@ static struct binding_level *current_bin
 static struct binding_level *global_binding_level;
 
 /* Binding level structures are initialized by copying this one.  */
-static struct binding_level clear_binding_level = {NULL, NULL, NULL, NULL};
+static struct binding_level clear_binding_level = {NULL, NULL, NULL };
 
 /* Return non-zero if we are currently in the global binding level.  */
 
@@ -1145,7 +1136,6 @@ poplevel (int keep, int reverse, int fun
   tree decl_chain;
   tree subblock_chain = current_binding_level->blocks;
   tree subblock_node;
-  tree block_created_by_back_end;
 
   /* Reverse the list of *_DECL nodes if desired.  Note that the ..._DECL
      nodes chained through the `names' field of current_binding_level are in
@@ -1154,23 +1144,10 @@ poplevel (int keep, int reverse, int fun
   decl_chain = (reverse) ? nreverse (current_binding_level->names)
 			 : current_binding_level->names;
 
-  block_created_by_back_end = current_binding_level->block_created_by_back_end;
-  if (block_created_by_back_end != 0)
-    {
-      block_node = block_created_by_back_end;
-
-      /* Check if we are about to discard some information that was gathered
-	 by the front-end. Nameley check if the back-end created a new block 
-	 without calling pushlevel first. To understand why things are lost
-	 just look at the next case (i.e. no block created by back-end.  */
-      if ((keep || functionbody) && (decl_chain || subblock_chain))
-	abort ();
-    }
-
   /* If there were any declarations in the current binding level, or if this
      binding level is a function body, or if there are any nested blocks then
      create a BLOCK node to record them for the life of this function.  */
-  else if (keep || functionbody)
+  if (keep || functionbody)
     block_node = build_block (keep ? decl_chain : 0, 0, subblock_chain, 0, 0);
 
   /* Record the BLOCK node just built as the subblock its enclosing scope.  */
@@ -1207,9 +1184,8 @@ poplevel (int keep, int reverse, int fun
     }
   else if (block_node)
     {
-      if (block_created_by_back_end == NULL)
-	current_binding_level->blocks
-	  = chainon (current_binding_level->blocks, block_node);
+      current_binding_level->blocks
+	= chainon (current_binding_level->blocks, block_node);
     }
 
   /* If we did not make a block for the level just exited, any blocks made for
@@ -1237,15 +1213,6 @@ insert_block (tree block)
     = chainon (current_binding_level->blocks, block);
 }
 
-/* Set the BLOCK node for the innermost scope
-   (the one we are currently in).  */
-
-void
-set_block (tree block)
-{
-  current_binding_level->block_created_by_back_end = block;
-}
-
 /* Records a ..._DECL node DECL as belonging to the current lexical scope.
    Returns the ..._DECL node. */
 


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