]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* cgraph.c (cgraph_node_name): Remove.
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Apr 2012 06:54:33 +0000 (06:54 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Apr 2012 06:54:33 +0000 (06:54 +0000)
(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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186559 138bc75d-0d04-0410-961f-82ee72b054a4

16 files changed:
gcc/ChangeLog
gcc/cgraph.c
gcc/cgraph.h
gcc/cgraphunit.c
gcc/ipa-cp.c
gcc/ipa-inline.c
gcc/ipa-ref.c
gcc/ipa-reference.c
gcc/ipa.c
gcc/matrix-reorg.c
gcc/passes.c
gcc/symtab.c
gcc/tree-pass.h
gcc/tree-sra.c
gcc/tree-ssa-structalias.c
gcc/varpool.c

index 474eb491d4169d40f379875208aae906f46c7370..11bb11cdfabe59e96f679425070c6e1a058fdc26 100644 (file)
@@ -1,3 +1,40 @@
+2012-04-18  Jan Hubicka  <jh@suse.cz>
+
+       * 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.
+
 2012-04-18  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
         * doc/invoke.texi (Language Independent Options): @item should be
index f5f662ccbc87ce9c918f0b4d3e638f7e2c926d79..ae8c4e8e36868c6fafeaea50af1def5e82912f72 100644 (file)
@@ -1605,13 +1605,6 @@ cgraph_inline_failed_string (cgraph_inline_failed_t reason)
   return cif_string_table[reason];
 }
 
-/* Return name of the node used in debug output.  */
-const char *
-cgraph_node_name (struct cgraph_node *node)
-{
-  return lang_hooks.decl_printable_name (node->symbol.decl, 2);
-}
-
 /* Names used to print out the availability enum.  */
 const char * const cgraph_availability_names[] =
   {"unset", "not_available", "overwritable", "available", "local"};
@@ -1625,60 +1618,44 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
   struct cgraph_edge *edge;
   int indirect_calls_count = 0;
 
-  fprintf (f, "%s/%i", cgraph_node_name (node), node->uid);
-  dump_addr (f, " @", (void *)node);
-  if (DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl))
-    fprintf (f, " (asm: %s)",
-            IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl)));
+  dump_symtab_base (f, (symtab_node) node);
+
   if (node->global.inlined_to)
-    fprintf (f, " (inline copy in %s/%i)",
+    fprintf (f, "  Function %s/%i is inline copy in %s/%i\n",
+            cgraph_node_name (node),
+            node->symbol.order,
             cgraph_node_name (node->global.inlined_to),
-            node->global.inlined_to->uid);
-  if (node->symbol.same_comdat_group)
-    fprintf (f, " (same comdat group as %s/%i)",
-            cgraph_node_name (cgraph (node->symbol.same_comdat_group)),
-            cgraph (node->symbol.same_comdat_group)->uid);
+            node->global.inlined_to->symbol.order);
   if (node->clone_of)
-    fprintf (f, " (clone of %s/%i)",
-            cgraph_node_name (node->clone_of),
-            node->clone_of->uid);
+    fprintf (f, "  Clone of %s/%i\n",
+            cgraph_node_asm_name (node->clone_of),
+            node->clone_of->symbol.order);
   if (cgraph_function_flags_ready)
-    fprintf (f, " availability:%s",
+    fprintf (f, "  Availability: %s\n",
             cgraph_availability_names [cgraph_function_body_availability (node)]);
+
+  fprintf (f, "  Function flags:");
   if (node->analyzed)
     fprintf (f, " analyzed");
-  if (node->symbol.in_other_partition)
-    fprintf (f, " in_other_partition");
   if (node->count)
     fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x",
             (HOST_WIDEST_INT)node->count);
   if (node->origin)
-    fprintf (f, " nested in: %s", cgraph_node_name (node->origin));
+    fprintf (f, " nested in: %s", cgraph_node_asm_name (node->origin));
   if (node->needed)
     fprintf (f, " needed");
-  if (node->symbol.address_taken)
-    fprintf (f, " address_taken");
   else if (node->reachable)
     fprintf (f, " reachable");
