Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
libgcj48.31962
gcc48-ipa-clones-dump.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gcc48-ipa-clones-dump.patch of Package libgcj48.31962
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index fd3aadee45d..c0f44ae0bdf 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1313,6 +1313,14 @@ cgraph_remove_node (struct cgraph_node *node) struct cgraph_node *n; int uid = node->uid; + if (ipa_clones_dump_file && pointer_set_contains (cloned_nodes, node)) + fprintf (ipa_clones_dump_file, + "Callgraph removal;%s;%d;%s;%d;%d\n", + symtab_node_asm_name ((symtab_node)node), node->symbol.order, + DECL_SOURCE_FILE (node->symbol.decl), + DECL_SOURCE_LINE (node->symbol.decl), + DECL_SOURCE_COLUMN (node->symbol.decl)); + cgraph_call_node_removal_hooks (node); cgraph_node_remove_callers (node); cgraph_node_remove_callees (node); diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 8ab7ae18102..a272ccfa45e 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -655,6 +655,8 @@ bool cgraph_propagate_frequency (struct cgraph_node *node); /* In cgraphunit.c */ struct asm_node *add_asm_node (tree); extern FILE *cgraph_dump_file; +extern FILE *ipa_clones_dump_file; +extern struct pointer_set_t *cloned_nodes; void cgraph_finalize_function (tree, bool); void finalize_compilation_unit (void); void compile (void); @@ -673,7 +675,7 @@ struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *, unsigned, gcov_type, int, bool); struct cgraph_node * cgraph_clone_node (struct cgraph_node *, tree, gcov_type, int, bool, vec<cgraph_edge_p>, - bool); + bool, const char *); tree clone_function_name (tree decl, const char *); struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node, vec<cgraph_edge_p>, @@ -689,7 +691,7 @@ void cgraph_create_edge_including_clones (struct cgraph_node *, cgraph_inline_failed_t); void cgraph_materialize_all_clones (void); struct cgraph_node * cgraph_copy_node_for_versioning (struct cgraph_node *, - tree, vec<cgraph_edge_p>, bitmap); + tree, vec<cgraph_edge_p>, bitmap, const char *); struct cgraph_node *cgraph_function_versioning (struct cgraph_node *, vec<cgraph_edge_p>, vec<ipa_replace_map_p, va_gc> *, @@ -698,6 +700,9 @@ struct cgraph_node *cgraph_function_versioning (struct cgraph_node *, void tree_function_versioning (tree, tree, vec<ipa_replace_map_p, va_gc> *, bool, bitmap, bool, bitmap, basic_block); +void dump_callgraph_transformation (cgraph_node *original, + cgraph_node *clone, + const char *suffix); /* In cgraphbuild.c */ unsigned int rebuild_cgraph_edges (void); void cgraph_rebuild_references (void); diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index 3a2e3d679e2..8ed34cbc6a7 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -158,6 +158,32 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, } +void +dump_callgraph_transformation (cgraph_node *original, + cgraph_node *clone, + const char *suffix) +{ + if (ipa_clones_dump_file) + { + fprintf (ipa_clones_dump_file, + "Callgraph clone;%s;%d;%s;%d;%d;<-;%s;%d;" + "%s;%d;%d;optimization:;%s\n", + symtab_node_asm_name ((symtab_node)original), + original->symbol.order, + DECL_SOURCE_FILE (original->symbol.decl), + DECL_SOURCE_LINE (original->symbol.decl), + DECL_SOURCE_COLUMN (original->symbol.decl), + symtab_node_asm_name ((symtab_node)clone), + clone->symbol.order, DECL_SOURCE_FILE (clone->symbol.decl), + DECL_SOURCE_LINE (clone->symbol.decl), + DECL_SOURCE_COLUMN (clone->symbol.decl), + suffix); + + pointer_set_insert (cloned_nodes, original); + pointer_set_insert (cloned_nodes, clone); + } +} + /* Create node representing clone of N executed COUNT times. Decrease the execution counts from original node too. The new clone will have decl set to DECL that may or may not be the same @@ -173,7 +199,8 @@ struct cgraph_node * cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge_p> redirect_callers, - bool call_duplication_hook) + bool call_duplication_hook, + const char *suffix) { struct cgraph_node *new_node = cgraph_create_empty_node (); struct cgraph_edge *e; @@ -240,6 +267,9 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq, if (call_duplication_hook) cgraph_call_node_duplication_hooks (n, new_node); + + dump_callgraph_transformation (n, new_node, suffix); + return new_node; } @@ -306,7 +336,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, new_node = cgraph_clone_node (old_node, new_decl, old_node->count, CGRAPH_FREQ_BASE, false, - redirect_callers, false); + redirect_callers, false, suffix); /* Update the properties. Make clone visible only within this translation unit. Make sure that is not weak also. @@ -620,7 +650,8 @@ struct cgraph_node * cgraph_copy_node_for_versioning (struct cgraph_node *old_version, tree new_decl, vec<cgraph_edge_p> redirect_callers, - bitmap bbs_to_copy) + bitmap bbs_to_copy, + const char *suffix) { struct cgraph_node *new_version; struct cgraph_edge *e; @@ -661,6 +692,8 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version, cgraph_call_node_duplication_hooks (old_version, new_version); + dump_callgraph_transformation (old_version, new_version, suffix); + return new_version; } @@ -692,7 +725,7 @@ cgraph_function_versioning (struct cgraph_node *old_version_node, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, - const char *clone_name) + const char *suffix) { tree old_decl = old_version_node->symbol.decl; struct cgraph_node *new_version_node = NULL; @@ -711,7 +744,7 @@ cgraph_function_versioning (struct cgraph_node *old_version_node, = build_function_decl_skip_args (old_decl, args_to_skip, skip_return); /* Generate a new name for the new version. */ - DECL_NAME (new_decl) = clone_function_name (old_decl, clone_name); + DECL_NAME (new_decl) = clone_function_name (old_decl, suffix); SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); SET_DECL_RTL (new_decl, NULL); @@ -723,7 +756,7 @@ cgraph_function_versioning (struct cgraph_node *old_version_node, and update the edges of the new node. */ new_version_node = cgraph_copy_node_for_versioning (old_version_node, new_decl, - redirect_callers, bbs_to_copy); + redirect_callers, bbs_to_copy, suffix); /* Copy the OLD_VERSION_NODE function tree to the new version. */ tree_function_versioning (old_decl, new_decl, tree_map, false, args_to_skip, diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 7dd2c1d5595..8608e84ba57 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -206,6 +206,8 @@ static void cgraph_analyze_function (struct cgraph_node *); static void handle_alias_pairs (void); FILE *cgraph_dump_file; +FILE *ipa_clones_dump_file; +struct pointer_set_t *cloned_nodes; /* Linked list of cgraph asm nodes. */ struct asm_node *asm_nodes; @@ -1957,8 +1959,13 @@ init_cgraph (void) { if (!cgraph_dump_file) cgraph_dump_file = dump_begin (TDI_cgraph, NULL); -} + if (!ipa_clones_dump_file) + ipa_clones_dump_file = dump_begin (TDI_clones, NULL); + + if (!cloned_nodes) + cloned_nodes = pointer_set_create (); +} /* Perform simple optimizations based on callgraph. */ diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index 7442a27540a..a5b19ad5165 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -52,6 +52,8 @@ static struct dump_file_info dump_files[TDI_end] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0}, {".cgraph", "ipa-cgraph", NULL, NULL, NULL, NULL, NULL, TDF_IPA, 0, 0, 0, 0, 0}, + {".ipa-clones", "ipa-clones", NULL, NULL, NULL, NULL, NULL, TDF_IPA, + 0, 0, 0, 0, 0}, {".tu", "translation-unit", NULL, NULL, NULL, NULL, NULL, TDF_TREE, 0, 0, 0, 0, 1}, {".class", "class-hierarchy", NULL, NULL, NULL, NULL, NULL, TDF_TREE, diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index b912ccf02bb..ca509e14cd6 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -29,6 +29,7 @@ enum tree_dump_index { TDI_none, /* No dump */ TDI_cgraph, /* dump function call graph. */ + TDI_clones, /* dump IPA cloning decisions. */ TDI_tu, /* dump the whole translation unit. */ TDI_class, /* dump class hierarchy. */ TDI_original, /* dump each function before optimizing it */ diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c index cac20fecc3b..e18ca646a76 100644 --- a/gcc/ipa-inline-transform.c +++ b/gcc/ipa-inline-transform.c @@ -168,9 +168,11 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, struct cgraph_node *n; n = cgraph_clone_node (e->callee, e->callee->symbol.decl, e->count, e->frequency, - update_original, vNULL, true); + update_original, vNULL, true, "inlining to"); cgraph_redirect_edge_callee (e, n); } + + dump_callgraph_transformation (e->callee, e->caller, "inlining to"); } else symtab_dissolve_same_comdat_group_list ((symtab_node) e->callee); diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 90b2a13fce9..8f76a77d4ca 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1312,7 +1312,7 @@ recursive_inlining (struct cgraph_edge *edge, /* We need original clone to copy around. */ master_clone = cgraph_clone_node (node, node->symbol.decl, node->count, CGRAPH_FREQ_BASE, - false, vNULL, true); + false, vNULL, true, "inlining to"); for (e = master_clone->callees; e; e = e->next_callee) if (!e->inline_failed) clone_inlined_nodes (e, true, false, NULL); diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 8cf57c6f937..ba77c3fbfb5 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -939,7 +939,7 @@ input_node (struct lto_file_decl_data *file_data, { node = cgraph_clone_node (cgraph (nodes[clone_ref]), fn_decl, 0, CGRAPH_FREQ_BASE, false, - vNULL, false); + vNULL, false, NULL); } else node = cgraph_get_create_node (fn_decl); diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index b0f18b552bb..46978a5c76a 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -4728,7 +4728,8 @@ ipa_tm_create_version (struct cgraph_node *old_node) if (DECL_ONE_ONLY (new_decl)) DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl)); - new_node = cgraph_copy_node_for_versioning (old_node, new_decl, vNULL, NULL); + new_node = cgraph_copy_node_for_versioning (old_node, new_decl, vNULL, NULL, + NULL); new_node->symbol.externally_visible = old_node->symbol.externally_visible; new_node->lowered = true; new_node->tm_clone = 1;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor