GCC Middle and Back End API Reference
print-rtl.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "alias.h"
#include "tree.h"
#include "basic-block.h"
#include "print-tree.h"
#include "flags.h"
#include "predict.h"
#include "function.h"
#include "cfg.h"
#include "diagnostic.h"
#include "tree-pretty-print.h"
#include "alloc-pool.h"
#include "cselib.h"
#include "dumpfile.h"
#include "dwarf2out.h"
#include "pretty-print.h"
#include "print-rtl.h"
#include "rtl-iter.h"
Include dependency graph for print-rtl.cc:

Functions

static bool uses_rtx_reuse_p (const_rtx x)
 
void print_mem_expr (FILE *outfile, const_tree expr)
 
static void print_poly_int (FILE *file, poly_int64 x)
 
void print_inline_rtx (FILE *outf, const_rtx x, int ind)
 
DEBUG_FUNCTION void debug_rtx (const_rtx x)
 
DEBUG_FUNCTION void debug (const rtx_def &ref)
 
DEBUG_FUNCTION void debug (const rtx_def *ptr)
 
static void debug_slim (const_rtx x)
 
DEBUG_FUNCTION void debug_rtx_list (const rtx_insn *x, int n)
 
DEBUG_FUNCTION void debug_rtx_range (const rtx_insn *start, const rtx_insn *end)
 
DEBUG_FUNCTION const rtx_insndebug_rtx_find (const rtx_insn *x, int uid)
 
void print_rtl (FILE *outf, const_rtx rtx_first)
 
void print_rtl_single (FILE *outf, const_rtx x)
 
void print_simple_rtl (FILE *outf, const_rtx x)
 
void print_rtx_insn_vec (FILE *file, const vec< rtx_insn * > &vec)
 
static void print_exp (pretty_printer *pp, const_rtx x, int verbose)
 
void print_value (pretty_printer *pp, const_rtx x, int verbose)
 
void print_pattern (pretty_printer *pp, const_rtx x, int verbose)
 
void print_insn (pretty_printer *pp, const rtx_insn *x, int verbose)
 
void print_insn_with_notes (pretty_printer *pp, const rtx_insn *x)
 
void dump_value_slim (FILE *f, const_rtx x, int verbose)
 
void dump_insn_slim (FILE *f, const rtx_insn *x)
 
void dump_rtl_slim (FILE *f, const rtx_insn *first, const rtx_insn *last, int count, int flags)
 
void rtl_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
 
const char * str_pattern_slim (const_rtx x)
 
void debug_insn_slim (const rtx_insn *)
 
void debug_rtl_slim (FILE *, const rtx_insn *, const rtx_insn *, int, int)
 
DEBUG_FUNCTION void debug_rtl_slim (const rtx_insn *first, const rtx_insn *last, int count, int flags)
 
void debug_bb_slim (basic_block)
 
void debug_bb_n_slim (int)
 

Variables

const char * print_rtx_head = ""
 
DEBUG_VARIABLE int debug_rtx_count = 0
 

Function Documentation

◆ debug() [1/2]

DEBUG_FUNCTION void debug ( const rtx_def & ref)
Dump rtx REF.   

References debug_rtx().

◆ debug() [2/2]

DEBUG_FUNCTION void debug ( const rtx_def * ptr)

References debug.

◆ debug_bb_n_slim()

DEBUG_FUNCTION void debug_bb_n_slim ( int n)
extern

◆ debug_bb_slim()

DEBUG_FUNCTION void debug_bb_slim ( basic_block bb)
extern

References debug_bb(), TDF_BLOCKS, and TDF_SLIM.

Referenced by debug_bb_n_slim().

◆ debug_insn_slim()

DEBUG_FUNCTION void debug_insn_slim ( const rtx_insn * x)
extern
Emit a slim dump of X (an insn) to stderr.   

References dump_insn_slim().

◆ debug_rtl_slim() [1/2]

DEBUG_FUNCTION void debug_rtl_slim ( const rtx_insn * first,
const rtx_insn * last,
int count,
int flags )

References count, dump_rtl_slim(), and last.

◆ debug_rtl_slim() [2/2]

void debug_rtl_slim ( FILE * ,
const rtx_insn * ,
const rtx_insn * ,
int ,
int  )
extern
Same as above, but using dump_rtl_slim.   

◆ debug_rtx()

DEBUG_FUNCTION void debug_rtx ( const_rtx x)
Call this function from the debugger to see what X looks like.   

References NULL, and rtx_writer::print_rtx().

Referenced by _fatal_insn(), debug(), debug_df_insn(), debug_dv(), debug_rtx_list(), debug_rtx_range(), make_insn_raw(), rtl_verify_fallthru(), and verify_rtx_sharing().

