diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de6a4c7d38cb25cf42db5e07507ec38fbb194a10..9d27cccb10911b8289bd96708f66e2ee7c00e2ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +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, diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f37efec39a9bc92276d806fab966967dc2f61172..57c55e218686294309393aff2ca66e327b32dfae 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 5b98771d4f50b89d61b6404080c73b03416bba77..c57cd80e30ec25d5b9aa1a4f3002abbd379e1e5d 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 58f0b68c4fca6c766c585711061e1e0c672dead3..2cde34e6565a23f77384f7c14d3fb5f55171c399 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 3d381231a59386efd7e140e7689155deb656d90c..22491aaec6aa1c5cba18061472a1a472f39f12b9 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 687d39a3cc544ed0de03a21ac8d5df8e9c44d6c0..92df36ad6323303475d9a9a28b7988c5f1a8f105 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 6aaf392a3fe160100d50638552e748f2e1202bb4..5b6c4981eb1ecfb4d99b17b61e37a5a725052947 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +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. diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index 0f5017365e37bb11789617833db81560f4c86896..2ffbd6f218a0ef86828b4b7ffe19cceac0e14ca7 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 9fb19c41572de8b61cab41af251bcc6e960da716..bc622efc95601335b465d950839444d78c484c86 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 52c0a819025f57b353ac2a592550ff6c223bef0b..4639d6c27b69a3ada2773245b05be1056fd9bfc7 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 2c2c35e03d4f9aa6c105687b1597010be0f99361..ee1790b841a19705f095e0778397efc5e3508fe9 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 9f08746154ad55352e40b05c010c38acd0ff53df..d449e39b53958e203125147a5bfbe4969430de84 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 494c428db199c7572beeb490cf94d69774e75660..02f93e26fb7d9f72b7115402f7d0927a83634b3a 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 745e3a260678868a5a0ccd981e058e5da2e6d0f2..47996a0d75bfa2c04a73617be8215a142f3d0695 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 ef46912c8cb13b781baf06f79001f75c8c1e149c..21e794fae809702f0a66c4885f8a1736d753a32f 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 216e3b4664d8a262bee8e76bb20e00558ad99d80..091a45a1439277adbcc091ada2bf30035d41003e 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 562713a3299093dae61ae78a9a08e1bd91e817a5..a69afd00f99b7dacc96f2282e79bdfbb6c916867 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 *);