]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stack_usage: Print out the user visibility name too
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 19 May 2026 01:20:14 +0000 (18:20 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sun, 24 May 2026 14:54:36 +0000 (07:54 -0700)
Since the output here should be usable via humans, we
should print out the user realable name and not just the
mangled name. For C, that means we print out the same name
twice which is fine. The mangled name is useful to correspond
the assembly with the stack usage too.

For C++ it will something like:
t.c:2:5:_Z5unopti `int unopt(int)` 16 static

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* toplev.cc (output_stack_usage_1): Print out the human readable
name in quotes.

gcc/testsuite/ChangeLog:

* gcc.dg/stack-usage-1.c: Update testcase.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/testsuite/gcc.dg/stack-usage-1.c
gcc/toplev.cc

index 8714c57c197b1abb0e00ad6b074a328678e2697d..1ba9d059956b5b5fd3c926564c73015d3c0bbdde 100644 (file)
@@ -116,5 +116,5 @@ int foo (void)
   return 0;
 }
 
-/* { dg-final { scan-stack-usage "foo\t\(256|264\)\tstatic" } } */
+/* { dg-final { scan-stack-usage "foo `foo`\t\(256|264\)\tstatic" } } */
 /* { dg-final { cleanup-stack-usage } } */
index 66fa927c53d3d7af2a4be65c0ac7d225f6c118fa..7925462bc583b9a172c520b83749b656b0f27583 100644 (file)
@@ -842,6 +842,10 @@ output_stack_usage_1 (FILE *cf)
       print_decl_identifier (stack_usage_file, current_function_decl,
                             PRINT_DECL_ORIGIN | PRINT_DECL_UNIQUE_NAME
                             | PRINT_DECL_REMAP_DEBUG);
+      fprintf (stack_usage_file, " `");
+      print_decl_identifier (stack_usage_file, current_function_decl,
+                            PRINT_DECL_NAME);
+      fprintf (stack_usage_file, "`");
       fprintf (stack_usage_file, "\t" HOST_WIDE_INT_PRINT_DEC"\t%s\n",
               stack_usage, stack_usage_kind_str[stack_usage_kind]);
     }