(reg_names): Make it static. Use DEBUG_REGISTER_NAMES if that's defined.
authorRichard Stallman <rms@gnu.org>
Wed, 14 Oct 1992 04:23:52 +0000 (04:23 +0000)
committerRichard Stallman <rms@gnu.org>
Wed, 14 Oct 1992 04:23:52 +0000 (04:23 +0000)
(DEBUG_PRINT_REG): Define if not defined.
(print_rtx): Use DEBUG_PRINT_REG for hard regs.

(reg_name): Moved here.

From-SVN: r2451

gcc/print-rtl.c

index 90d6566..c77e61b 100644 (file)
@@ -24,6 +24,22 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "rtl.h"
 
 
+/* How to print out a register name.
+   We don't use PRINT_REG because some definitions of PRINT_REG
+   don't work here.  */
+#ifndef DEBUG_PRINT_REG
+#define DEBUG_PRINT_REG(RTX, CODE, FILE) \
+  fprintf ((FILE), "%d %s", REGNO (RTX), reg_names[REGNO (RTX)])
+#endif
+
+/* Array containing all of the register names */
+
+#ifdef DEBUG_REGISTER_NAMES
+static char *reg_names[] = DEBUG_REGISTER_NAMES;
+#else
+static char *reg_names[] = REGISTER_NAMES;
+#endif
+
 static FILE *outfile;
 
 char spaces[] = "                                                                                                                                                                ";
@@ -151,11 +167,21 @@ print_rtx (in_rtx)
        break;
 
       case 'i':
-       fprintf (outfile, " %d", XINT (in_rtx, i));
+       {
+         register int value = XINT (in_rtx, i);
+
+         if (GET_CODE (in_rtx) == REG && value < FIRST_PSEUDO_REGISTER)
+           {
+             fputc (' ', outfile);
+             DEBUG_PRINT_REG (in_rtx, 0, outfile);
+           }
+         else
+           fprintf (outfile, " %d", value);
+       }
        if (is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, i)
            && insn_name_ptr
            && XINT (in_rtx, i) >= 0)
-           fprintf (outfile, " {%s}", insn_name_ptr[XINT (in_rtx, i)]);
+         fprintf (outfile, " {%s}", insn_name_ptr[XINT (in_rtx, i)]);
        sawclose = 0;
        break;