◆ debug_rtx_find()

DEBUG_FUNCTION const rtx_insn * debug_rtx_find ( const rtx_insn * x,
int uid )
Call this function to search an rtx_insn list to find one with insn uid UID,
and then call debug_rtx_list to print it, using DEBUG_RTX_COUNT.
The found insn is returned to enable further debugging analysis.   

References debug_rtx_count, debug_rtx_list(), INSN_UID(), and NEXT_INSN().

◆ debug_rtx_list()

DEBUG_FUNCTION void debug_rtx_list ( const rtx_insn * x,
int n )
Call this function to print list from X on.

N is a count of the rtx's to print. Positive values print from the specified
rtx_insn on.  Negative values print a window around the rtx_insn.
EG: -5 prints 2 rtx_insn's on either side (in addition to the specified
rtx_insn).   

References count, debug_rtx(), i, NEXT_INSN(), and PREV_INSN().

Referenced by debug_rtx_find().

◆ debug_rtx_range()

DEBUG_FUNCTION void debug_rtx_range ( const rtx_insn * start,
const rtx_insn * end )
Call this function to print an rtx_insn list from START to END
inclusive.   

References debug_rtx(), end(), and NEXT_INSN().

◆ debug_slim()

static void debug_slim ( const_rtx x)
static
Like debug_rtx but with no newline, as debug_helper will add one.

Note: No debug_slim(rtx_insn *) variant implemented, as this
function can serve for both rtx and rtx_insn.   

References NULL, and rtx_writer::print_rtx().

◆ dump_insn_slim()

◆ dump_rtl_slim()

void dump_rtl_slim ( FILE * f,
const rtx_insn * first,
const rtx_insn * last,
int count,
int flags )
Same as above, but stop at LAST or when COUNT == 0.
If COUNT < 0 it will stop only at LAST or NULL rtx.   

References count, last, NEXT_INSN(), NULL, pp_flush(), print_insn_with_notes(), and pretty_printer::set_output_stream().

Referenced by debug_rtl_slim(), inherit_reload_reg(), lra_dump_insns(), lra_process_new_insns(), and split_reg().

◆ dump_value_slim()

void dump_value_slim ( FILE * f,
const_rtx x,
int verbose )
Print X, an RTL value node, to file F in slim format.  Include
additional information if VERBOSE is nonzero.

Value nodes are constants, registers, labels, symbols and
memory.   

References pp_flush(), print_value(), pretty_printer::set_output_stream(), and verbose.

Referenced by curr_insn_transform(), equiv_address_substitution(), get_reload_reg(), ira_update_equiv_info_by_shuffle_insn(), and process_addr_reg().

◆ print_exp()

static void print_exp ( pretty_printer * pp,
const_rtx x,
int verbose )
static
The functions below  try to print RTL in a form resembling assembler
mnemonics.  Because this form is more concise than the "traditional" form
of RTL printing in Lisp-style, the form printed by this file is called
"slim".  RTL dumps in slim format can be obtained by appending the "-slim"
option to -fdump-rtl-<pass>.  Control flow graph output as a DOT file is
always printed in slim form.

The normal interface to the functionality provided in this pretty-printer
is through the dump_*_slim functions to print to a stream, or via the
print_*_slim functions to print into a user's pretty-printer.

It is also possible to obtain a string for a single pattern as a string
pointer, via str_pattern_slim, but this usage is discouraged.   
This recognizes rtx'en classified as expressions.  These are always
represent some action on values or results of other expression, that
may be stored in objects representing values.   

References CONST_INT_P, GEN_INT, GET_CODE, GET_RTX_CLASS, GET_RTX_NAME, i, INTVAL, NULL_RTX, pp_comma, pp_decimal_int, pp_left_bracket, pp_left_paren, pp_right_paren, pp_string(), print_pattern(), print_value(), RTX_BIN_ARITH, RTX_COMM_ARITH, RTX_COMM_COMPARE, RTX_COMPARE, RTX_TERNARY, RTX_UNARY, TRAP_CONDITION, verbose, XEXP, XINT, XVECEXP, and XVECLEN.

Referenced by print_pattern(), and print_value().

◆ print_inline_rtx()

◆ print_insn()

void print_insn ( pretty_printer * pp,
const rtx_insn * x,
int verbose )
This is the main function in slim rtl visualization mechanism.

X is an insn, to be printed into PP.

This function tries to print it properly in human-readable form,
resembling assembler mnemonics (instead of the older Lisp-style
form).

If VERBOSE is TRUE, insns are printed with more complete (but
longer) pattern names and with extra information, and prefixed
with their INSN_UIDs.   

