Commit 9c8305f8 by Jan Hubicka Committed by Jan Hubicka

cgraphunit.c: Update toplevel comment.


	* cgraphunit.c: Update toplevel comment.
	(tree_rest_of_compilation): Merge into cgraph_expand_function.
	(cgraph_analyze_function): Make static.
	(cgraph_decide_is_function_needed): Make static.
	(cgraph_add_new_function): Use expand_function instead of
	rest_of_compilation.
	(clone_of_p, verify_edge_count_and_frequency, cgraph_debug_gimple_stmt,
	verify_edge_corresponds_to_fndecl, verify_cgraph_node, verify_cgraph):
	Move to cgraph.c
	(cgraph_inline_p): Remove.
	(cgraph_preserve_function_body_p): Move to ipa-inline-transform.
	(init_cgraph): Add comment.
	* cgraphbuild.c (record_reference, mark_address, mark_load,
	mark_store): Do not call analyze_expr hook.
	* cgraph.c: Update toplevel comment.
	(clone_of_p, verify_edge_count_and_frequency, cgraph_debug_gimple_stmt,
	verify_edge_corresponds_to_fndecl, verify_cgraph_node, verify_cgraph):
	Move fere from cgraphunit.c
	(cgraph_mark_force_output_node): Move to cgraph.h
	* cgraph.h: Reorder so the comments match the function placement.
	(cgraph_analyze_function, cgraph_decide_is_function_needed): Remove.
	(cgraph_mark_force_output_node): Move here from cgraph.c
	* tree.c (free_lang_data): Do not clear analyze_expr hook.
	* ipa-inline-transform.c (preserve_function_body_p): New function.
	(inline_transform): Update.
	* langhooks.c (lhd_callgraph_analyze_expr): Remove.
	* langhooks.h (lang_hooks_for_callgraph): Remove.
	(lang_hooks): Remove callgraph.
	* tree-inline.c (expand_call_inline): Do not use cgraph_inline_p.
	* varpool.c: Remove out of date comment.
	* langhooks-def.h (lhd_callgraph_analyze_expr): Remove.
	(LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): Remove.

