2007-03-09 Paolo Bonzini <bonzini@gnu.org>
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Apr 2008 05:41:57 +0000 (05:41 +0000)
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Apr 2008 05:41:57 +0000 (05:41 +0000)
* tree-inline.c (copy_generic_body, copy_decl_no_change): Export.
(remap_block): Call id->transform_lang_insert_block instead
of langhook.
(optimize_inline_calls, unsave_expr_now, tree_function_versioning):
Set id.transform_lang_insert_block to NULL.
(clone_body): Move to cp/optimize.c
* tree-inline.h (struct copy_body_data): Change
transform_lang_insert_block to function pointer.
(copy_generic_body, copy_decl_no_change): Export.
* langhooks.h (struct lang_hooks_for_decls): Kill insert_block.
* langhooks-def.h (LANG_HOOKS_INSERT_BLOCK): Kill.
(LANG_HOOKS_DECLS): Remove LANG_HOOKS_INSERT_BLOCK.

* c-tree.h (insert_block): Kill.
* c-decl.c (insert_block): Kill.

cp:
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

* optimize.c (clone_body): New, from tree-inline.c.

ada:
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

* gigi.h (insert_block): Kill.
* utils.c (insert_block): Kill.

java:
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

* java-tree.h (insert_block): Kill.
* decl.c (insert_block): Kill.

fortran:
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

* f95-lang.c (insert_block): Kill.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133861 138bc75d-0d04-0410-961f-82ee72b054a4

17 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gigi.h
gcc/ada/utils.c
gcc/c-decl.c
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/optimize.c
gcc/fortran/ChangeLog
gcc/fortran/f95-lang.c
gcc/java/ChangeLog
gcc/java/decl.c
gcc/java/java-tree.h
gcc/langhooks-def.h
gcc/langhooks.h
gcc/tree-inline.c
gcc/tree-inline.h

index de6a4c7..9d27ccc 100644 (file)
@@ -1,5 +1,23 @@
 2008-04-03  Paolo Bonzini  <bonzini@gnu.org>
 
+        * tree-inline.c (copy_generic_body, copy_decl_no_change): Export.
+        (remap_block): Call id->transform_lang_insert_block instead
+        of langhook.
+        (optimize_inline_calls, unsave_expr_now, tree_function_versioning):
+        Set id.transform_lang_insert_block to NULL.
+        (clone_body): Move to cp/optimize.c
+        * tree-inline.h (struct copy_body_data): Change
+        transform_lang_insert_block to function pointer.
+        (copy_generic_body, copy_decl_no_change): Export.
+        * langhooks.h (struct lang_hooks_for_decls): Kill insert_block.
+        * langhooks-def.h (LANG_HOOKS_INSERT_BLOCK): Kill.
+        (LANG_HOOKS_DECLS): Remove LANG_HOOKS_INSERT_BLOCK.
+
+        * c-tree.h (insert_block): Kill.
+        * c-decl.c (insert_block): Kill.
+
+2008-04-03  Paolo Bonzini  <bonzini@gnu.org>
+
         * c-objc-common.h (LANG_HOOKS_FUNCTION_ENTER_NESTED,
         LANG_HOOKS_FUNCTION_LEAVE_NESTED): Delete.
         * c-tree.h (c_push_function_context, c_pop_function_context): Remove
index f37efec..57c55e2 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-03  Paolo Bonzini  <bonzini@gnu.org>
+
+        * gigi.h (insert_block): Kill.
+        * utils.c (insert_block): Kill.
+
 2008-04-02  Eric Botcazou  <ebotcazou@adacore.com>
 
        * decl.c (gnat_to_gnu_entity) <object>: For a constant object whose
index 5b98771..c57cd80 100644 (file)
@@ -442,11 +442,6 @@ extern void set_block_jmpbuf_decl (tree decl);
 /* Get the setjmp_decl, if any, for the current binding level.  */
 extern tree get_block_jmpbuf_decl (void);
 
-/* Insert BLOCK at the end of the list of subblocks of the
-   current binding level.  This is used when a BIND_EXPR is expanded,
-   to handle the BLOCK node inside the BIND_EXPR.  */
-extern void insert_block (tree block);
-
 /* Records a ..._DECL node DECL as belonging to the current lexical scope
    and uses GNAT_NODE for location information.  */
 extern void gnat_pushdecl (tree decl, Node_Id gnat_node);
index 58f0b68..2cde34e 100644 (file)
@@ -382,17 +382,6 @@ gnat_poplevel ()
   free_binding_level = level;
 }
 