-  else if (node->symbol.used_from_other_partition)
-    fprintf (f, " used_from_other_partition");
   if (gimple_has_body_p (node->symbol.decl))
     fprintf (f, " body");
   if (node->process)
     fprintf (f, " process");
   if (node->local.local)
     fprintf (f, " local");
-  if (node->symbol.externally_visible)
-    fprintf (f, " externally_visible");
-  if (node->symbol.resolution != LDPR_UNKNOWN)
-    fprintf (f, " %s",
-            ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]);
   if (node->local.finalized)
     fprintf (f, " finalized");
   if (node->local.redefined_extern_inline)
     fprintf (f, " redefined_extern_inline");
-  if (TREE_ASM_WRITTEN (node->symbol.decl))
-    fprintf (f, " asm_written");
   if (node->only_called_at_startup)
     fprintf (f, " only_called_at_startup");
   if (node->only_called_at_exit)
@@ -1692,7 +1669,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
 
   if (node->thunk.thunk_p)
     {
-      fprintf (f, "  thunk of %s (asm: %s) fixed offset %i virtual value %i has "
+      fprintf (f, "  Thunk of %s (asm: %s) fixed offset %i virtual value %i has "
               "virtual offset %i)\n",
               lang_hooks.decl_printable_name (node->thunk.alias, 2),
               IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->thunk.alias)),
@@ -1702,7 +1679,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
     }
   if (node->alias && node->thunk.alias)
     {
-      fprintf (f, "  alias of %s",
+      fprintf (f, "  Alias of %s",
               lang_hooks.decl_printable_name (node->thunk.alias, 2));
       if (DECL_ASSEMBLER_NAME_SET_P (node->thunk.alias))
         fprintf (f, " (asm: %s)",
@@ -1710,12 +1687,12 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
       fprintf (f, "\n");
     }
   
-  fprintf (f, "  called by: ");
+  fprintf (f, "  Called by: ");
 
   for (edge = node->callers; edge; edge = edge->next_caller)
     {
-      fprintf (f, "%s/%i ", cgraph_node_name (edge->caller),
-              edge->caller->uid);
+      fprintf (f, "%s/%i ", cgraph_node_asm_name (edge->caller),
+              edge->caller->symbol.order);
       if (edge->count)
        fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ",
                 (HOST_WIDEST_INT)edge->count);
@@ -1730,11 +1707,11 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
        fprintf(f, "(can throw external) ");
     }
 
-  fprintf (f, "\n  calls: ");
+  fprintf (f, "\n  Calls: ");
   for (edge = node->callees; edge; edge = edge->next_callee)
     {
-      fprintf (f, "%s/%i ", cgraph_node_name (edge->callee),
-              edge->callee->uid);
+      fprintf (f, "%s/%i ", cgraph_node_asm_name (edge->callee),
+              edge->callee->symbol.order);
       if (!edge->inline_failed)
        fprintf(f, "(inlined) ");
       if (edge->indirect_inlining_edge)
@@ -1749,15 +1726,11 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
        fprintf(f, "(can throw external) ");
     }
   fprintf (f, "\n");
-  fprintf (f, "  References: ");
-  ipa_dump_references (f, &node->symbol.ref_list);
-  fprintf (f, "  Refering this function: ");
-  ipa_dump_refering (f, &node->symbol.ref_list);
 
   for (edge = node->indirect_calls; edge; edge = edge->next_callee)
     indirect_calls_count++;
   if (indirect_calls_count)
-    fprintf (f, "  has %i outgoing edges for indirect calls.\n",
+    fprintf (f, "  Has %i outgoing edges for indirect calls.\n",
             indirect_calls_count);
 }
 
index 39372f1be980399dbf76cc2211141253f2017cfe..ca06622714cce9a6e7b5aeba93846a96c4b98b33 100644 (file)
@@ -508,7 +508,14 @@ void symtab_unregister_node (symtab_node);
 void symtab_remove_node (symtab_node);
 symtab_node symtab_get_node (const_tree);
 symtab_node symtab_node_for_asm (const_tree asmname);
+const char * symtab_node_asm_name (symtab_node);
+const char * symtab_node_name (symtab_node);
 void symtab_insert_node_to_hashtable (symtab_node);
+void dump_symtab (FILE *);
+void debug_symtab (void);
+void dump_symtab_node (FILE *, symtab_node);
+void debug_symtab_node (symtab_node);
+void dump_symtab_base (FILE *, symtab_node);
 
 /* In cgraph.c  */
 void dump_cgraph (FILE *);
@@ -545,7 +552,6 @@ void cgraph_update_edges_for_call_stmt (gimple, tree, gimple);
 struct cgraph_local_info *cgraph_local_info (tree);
 struct cgraph_global_info *cgraph_global_info (tree);
 struct cgraph_rtl_info *cgraph_rtl_info (tree);
-const char * cgraph_node_name (struct cgraph_node *);
 struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *,
                                        struct cgraph_node *, gimple,
                                        unsigned, gcov_type, int, bool);
