+
+/* Handle a %K format for TEXT. Separate from default_tree_printer so
+ it can also be used in front ends.
+ %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
+*/
+
+void
+percent_K_format (text_info *text)
+{
+ tree t = va_arg (*text->args_ptr, tree), block;
+ gcc_assert (text->locus != NULL);
+ *text->locus = EXPR_LOCATION (t);
+ gcc_assert (pp_ti_abstract_origin (text) != NULL);
+ block = TREE_BLOCK (t);
+ *pp_ti_abstract_origin (text) = NULL;
+ while (block
+ && TREE_CODE (block) == BLOCK
+ && BLOCK_ABSTRACT_ORIGIN (block))
+ {
+ tree ao = BLOCK_ABSTRACT_ORIGIN (block);
+
+ while (TREE_CODE (ao) == BLOCK
+ && BLOCK_ABSTRACT_ORIGIN (ao)
+ && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
+ ao = BLOCK_ABSTRACT_ORIGIN (ao);
+
+ if (TREE_CODE (ao) == FUNCTION_DECL)
+ {
+ *pp_ti_abstract_origin (text) = block;
+ break;
+ }
+ block = BLOCK_SUPERCONTEXT (block);
+ }
+}
+
+/* Print the identifier ID to PRETTY-PRINTER. */
+
+void
+pp_base_tree_identifier (pretty_printer *pp, tree id)
+{
+ if (pp_translate_identifiers (pp))
+ {
+ const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
+ pp_append_text (pp, text, text + strlen (text));
+ }
+ else
+ 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, int flags)
+{
+ 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>";
+
+ fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
+ dname, aname, fun->funcdef_no);
+ if (!(flags & TDF_NOUID))
+ fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
+ if (node)
+ {
+ fprintf (dump_file, ", cgraph_uid=%d)%s\n\n", node->uid,
+ 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\n");
+}