From-SVN: r186832
parent 95e5b9a4
2012-04-25 Jan Hubicka <jh@suse.cz>
* cgraphunit.c: Update toplevel comment.
(tree_rest_of_compilation): Merge into cgraph_expand_function.
(cgraph_analyze_function): Make static.
(cgraph_decide_is_function_needed): Make static.
(cgraph_add_new_function): Use expand_function instead of
rest_of_compilation.
(clone_of_p, verify_edge_count_and_frequency, cgraph_debug_gimple_stmt,
verify_edge_corresponds_to_fndecl, verify_cgraph_node, verify_cgraph):
Move to cgraph.c
(cgraph_inline_p): Remove.
(cgraph_preserve_function_body_p): Move to ipa-inline-transform.
(init_cgraph): Add comment.
* cgraphbuild.c (record_reference, mark_address, mark_load,
mark_store): Do not call analyze_expr hook.
* cgraph.c: Update toplevel comment.
(clone_of_p, verify_edge_count_and_frequency, cgraph_debug_gimple_stmt,
verify_edge_corresponds_to_fndecl, verify_cgraph_node, verify_cgraph):
Move fere from cgraphunit.c
(cgraph_mark_force_output_node): Move to cgraph.h
* cgraph.h: Reorder so the comments match the function placement.
(cgraph_analyze_function, cgraph_decide_is_function_needed): Remove.
(cgraph_mark_force_output_node): Move here from cgraph.c
* tree.c (free_lang_data): Do not clear analyze_expr hook.
* ipa-inline-transform.c (preserve_function_body_p): New function.
(inline_transform): Update.
* langhooks.c (lhd_callgraph_analyze_expr): Remove.
* langhooks.h (lang_hooks_for_callgraph): Remove.
(lang_hooks): Remove callgraph.
* tree-inline.c (expand_call_inline): Do not use cgraph_inline_p.
* varpool.c: Remove out of date comment.
* langhooks-def.h (lhd_callgraph_analyze_expr): Remove.
(LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): Remove.
2012-04-25 Jan Hubicka <jh@suse.cz>
PR middle-end/53089
* cgraphunit.c (referred_to_p): Move ahead in file to avoid forward declaration.
(cgraph_finalize_function): Finalize them here.
......
......@@ -574,37 +574,9 @@ bool cgraph_for_node_and_aliases (struct cgraph_node *,
bool (*) (struct cgraph_node *, void *),
void *, bool);
VEC (cgraph_edge_p, heap) * collect_callers_of_node (struct cgraph_node *node);
/* In cgraphunit.c */
extern FILE *cgraph_dump_file;
void cgraph_finalize_function (tree, bool);
void cgraph_analyze_function (struct cgraph_node *);
void cgraph_finalize_compilation_unit (void);
void cgraph_optimize (void);
void cgraph_mark_force_output_node (struct cgraph_node *);
void cgraph_mark_address_taken_node (struct cgraph_node *);
bool cgraph_inline_p (struct cgraph_edge *, cgraph_inline_failed_t *reason);
bool cgraph_preserve_function_body_p (struct cgraph_node *);
void verify_cgraph (void);
void verify_cgraph_node (struct cgraph_node *);
void cgraph_build_static_cdtor (char which, tree body, int priority);
void cgraph_reset_static_var_maps (void);
void init_cgraph (void);
struct cgraph_node * cgraph_copy_node_for_versioning (struct cgraph_node *,
tree, VEC(cgraph_edge_p,heap)*, bitmap);
struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
VEC(cgraph_edge_p,heap)*,
VEC(ipa_replace_map_p,gc)*,
bitmap, bool, bitmap,
basic_block, const char *);
void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*,
bool, bitmap, bool, bitmap, basic_block);
void record_references_in_initializer (tree, bool);
bool cgraph_process_new_functions (void);
void cgraph_process_same_body_aliases (void);
bool cgraph_decide_is_function_needed (struct cgraph_node *, tree);
void cgraph_mark_address_taken_node (struct cgraph_node *);
typedef void (*cgraph_edge_hook)(struct cgraph_edge *, void *);
typedef void (*cgraph_node_hook)(struct cgraph_node *, void *);
......@@ -631,10 +603,31 @@ struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_ho
void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *);
bool cgraph_propagate_frequency (struct cgraph_node *node);
/* In cgraphunit.c */
extern FILE *cgraph_dump_file;
void cgraph_finalize_function (tree, bool);
void cgraph_finalize_compilation_unit (void);
void cgraph_optimize (void);
void init_cgraph (void);
struct cgraph_node * cgraph_copy_node_for_versioning (struct cgraph_node *,
tree, VEC(cgraph_edge_p,heap)*, bitmap);
struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
VEC(cgraph_edge_p,heap)*,
VEC(ipa_replace_map_p,gc)*,
bitmap, bool, bitmap,
basic_block, const char *);
void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*,
bool, bitmap, bool, bitmap, basic_block);
bool cgraph_process_new_functions (void);
void cgraph_process_same_body_aliases (void);
/* In cgraphbuild.c */
unsigned int rebuild_cgraph_edges (void);
void cgraph_rebuild_references (void);
int compute_call_stmt_bb_frequency (tree, basic_block bb);
void record_references_in_initializer (tree, bool);
/* In ipa.c */
bool cgraph_remove_unreachable_nodes (bool, FILE *);
......@@ -646,6 +639,7 @@ void cgraph_node_set_remove (cgraph_node_set, struct cgraph_node *);
void dump_cgraph_node_set (FILE *, cgraph_node_set);
void debug_cgraph_node_set (cgraph_node_set);
void free_cgraph_node_set (cgraph_node_set);
void cgraph_build_static_cdtor (char which, tree body, int priority);
varpool_node_set varpool_node_set_new (void);
varpool_node_set_iterator varpool_node_set_find (varpool_node_set,
......@@ -1284,4 +1278,14 @@ decl_is_tm_clone (const_tree fndecl)
return n->tm_clone;
return false;
}
/* Likewise indicate that a node is needed, i.e. reachable via some
external means. */
static inline void
cgraph_mark_force_output_node (struct cgraph_node *node)
{
node->symbol.force_output = 1;
gcc_checking_assert (!node->global.inlined_to);
}
#endif /* GCC_CGRAPH_H */
......@@ -85,8 +85,6 @@ record_reference (tree *tp, int *walk_subtrees, void *data)
if (TREE_CODE (decl) == VAR_DECL)
{
struct varpool_node *vnode = varpool_node (decl);
if (lang_hooks.callgraph.analyze_expr)
lang_hooks.callgraph.analyze_expr (&decl, walk_subtrees);
ipa_record_reference ((symtab_node)ctx->varpool_node,
(symtab_node)vnode,
IPA_REF_ADDR, NULL);
......@@ -102,9 +100,6 @@ record_reference (tree *tp, int *walk_subtrees, void *data)
*walk_subtrees = 0;
break;
}
if ((unsigned int) TREE_CODE (t) >= LAST_AND_UNUSED_TREE_CODE)
return lang_hooks.callgraph.analyze_expr (tp, walk_subtrees);
break;
}
......@@ -239,10 +234,7 @@ mark_address (gimple stmt, tree addr, void *data)
&& (TREE_STATIC (addr) || DECL_EXTERNAL (addr)))
{
struct varpool_node *vnode = varpool_node (addr);
int walk_subtrees;
if (lang_hooks.callgraph.analyze_expr)
lang_hooks.callgraph.analyze_expr (&addr, &walk_subtrees);
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
IPA_REF_ADDR, stmt);
......@@ -271,10 +263,7 @@ mark_load (gimple stmt, tree t, void *data)
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
int walk_subtrees;
if (lang_hooks.callgraph.analyze_expr)
lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees);
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
IPA_REF_LOAD, stmt);
......@@ -292,10 +281,7 @@ mark_store (gimple stmt, tree t, void *data)
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
int walk_subtrees;
if (lang_hooks.callgraph.analyze_expr)
lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees);
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
IPA_REF_STORE, stmt);
......
......@@ -353,6 +353,19 @@ save_inline_function_body (struct cgraph_node *node)
return first_clone;
}
/* Return true when function body of DECL still needs to be kept around
for later re-use. */
bool
preserve_function_body_p (struct cgraph_node *node)
{
gcc_assert (cgraph_global_info_ready);
gcc_assert (!node->alias && !node->thunk.thunk_p);
/* Look if there is any clone around. */
if (node->clones)
return true;
return false;
}
/* Apply inline plan to function. */
......@@ -369,7 +382,7 @@ inline_transform (struct cgraph_node *node)
/* We might need the body of this function so that we can expand
it inline somewhere else. */
if (cgraph_preserve_function_body_p (node))
if (preserve_function_body_p (node))
save_inline_function_body (node);
for (e = node->callees; e; e = e->next_callee)
......
......@@ -69,7 +69,6 @@ extern void lhd_init_options (unsigned int,
extern bool lhd_complain_wrong_lang_p (const struct cl_option *);
extern bool lhd_handle_option (size_t, const char *, int, int, location_t,
const struct cl_option_handlers *);
extern tree lhd_callgraph_analyze_expr (tree *, int *);
/* Declarations for tree gimplification hooks. */
......@@ -132,12 +131,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
}
#define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr
#define LANG_HOOKS_CALLGRAPH_INITIALIZER { \
LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR \
}
/* Hooks for tree gimplification. */
#define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr
......@@ -292,7 +285,6 @@ extern void lhd_end_section (void);
LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \
LANG_HOOKS_TREE_INLINING_INITIALIZER, \
LANG_HOOKS_CALLGRAPH_INITIALIZER, \
LANG_HOOKS_TREE_DUMP_INITIALIZER, \
LANG_HOOKS_DECLS, \
LANG_HOOKS_FOR_TYPES_INITIALIZER, \
......
......@@ -472,13 +472,6 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
}
tree
lhd_callgraph_analyze_expr (tree *tp ATTRIBUTE_UNUSED,
int *walk_subtrees ATTRIBUTE_UNUSED)
{
return NULL;
}
tree
lhd_make_node (enum tree_code code)
{
return make_node (code);
......
......@@ -43,13 +43,6 @@ struct lang_hooks_for_tree_inlining
bool (*var_mod_type_p) (tree, tree);
};
struct lang_hooks_for_callgraph
{
/* The node passed is a language-specific tree node. If its contents
are relevant to use of other declarations, mark them. */
tree (*analyze_expr) (tree *, int *);
};
/* The following hooks are used by tree-dump.c. */
struct lang_hooks_for_tree_dump
......@@ -407,8 +400,6 @@ struct lang_hooks
struct lang_hooks_for_tree_inlining tree_inlining;
struct lang_hooks_for_callgraph callgraph;
struct lang_hooks_for_tree_dump tree_dump;
struct lang_hooks_for_decls decls;
......
......@@ -3807,8 +3807,9 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
fn = DECL_ABSTRACT_ORIGIN (fn);
/* Don't try to inline functions that are not well-suited to inlining. */
if (!cgraph_inline_p (cg_edge, &reason))
if (cg_edge->inline_failed)
{
reason = cg_edge->inline_failed;
/* If this call was originally indirect, we do not want to emit any
inlining related warnings or sorry messages because there are no
guarantees regarding those. */
......
......@@ -5244,7 +5244,6 @@ free_lang_data (void)
/* Reset some langhooks. Do not reset types_compatible_p, it may
still be used indirectly via the get_alias_set langhook. */
lang_hooks.callgraph.analyze_expr = NULL;
lang_hooks.dwarf_name = lhd_dwarf_name;
lang_hooks.decl_printable_name = gimple_decl_printable_name;
/* We do not want the default decl_assembler_name implementation,
......
......@@ -37,17 +37,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-flow.h"
#include "flags.h"
/* This file contains basic routines manipulating variable pool.
Varpool acts as interface in between the front-end and middle-end
and drives the decision process on what variables and when are
going to be compiled.
The varpool nodes are allocated lazily for declarations
either by frontend or at callgraph construction time.
All variables supposed to be output into final file needs to be
explicitly marked by frontend via VARPOOL_FINALIZE_DECL function. */
/* Return varpool node assigned to DECL. Create new one when needed. */
struct varpool_node *
varpool_node (tree decl)
......
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