@@ -715,7 +721,6 @@ void varpool_remove_unreferenced_decls (void);
 void varpool_empty_needed_queue (void);
 struct varpool_node * varpool_extra_name_alias (tree, tree);
 struct varpool_node * varpool_create_variable_alias (tree, tree);
-const char * varpool_node_name (struct varpool_node *node);
 void varpool_reset_queue (void);
 bool const_value_known_p (tree);
 bool varpool_for_node_and_aliases (struct varpool_node *,
@@ -769,6 +774,34 @@ varpool_get_node (const_tree decl)
   return varpool (symtab_get_node (decl));
 }
 
+/* Return asm name of cgraph node.  */
+static inline const char *
+cgraph_node_asm_name(struct cgraph_node *node)
+{
+  return symtab_node_asm_name ((symtab_node)node);
+}
+
+/* Return asm name of varpool node.  */
+static inline const char *
+varpool_node_asm_name(struct varpool_node *node)
+{
+  return symtab_node_asm_name ((symtab_node)node);
+}
+
+/* Return name of cgraph node.  */
+static inline const char *
+cgraph_node_name(struct cgraph_node *node)
+{
+  return symtab_node_name ((symtab_node)node);
+}
+
+/* Return name of varpool node.  */
+static inline const char *
+varpool_node_name(struct varpool_node *node)
+{
+  return symtab_node_name ((symtab_node)node);
+}
+
 /* Walk all symbols.  */
 #define FOR_EACH_SYMBOL(node) \
    for ((node) = symtab_nodes; (node); (node) = (node)->symbol.next)
index 726d8839d3db362c734e13ca5161a255dd03fcab..4342d3d30ec12945418acf310a5b9731d7ccc028 100644 (file)
@@ -1273,8 +1273,7 @@ cgraph_analyze_functions (void)
        if (node->needed)
          fprintf (cgraph_dump_file, " %s", cgraph_node_name (node));
       fprintf (cgraph_dump_file, "\n\nInitial ");
-      dump_cgraph (cgraph_dump_file);
-      dump_varpool (cgraph_dump_file);
+      dump_symtab (cgraph_dump_file);
     }
 
   if (cgraph_dump_file)
@@ -1310,8 +1309,7 @@ cgraph_analyze_functions (void)
   if (cgraph_dump_file)
     {
       fprintf (cgraph_dump_file, "\n\nReclaimed ");
-      dump_cgraph (cgraph_dump_file);
-      dump_varpool (cgraph_dump_file);
+      dump_symtab (cgraph_dump_file);
     }
   bitmap_obstack_release (NULL);
   first_analyzed = cgraph_first_function ();
@@ -2690,8 +2688,7 @@ cgraph_optimize (void)
   if (cgraph_dump_file)
     {
       fprintf (cgraph_dump_file, "Optimized ");
-      dump_cgraph (cgraph_dump_file);
-      dump_varpool (cgraph_dump_file);
+      dump_symtab (cgraph_dump_file);
     }
   if (post_ipa_mem_report)
     {
@@ -2738,8 +2735,7 @@ cgraph_optimize (void)
   if (cgraph_dump_file)
     {
       fprintf (cgraph_dump_file, "\nFinal ");
-      dump_cgraph (cgraph_dump_file);
-      dump_varpool (cgraph_dump_file);
+      dump_symtab (cgraph_dump_file);
     }
 #ifdef ENABLE_CHECKING
   verify_cgraph ();
index cd9afb8637061b27ec92aaa8214be29889983757..d0a6ee0c8e2b7ec7143fb9b827569ea93582f991 100644 (file)
@@ -2544,7 +2544,7 @@ struct ipa_opt_pass_d pass_ipa_cp =
   0,                           /* properties_provided */
   0,                           /* properties_destroyed */
   0,                           /* todo_flags_start */
-  TODO_dump_cgraph |
+  TODO_dump_symtab |
   TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
  },
  ipcp_generate_summary,                        /* generate_summary */
index 8c41db8eb38470c31dfe16e1f2e5ee88fa12be3f..d28bed4d8325a1ae33e7a004c320922e05b19c17 100644 (file)
@@ -2025,7 +2025,7 @@ struct ipa_opt_pass_d pass_ipa_inline =
   0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   TODO_remove_functions,               /* todo_flags_finish */
-  TODO_dump_cgraph 
+  TODO_dump_symtab 
   | TODO_remove_functions | TODO_ggc_collect   /* todo_flags_finish */
  },
  inline_generate_summary,              /* generate_summary */
index 4f4d7d013781127805f9ba5a6364d62648679896..08f5ade398fbdfe43d41722e48ba366efba528dd 100644 (file)
@@ -164,13 +164,13 @@ ipa_dump_references (FILE * file, struct ipa_ref_list *list)
     {
       if (ref->refered_type == IPA_REF_CGRAPH)
        {
-         fprintf (file, " fn:%s/%i (%s)", cgraph_node_name (ipa_ref_node (ref)),
-                  ipa_ref_node (ref)->uid,
+         fprintf (file, " fn:%s/%i (%s)", cgraph_node_asm_name (ipa_ref_node (ref)),
+                  ipa_ref_node (ref)->symbol.order,
                   ipa_ref_use_name [ref->use]);
        }
       else
        fprintf (file, " var:%s (%s)",
-                varpool_node_name (ipa_ref_varpool_node (ref)),
+                varpool_node_asm_name (ipa_ref_varpool_node (ref)),
                 ipa_ref_use_name [ref->use]);
     }
   fprintf (file, "\n");
@@ -187,12 +187,12 @@ ipa_dump_refering (FILE * file, struct ipa_ref_list *list)
     {
       if (ref->refering_type == IPA_REF_CGRAPH)
        fprintf (file, " fn:%s/%i (%s)",
-                cgraph_node_name (ipa_ref_refering_node (ref)),
-                ipa_ref_refering_node (ref)->uid,
+                cgraph_node_asm_name (ipa_ref_refering_node (ref)),
+                ipa_ref_refering_node (ref)->symbol.order,
                 ipa_ref_use_name [ref->use]);
       else
        fprintf (file, " var:%s (%s)",
-                varpool_node_name (ipa_ref_refering_varpool_node (ref)),
+                varpool_node_asm_name (ipa_ref_refering_varpool_node (ref)),
                 ipa_ref_use_name [ref->use]);
     }
   fprintf (file, "\n");
index d8fd796ea2581d8d75a18a489e2d058b8605dfa1..faf3a20ca83a3bcd817ab5108bce5717d5e14983 100644 (file)
@@ -553,7 +553,7 @@ generate_summary (void)
          l = &get_reference_vars_info (node)->local;
          fprintf (dump_file,
                   "\nFunction name:%s/%i:",
-                  cgraph_node_name (node), node->uid);
+                  cgraph_node_asm_name (node), node->symbol.order);
          fprintf (dump_file, "\n  locals read: ");
          if (l->statics_read)
            EXECUTE_IF_SET_IN_BITMAP (l->statics_read,
@@ -592,7 +592,7 @@ read_write_all_from_decl (struct cgraph_node *node, bool * read_all,
       *read_all = true;
       if (dump_file && (dump_flags & TDF_DETAILS))
          fprintf (dump_file, "   %s/%i -> read all\n",
-                 cgraph_node_name (node), node->uid);
+                 cgraph_node_asm_name (node), node->symbol.order);
     }
   else
     {
@@ -602,7 +602,7 @@ read_write_all_from_decl (struct cgraph_node *node, bool * read_all,
       *write_all = true;
       if (dump_file && (dump_flags & TDF_DETAILS))
          fprintf (dump_file, "   %s/%i -> read all, write all\n",
-                 cgraph_node_name (node), node->uid);
+                 cgraph_node_asm_name (node), node->symbol.order);
     }
 }
 
