Commit 50886bf1 by Richard Guenther Committed by Richard Biener

langhooks-def.h (lhd_tree_inlining_auto_var_in_fn_p): Remove.

2007-08-20  Richard Guenther  <rguenther@suse.de>

	* langhooks-def.h (lhd_tree_inlining_auto_var_in_fn_p): Remove.
	(LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P): Likewise.
	(LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove initializer for
	auto_var_in_fn_p langhook.
	* langhooks.c (lhd_tree_inlining_auto_var_in_fn_p): Rename and
	move ...
	* tree.c (auto_var_in_fn_p): ... here.
	(find_var_from_fn): Call auto_var_in_fn_p directly.
	* langhooks.h (lang_hooks_for_tree_inlining): Remove
	auto_var_in_fn_p langhook.
	* tree-inline.c (remap_decls): Call auto_var_in_fn_p directly.
	(copy_body_r): Likewise.
	(self_inlining_addr_expr): Likewise.
	* tree.h (auto_var_in_fn_p): Declare.

	cp/
	* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P):
	Remove.
	* cp-tree.h (cp_auto_var_in_fn_p): Remove.
	(nonstatic_local_decl_p): Likewise.
	* tree.c (cp_auto_var_in_fn_p): Remove.
	* decl.c (nonstatic_local_decl_p): Remove.

