参照元†
返り値†
/* Print IN_RTX onto m_outfile. This is the recursive part of printing. */
void
rtx_writer::print_rtx (const_rtx in_rtx)
{
int idx = 0;
if (m_sawclose)
{
if (m_simple)
fputc (' ', m_outfile);
else
fprintf (m_outfile, "\n%s%*s", print_rtx_head, m_indent * 2, "");
m_sawclose = 0;
}
if (in_rtx == 0)
{
fputs ("(nil)", m_outfile);
m_sawclose = 1;
return;
}
else if (GET_CODE (in_rtx) > NUM_RTX_CODE)
{
fprintf (m_outfile, "(??? bad code %d\n%s%*s)", GET_CODE (in_rtx),
print_rtx_head, m_indent * 2, "");
m_sawclose = 1;
return;
}
fputc ('(', m_outfile);
/* Print name of expression code. */
/* Handle reuse. */
#ifndef GENERATOR_FILE
if (m_rtx_reuse_manager)
{
int reuse_id;
if (m_rtx_reuse_manager->has_reuse_id (in_rtx, &reuse_id))
{
/* Have we already seen the defn of this rtx? */
if (m_rtx_reuse_manager->seen_def_p (reuse_id))
{
fprintf (m_outfile, "reuse_rtx %i)", reuse_id);
m_sawclose = 1;
return;
}
else
{
/* First time we've seen this reused-rtx. */
fprintf (m_outfile, "%i|", reuse_id);
m_rtx_reuse_manager->set_seen_def (reuse_id);
}
}
}
#endif /* #ifndef GENERATOR_FILE */
/* In compact mode, prefix the code of insns with "c",
giving "cinsn", "cnote" etc. */
if (m_compact && is_a <const rtx_insn *, const struct rtx_def> (in_rtx))
{
/* "ccode_label" is slightly awkward, so special-case it as
just "clabel". */
rtx_code code = GET_CODE (in_rtx);
if (code == CODE_LABEL)
fprintf (m_outfile, "clabel");
else
fprintf (m_outfile, "c%s", GET_RTX_NAME (code));
}
else if (m_simple && CONST_INT_P (in_rtx))
; /* no code. */
else
fprintf (m_outfile, "%s", GET_RTX_NAME (GET_CODE (in_rtx)));
if (! m_simple)
{
if (RTX_FLAG (in_rtx, in_struct))
fputs ("/s", m_outfile);
if (RTX_FLAG (in_rtx, volatil))
fputs ("/v", m_outfile);
if (RTX_FLAG (in_rtx, unchanging))
fputs ("/u", m_outfile);
if (RTX_FLAG (in_rtx, frame_related))
fputs ("/f", m_outfile);
if (RTX_FLAG (in_rtx, jump))
fputs ("/j", m_outfile);
if (RTX_FLAG (in_rtx, call))
fputs ("/c", m_outfile);
if (RTX_FLAG (in_rtx, return_val))
fputs ("/i", m_outfile);
/* Print REG_NOTE names for EXPR_LIST and INSN_LIST. */
if ((GET_CODE (in_rtx) == EXPR_LIST
|| GET_CODE (in_rtx) == INSN_LIST
|| GET_CODE (in_rtx) == INT_LIST)
&& (int)GET_MODE (in_rtx) < REG_NOTE_MAX
&& !m_in_call_function_usage)
fprintf (m_outfile, ":%s",
GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
/* For other rtl, print the mode if it's not VOID. */
else if (GET_MODE (in_rtx) != VOIDmode)
fprintf (m_outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx)));
#ifndef GENERATOR_FILE
if (GET_CODE (in_rtx) == VAR_LOCATION)
{
if (TREE_CODE (PAT_VAR_LOCATION_DECL (in_rtx)) == STRING_CST)
fputs (" <debug string placeholder>", m_outfile);
else
print_mem_expr (m_outfile, PAT_VAR_LOCATION_DECL (in_rtx));
fputc (' ', m_outfile);
print_rtx (PAT_VAR_LOCATION_LOC (in_rtx));
if (PAT_VAR_LOCATION_STATUS (in_rtx)
== VAR_INIT_STATUS_UNINITIALIZED)
fprintf (m_outfile, " [uninit]");
m_sawclose = 1;
idx = GET_RTX_LENGTH (VAR_LOCATION);
}
#endif
}
/* For insns, print the INSN_UID. */
if (INSN_CHAIN_CODE_P (GET_CODE (in_rtx)))
{
if (flag_dump_unnumbered)
fprintf (m_outfile, " #");
else
fprintf (m_outfile, " %d", INSN_UID (in_rtx));
}
/* Determine which is the final operand to print.
In compact mode, skip trailing operands that have the default values
e.g. trailing "(nil)" values. */
int limit = GET_RTX_LENGTH (GET_CODE (in_rtx));
if (m_compact)
while (limit > idx && operand_has_default_value_p (in_rtx, limit - 1))
limit--;
/* Get the format string and skip the first elements if we have handled
them already. */
for (; idx < limit; idx++)
print_rtx_operand (in_rtx, idx);
switch (GET_CODE (in_rtx))
{
#ifndef GENERATOR_FILE
case MEM:
if (__builtin_expect (final_insns_dump_p, false))
fprintf (m_outfile, " [");
else
fprintf (m_outfile, " [" HOST_WIDE_INT_PRINT_DEC,
(HOST_WIDE_INT) MEM_ALIAS_SET (in_rtx));
if (MEM_EXPR (in_rtx))
print_mem_expr (m_outfile, MEM_EXPR (in_rtx));
else
fputc (' ', m_outfile);
if (MEM_OFFSET_KNOWN_P (in_rtx))
{
fprintf (m_outfile, "+");
print_poly_int (m_outfile, MEM_OFFSET (in_rtx));
}
if (MEM_SIZE_KNOWN_P (in_rtx))
{
fprintf (m_outfile, " S");
print_poly_int (m_outfile, MEM_SIZE (in_rtx));
}
if (MEM_ALIGN (in_rtx) != 1)
fprintf (m_outfile, " A%u", MEM_ALIGN (in_rtx));
if (!ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (in_rtx)))
fprintf (m_outfile, " AS%u", MEM_ADDR_SPACE (in_rtx));
fputc (']', m_outfile);
break;
case CONST_DOUBLE:
if (FLOAT_MODE_P (GET_MODE (in_rtx)))
{
char s[60];
real_to_decimal (s, CONST_DOUBLE_REAL_VALUE (in_rtx),
sizeof (s), 0, 1);
fprintf (m_outfile, " %s", s);
real_to_hexadecimal (s, CONST_DOUBLE_REAL_VALUE (in_rtx),
sizeof (s), 0, 1);
fprintf (m_outfile, " [%s]", s);
}
break;
case CONST_WIDE_INT:
fprintf (m_outfile, " ");
cwi_output_hex (m_outfile, in_rtx);
break;
case CONST_POLY_INT:
fprintf (m_outfile, " [");
print_dec (CONST_POLY_INT_COEFFS (in_rtx)[0], m_outfile, SIGNED);
for (unsigned int i = 1; i < NUM_POLY_INT_COEFFS; ++i)
{
fprintf (m_outfile, ", ");
print_dec (CONST_POLY_INT_COEFFS (in_rtx)[i], m_outfile, SIGNED);
}
fprintf (m_outfile, "]");
break;
#endif
case CODE_LABEL:
if (!m_compact)
fprintf (m_outfile, " [%d uses]", LABEL_NUSES (in_rtx));
switch (LABEL_KIND (in_rtx))
{
case LABEL_NORMAL: break;
case LABEL_STATIC_ENTRY: fputs (" [entry]", m_outfile); break;
case LABEL_GLOBAL_ENTRY: fputs (" [global entry]", m_outfile); break;
case LABEL_WEAK_ENTRY: fputs (" [weak entry]", m_outfile); break;
default: gcc_unreachable ();
}
break;
default:
break;
}
fputc (')', m_outfile);
m_sawclose = 1;
}
コメント†