summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/print-rtl.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/print-rtl.c')
-rw-r--r--contrib/gcc/print-rtl.c133
1 files changed, 118 insertions, 15 deletions
diff --git a/contrib/gcc/print-rtl.c b/contrib/gcc/print-rtl.c
index 20d34db..947a9b7 100644
--- a/contrib/gcc/print-rtl.c
+++ b/contrib/gcc/print-rtl.c
@@ -1,5 +1,5 @@
/* Print RTL for GNU C Compiler.
- Copyright (C) 1987, 1988, 1992 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1992, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -20,9 +20,10 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
-#include <ctype.h>
-#include <stdio.h>
+#include "system.h"
#include "rtl.h"
+#include "bitmap.h"
+#include "real.h"
/* How to print out a register name.
@@ -47,17 +48,19 @@ char spaces[] = "
static int sawclose = 0;
+static int indent;
+
/* Names for patterns. Non-zero only when linked with insn-output.c. */
extern char **insn_name_ptr;
+int flag_dump_unnumbered = 0;
/* Print IN_RTX onto OUTFILE. This is the recursive part of printing. */
static void
print_rtx (in_rtx)
register rtx in_rtx;
{
- static int indent;
register int i, j;
register char *format_ptr;
register int is_insn;
@@ -108,6 +111,39 @@ print_rtx (in_rtx)
{
case 'S':
case 's':
+ if (i == 3 && GET_CODE (in_rtx) == NOTE
+ && (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_EH_REGION_BEG
+ || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_EH_REGION_END
+ || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_BEG
+ || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_END))
+ {
+ fprintf (outfile, " %d", NOTE_BLOCK_NUMBER (in_rtx));
+ sawclose = 1;
+ break;
+ }
+
+ if (i == 3 && GET_CODE (in_rtx) == NOTE
+ && (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_RANGE_START
+ || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_RANGE_END))
+ {
+ indent += 2;
+ if (!sawclose)
+ fprintf (outfile, " ");
+ print_rtx (NOTE_RANGE_INFO (in_rtx));
+ indent -= 2;
+ break;
+ }
+
+ if (i == 3 && GET_CODE (in_rtx) == NOTE
+ && NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_LIVE)
+ {
+ if (XBITMAP (in_rtx, i) == NULL)
+ fprintf (outfile, " {null}");
+ else
+ bitmap_print (outfile, XBITMAP (in_rtx, i), " {", "}");
+ sawclose = 0;
+ }
+
if (XSTR (in_rtx, i) == 0)
fprintf (outfile, " \"\"");
else
@@ -158,13 +194,8 @@ print_rtx (in_rtx)
break;
case 'w':
- fprintf (outfile,
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- " %d",
-#else
- " %ld",
-#endif
- XWINT (in_rtx, i));
+ fprintf (outfile, " ");
+ fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, XWINT (in_rtx, i));
break;
case 'i':
@@ -176,6 +207,9 @@ print_rtx (in_rtx)
fputc (' ', outfile);
DEBUG_PRINT_REG (in_rtx, 0, outfile);
}
+ else if (flag_dump_unnumbered
+ && (is_insn || GET_CODE (in_rtx) == NOTE))
+ fprintf (outfile, "#");
else
fprintf (outfile, " %d", value);
}
@@ -198,12 +232,30 @@ print_rtx (in_rtx)
case 'u':
if (XEXP (in_rtx, i) != NULL)
- fprintf (outfile, " %d", INSN_UID (XEXP (in_rtx, i)));
+ {
+ if (flag_dump_unnumbered)
+ fprintf (outfile, "#");
+ else
+ fprintf (outfile, " %d", INSN_UID (XEXP (in_rtx, i)));
+ }
else
fprintf (outfile, " 0");
sawclose = 0;
break;
+ case 'b':
+ if (XBITMAP (in_rtx, i) == NULL)
+ fprintf (outfile, " {null}");
+ else
+ bitmap_print (outfile, XBITMAP (in_rtx, i), " {", "}");
+ sawclose = 0;
+ break;
+
+ case 't':
+ putc (' ', outfile);
+ fprintf (outfile, HOST_PTR_PRINTF, (char *) XTREE (in_rtx, i));
+ break;
+
case '*':
fprintf (outfile, " Unknown");
sawclose = 0;
@@ -216,10 +268,39 @@ print_rtx (in_rtx)
abort ();
}
+#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && LONG_DOUBLE_TYPE_SIZE == 64
+ if (GET_CODE (in_rtx) == CONST_DOUBLE && FLOAT_MODE_P (GET_MODE (in_rtx)))
+ {
+ double val;
+ REAL_VALUE_FROM_CONST_DOUBLE (val, in_rtx);
+ fprintf (outfile, " [%.16g]", val);
+ }
+#endif
+
fprintf (outfile, ")");
sawclose = 1;
}
+/* Print an rtx on the current line of FILE. Initially indent IND
+ characters. */
+
+void
+print_inline_rtx (outf, x, ind)
+ FILE *outf;
+ rtx x;
+ int ind;
+{
+ int oldsaw = sawclose;
+ int oldindent = indent;
+
+ sawclose = 0;
+ indent = ind;
+ outfile = outf;
+ print_rtx (x);
+ sawclose = oldsaw;
+ indent = oldindent;
+}
+
/* Call this function from the debugger to see what X looks like. */
void
@@ -271,7 +352,7 @@ debug_rtx_list (x, n)
The found insn is returned to enable further debugging analysis. */
rtx
-debug_rtx_find(x, uid)
+debug_rtx_find (x, uid)
rtx x;
int uid;
{
@@ -318,8 +399,13 @@ print_rtl (outf, rtx_first)
case BARRIER:
for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx))
{
- print_rtx (tmp_rtx);
- fprintf (outfile, "\n");
+ if (! flag_dump_unnumbered
+ || GET_CODE (tmp_rtx) != NOTE
+ || NOTE_LINE_NUMBER (tmp_rtx) < 0)
+ {
+ print_rtx (tmp_rtx);
+ fprintf (outfile, "\n");
+ }
}
break;
@@ -327,3 +413,20 @@ print_rtl (outf, rtx_first)
print_rtx (rtx_first);
}
}
+
+/* Like print_rtx, except specify a file. */
+
+void
+print_rtl_single (outf, x)
+ FILE *outf;
+ rtx x;
+{
+ outfile = outf;
+ sawclose = 0;
+ if (! flag_dump_unnumbered
+ || GET_CODE (x) != NOTE || NOTE_LINE_NUMBER (x) < 0)
+ {
+ print_rtx (x);
+ putc ('\n', outf);
+ }
+}
OpenPOWER on IntegriCloud