From-SVN: r127643
parent 14588106
2007-08-20 Richard Guenther <rguenther@suse.de> 2007-08-20 Richard Guenther <rguenther@suse.de>
* langhooks-def.h (lhd_tree_inlining_auto_var_in_fn_p): Remove.
(LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P): Likewise.
(LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove initializer for
auto_var_in_fn_p langhook.
* langhooks.c (lhd_tree_inlining_auto_var_in_fn_p): Rename and
move ...
* tree.c (auto_var_in_fn_p): ... here.
(find_var_from_fn): Call auto_var_in_fn_p directly.
* langhooks.h (lang_hooks_for_tree_inlining): Remove
auto_var_in_fn_p langhook.
* tree-inline.c (remap_decls): Call auto_var_in_fn_p directly.
(copy_body_r): Likewise.
(self_inlining_addr_expr): Likewise.
* tree.h (auto_var_in_fn_p): Declare.
2007-08-20 Richard Guenther <rguenther@suse.de>
* tree.c (WALK_SUBTREE): Call walk_tree_1. * tree.c (WALK_SUBTREE): Call walk_tree_1.
(walk_type_fields): Take lh parameter. (walk_type_fields): Take lh parameter.
(walk_tree): Rename to ... (walk_tree): Rename to ...
......
2007-08-20 Richard Guenther <rguenther@suse.de> 2007-08-20 Richard Guenther <rguenther@suse.de>
* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P):
Remove.
* cp-tree.h (cp_auto_var_in_fn_p): Remove.
(nonstatic_local_decl_p): Likewise.
* tree.c (cp_auto_var_in_fn_p): Remove.
* decl.c (nonstatic_local_decl_p): Remove.
2007-08-20 Richard Guenther <rguenther@suse.de>
* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): * cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES):
Remove define. Remove define.
* tree.h (cp_walk_tree): New define to walk_tree_1 with * tree.h (cp_walk_tree): New define to walk_tree_1 with
......
...@@ -107,9 +107,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t, ...@@ -107,9 +107,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN #undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \ #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
cp_cannot_inline_tree_fn cp_cannot_inline_tree_fn
#undef LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P
#define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \
cp_auto_var_in_fn_p
#undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P #undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_type_p #define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_type_p
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
......
...@@ -4251,7 +4251,6 @@ extern tree maybe_push_decl (tree); ...@@ -4251,7 +4251,6 @@ extern tree maybe_push_decl (tree);
extern tree force_target_expr (tree, tree); extern tree force_target_expr (tree, tree);
extern tree build_target_expr_with_type (tree, tree); extern tree build_target_expr_with_type (tree, tree);
extern int local_variable_p (const_tree); extern int local_variable_p (const_tree);
extern int nonstatic_local_decl_p (const_tree);
extern tree register_dtor_fn (tree); extern tree register_dtor_fn (tree);
extern tmpl_spec_kind current_tmpl_spec_kind (int); extern tmpl_spec_kind current_tmpl_spec_kind (int);
extern tree cp_fname_init (const char *, tree *); extern tree cp_fname_init (const char *, tree *);
...@@ -4741,7 +4740,6 @@ extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn, ...@@ -4741,7 +4740,6 @@ extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
#define cp_walk_tree_without_duplicates(a,b,c) \ #define cp_walk_tree_without_duplicates(a,b,c) \
walk_tree_without_duplicates_1 (a, b, c, cp_walk_subtrees) walk_tree_without_duplicates_1 (a, b, c, cp_walk_subtrees)
extern int cp_cannot_inline_tree_fn (tree*); extern int cp_cannot_inline_tree_fn (tree*);
extern int cp_auto_var_in_fn_p (const_tree, const_tree);
extern tree fold_if_not_in_template (tree); extern tree fold_if_not_in_template (tree);
extern tree rvalue (tree); extern tree rvalue (tree);
extern tree convert_bitfield_to_declared_type (tree); extern tree convert_bitfield_to_declared_type (tree);
......
...@@ -8976,18 +8976,6 @@ local_variable_p (const_tree t) ...@@ -8976,18 +8976,6 @@ local_variable_p (const_tree t)
return 0; return 0;
} }
/* Returns nonzero if T is an automatic local variable or a label.
(These are the declarations that need to be remapped when the code
containing them is duplicated.) */
int
nonstatic_local_decl_p (const_tree t)
{
return ((local_variable_p (t) && !TREE_STATIC (t))
|| TREE_CODE (t) == LABEL_DECL
|| TREE_CODE (t) == RESULT_DECL);
}
/* Like local_variable_p, but suitable for use as a tree-walking /* Like local_variable_p, but suitable for use as a tree-walking
function. */ function. */
......
...@@ -2450,16 +2450,6 @@ cp_cannot_inline_tree_fn (tree* fnp) ...@@ -2450,16 +2450,6 @@ cp_cannot_inline_tree_fn (tree* fnp)
return 0; return 0;
} }
/* Determine whether VAR is a declaration of an automatic variable in
function FN. */
int
cp_auto_var_in_fn_p (const_tree var, const_tree fn)
{
return (DECL_P (var) && DECL_CONTEXT (var) == fn
&& nonstatic_local_decl_p (var));
}
/* Like save_expr, but for C++. */ /* Like save_expr, but for C++. */
tree tree
......
...@@ -70,7 +70,6 @@ extern tree lhd_builtin_function (tree decl); ...@@ -70,7 +70,6 @@ extern tree lhd_builtin_function (tree decl);
/* Declarations of default tree inlining hooks. */ /* Declarations of default tree inlining hooks. */
extern int lhd_tree_inlining_cannot_inline_tree_fn (tree *); extern int lhd_tree_inlining_cannot_inline_tree_fn (tree *);
extern int lhd_tree_inlining_disregard_inline_limits (const_tree); extern int lhd_tree_inlining_disregard_inline_limits (const_tree);
extern int lhd_tree_inlining_auto_var_in_fn_p (const_tree, const_tree);
extern void lhd_initialize_diagnostics (struct diagnostic_context *); extern void lhd_initialize_diagnostics (struct diagnostic_context *);
extern tree lhd_callgraph_analyze_expr (tree *, int *, tree); extern tree lhd_callgraph_analyze_expr (tree *, int *, tree);
...@@ -137,15 +136,12 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, ...@@ -137,15 +136,12 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
lhd_tree_inlining_cannot_inline_tree_fn lhd_tree_inlining_cannot_inline_tree_fn
#define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \ #define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
lhd_tree_inlining_disregard_inline_limits lhd_tree_inlining_disregard_inline_limits
#define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \
lhd_tree_inlining_auto_var_in_fn_p
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \ #define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \
hook_bool_tree_tree_false hook_bool_tree_tree_false
#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \ #define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \ LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \
LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS, \ LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS, \
LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P, \
LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \ LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
} }
......
...@@ -303,19 +303,6 @@ lhd_tree_inlining_disregard_inline_limits (const_tree fn) ...@@ -303,19 +303,6 @@ lhd_tree_inlining_disregard_inline_limits (const_tree fn)
return 0; return 0;
} }
/* lang_hooks.tree_inlining.auto_var_in_fn_p is called to determine
whether VT is an automatic variable defined in function FT. */
int
lhd_tree_inlining_auto_var_in_fn_p (const_tree var, const_tree fn)
{
return (DECL_P (var) && DECL_CONTEXT (var) == fn
&& (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL)
&& ! TREE_STATIC (var))
|| TREE_CODE (var) == LABEL_DECL
|| TREE_CODE (var) == RESULT_DECL));
}
/* lang_hooks.tree_dump.dump_tree: Dump language-specific parts of tree /* lang_hooks.tree_dump.dump_tree: Dump language-specific parts of tree
nodes. Returns nonzero if it does not want the usual dumping of the nodes. Returns nonzero if it does not want the usual dumping of the
second argument. */ second argument. */
......
...@@ -37,7 +37,6 @@ struct lang_hooks_for_tree_inlining ...@@ -37,7 +37,6 @@ struct lang_hooks_for_tree_inlining
{ {
int (*cannot_inline_tree_fn) (tree *); int (*cannot_inline_tree_fn) (tree *);
int (*disregard_inline_limits) (const_tree); int (*disregard_inline_limits) (const_tree);
int (*auto_var_in_fn_p) (const_tree, const_tree);
bool (*var_mod_type_p) (tree, tree); bool (*var_mod_type_p) (tree, tree);
}; };
......
...@@ -428,7 +428,7 @@ remap_decls (tree decls, copy_body_data *id) ...@@ -428,7 +428,7 @@ remap_decls (tree decls, copy_body_data *id)
/* We can not chain the local static declarations into the unexpanded_var_list /* We can not chain the local static declarations into the unexpanded_var_list
as we can't duplicate them or break one decl rule. Go ahead and link as we can't duplicate them or break one decl rule. Go ahead and link
them into unexpanded_var_list. */ them into unexpanded_var_list. */
if (!lang_hooks.tree_inlining.auto_var_in_fn_p (old_var, id->src_fn) if (!auto_var_in_fn_p (old_var, id->src_fn)
&& !DECL_EXTERNAL (old_var)) && !DECL_EXTERNAL (old_var))
{ {
cfun->unexpanded_var_list = tree_cons (NULL_TREE, old_var, cfun->unexpanded_var_list = tree_cons (NULL_TREE, old_var,
...@@ -586,7 +586,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) ...@@ -586,7 +586,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
variables. We don't want to copy static variables; there's only variables. We don't want to copy static variables; there's only
one of those, no matter how many times we inline the containing one of those, no matter how many times we inline the containing
function. Similarly for globals from an outer function. */ function. Similarly for globals from an outer function. */
else if (lang_hooks.tree_inlining.auto_var_in_fn_p (*tp, fn)) else if (auto_var_in_fn_p (*tp, fn))
{ {
tree new_decl; tree new_decl;
...@@ -641,8 +641,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) ...@@ -641,8 +641,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
discarding. */ discarding. */
if (TREE_CODE (*tp) == GIMPLE_MODIFY_STMT if (TREE_CODE (*tp) == GIMPLE_MODIFY_STMT
&& GIMPLE_STMT_OPERAND (*tp, 0) == GIMPLE_STMT_OPERAND (*tp, 1) && GIMPLE_STMT_OPERAND (*tp, 0) == GIMPLE_STMT_OPERAND (*tp, 1)
&& (lang_hooks.tree_inlining.auto_var_in_fn_p && (auto_var_in_fn_p (GIMPLE_STMT_OPERAND (*tp, 0), fn)))
(GIMPLE_STMT_OPERAND (*tp, 0), fn)))
{ {
/* Some assignments VAR = VAR; don't generate any rtl code /* Some assignments VAR = VAR; don't generate any rtl code
and thus don't count as variable modification. Avoid and thus don't count as variable modification. Avoid
...@@ -1268,7 +1267,7 @@ self_inlining_addr_expr (tree value, tree fn) ...@@ -1268,7 +1267,7 @@ self_inlining_addr_expr (tree value, tree fn)
var = get_base_address (TREE_OPERAND (value, 0)); var = get_base_address (TREE_OPERAND (value, 0));
return var && lang_hooks.tree_inlining.auto_var_in_fn_p (var, fn); return var && auto_var_in_fn_p (var, fn);
} }
static void static void
......
...@@ -6354,6 +6354,19 @@ get_type_static_bounds (const_tree type, mpz_t min, mpz_t max) ...@@ -6354,6 +6354,19 @@ get_type_static_bounds (const_tree type, mpz_t min, mpz_t max)
} }
} }
/* auto_var_in_fn_p is called to determine whether VAR is an automatic
variable defined in function FN. */
bool
auto_var_in_fn_p (tree var, tree fn)
{
return (DECL_P (var) && DECL_CONTEXT (var) == fn
&& (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL)
&& ! TREE_STATIC (var))
|| TREE_CODE (var) == LABEL_DECL
|| TREE_CODE (var) == RESULT_DECL));
}
/* Subprogram of following function. Called by walk_tree. /* Subprogram of following function. Called by walk_tree.
Return *TP if it is an automatic variable or parameter of the Return *TP if it is an automatic variable or parameter of the
...@@ -6368,7 +6381,7 @@ find_var_from_fn (tree *tp, int *walk_subtrees, void *data) ...@@ -6368,7 +6381,7 @@ find_var_from_fn (tree *tp, int *walk_subtrees, void *data)
*walk_subtrees = 0; *walk_subtrees = 0;
else if (DECL_P (*tp) else if (DECL_P (*tp)
&& lang_hooks.tree_inlining.auto_var_in_fn_p (*tp, fn)) && auto_var_in_fn_p (*tp, fn))
return *tp; return *tp;
return NULL_TREE; return NULL_TREE;
......
...@@ -4610,6 +4610,7 @@ extern bool empty_body_p (tree); ...@@ -4610,6 +4610,7 @@ extern bool empty_body_p (tree);
extern tree call_expr_arg (tree, int); extern tree call_expr_arg (tree, int);
extern tree *call_expr_argp (tree, int); extern tree *call_expr_argp (tree, int);
extern tree call_expr_arglist (tree); extern tree call_expr_arglist (tree);
extern bool auto_var_in_fn_p (tree, tree);
/* In stmt.c */ /* In stmt.c */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment