lto-dump: modernize a bit

Message ID bc0954f7-b256-4b1a-3e6e-2464b22cca98@suse.cz
State Not Applicable
Headers
Series lto-dump: modernize a bit |

Checks

Context Check Description
snail/gcc-patch-check fail Git am fail log

Commit Message

Martin Liška Oct. 27, 2022, 8:42 a.m. UTC
  Hi.

Ready to be installed?
Thanks,
Martin

gcc/lto/ChangeLog:

	* lto-dump.cc (dump_list): Remove trailing return.
	(dump_symbol): Likewise.
	(dump_body): Filter name based on mangled name.
	(dump_tool_help): Use GIMPLE wording.
	(lto_main): Update wording.
---
  gcc/lto/lto-dump.cc | 19 +++++++------------
  1 file changed, 7 insertions(+), 12 deletions(-)
  

Comments

Richard Biener Oct. 27, 2022, 6:15 p.m. UTC | #1
> Am 27.10.2022 um 10:43 schrieb Martin Liška <mliska@suse.cz>:
> 
> Hi.
> 
> Ready to be installed?

Ok

Richard 

> Thanks,
> Martin
> 
> gcc/lto/ChangeLog:
> 
>    * lto-dump.cc (dump_list): Remove trailing return.
>    (dump_symbol): Likewise.
>    (dump_body): Filter name based on mangled name.
>    (dump_tool_help): Use GIMPLE wording.
>    (lto_main): Update wording.
> ---
> gcc/lto/lto-dump.cc | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/gcc/lto/lto-dump.cc b/gcc/lto/lto-dump.cc
> index cb9782722a9..5c4dbf5d297 100644
> --- a/gcc/lto/lto-dump.cc
> +++ b/gcc/lto/lto-dump.cc
> @@ -227,7 +227,6 @@ void dump_list (void)
> {
>   dump_list_functions ();
>   dump_list_variables ();
> -  return;
> }
>  /* Dump specific variables and functions used in IL.  */
> @@ -243,7 +242,6 @@ void dump_symbol ()
>      printf ("\n");
>    }
>     }
> -  return;
> }
>  /* Dump specific gimple body of specified function.  */
> @@ -259,19 +257,17 @@ void dump_body ()
>     return;
>   }
>   cgraph_node *cnode;
> -  FOR_EACH_FUNCTION (cnode)
> -    if (cnode->definition
> -    && !cnode->alias
> -    && !strcmp (cnode->name (), flag_dump_body))
> +  FOR_EACH_DEFINED_FUNCTION (cnode)
> +    if (!cnode->alias
> +    && !strcmp (cnode->asm_name (), flag_dump_body))
>       {
> -    printf ("Gimple Body of Function: %s\n", cnode->name ());
> +    printf ("GIMPLE body of function: %s\n\n", cnode->asm_name ());
>    cnode->get_untransformed_body ();
>    debug_function (cnode->decl, flags);
>    flag = 1;
>       }
>   if (!flag)
>     error_at (input_location, "Function not found.");
> -  return;
> }
>  /* List of command line options for dumping.  */
> @@ -292,13 +288,12 @@ void dump_tool_help ()
>     "  -callgraph                Dump the callgraph in graphviz format.\n"
>     "  -type-stats               Dump statistics of tree types.\n"
>     "  -tree-stats               Dump statistics of trees.\n"
> -    "  -gimple-stats             Dump statistics of gimple statements.\n"
> -    "  -dump-body=               Dump the specific gimple body.\n"
> +    "  -gimple-stats             Dump statistics of GIMPLE statements.\n"
> +    "  -dump-body=               Dump the specific GIMPLE body.\n"
>     "  -dump-level=              Deciding the optimization level of body.\n"
>     "  -help                     Display the dump tool help.\n";
>    fputs (msg, stdout);
> -  return;
> }
>  unsigned int
> @@ -365,7 +360,7 @@ lto_main (void)
>            "%<--enable-gather-detailed-mem-stats%>.");
>       else
>    {
> -      printf ("Tree Statistics\n");
> +      printf ("Tree statistics\n");
>      dump_tree_statistics ();
>    }
>     }
> -- 
> 2.38.0
>
  

Patch

diff --git a/gcc/lto/lto-dump.cc b/gcc/lto/lto-dump.cc
index cb9782722a9..5c4dbf5d297 100644
--- a/gcc/lto/lto-dump.cc
+++ b/gcc/lto/lto-dump.cc
@@ -227,7 +227,6 @@  void dump_list (void)
  {
    dump_list_functions ();
    dump_list_variables ();
-  return;
  }
  
  /* Dump specific variables and functions used in IL.  */
@@ -243,7 +242,6 @@  void dump_symbol ()
  	  printf ("\n");
  	}
      }
-  return;
  }
  
  /* Dump specific gimple body of specified function.  */
@@ -259,19 +257,17 @@  void dump_body ()
      return;
    }
    cgraph_node *cnode;
-  FOR_EACH_FUNCTION (cnode)
-    if (cnode->definition
-	&& !cnode->alias
-	&& !strcmp (cnode->name (), flag_dump_body))
+  FOR_EACH_DEFINED_FUNCTION (cnode)
+    if (!cnode->alias
+	&& !strcmp (cnode->asm_name (), flag_dump_body))
        {
-	printf ("Gimple Body of Function: %s\n", cnode->name ());
+	printf ("GIMPLE body of function: %s\n\n", cnode->asm_name ());
  	cnode->get_untransformed_body ();
  	debug_function (cnode->decl, flags);
  	flag = 1;
        }
    if (!flag)
      error_at (input_location, "Function not found.");
-  return;
  }
  
  /* List of command line options for dumping.  */
@@ -292,13 +288,12 @@  void dump_tool_help ()
      "  -callgraph                Dump the callgraph in graphviz format.\n"
      "  -type-stats               Dump statistics of tree types.\n"
      "  -tree-stats               Dump statistics of trees.\n"
-    "  -gimple-stats             Dump statistics of gimple statements.\n"
-    "  -dump-body=               Dump the specific gimple body.\n"
+    "  -gimple-stats             Dump statistics of GIMPLE statements.\n"
+    "  -dump-body=               Dump the specific GIMPLE body.\n"
      "  -dump-level=              Deciding the optimization level of body.\n"
      "  -help                     Display the dump tool help.\n";
  
    fputs (msg, stdout);
-  return;
  }
  
  unsigned int
@@ -365,7 +360,7 @@  lto_main (void)
  		    "%<--enable-gather-detailed-mem-stats%>.");
        else
  	{
-	  printf ("Tree Statistics\n");
+	  printf ("Tree statistics\n");
  	  dump_tree_statistics ();
  	}
      }