@@ -653,7 +653,7 @@ propagate (void)
 
       if (dump_file && (dump_flags & TDF_DETAILS))
        fprintf (dump_file, "Starting cycle with %s/%i\n",
-                 cgraph_node_name (node), node->uid);
+                 cgraph_node_asm_name (node), node->symbol.order);
 
       node_l = &node_info->local;
       node_g = &node_info->global;
@@ -697,7 +697,7 @@ propagate (void)
        {
          if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "  Visiting %s/%i\n",
-                     cgraph_node_name (w), w->uid);
+                     cgraph_node_asm_name (w), w->symbol.order);
          /* When function is overwritable, we can not assume anything.  */
          if (cgraph_function_body_availability (w) <= AVAIL_OVERWRITABLE)
            read_write_all_from_decl (w, &read_all, &write_all);
@@ -811,7 +811,7 @@ propagate (void)
          node_l = &node_info->local;
          fprintf (dump_file,
                   "\nFunction name:%s/%i:",
-                  cgraph_node_name (node), node->uid);
+                  cgraph_node_asm_name (node), node->symbol.order);
          fprintf (dump_file, "\n  locals read: ");
          if (node_l->statics_read)
            EXECUTE_IF_SET_IN_BITMAP (node_l->statics_read,
@@ -837,7 +837,7 @@ propagate (void)
                get_reference_vars_info (w);
              ipa_reference_local_vars_info_t w_l = &w_ri->local;
              fprintf (dump_file, "\n  next cycle: %s/%i ",
-                      cgraph_node_name (w), w->uid);
+                      cgraph_node_asm_name (w), w->symbol.order);
              fprintf (dump_file, "\n    locals read: ");
              if (w_l->statics_read)
                EXECUTE_IF_SET_IN_BITMAP (w_l->statics_read,
@@ -1148,7 +1148,7 @@ ipa_reference_read_optimization_summary (void)
              if (dump_file)
                fprintf (dump_file,
                         "\nFunction name:%s/%i:\n  static not read:",
-                        cgraph_node_name (node), node->uid);
+                        cgraph_node_asm_name (node), node->symbol.order);
 
              /* Set the statics not read.  */
              v_count = streamer_read_hwi (ib);
index b46618809dfa1e0078c63ecad338539bf6346600..51a1dc0ce2fe970329f6b5e9e57b49d6fdb53434 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -989,7 +989,7 @@ struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility =
   0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
-  TODO_remove_functions | TODO_dump_cgraph
+  TODO_remove_functions | TODO_dump_symtab
   | TODO_ggc_collect                   /* todo_flags_finish */
  }
 };
@@ -1047,7 +1047,7 @@ struct ipa_opt_pass_d pass_ipa_whole_program_visibility =
   0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
-  TODO_remove_functions | TODO_dump_cgraph
+  TODO_remove_functions | TODO_dump_symtab
   | TODO_ggc_collect                   /* todo_flags_finish */
  },
  NULL,                                 /* generate_summary */
index 31e9a8e67d68b18101f756974e1226e337469eb1..6589e7803d3237728f3a2beedf13037ba19d068e 100644 (file)
@@ -2389,6 +2389,6 @@ struct simple_ipa_opt_pass pass_ipa_matrix_reorg =
   0,                           /* properties_provided */
   0,                           /* properties_destroyed */
   0,                           /* todo_flags_start */
-  TODO_dump_cgraph             /* todo_flags_finish */
+  TODO_dump_symtab             /* todo_flags_finish */
  }
 };
index c012a1290ee3f7e72cfdb1079323e6be7e4c1885..fadb4d719a5603328702b660057aefd838653711 100644 (file)
@@ -1862,7 +1862,7 @@ execute_todo (unsigned int flags)
       cgraph_remove_unreachable_nodes (true, dump_file);
     }
 