-/* Insert BLOCK at the end of the list of subblocks of the
-   current binding level.  This is used when a BIND_EXPR is expanded,
-   to handle the BLOCK node inside the BIND_EXPR.  */
-
-void
-insert_block (tree block)
-{
-  TREE_USED (block) = 1;
-  TREE_CHAIN (block) = BLOCK_SUBBLOCKS (current_binding_level->block);
-  BLOCK_SUBBLOCKS (current_binding_level->block) = block;
-}
 \f
 /* Records a ..._DECL node DECL as belonging to the current lexical scope
    and uses GNAT_NODE for location information and propagating flags.  */
index 3d38123..22491aa 100644 (file)
@@ -931,16 +931,6 @@ pop_file_scope (void)
   cgraph_finalize_compilation_unit ();
 }
 
-/* Insert BLOCK at the end of the list of subblocks of the current
-   scope.  This is used when a BIND_EXPR is expanded, to handle the
-   BLOCK node inside the BIND_EXPR.  */
-
-void
-insert_block (tree block)
-{
-  TREE_USED (block) = 1;
-  SCOPE_LIST_APPEND (current_scope, blocks, block);
-}
 \f
 /* Push a definition or a declaration of struct, union or enum tag "name".
    "type" should be the type node.
index 687d39a..92df36a 100644 (file)
@@ -455,7 +455,6 @@ extern tree c_cont_label;
 extern int global_bindings_p (void);
 extern void push_scope (void);
 extern tree pop_scope (void);
-extern void insert_block (tree);
 
 extern void c_init_decl_processing (void);
 extern void c_dup_lang_specific_decl (tree);
index 6aaf392..5b6c498 100644 (file)
@@ -1,4 +1,8 @@
 2008-04-03  Paolo Bonzini  <bonzini@gnu.org>
+    
+       * optimize.c (clone_body): New, from tree-inline.c.
+
+2008-04-03  Paolo Bonzini  <bonzini@gnu.org>
 
         * method.c (synthesize_method): Use {push,pop}_function_context.
         * name-lookup.c (push_to_top_level): Likewise.
index 0f50173..2ffbd6f 100644 (file)
@@ -72,6 +72,37 @@ update_cloned_parm (tree parm, tree cloned_parm, bool first)
   DECL_GIMPLE_REG_P (cloned_parm) = DECL_GIMPLE_REG_P (parm);
 }
 
+/* FN is a function that has a complete body, and CLONE is a function whose
+   body is to be set to a copy of FN, mapping argument declarations according
+   to the ARG_MAP splay_tree.  */
+
+static void
+clone_body (tree clone, tree fn, void *arg_map)
+{
+  copy_body_data id;
+
+  /* Clone the body, as if we were making an inline call.  But, remap the
+     parameters in the callee to the parameters of caller.  */
+  memset (&id, 0, sizeof (id));
+  id.src_fn = fn;
+  id.dst_fn = clone;
+  id.src_cfun = DECL_STRUCT_FUNCTION (fn);
+  id.decl_map = (struct pointer_map_t *)arg_map;
+
+  id.copy_decl = copy_decl_no_change;
+  id.transform_call_graph_edges = CB_CGE_DUPLICATE;
+  id.transform_new_cfg = true;
+  id.transform_return_to_modify = false;
+  id.transform_lang_insert_block = insert_block;
+
+  /* We're not inside any EH region.  */
+  id.eh_region = -1;
+
+  /* Actually copy the body.  */
+  append_to_statement_list_force (copy_generic_body (&id),
+                                 &DECL_SAVED_TREE (clone));
+}
+
 /* FN is a function that has a complete body.  Clone the body as
    necessary.  Returns nonzero if there's no longer any need to
    process the main body.  */
index 9fb19c4..bc622ef 100644 (file)
@@ -1,3 +1,7 @@
+2008-04-03  Paolo Bonzini  <bonzini@gnu.org>
+
+        * f95-lang.c (insert_block): Kill.
+
 2008-04-01  George Helffrich <george@gcc.gnu.org>
 
        * trans-common.c (create_common):  Add decl to function
index 52c0a81..4639d6c 100644 (file)
@@ -95,7 +95,6 @@ static void gfc_print_identifier (FILE *, tree, int);
 static bool gfc_mark_addressable (tree);
 void do_function_end (void);
 int global_bindings_p (void);
-void insert_block (tree);
 static void clear_binding_stack (void);
 static void gfc_be_parse_file (int);
 static alias_set_type gfc_get_alias_set (tree);
@@ -473,19 +472,6 @@ poplevel (int keep, int reverse, int functionbody)
 }
 
 
