]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR testsuite/40488 (Revision 148642 caused extra failures)
authorRichard Henderson <rth@redhat.com>
Thu, 18 Jun 2009 23:27:40 +0000 (16:27 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 18 Jun 2009 23:27:40 +0000 (16:27 -0700)
        PR 40488
        * tree-pass.h (TDF_ASMNAME): New.
        * tree-dump.c (dump_options): Add asmname.
        * doc/invoke.texi: Document it.

        * tree-pretty-print.c (maybe_dump_asm_name): Merge into...
        (dump_decl_name): ...here.
        (dump_function_name): New flags arg; mind TDF_ASMNAME.
        (dump_generic_node): Update dump_function_name calls.
        (print_call_name): New flags arg; update all dump calls.
        * diagnostic.h (print_call_name): Update.
        * gimple-pretty-print.c (dump_gimple_call): Update.

From-SVN: r148685

gcc/ChangeLog
gcc/diagnostic.h
gcc/doc/invoke.texi
gcc/gimple-pretty-print.c
gcc/tree-dump.c
gcc/tree-pass.h
gcc/tree-pretty-print.c

index 55ffbfdb0269ee8c1c772f796ee6ca399e78252c..0633e2302743a19d9793b559d8761537d34ad7eb 100644 (file)
@@ -1,3 +1,18 @@
+2009-06-18  Richard Henderson  <rth@redhat.com>
+
+       PR 40488
+       * tree-pass.h (TDF_ASMNAME): New.
+       * tree-dump.c (dump_options): Add asmname.
+       * doc/invoke.texi: Document it.
+
+       * tree-pretty-print.c (maybe_dump_asm_name): Merge into...
+       (dump_decl_name): ...here.
+       (dump_function_name): New flags arg; mind TDF_ASMNAME.
+       (dump_generic_node): Update dump_function_name calls.
+       (print_call_name): New flags arg; update all dump calls.
+       * diagnostic.h (print_call_name): Update.
+       * gimple-pretty-print.c (dump_gimple_call): Update.
+
 2009-06-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/40470
index aa9aaf8a9c2e1da3fe1a167caa9ed0a55b2011c5..b9bff22c24bf1a0dbdedf70bc1ed46e7ed4f7e70 100644 (file)
@@ -226,7 +226,7 @@ extern void print_generic_expr (FILE *, tree, int);
 extern void print_generic_decl (FILE *, tree, int);
 extern void debug_c_tree (tree);
 extern void dump_omp_clauses (pretty_printer *, tree, int, int);
-extern void print_call_name (pretty_printer *, tree);
+extern void print_call_name (pretty_printer *, tree, int);
 
 /* In gimple-pretty-print.c  */
 extern void debug_generic_expr (tree);
index 155ceeecf42537ae85afdf02f9eed5f7cc181a5d..5df3513803fb75f4ffda85e29468e800ce54047a 100644 (file)
@@ -5094,6 +5094,10 @@ meaningful will be ignored.  The following options are available
 Print the address of each node.  Usually this is not meaningful as it
 changes according to the environment and source file.  Its primary use
 is for tying up a dump file with a debug environment.
+@item asmname
+If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
+in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
+use working backward from mangled names in the assembly file.
 @item slim
 Inhibit dumping of members of a scope or body of a function merely
 because that scope has been reached.  Only dump such items when they
index 84531789f22e49e8f83f527a56284b99b9d0b48f..c6f0c658361bbf0e44547a450f84fadb69934b36 100644 (file)
@@ -508,7 +508,7 @@ dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags)
 
          pp_space (buffer);
         }
-      print_call_name (buffer, gimple_call_fn (gs));
+      print_call_name (buffer, gimple_call_fn (gs), flags);
       pp_string (buffer, " (");
       dump_gimple_call_args (buffer, gs, flags);
       pp_character (buffer, ')');
index 893da7ab1048ab7dff1cb78a310123da28d08226..1cb650442b77da2ffd6452771cf8a9d0b66a87db 100644 (file)
@@ -803,6 +803,7 @@ struct dump_option_value_info
 static const struct dump_option_value_info dump_options[] =
 {
   {"address", TDF_ADDRESS},
+  {"asmname", TDF_ASMNAME},
   {"slim", TDF_SLIM},
   {"raw", TDF_RAW},
   {"graph", TDF_GRAPH},
index e919909d090f0981063b79806c296d2d139ef0e1..db3ebce28cc93a1239b6a1699429bf8750f9252a 100644 (file)
@@ -75,6 +75,9 @@ enum tree_dump_index
                                           dumper to print stmts.  */
 #define TDF_RHS_ONLY   (1 << 17)       /* a flag to only print the RHS of
                                           a gimple stmt.  */
+#define TDF_ASMNAME    (1 << 18)       /* display asm names of decls  */
+
+
 /* In tree-dump.c */
 
 extern char *get_dump_file_name (int);
index cd8033a152331a15c6b4b4e389afd648b81e8b4c..142690777153f4f2fea97233bbd155ee9ed8e588 100644 (file)
@@ -155,72 +155,42 @@ print_generic_expr (FILE *file, tree t, int flags)
   dump_generic_node (&buffer, t, 0, flags, false);
 }
 
-/* Dump the assembly name of a decl node if it's sufficiently different
-   from the decl name.  */
-
-static void
-maybe_dump_asm_name (pretty_printer *buffer, tree node, int flags)
-{
-  tree n, a;
-
-  if (flags & TDF_SLIM)
-    return;
-  if (DECL_NAME (node) == NULL || !DECL_ASSEMBLER_NAME_SET_P (node))
-    return;
-
-  n = DECL_NAME (node);
-  a = DECL_ASSEMBLER_NAME (node);
-  if (n == a)
-    return;
-  if (strncmp (IDENTIFIER_POINTER (n), "__builtin_", 10) == 0)
-    return;
-
-  pp_space (buffer);
-  pp_character (buffer, '[');
-  pp_tree_identifier (buffer, a);
-  pp_character (buffer, ']');
-}
-
 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
    in FLAGS.  */
 
 static void
 dump_decl_name (pretty_printer *buffer, tree node, int flags)
 {
-  tree t = node;
-
-  if (DECL_NAME (t))
-    pp_tree_identifier (buffer, DECL_NAME (t));
-  if ((flags & TDF_UID)
-      || DECL_NAME (t) == NULL_TREE)
+  if (DECL_NAME (node))
+    {
+      if ((flags & TDF_ASMNAME) && DECL_ASSEMBLER_NAME_SET_P (node))
+       pp_tree_identifier (buffer, DECL_ASSEMBLER_NAME (node));
+      else
+       pp_tree_identifier (buffer, DECL_NAME (node));
+    }
+  if ((flags & TDF_UID) || DECL_NAME (node) == NULL_TREE)
     {
-      if (TREE_CODE (t) == LABEL_DECL
-          && LABEL_DECL_UID (t) != -1)
-        pp_printf (buffer, "L.%d", (int) LABEL_DECL_UID (t));
+      if (TREE_CODE (node) == LABEL_DECL && LABEL_DECL_UID (node) != -1)
+        pp_printf (buffer, "L.%d", (int) LABEL_DECL_UID (node));
       else
        {
-         char c = TREE_CODE (t) == CONST_DECL ? 'C' : 'D';
-         pp_printf (buffer, "%c.%u", c, DECL_UID (t));
+         char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
+         pp_printf (buffer, "%c.%u", c, DECL_UID (node));
        }
     }
-
-  maybe_dump_asm_name (buffer, node, flags);
 }
 
 /* Like the above, but used for pretty printing function calls.  */
 
 static void
-dump_function_name (pretty_printer *buffer, tree node)
+dump_function_name (pretty_printer *buffer, tree node, int flags)
 {
-  if (DECL_NAME (node))
-    {
-      if (TREE_CODE (node) == NOP_EXPR)
-       node = TREE_OPERAND (node, 0);
-      pp_string (buffer, lang_hooks.decl_printable_name (node, 1));
-      maybe_dump_asm_name (buffer, node, 0);
-    }
+  if (TREE_CODE (node) == NOP_EXPR)
+    node = TREE_OPERAND (node, 0);
+  if (DECL_NAME (node) && (flags & TDF_ASMNAME) == 0)
+    pp_string (buffer, lang_hooks.decl_printable_name (node, 1));
   else
-    dump_decl_name (buffer, node, 0);
+    dump_decl_name (buffer, node, flags);
 }
 
 /* Dump a function declaration.  NODE is the FUNCTION_TYPE.  BUFFER, SPC and
@@ -1356,7 +1326,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
       break;
 
     case CALL_EXPR:
-      print_call_name (buffer, CALL_EXPR_FN (node));
+      print_call_name (buffer, CALL_EXPR_FN (node), flags);
 
       /* Print parameters.  */
       pp_space (buffer);
@@ -2693,7 +2663,7 @@ op_symbol (const_tree op)
    the gimple_call_fn of a GIMPLE_CALL.  */
 
 void
-print_call_name (pretty_printer *buffer, tree node)
+print_call_name (pretty_printer *buffer, tree node, int flags)
 {
   tree op0 = node;
 
@@ -2706,7 +2676,7 @@ print_call_name (pretty_printer *buffer, tree node)
     case VAR_DECL:
     case PARM_DECL:
     case FUNCTION_DECL:
-      dump_function_name (buffer, op0);
+      dump_function_name (buffer, op0, flags);
       break;
 
     case ADDR_EXPR:
@@ -2717,20 +2687,20 @@ print_call_name (pretty_printer *buffer, tree node)
 
     case COND_EXPR:
       pp_string (buffer, "(");
-      dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
+      dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
       pp_string (buffer, ") ? ");
-      dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, 0, false);
+      dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, flags, false);
       pp_string (buffer, " : ");
-      dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, 0, false);
+      dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, flags, false);
       break;
 
     case COMPONENT_REF:
       /* The function is a pointer contained in a structure.  */
       if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
          TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
-       dump_function_name (buffer, TREE_OPERAND (op0, 1));
+       dump_function_name (buffer, TREE_OPERAND (op0, 1), flags);
       else
-       dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
+       dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
       /* else
         We can have several levels of structures and a function
         pointer inside.  This is not implemented yet...  */
@@ -2739,14 +2709,14 @@ print_call_name (pretty_printer *buffer, tree node)
 
     case ARRAY_REF:
       if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
-       dump_function_name (buffer, TREE_OPERAND (op0, 0));
+       dump_function_name (buffer, TREE_OPERAND (op0, 0), flags);
       else
-       dump_generic_node (buffer, op0, 0, 0, false);
+       dump_generic_node (buffer, op0, 0, flags, false);
       break;
 
     case SSA_NAME:
     case OBJ_TYPE_REF:
-      dump_generic_node (buffer, op0, 0, 0, false);
+      dump_generic_node (buffer, op0, 0, flags, false);
       break;
 
     default: