/* Print RTL for GNU C Compiler.
Copyright (C) 1987-1991 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC 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 2, or (at your option)
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* How to print out a register name.
We don't use PRINT_REG because some definitions of PRINT_REG
#define DEBUG_PRINT_REG(RTX, CODE, FILE) \
fprintf ((FILE), "%d %s", REGNO (RTX), reg_names[REGNO (RTX)])
/* Array containing all of the register names */
#ifdef DEBUG_REGISTER_NAMES
static char *reg_names
[] = DEBUG_REGISTER_NAMES
;
static char *reg_names
[] = REGISTER_NAMES
;
/* Names for patterns. Non-zero only when linked with insn-output.c. */
extern char **insn_name_ptr
;
/* Print IN_RTX onto OUTFILE. This is the recursive part of printing. */
register char *format_ptr
;
fprintf (outfile
, "\n%s",
(spaces
+ (sizeof spaces
- 1 - indent
* 2)));
fprintf (outfile
, "(nil)");
/* print name of expression code */
fprintf (outfile
, "(%s", GET_RTX_NAME (GET_CODE (in_rtx
)));
if (GET_MODE (in_rtx
) != VOIDmode
)
/* Print REG_NOTE names for EXPR_LIST and INSN_LIST. */
if (GET_CODE (in_rtx
) == EXPR_LIST
|| GET_CODE (in_rtx
) == INSN_LIST
)
fprintf (outfile
, ":%s", GET_REG_NOTE_NAME (GET_MODE (in_rtx
)));
fprintf (outfile
, ":%s", GET_MODE_NAME (GET_MODE (in_rtx
)));
is_insn
= (GET_RTX_CLASS (GET_CODE (in_rtx
)) == 'i');
format_ptr
= GET_RTX_FORMAT (GET_CODE (in_rtx
));
for (i
= 0; i
< GET_RTX_LENGTH (GET_CODE (in_rtx
)); i
++)
if (XSTR (in_rtx
, i
) == 0)
fprintf (outfile
, " \"\"");
fprintf (outfile
, " (\"%s\")", XSTR (in_rtx
, i
));
/* 0 indicates a field for internal use that should not be printed. */
print_rtx (XEXP (in_rtx
, i
));
fprintf (outfile
, "\n%s",
(spaces
+ (sizeof spaces
- 1 - indent
* 2)));
if (NULL
!= XVEC (in_rtx
, i
))
for (j
= 0; j
< XVECLEN (in_rtx
, i
); j
++)
print_rtx (XVECEXP (in_rtx
, i
, j
));
fprintf (outfile
, "\n%s",
(spaces
+ (sizeof spaces
- 1 - indent
* 2)));
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
register int value
= XINT (in_rtx
, i
);
if (GET_CODE (in_rtx
) == REG
&& value
< FIRST_PSEUDO_REGISTER
)
DEBUG_PRINT_REG (in_rtx
, 0, outfile
);
fprintf (outfile
, " %d", value
);
if (is_insn
&& &INSN_CODE (in_rtx
) == &XINT (in_rtx
, i
)
&& XINT (in_rtx
, i
) >= 0)
fprintf (outfile
, " {%s}", insn_name_ptr
[XINT (in_rtx
, i
)]);
/* Print NOTE_INSN names rather than integer codes. */
if (XINT (in_rtx
, i
) <= 0)
fprintf (outfile
, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx
, i
)));
fprintf (outfile
, " %d", XINT (in_rtx
, i
));
if (XEXP (in_rtx
, i
) != NULL
)
fprintf (outfile
, " %d", INSN_UID (XEXP (in_rtx
, i
)));
fprintf (outfile
, " Unknown");
"switch format wrong in rtl.print_rtx(). format was: %c.\n",
/* Call this function from the debugger to see what X looks like. */
/* Count of rtx's to print with debug_rtx_list.
This global exists because gdb user defined commands have no arguments. */
int debug_rtx_count
= 0; /* 0 is treated as equivalent to 1 */
/* 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 on. Negative values print a window around the rtx.
EG: -5 prints 2 rtx's on either side (in addition to the specified rtx). */
count
= n
== 0 ? 1 : n
< 0 ? -n
: n
;
/* If we are printing a window, back up to the start. */
for (i
= count
/ 2; i
> 0; i
--)
for (i
= count
, insn
= x
; i
> 0 && insn
!= 0; i
--, insn
= NEXT_INSN (insn
))
/* Call this function to search an rtx 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. */
while (x
!= 0 && INSN_UID (x
) != uid
)
debug_rtx_list (x
, debug_rtx_count
);
fprintf (stderr
, "insn uid %d not found\n", uid
);
/* External entry point for printing a chain of insns
starting with RTX_FIRST onto file OUTF.
A blank line separates insns.
If RTX_FIRST is not an insn, then it alone is printed, with no newline. */
print_rtl (outf
, rtx_first
)
fprintf (outf
, "(nil)\n");
switch (GET_CODE (rtx_first
))
for (tmp_rtx
= rtx_first
; NULL
!= tmp_rtx
; tmp_rtx
= NEXT_INSN (tmp_rtx
))