+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,
+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
/* 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);
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. */
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.
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);
+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.
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. */
+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
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);
}
-/* 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. */
+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
}
}
-/* 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
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);
/* 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
#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, \
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
/* 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 *);
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
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);
/* 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;
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 ();
| (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
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);
}
-static tree
+tree
copy_decl_no_change (tree decl, copy_body_data *id)
{
tree copy;
= 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
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;
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 *);