References BLOCK_NUMBER, DEBUG_MARKER_INSN_P, DEBUG_TEMP_UID, DECL_NAME, DECL_P, DECL_UID, gcc_unreachable, GET_CODE, GET_NOTE_INSN_NAME, IDENTIFIER_POINTER, INSN_DEBUG_MARKER_KIND, INSN_UID(), INSN_VAR_LOCATION_DECL, INSN_VAR_LOCATION_LOC, NOTE_BASIC_BLOCK, NOTE_BLOCK, NOTE_DELETED_LABEL_NAME, NOTE_EH_HANDLER, NOTE_KIND, NOTE_VAR_LOCATION, NULL, PATTERN(), pp_left_brace, pp_printf(), pp_right_brace, pp_string(), print_pattern(), TREE_CODE, VAR_LOC_UNKNOWN_P, verbose, and XVECEXP.

Referenced by print_insn_with_notes().

◆ print_insn_with_notes()

void print_insn_with_notes ( pretty_printer * pp,
const rtx_insn * x )
Pretty-print a slim dump of X (an insn) to PP, including any register
note attached to the instruction.   

References GET_CODE, GET_REG_NOTE_NAME, INSN_P, pp_newline(), pp_printf(), pp_string(), print_insn(), print_pattern(), print_rtx_head, REG_NOTE_KIND, REG_NOTES, XEXP, and XINT.

Referenced by dump_insn_slim(), dump_rtl_slim(), print_pattern(), and rtl_dump_bb_for_graph().

◆ print_mem_expr()

◆ print_pattern()

◆ print_poly_int()

◆ print_rtl()

◆ print_rtl_single()

◆ print_rtx_insn_vec()

void print_rtx_insn_vec ( FILE * file,
const vec< rtx_insn * > & vec )
Print the elements of VEC to FILE.   

References fputc(), i, and print_rtl_single().

Referenced by print_ldst_list(), and print_store_motion_mems().

◆ print_simple_rtl()

void print_simple_rtl ( FILE * outf,
const_rtx x )
Like print_rtl except without all the detail; for example,
if RTX is a CONST_INT then print in decimal format.   

References NULL, and rtx_writer::print_rtl().

Referenced by insert_part_to_rtx_on_edge(), insert_rtx_to_part_on_edge(), mark_reg_dependencies(), replace_read(), and store_modifies_mem_p().

◆ print_value()

◆ rtl_dump_bb_for_graph()

void rtl_dump_bb_for_graph ( pretty_printer * pp,
basic_block bb )
Dumps basic block BB to pretty-printer PP in slim form and without and
no indentation, for use as a label of a DOT graph record-node.   

References FOR_BB_INSNS, pp_bar, pp_write_text_as_dot_label_to_stream(), pp_write_text_to_stream(), and print_insn_with_notes().

◆ str_pattern_slim()

const char * str_pattern_slim ( const_rtx x)
Pretty-print pattern X of some insn in non-verbose mode.
Return a string pointer to the pretty-printer buffer.

This function is only exported exists only to accommodate some older users
of the slim RTL pretty printers.  Please do not use it for new code.   

References ggc_strdup, pp_formatted_text(), and print_pattern().

◆ uses_rtx_reuse_p()

static bool uses_rtx_reuse_p ( const_rtx x)
static
Determine if X is of a kind suitable for dumping via reuse_rtx.   

References CASE_CONST_UNIQUE, GET_CODE, and NULL.

Referenced by rtx_reuse_manager::preprocess().

Variable Documentation

◆ debug_rtx_count

DEBUG_VARIABLE int debug_rtx_count = 0
Count of rtx's to print with debug_rtx_list.
This global exists because gdb user defined commands have no arguments.   

Referenced by debug_rtx_find().

◆ print_rtx_head

const char* print_rtx_head = ""
Print RTL for GCC.
   Copyright (C) 1987-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
This file is compiled twice: once for the generator programs,
once for the compiler.   
These headers all define things which are not available in
generator programs.   
Disable warnings about quoting issues in the pp_xxx calls below
that (intentionally) don't follow GCC diagnostic conventions.   
String printed at beginning of each RTL when it is dumped.
This string is set to ASM_COMMENT_START when the RTL is dumped in
the assembly output file.   

Referenced by final_scan_insn_1(), print_insn_with_notes(), print_pattern(), rtx_writer::print_rtl(), rtx_writer::print_rtl_single_with_indent(), print_rtl_with_bb(), rtx_writer::print_rtx(), rtx_writer::print_rtx_operand_code_0(), rtx_writer::print_rtx_operand_code_e(), and rtx_writer::print_rtx_operand_codes_E_and_V().