public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC] Dump function attributes
@ 2015-09-28 15:07 Tom de Vries
  2015-09-28 15:56 ` Bernd Schmidt
  0 siblings, 1 reply; 8+ messages in thread
From: Tom de Vries @ 2015-09-28 15:07 UTC (permalink / raw)
  To: gcc-patches

Hi,

patch below prints the function attributes in the dump file.

Say we mark a function foo with attributes noinline and noclone like this:
...
int __attribute__((noinline, noclone))
foo (void)
...

Then using this patch, we find in the dump file:
...
;; Function foo (foo, funcdef_no=10, decl_uid=2455, cgraph_uid=10, 
symbol_order=10)

Pass statistics of <pass>: ----------------

foo ()
[ noclone , noinline ]
{
...

Good idea?

If so, do we want one attribute per line?

Thanks,
- Tom

diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index cd7a4b4..c724fde 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7384,6 +7384,13 @@ dump_function_to_file (tree fndecl, FILE *file, 
int flags)
      }
    fprintf (file, ")\n");

+  if (DECL_ATTRIBUTES (fndecl) != NULL_TREE)
+    {
+      fprintf (file, "[ ");
+      print_generic_expr (file, DECL_ATTRIBUTES (fndecl), dump_flags);
+      fprintf (file, "]\n");
+    }
+
    if (flags & TDF_VERBOSE)
      print_node (file, "", fndecl, 2);

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-09-30 12:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28 15:07 [RFC] Dump function attributes Tom de Vries
2015-09-28 15:56 ` Bernd Schmidt
2015-09-29  7:01   ` [patch, committed] " Tom de Vries
2015-09-29 11:29     ` Richard Biener
2015-09-29 11:41       ` Tom de Vries
2015-09-29 11:42         ` Richard Biener
2015-09-30 10:41           ` Tom de Vries
2015-09-30 12:37             ` 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).