-/* Insert BLOCK at the end of the list of subblocks of the
-   current binding level.  This is used when a BIND_EXPR is expanded,
-   to handle the BLOCK node inside the BIND_EXPR.  */
-
-void
-insert_block (tree block)
-{
-  TREE_USED (block) = 1;
-  current_binding_level->blocks
-    = chainon (current_binding_level->blocks, block);
-}
-
-
 /* Records a ..._DECL node DECL as belonging to the current lexical scope.
    Returns the ..._DECL node.  */
 
index 2c2c35e..ee1790b 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-03  Paolo Bonzini  <bonzini@gnu.org>
+
+        * java-tree.h (insert_block): Kill.
+        * decl.c (insert_block): Kill.
+               
 2008-04-01  Joseph Myers  <joseph@codesourcery.com>
 
        * gcj.texi: Include gpl_v3.texi instead of gpl.texi
index 9f08746..d449e39 100644 (file)
@@ -1581,18 +1581,6 @@ force_poplevels (int start_pc)
     }
 }
 
-/* Insert BLOCK at the end of the list of subblocks of the
-   current binding level.  This is used when a BIND_EXPR is expanded,
-   to handle the BLOCK node inside the BIND_EXPR.  */
-
-void
-insert_block (tree block)
-{
-  TREE_USED (block) = 1;
-  current_binding_level->blocks
-    = chainon (current_binding_level->blocks, block);
-}
-
 /* integrate_decl_tree calls this function. */
 
 void
index 494c428..02f93e2 100644 (file)
@@ -1051,7 +1051,6 @@ extern int global_bindings_p (void);
 extern tree getdecls (void);
 extern void pushlevel (int);
 extern tree poplevel (int,int, int);
-extern void insert_block (tree);
 extern tree pushdecl (tree);
 extern void java_init_decl_processing (void);
 extern void java_dup_lang_specific_decl (tree);
index 745e3a2..47996a0 100644 (file)
@@ -196,7 +196,6 @@ extern tree lhd_make_node (enum tree_code);
 
 /* Declaration hooks.  */
 #define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
-#define LANG_HOOKS_INSERT_BLOCK        insert_block
 #define LANG_HOOKS_PUSHDECL    pushdecl
 #define LANG_HOOKS_GETDECLS    getdecls
 #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
@@ -214,7 +213,6 @@ extern tree lhd_make_node (enum tree_code);
 
 #define LANG_HOOKS_DECLS { \
   LANG_HOOKS_GLOBAL_BINDINGS_P, \
-  LANG_HOOKS_INSERT_BLOCK, \
   LANG_HOOKS_PUSHDECL, \
   LANG_HOOKS_GETDECLS, \
   LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
index ef46912..21e794f 100644 (file)
@@ -158,11 +158,6 @@ struct lang_hooks_for_decls
      returns -1 for an undocumented reason used in stor-layout.c.  */
   int (*global_bindings_p) (void);
 
-  /* Insert BLOCK at the end of the list of subblocks of the
-     current binding level.  This is used when a BIND_EXPR is expanded,
-     to handle the BLOCK node inside the BIND_EXPR.  */
-  void (*insert_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
index 216e3b4..091a45a 100644 (file)
@@ -127,7 +127,6 @@ eni_weights eni_time_weights;
 /* Prototypes.  */
 
 static tree declare_return_variable (copy_body_data *, tree, tree, tree *);
-static tree copy_generic_body (copy_body_data *);
 static bool inlinable_function_p (tree);
 static void remap_block (tree *, copy_body_data *);
 static tree remap_decls (tree, copy_body_data *);
@@ -140,7 +139,6 @@ static void remap_save_expr (tree *, void *, int *);
 static void add_lexical_block (tree current_block, tree new_block);
 static tree copy_decl_to_var (tree, copy_body_data *);
 static tree copy_result_decl_to_var (tree, copy_body_data *);
-static tree copy_decl_no_change (tree, copy_body_data *);
 static tree copy_decl_maybe_to_var (tree, copy_body_data *);
 
 /* Insert a tree->tree mapping for ID.  Despite the name suggests
@@ -498,7 +496,7 @@ remap_block (tree *block, copy_body_data *id)
   fn = id->dst_fn;
 
   if (id->transform_lang_insert_block)
-    lang_hooks.decls.insert_block (new_block);
+    id->transform_lang_insert_block (new_block);
 
   /* Remember the remapped block.  */
   insert_decl_map (id, old_block, new_block);
@@ -1394,7 +1392,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency,
 /* Make a copy of the body of FN so that it can be inserted inline in
    another function.  */
 
-static tree
+tree
 copy_generic_body (copy_body_data *id)
 {
   tree body;
@@ -3024,7 +3022,7 @@ optimize_inline_calls (tree fn)
   id.transform_call_graph_edges = CB_CGE_DUPLICATE;
   id.transform_new_cfg = false;
   id.transform_return_to_modify = true;
-  id.transform_lang_insert_block = false;
+  id.transform_lang_insert_block = NULL;
   id.statements_to_fold = pointer_set_create ();
 
   push_gimplify_context ();
@@ -3079,36 +3077,6 @@ optimize_inline_calls (tree fn)
          | (profile_status != PROFILE_ABSENT ? TODO_rebuild_frequencies : 0));
 }
 
