GNU Compiler Collection (GCC) Internals: Dump types

Next: Dump examples, Previous: Dump output verbosity, Up: Optimization info [Contents][Index]

#### 9.7.5 Dump types

`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.c` where an informative message about a loop (along with its location) is printed when any of the following flags is enabled

  - - optimization messages
  - - RTL dumps
  - - detailed dumps

      int report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS;
      dump_printf_loc (report_flags, locus,
                       "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.