aboutsummaryrefslogtreecommitdiff
path: root/gcc/print-rtl.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-11-07 15:19:17 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-11-07 15:19:17 +0000
commitb5fbe7164833774eabba67ecd47b3658d8e2c395 (patch)
tree2a53d93e01ff3266941b8cd229c9472180d2f20d /gcc/print-rtl.c
parent061ee39672f0086c2a9ab6e38f0747d0b9ad18a8 (diff)
downloadgcc-b5fbe7164833774eabba67ecd47b3658d8e2c395.zip
gcc-b5fbe7164833774eabba67ecd47b3658d8e2c395.tar.gz
gcc-b5fbe7164833774eabba67ecd47b3658d8e2c395.tar.bz2
rtx_writer: avoid printing trailing default values
gcc/ChangeLog: * print-rtl.c (rtx_writer::operand_has_default_value_p): New method. (rtx_writer::print_rtx): In compact mode, omit trailing operands that have the default values. * print-rtl.h (rtx_writer::operand_has_default_value_p): New method. * rtl-tests.c (selftest::test_dumping_insns): Remove empty label string from expected dump. (seltest::test_uncond_jump): Remove trailing "(nil)" for REG_NOTES from expected dump. From-SVN: r241908
Diffstat (limited to 'gcc/print-rtl.c')
-rw-r--r--gcc/print-rtl.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 341ecdf..3f15a21 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -564,6 +564,43 @@ rtx_writer::print_rtx_operand (const_rtx in_rtx, int idx)
}
}
+/* Subroutine of rtx_writer::print_rtx.
+ In compact mode, determine if operand IDX of IN_RTX is interesting
+ to dump, or (if in a trailing position) it can be omitted. */
+
+bool
+rtx_writer::operand_has_default_value_p (const_rtx in_rtx, int idx)
+{
+ const char *format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx));
+
+ switch (format_ptr[idx])
+ {
+ case 'e':
+ case 'u':
+ return XEXP (in_rtx, idx) == NULL_RTX;
+
+ case 's':
+ return XSTR (in_rtx, idx) == NULL;
+
+ case '0':
+ switch (GET_CODE (in_rtx))
+ {
+ case JUMP_INSN:
+ /* JUMP_LABELs are always omitted in compact mode, so treat
+ any value here as omittable, so that earlier operands can
+ potentially be omitted also. */
+ return m_compact;
+
+ default:
+ return false;
+
+ }
+
+ default:
+ return false;
+ }
+}
+
/* Print IN_RTX onto m_outfile. This is the recursive part of printing. */
void
@@ -681,9 +718,18 @@ rtx_writer::print_rtx (const_rtx in_rtx)
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 < GET_RTX_LENGTH (GET_CODE (in_rtx)); idx++)
+
+ for (; idx < limit; idx++)
print_rtx_operand (in_rtx, idx);
switch (GET_CODE (in_rtx))