diff options
author | Jan Hubicka <jh@suse.cz> | 2012-04-18 08:54:33 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-04-18 06:54:33 +0000 |
commit | 8f940ee6546bc5411d4f65174c87c20a424c7ca1 (patch) | |
tree | d617998b8e72778558a170df59931a3bd122e04c /gcc/symtab.c | |
parent | cc8e7b1f5829ad7afddaee8b5c867305af6fbcc8 (diff) | |
download | gcc-8f940ee6546bc5411d4f65174c87c20a424c7ca1.zip gcc-8f940ee6546bc5411d4f65174c87c20a424c7ca1.tar.gz gcc-8f940ee6546bc5411d4f65174c87c20a424c7ca1.tar.bz2 |
cgraph.c (cgraph_node_name): Remove.
* cgraph.c (cgraph_node_name): Remove.
(dump_cgraph_node): Use dump_symtab_base; reformat.
* cgraph.h (symtab_node_asm_name, symtab_node_name, dump_symtab,
debug_symtab, dump_symtab_node, debug_symtab_node, dump_symtab_base):
Declare.
(cgraph_node_name, varpool_node_name): Remove.
(cgraph_node_asm_name, varpool_node_asm_name,
cgraph_node_name, varpool_node_name): New.
* tree-pass.h (TODO_dump_cgraph): Rename to ...
(TODO_dump_symtab): ... this one.
* ipa-cp (pass_ipa_cp): Update.
* ia-reference.c (generate_summary, read_write_all_from_decl,
propagate, ipa_reference_read_optimization_summary): Update.
* cgraphunit.c (cgraph_analyze_functions): Update.
(cgraph_optimize): Update.
* ipa-ref.c (ipa_dump_references): Update.
(ipa_dump_refering): Update.
* ipa-inline.c (pass_ipa_inline): Update.
* matrix-reorg.c (pass_ipa_matrix_reorg): Update.
* ipa.c (pass_ipa_function_visibility,
pass_ipa_whole_program_visibility): Update.
* tree-sra.c (pass_early_ipa_sra): Update.
* symtab.c: Include langhooks.h
(symtab_node_asm_name): New.
(symtab_node_name): New.
(symtab_type_names): New static var.
(dump_symtab_base): New.
(dump_symtab_node, dump_symtab): New.
(debug_symtab_node, debug_symtab): New.
* tree-ssa-structalias.c: Dump symbol table.
* pases.c (execute_todo): Handle TODO_dump_symtab instead
of TODO_dump_cgraph.
* varpoo.c (varpool_node_name): Remove.
(dump_varpool_node): Use dump_symtab_base; reformat.
From-SVN: r186559
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r-- | gcc/symtab.c | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c index 9e7c4df..5577cb2 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "tree.h" #include "tree-inline.h" +#include "langhooks.h" #include "hashtab.h" #include "ggc.h" #include "cgraph.h" @@ -333,4 +334,141 @@ change_decl_assembler_name (tree decl, tree name) } } +/* Return printable assembler name of NODE. + This function is used only for debugging. When assembler name + is unknown go with identifier name. */ + +const char * +symtab_node_asm_name (symtab_node node) +{ + if (!DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl)) + return lang_hooks.decl_printable_name (node->symbol.decl, 2); + return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl)); +} + +/* Return printable identifier name. */ + +const char * +symtab_node_name (symtab_node node) +{ + return lang_hooks.decl_printable_name (node->symbol.decl, 2); +} + +static const char * const symtab_type_names[] = {"symbol", "function", "variable"}; + +/* Dump base fields of symtab nodes. Not to be used directly. */ + +void +dump_symtab_base (FILE *f, symtab_node node) +{ + static const char * const visibility_types[] = { + "default", "protected", "hidden", "internal" + }; + + fprintf (f, "%s/%i (%s)", + symtab_node_asm_name (node), + node->symbol.order, + symtab_node_name (node)); + dump_addr (f, " @", (void *)node); + fprintf (f, "\n Type: %s\n", symtab_type_names[node->symbol.type]); + fprintf (f, " Visibility:"); + + if (node->symbol.in_other_partition) + fprintf (f, " in_other_partition"); + if (node->symbol.used_from_other_partition) + fprintf (f, " used_from_other_partition"); + if (node->symbol.resolution != LDPR_UNKNOWN) + fprintf (f, " %s", + ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]); + if (TREE_ASM_WRITTEN (node->symbol.decl)) + fprintf (f, " asm_written"); + if (DECL_EXTERNAL (node->symbol.decl)) + fprintf (f, " external"); + if (TREE_PUBLIC (node->symbol.decl)) + fprintf (f, " public"); + if (DECL_COMMON (node->symbol.decl)) + fprintf (f, " common"); + if (DECL_WEAK (node->symbol.decl)) + fprintf (f, " weak"); + if (DECL_DLLIMPORT_P (node->symbol.decl)) + fprintf (f, " dll_import"); + if (DECL_COMDAT (node->symbol.decl)) + fprintf (f, " comdat"); + if (DECL_COMDAT_GROUP (node->symbol.decl)) + fprintf (f, " comdat_group:%s", + IDENTIFIER_POINTER (DECL_COMDAT_GROUP (node->symbol.decl))); + if (DECL_ONE_ONLY (node->symbol.decl)) + fprintf (f, " one_only"); + if (DECL_SECTION_NAME (node->symbol.decl)) + fprintf (f, " section_name:%s", + IDENTIFIER_POINTER (DECL_SECTION_NAME (node->symbol.decl))); + if (DECL_VISIBILITY_SPECIFIED (node->symbol.decl)) + fprintf (f, " visibility_specified"); + if (DECL_VISIBILITY (node->symbol.decl)) + fprintf (f, " visibility:%s", + visibility_types [DECL_VISIBILITY (node->symbol.decl)]); + if (DECL_VIRTUAL_P (node->symbol.decl)) + fprintf (f, " virtual"); + if (DECL_ARTIFICIAL (node->symbol.decl)) + fprintf (f, " artificial"); + fprintf (f, "\n"); + + if (node->symbol.same_comdat_group) + fprintf (f, " Same comdat group as: %s/%i\n", + symtab_node_asm_name (node->symbol.same_comdat_group), + node->symbol.same_comdat_group->symbol.order); + if (node->symbol.next_sharing_asm_name) + fprintf (f, " next sharing asm name: %i\n", + node->symbol.same_comdat_group->symbol.order); + if (node->symbol.previous_sharing_asm_name) + fprintf (f, " previous sharing asm name: %i\n", + node->symbol.same_comdat_group->symbol.order); + + if (node->symbol.address_taken) + fprintf (f, " Address is taken."); + + fprintf (f, " References: "); + ipa_dump_references (f, &node->symbol.ref_list); + fprintf (f, " Refering: "); + ipa_dump_refering (f, &node->symbol.ref_list); +} + +/* Dump symtab node. */ + +void +dump_symtab_node (FILE *f, symtab_node node) +{ + if (symtab_function_p (node)) + dump_cgraph_node (f, cgraph (node)); + else if (symtab_variable_p (node)) + dump_varpool_node (f, varpool (node)); +} + +/* Dump symbol table. */ + +void +dump_symtab (FILE *f) +{ + symtab_node node; + fprintf (f, "Symbol table:\n\n"); + FOR_EACH_SYMBOL (node) + dump_symtab_node (f, node); +} + +/* Dump symtab node NODE to stderr. */ + +DEBUG_FUNCTION void +debug_symtab_node (symtab_node node) +{ + dump_symtab_node (stderr, node); +} + +/* Dump symbol table to stderr. */ + +DEBUG_FUNCTION void +debug_symtab (void) +{ + dump_symtab (stderr); +} + #include "gt-symtab.h" |