From ea6cf778dd408c1f4a0a929f5b7b0896843250a1 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 1 Jun 2011 17:42:39 +0000 Subject: Better function header dump From-SVN: r174536 --- gcc/tree-pretty-print.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'gcc/tree-pretty-print.c') 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 = ""; + + 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)); +} -- cgit v1.1