aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2014-07-24 14:07:13 +0200
committerMartin Liska <marxin@gcc.gnu.org>2014-07-24 12:07:13 +0000
commitd52f529517da6e1143714a274d71dcfd64b7a2f0 (patch)
tree4dd09f8eb18392a620ad92b028d01fbda5d27ee7 /gcc/cgraphunit.c
parent785129aa1660f4210ff4c58dfb1df3a4506aa6d4 (diff)
downloadgcc-d52f529517da6e1143714a274d71dcfd64b7a2f0.zip
gcc-d52f529517da6e1143714a274d71dcfd64b7a2f0.tar.gz
gcc-d52f529517da6e1143714a274d71dcfd64b7a2f0.tar.bz2
IPA C++ refactoring 1/N
* cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c233
1 files changed, 114 insertions, 119 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index b2bafe4..47828d7 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -220,7 +220,6 @@ cgraph_node_set cgraph_new_nodes;
static void expand_all_functions (void);
static void mark_functions_to_output (void);
static void expand_function (struct cgraph_node *);
-static void analyze_function (struct cgraph_node *);
static void handle_alias_pairs (void);
FILE *cgraph_dump_file;
@@ -320,7 +319,7 @@ cgraph_process_new_functions (void)
it into reachable functions list. */
cgraph_finalize_function (fndecl, false);
- cgraph_call_function_insertion_hooks (node);
+ node->call_function_insertion_hooks ();
enqueue_node (node);
break;
@@ -332,7 +331,7 @@ cgraph_process_new_functions (void)
gimple_register_cfg_hooks ();
if (!node->analyzed)
- analyze_function (node);
+ node->analyze ();
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
if (cgraph_state == CGRAPH_STATE_IPA_SSA
&& !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
@@ -342,14 +341,14 @@ cgraph_process_new_functions (void)
free_dominance_info (CDI_POST_DOMINATORS);
free_dominance_info (CDI_DOMINATORS);
pop_cfun ();
- cgraph_call_function_insertion_hooks (node);
+ node->call_function_insertion_hooks ();
break;
case CGRAPH_STATE_EXPANSION:
/* Functions created during expansion shall be compiled
directly. */
node->process = 0;
- cgraph_call_function_insertion_hooks (node);
+ node->call_function_insertion_hooks ();
expand_function (node);
break;
@@ -373,27 +372,27 @@ cgraph_process_new_functions (void)
body for expanding the function but this is difficult to do. */
void
-cgraph_reset_node (struct cgraph_node *node)
+cgraph_node::reset (void)
{
- /* If node->process is set, then we have already begun whole-unit analysis.
+ /* If process is set, then we have already begun whole-unit analysis.
This is *not* testing for whether we've already emitted the function.
That case can be sort-of legitimately seen with real function redefinition
errors. I would argue that the front end should never present us with
such a case, but don't enforce that for now. */
- gcc_assert (!node->process);
+ gcc_assert (!process);
/* Reset our data structures so we can analyze the function again. */
- memset (&node->local, 0, sizeof (node->local));
- memset (&node->global, 0, sizeof (node->global));
- memset (&node->rtl, 0, sizeof (node->rtl));
- node->analyzed = false;
- node->definition = false;
- node->alias = false;
- node->weakref = false;
- node->cpp_implicit_alias = false;
-
- cgraph_node_remove_callees (node);
- node->remove_all_references ();
+ memset (&local, 0, sizeof (local));
+ memset (&global, 0, sizeof (global));
+ memset (&rtl, 0, sizeof (rtl));
+ analyzed = false;
+ definition = false;
+ alias = false;
+ weakref = false;
+ cpp_implicit_alias = false;
+
+ remove_callees ();
+ remove_all_references ();
}
/* Return true when there are references to NODE. */
@@ -421,14 +420,14 @@ referred_to_p (symtab_node *node)
void
cgraph_finalize_function (tree decl, bool no_collect)
{
- struct cgraph_node *node = cgraph_get_create_node (decl);
+ struct cgraph_node *node = cgraph_node::get_create (decl);
if (node->definition)
{
/* Nested functions should only be defined once. */
gcc_assert (!DECL_CONTEXT (decl)
|| TREE_CODE (DECL_CONTEXT (decl)) != FUNCTION_DECL);
- cgraph_reset_node (node);
+ node->reset ();
node->local.redefined_extern_inline = true;
}
@@ -488,7 +487,7 @@ cgraph_finalize_function (tree decl, bool no_collect)
processing to avoid need the passes to be re-entrant. */
void
-cgraph_add_new_function (tree fndecl, bool lowered)
+cgraph_node::add_new_function (tree fndecl, bool lowered)
{
gcc::pass_manager *passes = g->get_passes ();
struct cgraph_node *node;
@@ -499,7 +498,7 @@ cgraph_add_new_function (tree fndecl, bool lowered)
break;
case CGRAPH_STATE_CONSTRUCTION:
/* Just enqueue function to be processed at nearest occurrence. */
- node = cgraph_get_create_node (fndecl);
+ node = cgraph_node::get_create (fndecl);
if (lowered)
node->lowered = true;
if (!cgraph_new_nodes)
@@ -512,7 +511,7 @@ cgraph_add_new_function (tree fndecl, bool lowered)
case CGRAPH_STATE_EXPANSION:
/* Bring the function into finalized state and enqueue for later
analyzing and compilation. */
- node = cgraph_get_create_node (fndecl);
+ node = cgraph_node::get_create (fndecl);
node->local.local = false;
node->definition = true;
node->force_output = true;
@@ -538,11 +537,11 @@ cgraph_add_new_function (tree fndecl, bool lowered)
case CGRAPH_STATE_FINISHED:
/* At the very end of compilation we have to do all the work up
to expansion. */
- node = cgraph_create_node (fndecl);
+ node = cgraph_node::create (fndecl);
if (lowered)
node->lowered = true;
node->definition = true;
- analyze_function (node);
+ node->analyze ();
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
@@ -599,40 +598,39 @@ output_asm_statements (void)
}
/* Analyze the function scheduled to be output. */
-static void
-analyze_function (struct cgraph_node *node)
+void
+cgraph_node::analyze (void)
{
- tree decl = node->decl;
+ tree decl = this->decl;
location_t saved_loc = input_location;
input_location = DECL_SOURCE_LOCATION (decl);
- if (node->thunk.thunk_p)
+ if (thunk.thunk_p)
{
- cgraph_create_edge (node, cgraph_get_node (node->thunk.alias),
- NULL, 0, CGRAPH_FREQ_BASE);
- if (!expand_thunk (node, false, false))
+ create_edge (cgraph_node::get (thunk.alias),
+ NULL, 0, CGRAPH_FREQ_BASE);
+ if (!expand_thunk (false, false))
{
- node->thunk.alias = NULL;
- node->analyzed = true;
+ thunk.alias = NULL;
+ analyzed = true;
return;
}
- node->thunk.alias = NULL;
+ thunk.alias = NULL;
}
- if (node->alias)
- symtab_resolve_alias
- (node, cgraph_get_node (node->alias_target));
- else if (node->dispatcher_function)
+ if (alias)
+ resolve_alias (cgraph_node::get (alias_target));
+ else if (dispatcher_function)
{
/* Generate the dispatcher body of multi-versioned functions. */
struct cgraph_function_version_info *dispatcher_version_info
- = get_cgraph_node_version (node);
+ = function_version ();
if (dispatcher_version_info != NULL
&& (dispatcher_version_info->dispatcher_resolver
== NULL_TREE))
{
tree resolver = NULL_TREE;
gcc_assert (targetm.generate_version_dispatcher_body);
- resolver = targetm.generate_version_dispatcher_body (node);
+ resolver = targetm.generate_version_dispatcher_body (this);
gcc_assert (resolver != NULL_TREE);
}
}
@@ -640,7 +638,7 @@ analyze_function (struct cgraph_node *node)
{
push_cfun (DECL_STRUCT_FUNCTION (decl));
- assign_assembler_name_if_neeeded (node->decl);
+ assign_assembler_name_if_neeeded (decl);
/* Make sure to gimplify bodies only once. During analyzing a
function we lower it, which will require gimplified nested
@@ -651,11 +649,11 @@ analyze_function (struct cgraph_node *node)
dump_function (TDI_generic, decl);
/* Lower the function. */
- if (!node->lowered)
+ if (!lowered)
{
- if (node->nested)
- lower_nested_functions (node->decl);
- gcc_assert (!node->nested);
+ if (nested)
+ lower_nested_functions (decl);
+ gcc_assert (!nested);
gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
@@ -664,12 +662,12 @@ analyze_function (struct cgraph_node *node)
free_dominance_info (CDI_DOMINATORS);
compact_blocks ();
bitmap_obstack_release (NULL);
- node->lowered = true;
+ lowered = true;
}
pop_cfun ();
}
- node->analyzed = true;
+ analyzed = true;
input_location = saved_loc;
}
@@ -686,11 +684,10 @@ cgraph_process_same_body_aliases (void)
symtab_node *node;
FOR_EACH_SYMBOL (node)
if (node->cpp_implicit_alias && !node->analyzed)
- symtab_resolve_alias
- (node,
- TREE_CODE (node->alias_target) == VAR_DECL
+ node->resolve_alias
+ (TREE_CODE (node->alias_target) == VAR_DECL
? (symtab_node *)varpool_node_for_decl (node->alias_target)
- : (symtab_node *)cgraph_get_create_node (node->alias_target));
+ : (symtab_node *)cgraph_node::get_create (node->alias_target));
cpp_implicit_aliases_done = true;
}
@@ -748,7 +745,7 @@ process_function_and_variable_attributes (struct cgraph_node *first,
{
tree decl = node->decl;
if (DECL_PRESERVE_P (decl))
- cgraph_mark_force_output_node (node);
+ node->mark_force_output ();
else if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl)))
{
if (! TREE_PUBLIC (node->decl))
@@ -893,8 +890,8 @@ walk_polymorphic_call_targets (pointer_set_t *reachable_call_targets,
if (targets.length () == 1)
target = targets[0];
else
- target = cgraph_get_create_node
- (builtin_decl_implicit (BUILT_IN_UNREACHABLE));
+ target = cgraph_node::create
+ (builtin_decl_implicit (BUILT_IN_UNREACHABLE));
if (cgraph_dump_file)
{
@@ -957,7 +954,7 @@ analyze_functions (void)
if (cpp_implicit_aliases_done)
FOR_EACH_SYMBOL (node)
if (node->cpp_implicit_alias)
- fixup_same_cpp_alias_visibility (node, symtab_alias_target (node));
+ node->fixup_same_cpp_alias_visibility (node->get_alias_target ());
if (optimize && flag_devirtualize)
build_type_inheritance_graph ();
@@ -1019,13 +1016,13 @@ analyze_functions (void)
&& !cnode->thunk.thunk_p
&& !cnode->dispatcher_function)
{
- cgraph_reset_node (cnode);
+ cnode->reset ();
cnode->local.redefined_extern_inline = true;
continue;
}
if (!cnode->analyzed)
- analyze_function (cnode);
+ cnode->analyze ();
for (edge = cnode->callees; edge; edge = edge->next_callee)
if (edge->callee->definition)
@@ -1050,7 +1047,7 @@ analyze_functions (void)
if (DECL_ABSTRACT_ORIGIN (decl))
{
struct cgraph_node *origin_node
- = cgraph_get_node (DECL_ABSTRACT_ORIGIN (decl));
+ = cgraph_node::get (DECL_ABSTRACT_ORIGIN (decl));
origin_node->used_as_abstract_origin = true;
}
}
@@ -1082,7 +1079,7 @@ analyze_functions (void)
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "\n\nInitial ");
- dump_symtab (cgraph_dump_file);
+ symtab_node::dump_table (cgraph_dump_file);
}
if (cgraph_dump_file)
@@ -1097,7 +1094,7 @@ analyze_functions (void)
{
if (cgraph_dump_file)
fprintf (cgraph_dump_file, " %s", node->name ());
- symtab_remove_node (node);
+ node->remove ();
continue;
}
if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
@@ -1107,7 +1104,7 @@ analyze_functions (void)
if (cnode->definition && !gimple_has_body_p (decl)
&& !cnode->alias
&& !cnode->thunk.thunk_p)
- cgraph_reset_node (cnode);
+ cnode->reset ();
gcc_assert (!cnode->definition || cnode->thunk.thunk_p
|| cnode->alias
@@ -1123,7 +1120,7 @@ analyze_functions (void)
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "\n\nReclaimed ");
- dump_symtab (cgraph_dump_file);
+ symtab_node::dump_table (cgraph_dump_file);
}
bitmap_obstack_release (NULL);
pointer_set_destroy (reachable_call_targets);
@@ -1157,7 +1154,7 @@ handle_alias_pairs (void)
if (!target_node
&& lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)) != NULL)
{
- symtab_node *node = symtab_get_node (p->decl);
+ symtab_node *node = symtab_node::get (p->decl);
if (node)
{
node->alias_target = p->target;
@@ -1170,7 +1167,7 @@ handle_alias_pairs (void)
else if (!target_node)
{
error ("%q+D aliased to undefined symbol %qE", p->decl, p->target);
- symtab_node *node = symtab_get_node (p->decl);
+ symtab_node *node = symtab_node::get (p->decl);
if (node)
node->alias = false;
alias_pairs->unordered_remove (i);
@@ -1192,10 +1189,10 @@ handle_alias_pairs (void)
if (TREE_CODE (p->decl) == FUNCTION_DECL
&& target_node && is_a <cgraph_node *> (target_node))
{
- struct cgraph_node *src_node = cgraph_get_node (p->decl);
+ struct cgraph_node *src_node = cgraph_node::get (p->decl);
if (src_node && src_node->definition)
- cgraph_reset_node (src_node);
- cgraph_create_function_alias (p->decl, target_node->decl);
+ src_node->reset ();
+ cgraph_node::create_alias (p->decl, target_node->decl);
alias_pairs->unordered_remove (i);
}
else if (TREE_CODE (p->decl) == VAR_DECL
@@ -1252,11 +1249,11 @@ mark_functions_to_output (void)
if (node->same_comdat_group)
{
struct cgraph_node *next;
- for (next = cgraph (node->same_comdat_group);
+ for (next = dyn_cast<cgraph_node *> (node->same_comdat_group);
next != node;
- next = cgraph (next->same_comdat_group))
+ next = dyn_cast<cgraph_node *> (next->same_comdat_group))
if (!next->thunk.thunk_p && !next->alias
- && !symtab_comdat_local_p (next))
+ && !next->comdat_local_p ())
next->process = 1;
}
}
@@ -1280,7 +1277,7 @@ mark_functions_to_output (void)
&& !node->clones
&& !DECL_EXTERNAL (decl))
{
- dump_cgraph_node (stderr, node);
+ node->debug ();
internal_error ("failed to reclaim unneeded function");
}
#endif
@@ -1310,7 +1307,7 @@ mark_functions_to_output (void)
&& !node->clones
&& !DECL_EXTERNAL (decl))
{
- dump_cgraph_node (stderr, node);
+ node->debug ();
internal_error ("failed to reclaim unneeded function in same "
"comdat group");
}
@@ -1472,14 +1469,14 @@ thunk_adjust (gimple_stmt_iterator * bsi,
thunks that are not lowered. */
bool
-expand_thunk (struct cgraph_node *node, bool output_asm_thunks, bool force_gimple_thunk)
+cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
{
- bool this_adjusting = node->thunk.this_adjusting;
- HOST_WIDE_INT fixed_offset = node->thunk.fixed_offset;
- HOST_WIDE_INT virtual_value = node->thunk.virtual_value;
+ bool this_adjusting = thunk.this_adjusting;
+ HOST_WIDE_INT fixed_offset = thunk.fixed_offset;
+ HOST_WIDE_INT virtual_value = thunk.virtual_value;
tree virtual_offset = NULL;
- tree alias = node->callees->callee->decl;
- tree thunk_fndecl = node->decl;
+ tree alias = callees->callee->decl;
+ tree thunk_fndecl = decl;
tree a;
@@ -1495,7 +1492,7 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks, bool force_gimpl
return false;
if (in_lto_p)
- cgraph_get_body (node);
+ get_body ();
a = DECL_ARGUMENTS (thunk_fndecl);
current_function_decl = thunk_fndecl;
@@ -1530,8 +1527,8 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks, bool force_gimpl
free_after_compilation (cfun);
set_cfun (NULL);
TREE_ASM_WRITTEN (thunk_fndecl) = 1;
- node->thunk.thunk_p = false;
- node->analyzed = false;
+ thunk.thunk_p = false;
+ analyzed = false;
}
else
{
@@ -1548,7 +1545,7 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks, bool force_gimpl
gimple ret;
if (in_lto_p)
- cgraph_get_body (node);
+ get_body ();
a = DECL_ARGUMENTS (thunk_fndecl);
current_function_decl = thunk_fndecl;
@@ -1559,7 +1556,7 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks, bool force_gimpl
DECL_IGNORED_P (thunk_fndecl) = 1;
bitmap_obstack_initialize (NULL);
- if (node->thunk.virtual_offset_p)
+ if (thunk.virtual_offset_p)
virtual_offset = size_int (virtual_value);
/* Build the return declaration for the function. */
@@ -1617,7 +1614,7 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks, bool force_gimpl
vargs.quick_push (tmp);
}
call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
- node->callees->call_stmt = call;
+ callees->call_stmt = call;
gimple_call_set_from_thunk (call, true);
if (restmp)
{
@@ -1697,8 +1694,8 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks, bool force_gimpl
/* Since we want to emit the thunk, we explicitly mark its name as
referenced. */
- node->thunk.thunk_p = false;
- node->lowered = true;
+ thunk.thunk_p = false;
+ lowered = true;
bitmap_obstack_release (NULL);
}
current_function_decl = NULL;
@@ -1720,7 +1717,7 @@ assemble_thunks_and_aliases (struct cgraph_node *node)
struct cgraph_node *thunk = e->caller;
e = e->next_caller;
- expand_thunk (thunk, true, false);
+ thunk->expand_thunk (true, false);
assemble_thunks_and_aliases (thunk);
}
else
@@ -1755,7 +1752,7 @@ expand_function (struct cgraph_node *node)
announce_function (decl);
node->process = 0;
gcc_assert (node->lowered);
- cgraph_get_body (node);
+ node->get_body ();
/* Generate RTL for the body of DECL. */
@@ -1819,7 +1816,7 @@ expand_function (struct cgraph_node *node)
gimple_set_body (decl, NULL);
if (DECL_STRUCT_FUNCTION (decl) == 0
- && !cgraph_get_node (decl)->origin)
+ && !cgraph_node::get (decl)->origin)
{
/* Stop pointing to the local nodes about to be freed.
But DECL_INITIAL must remain nonzero so we know this
@@ -1847,10 +1844,10 @@ expand_function (struct cgraph_node *node)
FIXME: Perhaps thunks should be move before function IFF they are not in comdat
groups. */
assemble_thunks_and_aliases (node);
- cgraph_release_function_body (node);
+ node->release_body ();
/* Eliminate all call edges. This is important so the GIMPLE_CALL no longer
points to the dead function body. */
- cgraph_node_remove_callees (node);
+ node->remove_callees ();
node->remove_all_references ();
}
@@ -2135,7 +2132,7 @@ output_weakrefs (void)
? DECL_ASSEMBLER_NAME (node->alias_target)
: node->alias_target);
else if (node->analyzed)
- target = DECL_ASSEMBLER_NAME (symtab_alias_target (node)->decl);
+ target = DECL_ASSEMBLER_NAME (node->get_alias_target ()->decl);
else
{
gcc_unreachable ();
@@ -2164,7 +2161,7 @@ compile (void)
return;
#ifdef ENABLE_CHECKING
- verify_symtab ();
+ symtab_node::verify_symtab_nodes ();
#endif
timevar_push (TV_CGRAPHOPT);
@@ -2200,7 +2197,7 @@ compile (void)
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "Optimized ");
- dump_symtab (cgraph_dump_file);
+ symtab_node:: dump_table (cgraph_dump_file);
}
if (post_ipa_mem_report)
{
@@ -2214,7 +2211,7 @@ compile (void)
if (!quiet_flag)
fprintf (stderr, "Assembling functions:\n");
#ifdef ENABLE_CHECKING
- verify_symtab ();
+ symtab_node::verify_symtab_nodes ();
#endif
cgraph_materialize_all_clones ();
@@ -2222,7 +2219,7 @@ compile (void)
execute_ipa_pass_list (g->get_passes ()->all_late_ipa_passes);
symtab_remove_unreachable_nodes (true, dump_file);
#ifdef ENABLE_CHECKING
- verify_symtab ();
+ symtab_node::verify_symtab_nodes ();
#endif
bitmap_obstack_release (NULL);
mark_functions_to_output ();
@@ -2272,10 +2269,10 @@ compile (void)
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "\nFinal ");
- dump_symtab (cgraph_dump_file);
+ symtab_node::dump_table (cgraph_dump_file);
}
#ifdef ENABLE_CHECKING
- verify_symtab ();
+ symtab_node::verify_symtab_nodes ();
/* Double check that all inline clones are gone and that all
function bodies have been released from memory. */
if (!seen_error ())
@@ -2288,7 +2285,7 @@ compile (void)
|| gimple_has_body_p (node->decl))
{
error_found = true;
- dump_cgraph_node (stderr, node);
+ node->debug ();
}
if (error_found)
internal_error ("nodes with unreleased memory found");
@@ -2343,41 +2340,39 @@ finalize_compilation_unit (void)
timevar_pop (TV_CGRAPH);
}
-/* Creates a wrapper from SOURCE node to TARGET node. Thunk is used for this
+/* Creates a wrapper from cgraph_node to TARGET node. Thunk is used for this
kind of wrapper method. */
void
-cgraph_make_wrapper (struct cgraph_node *source, struct cgraph_node *target)
+cgraph_node::create_wrapper (struct cgraph_node *target)
{
/* Preserve DECL_RESULT so we get right by reference flag. */
- tree decl_result = DECL_RESULT (source->decl);
+ tree decl_result = DECL_RESULT (decl);
/* Remove the function's body. */
- cgraph_release_function_body (source);
- cgraph_reset_node (source);
+ release_body ();
+ reset ();
- DECL_RESULT (source->decl) = decl_result;
- DECL_INITIAL (source->decl) = NULL;
- allocate_struct_function (source->decl, false);
+ DECL_RESULT (decl) = decl_result;
+ DECL_INITIAL (decl) = NULL;
+ allocate_struct_function (decl, false);
set_cfun (NULL);
/* Turn alias into thunk and expand it into GIMPLE representation. */
- source->definition = true;
- source->thunk.thunk_p = true;
- source->thunk.this_adjusting = false;
+ definition = true;
+ thunk.thunk_p = true;
+ thunk.this_adjusting = false;
- struct cgraph_edge *e = cgraph_create_edge (source, target, NULL, 0,
- CGRAPH_FREQ_BASE);
+ struct cgraph_edge *e = create_edge (target, NULL, 0, CGRAPH_FREQ_BASE);
- if (!expand_thunk (source, false, true))
- source->analyzed = true;
+ if (!expand_thunk (false, true))
+ analyzed = true;
e->call_stmt_cannot_inline_p = true;
/* Inline summary set-up. */
-
- analyze_function (source);
- inline_analyze_function (source);
+ analyze ();
+ inline_analyze_function (this);
}
#include "gt-cgraphunit.h"