This is a generic method for doing formatted output. It takes an
dump_kind which signifies the type of
dump. This method outputs information only when the dumps are enabled
for this particular
dump_kind. Note that the caller doesn’t
need to know if the particular dump is enabled or not, or even the
file name. The caller only needs to decide which dump output
information is relevant, and under what conditions. This determines
the associated flags.
Consider the following example from loop-unroll.c where an informative message about a loop (along with its location) is printed when any of the following flags is enabled
int report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS; dump_printf_loc (report_flags, insn, "loop turned into non-loop; it never loops.\n");
Output basic block.
Output generic expression.
Output gimple statement.
Note that the above methods also have variants prefixed with
_loc, such as
dump_printf_loc, which are similar except
they also output the source location information. The
const dump_location_t &. This class can be constructed from
gimple * or from a
rtx_insn *, and so callers can pass
gimple * or a
rtx_insn * as the
dump_location_t constructor will extract the source location
from the statement or instruction, along with the profile count, and
the location in GCC’s own source code (or the plugin) from which the dump
call was emitted. Only the source location is currently used.
There is also a
dump_user_location_t class, capturing the
source location and profile count, but not the dump emission location,
so that locations in the user’s code can be passed around. This
can also be constructed from a
gimple * and from a
and it too can be passed as the