-  if ((flags & TODO_dump_cgraph) && dump_file && !current_function_decl)
+  if ((flags & TODO_dump_symtab) && dump_file && !current_function_decl)
     {
       gcc_assert (!cfun);
       dump_cgraph (dump_file);
index 9e7c4df83e94e7084ed4b0baf5b768141d3fb4bb..5577cb2b189e33d5ed6b447f708f263679833ee9 100644 (file)
@@ -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"
index 7b330db00c2e0d928fa9d1fd501b4f90e64ba8d5..1c902bc1648bc429cc1be71be3c2e7e07f914849 100644 (file)
@@ -250,7 +250,7 @@ struct dump_file_info
 #define TODO_verify_flow               (1 << 3)
 #define TODO_verify_stmts              (1 << 4)
 #define TODO_cleanup_cfg               (1 << 5)
-#define TODO_dump_cgraph               (1 << 7)
+#define TODO_dump_symtab               (1 << 7)
 #define TODO_remove_functions          (1 << 8)
 #define TODO_rebuild_frequencies       (1 << 9)
 #define TODO_verify_rtl_sharing         (1 << 10)
index e69f3ac5918cfdc1379dfd2fbd32759323007190..70b241d52376f498f5aead18f4a6e30dd0dba90e 100644 (file)
@@ -4865,6 +4865,6 @@ struct gimple_opt_pass pass_early_ipa_sra =
   0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
-  TODO_dump_cgraph                     /* todo_flags_finish */
+  TODO_dump_symtab                     /* todo_flags_finish */
  }
 };
index 3601bc37ec525f1b508f8e25c861702b40f98c85..28d2312e8e308156fa859b4b6334638cdd55b5ba 100644 (file)
@@ -6857,7 +6857,7 @@ ipa_pta_execute (void)
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
-      dump_cgraph (dump_file);
+      dump_symtab (dump_file);
       fprintf (dump_file, "\n");
     }
 
index e41a780fec3bc9c79be3e9c83564ce94680e6a30..27639935d9d8ec6191867a07439146f2f062e169 100644 (file)
@@ -74,13 +74,6 @@ static GTY(()) symtab_node x_varpool_first_unanalyzed_node;
 /* Lists all assembled variables to be sent to debugger output later on.  */
 static GTY(()) struct varpool_node *varpool_assembled_nodes_queue;
 
-/* Return name of the node used in debug output.  */
-const char *
-varpool_node_name (struct varpool_node *node)
-{
-  return lang_hooks.decl_printable_name (node->symbol.decl, 2);
-}
-
 /* Return varpool node assigned to DECL.  Create new one when needed.  */
 struct varpool_node *
 varpool_node (tree decl)
@@ -127,17 +120,14 @@ varpool_remove_node (struct varpool_node *node)
 void
 dump_varpool_node (FILE *f, struct varpool_node *node)
 {
-  fprintf (f, "%s:", varpool_node_name (node));
-  fprintf (f, " availability:%s",
+  dump_symtab_base (f, (symtab_node)node);
+  fprintf (f, "  Availability: %s\n",
           cgraph_function_flags_ready
           ? cgraph_availability_names[cgraph_variable_initializer_availability (node)]
           : "not-ready");
-  if (DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl))
-    fprintf (f, " (asm: %s)", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl)));
+  fprintf (f, "  Varpool flags:");
   if (DECL_INITIAL (node->symbol.decl))
     fprintf (f, " initialized");
-  if (TREE_ASM_WRITTEN (node->symbol.decl))
-    fprintf (f, " (asm written)");
   if (node->needed)
     fprintf (f, " needed");
   if (node->analyzed)
@@ -146,20 +136,7 @@ dump_varpool_node (FILE *f, struct varpool_node *node)
     fprintf (f, " finalized");
   if (node->output)
     fprintf (f, " output");
-  if (node->symbol.externally_visible)
-    fprintf (f, " externally_visible");
-  if (node->symbol.resolution != LDPR_UNKNOWN)
-    fprintf (f, " %s",
-            ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]);
-  if (node->symbol.in_other_partition)
-    fprintf (f, " in_other_partition");
-  else if (node->symbol.used_from_other_partition)
-    fprintf (f, " used_from_other_partition");
   fprintf (f, "\n");
-  fprintf (f, "  References: ");
-  ipa_dump_references (f, &node->symbol.ref_list);
-  fprintf (f, "  Refering this var: ");
-  ipa_dump_refering (f, &node->symbol.ref_list);
 }
 
 /* Dump the variable pool.  */