diff mbox

[RFC] Dump function attributes

Message ID 56094F9A.1040500@mentor.com
State New
Headers show

Commit Message

Tom de Vries Sept. 28, 2015, 2:32 p.m. UTC
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

Comments

Bernd Schmidt Sept. 28, 2015, 3:17 p.m. UTC | #1
On 09/28/2015 04:32 PM, Tom de Vries wrote:
> patch below prints the function attributes in the dump file.

> foo ()
> [ noclone , noinline ]
> {
> ...
>
> Good idea?
>
> If so, do we want one attribute per line?

Only for really long ones I'd think. Patch is ok for now.


Bernd
diff mbox

Patch

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);