aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2022-06-27 11:55:45 +0530
committerPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2022-06-27 11:55:45 +0530
commit2ae7895416a7aa4fc9e7f9fa646dca1f51bdea56 (patch)
tree77cd22f0988d453220513ffc2243cfb5d815e450 /gcc
parent773dffc50fbc768e3282455bd4238a67b1481176 (diff)
downloadgcc-2ae7895416a7aa4fc9e7f9fa646dca1f51bdea56.zip
gcc-2ae7895416a7aa4fc9e7f9fa646dca1f51bdea56.tar.gz
gcc-2ae7895416a7aa4fc9e7f9fa646dca1f51bdea56.tar.bz2
Emit asmname if set for decl with -fdump-statistics-asmname.
gcc/ChangeLog: * statistics.cc: Include tree.h. (get_function_name): New function. (statistics_fini_pass_2): Call get_function_name instead of current_function_name. (statistics_counter_event): Call get_function_name instead of function_name. (statistics_histogram_event): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/statistics.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc/statistics.cc b/gcc/statistics.cc
index 0d596e3..6c21415 100644
--- a/gcc/statistics.cc
+++ b/gcc/statistics.cc
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "context.h"
#include "pass_manager.h"
+#include "tree.h"
static int statistics_dump_nr;
static dump_flags_t statistics_dump_flags;
@@ -113,6 +114,22 @@ curr_statistics_hash (void)
return statistics_hashes[idx];
}
+/* Helper function to return asmname or name of FN
+ depending on whether asmname option is set. */
+
+static const char *
+get_function_name (struct function *fn)
+{
+ if ((statistics_dump_flags & TDF_ASMNAME)
+ && DECL_ASSEMBLER_NAME_SET_P (fn->decl))
+ {
+ tree asmname = decl_assembler_name (fn->decl);
+ if (asmname)
+ return IDENTIFIER_POINTER (asmname);
+ }
+ return function_name (fn);
+}
+
/* Helper for statistics_fini_pass. Print the counter difference
since the last dump for the pass dump files. */
@@ -152,7 +169,7 @@ statistics_fini_pass_2 (statistics_counter **slot,
current_pass->static_pass_number,
current_pass->name,
counter->id, counter->val,
- current_function_name (),
+ get_function_name (cfun),
count);
else
fprintf (statistics_dump_file,
@@ -160,7 +177,7 @@ statistics_fini_pass_2 (statistics_counter **slot,
current_pass->static_pass_number,
current_pass->name,
counter->id,
- current_function_name (),
+ get_function_name (cfun),
count);
counter->prev_dumped_count = counter->count;
return 1;
@@ -329,7 +346,7 @@ statistics_counter_event (struct function *fn, const char *id, int incr)
current_pass ? current_pass->static_pass_number : -1,
current_pass ? current_pass->name : "none",
id,
- function_name (fn),
+ get_function_name (fn),
incr);
}
@@ -359,5 +376,5 @@ statistics_histogram_event (struct function *fn, const char *id, int val)
current_pass->static_pass_number,
current_pass->name,
id, val,
- function_name (fn));
+ get_function_name (fn));
}