aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-pretty-print.c
diff options
context:
space:
mode:
authorDavid Li <davidxl@google.com>2011-06-01 17:42:39 +0000
committerXinliang David Li <davidxl@gcc.gnu.org>2011-06-01 17:42:39 +0000
commitea6cf778dd408c1f4a0a929f5b7b0896843250a1 (patch)
treebd47a6c1db5bf72c650753ad4f7238f47f6f6d3c /gcc/tree-pretty-print.c
parenteeeb9b49bdae0cd4fe6bf4dc3bd75d401ae5c66d (diff)
downloadgcc-ea6cf778dd408c1f4a0a929f5b7b0896843250a1.zip
gcc-ea6cf778dd408c1f4a0a929f5b7b0896843250a1.tar.gz
gcc-ea6cf778dd408c1f4a0a929f5b7b0896843250a1.tar.bz2
Better function header dump
From-SVN: r174536
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r--gcc/tree-pretty-print.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index f2f5a22..f498819 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -3013,3 +3013,39 @@ pp_base_tree_identifier (pretty_printer *pp, tree id)
pp_append_text (pp, IDENTIFIER_POINTER (id),
IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
}
+
+/* A helper function that is used to dump function information before the
+ function dump. */
+
+void
+dump_function_header (FILE *dump_file, tree fdecl)
+{
+ const char *dname, *aname;
+ struct cgraph_node *node = cgraph_get_node (fdecl);
+ struct function *fun = DECL_STRUCT_FUNCTION (fdecl);
+
+ dname = lang_hooks.decl_printable_name (fdecl, 2);
+
+ if (DECL_ASSEMBLER_NAME_SET_P (fdecl))
+ aname = (IDENTIFIER_POINTER
+ (DECL_ASSEMBLER_NAME (fdecl)));
+ else
+ aname = "<unset-asm-name>";
+
+ if (node)
+ {
+ fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d, decl_uid = %d, cgraph_uid=%d)",
+ dname, aname, fun->funcdef_no, DECL_UID(fdecl), node->uid);
+ fprintf (dump_file, "%s\n\n",
+ node->frequency == NODE_FREQUENCY_HOT
+ ? " (hot)"
+ : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
+ ? " (unlikely executed)"
+ : node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
+ ? " (executed once)"
+ : "");
+ }
+ else
+ fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d, decl_uid = %d)",
+ dname, aname, fun->funcdef_no, DECL_UID(fdecl));
+}