dump_printf
¶This is a generic method for doing formatted output. It takes an
additional argument 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.cc 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");
dump_basic_block
¶Output basic block.
dump_generic_expr
¶Output generic expression.
dump_gimple_stmt
¶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 _loc
variants
take a const dump_location_t &
. This class can be constructed from
a gimple *
or from a rtx_insn *
, and so callers can pass
a gimple *
or a rtx_insn *
as the _loc
argument.
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 rtx_insn *
,
and it too can be passed as the _loc
argument.