-/* FN is a function that has a complete body, and CLONE is a function whose
-   body is to be set to a copy of FN, mapping argument declarations according
-   to the ARG_MAP splay_tree.  */
-
-void
-clone_body (tree clone, tree fn, void *arg_map)
-{
-  copy_body_data id;
-
-  /* Clone the body, as if we were making an inline call.  But, remap the
-     parameters in the callee to the parameters of caller.  */
-  memset (&id, 0, sizeof (id));
-  id.src_fn = fn;
-  id.dst_fn = clone;
-  id.src_cfun = DECL_STRUCT_FUNCTION (fn);
-  id.decl_map = (struct pointer_map_t *)arg_map;
-
-  id.copy_decl = copy_decl_no_change;
-  id.transform_call_graph_edges = CB_CGE_DUPLICATE;
-  id.transform_new_cfg = true;
-  id.transform_return_to_modify = false;
-  id.transform_lang_insert_block = true;
-
-  /* We're not inside any EH region.  */
-  id.eh_region = -1;
-
-  /* Actually copy the body.  */
-  append_to_statement_list_force (copy_generic_body (&id), &DECL_SAVED_TREE (clone));
-}
-
 /* Passed to walk_tree.  Copies the node pointed to, if appropriate.  */
 
 tree
@@ -3329,7 +3297,7 @@ unsave_expr_now (tree expr)
   id.transform_call_graph_edges = CB_CGE_DUPLICATE;
   id.transform_new_cfg = false;
   id.transform_return_to_modify = false;
-  id.transform_lang_insert_block = false;
+  id.transform_lang_insert_block = NULL;
 
   /* Walk the tree once to find local labels.  */
   walk_tree_without_duplicates (&expr, mark_local_for_remap_r, &id);
@@ -3475,7 +3443,7 @@ copy_result_decl_to_var (tree decl, copy_body_data *id)
 }
 
 
-static tree
+tree
 copy_decl_no_change (tree decl, copy_body_data *id)
 {
   tree copy;
@@ -3611,7 +3579,7 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map,
     = update_clones ? CB_CGE_MOVE_CLONES : CB_CGE_MOVE;
   id.transform_new_cfg = true;
   id.transform_return_to_modify = false;
-  id.transform_lang_insert_block = false;
+  id.transform_lang_insert_block = NULL;
 
   current_function_decl = new_decl;
   old_entry_block = ENTRY_BLOCK_PTR_FOR_FUNCTION
index 562713a..a69afd0 100644 (file)
@@ -88,16 +88,15 @@ typedef struct copy_body_data
      by manipulating the CFG rather than a statement.  */
   bool transform_return_to_modify;
 
-  /* True if lang_hooks.decls.insert_block should be invoked when
-     duplicating BLOCK nodes.  */
-  bool transform_lang_insert_block;
-
   /* True if this statement will need to be regimplified.  */
   bool regimplify;
 
   /* > 0 if we are remapping a type currently.  */
   int remapping_type_depth;
 
+  /* A function to be called when duplicating BLOCK nodes.  */
+  void (*transform_lang_insert_block) (tree);
+
   /* Statements that might be possibly folded.  */
   struct pointer_set_t *statements_to_fold;
 
@@ -144,7 +143,8 @@ extern void insert_decl_map (copy_body_data *, tree, tree);
 unsigned int optimize_inline_calls (tree);
 bool tree_inlinable_function_p (tree);
 tree copy_tree_r (tree *, int *, void *);
-void clone_body (tree, tree, void *);
+tree copy_generic_body (copy_body_data *id);
+tree copy_decl_no_change (tree decl, copy_body_data *id);
 void save_body (tree, tree *, tree *);
 int estimate_move_cost (tree type);
 int estimate_num_insns (tree expr, eni_weights *);