* [PATCH] Amend function names with UID when dumping with TDF_UID
@ 2021-10-05 10:35 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-10-05 10:35 UTC (permalink / raw)
To: gcc-patches
The following makes sure to amend more function names with the
associated DECL_UID when dumping with TDF_UID, in particular
function names printed as part of calls and in the function header.
That allows one to more easily follow the call flow of PR102528
where coroutines cause three clones of the name 'test2' that are
not distinguishable otherwise.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
Richard.
2021-10-05 Richard Biener <rguenther@suse.de>
* tree-cfg.c (dump_function_to_file): Dump the UID of the
function as part of the name when requested.
* tree-pretty-print.c (dump_function_name): Dump the UID when
requested and the langhook produced the actual name.
---
gcc/tree-cfg.c | 14 +++++++++++---
gcc/tree-pretty-print.c | 11 ++++++++++-
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 367dcfa20bf..4b4b0b52d9a 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -8127,14 +8127,22 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
fprintf (file, ",%s(%" PRIu64 ")",
profile_quality_as_string (bb->count.quality ()),
bb->count.value ());
- fprintf (file, ")\n%s (", function_name (fun));
+ if (dump_flags & TDF_UID)
+ fprintf (file, ")\n%sD_%u (", function_name (fun),
+ DECL_UID (fndecl));
+ else
+ fprintf (file, ")\n%s (", function_name (fun));
}
}
else
{
print_generic_expr (file, TREE_TYPE (fntype), dump_flags);
- fprintf (file, " %s %s(", function_name (fun),
- tmclone ? "[tm-clone] " : "");
+ if (dump_flags & TDF_UID)
+ fprintf (file, " %sD.%u %s(", function_name (fun), DECL_UID (fndecl),
+ tmclone ? "[tm-clone] " : "");
+ else
+ fprintf (file, " %s %s(", function_name (fun),
+ tmclone ? "[tm-clone] " : "");
}
arg = DECL_ARGUMENTS (fndecl);
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 0b5bdd78f06..81d86ebf97d 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -344,7 +344,16 @@ dump_function_name (pretty_printer *pp, tree node, dump_flags_t flags)
if (CONVERT_EXPR_P (node))
node = TREE_OPERAND (node, 0);
if (DECL_NAME (node) && (flags & TDF_ASMNAME) == 0)
- pp_string (pp, lang_hooks.decl_printable_name (node, 1));
+ {
+ pp_string (pp, lang_hooks.decl_printable_name (node, 1));
+ if (flags & TDF_UID)
+ {
+ char uid_sep = (flags & TDF_GIMPLE) ? '_' : '.';
+ pp_character (pp, 'D');
+ pp_character (pp, uid_sep);
+ pp_scalar (pp, "%u", DECL_UID (node));
+ }
+ }
else
dump_decl_name (pp, node, flags);
}
--
2.31.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-05 10:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 10:35 [PATCH] Amend function names with UID when dumping with TDF_UID Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).