aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2008-04-03 05:41:57 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2008-04-03 05:41:57 +0000
commit9ff420f135551a6d3582b986997ef78ac6762f56 (patch)
tree452e7c06ff6f1f3a8357898f7dcdc5ae66011637 /gcc
parentd2784db4e5b1950ca24582e3dd716af7f5e04906 (diff)
downloadgcc-9ff420f135551a6d3582b986997ef78ac6762f56.zip
gcc-9ff420f135551a6d3582b986997ef78ac6762f56.tar.gz
gcc-9ff420f135551a6d3582b986997ef78ac6762f56.tar.bz2
tree-inline.c (copy_generic_body, [...]): Export.
2007-03-09 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. 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. From-SVN: r133861
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gigi.h5
-rw-r--r--gcc/ada/utils.c11
-rw-r--r--gcc/c-decl.c10
-rw-r--r--gcc/c-tree.h1
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/optimize.c31
-rw-r--r--gcc/fortran/ChangeLog4
-rw-r--r--gcc/fortran/f95-lang.c14
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/decl.c12
-rw-r--r--gcc/java/java-tree.h1
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.h5
-rw-r--r--gcc/tree-inline.c44
-rw-r--r--gcc/tree-inline.h10
17 files changed, 78 insertions, 104 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index de6a4c7..9d27ccc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index f37efec..57c55e2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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
diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h
index 5b98771..c57cd80 100644
--- a/gcc/ada/gigi.h
+++ b/gcc/ada/gigi.h
@@ -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);
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index 58f0b68..2cde34e 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -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;
-}
/* Records a ..._DECL node DECL as belonging to the current lexical scope
and uses GNAT_NODE for location information and propagating flags. */
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 3d38123..22491aa 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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);
-}
/* Push a definition or a declaration of struct, union or enum tag "name".
"type" should be the type node.
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 687d39a..92df36a 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -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);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6aaf392..5b6c498 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 0f50173..2ffbd6f 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -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. */
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 9fb19c4..bc622ef 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 52c0a81..4639d6c 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -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. */
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 2c2c35e..ee1790b 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -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
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 9f08746..d449e39 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -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
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 494c428..02f93e2 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -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);
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 745e3a2..47996a0 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -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, \
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index ef46912..21e794f 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -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
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 216e3b4..091a45a 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -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
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 562713a..a69afd0 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -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 *);