
2004-02-08  Andreas Schwab  <schwab@suse.de>
            Bernardo Innocenti  <bernie@develer.com>

	* config/m68k/m68k.h (REGISTER_NAMES): Prefix each name with
	REGISTER_PREFIX.
	* (M68K_FP_REG_NAME): New macro to specify an alternate name for the
	frame pointer register, overridable by OS targets.
	* (M68K_REGNAME): Macro to obtain register name for asm output,
	eventually replacing %a6 with M68K_FP_REG_NAME.
	* config/m68k/coff.h (REGISTER_NAMES): Don't redefine.
	* config/m68k/linux.h (REGISTER_NAMES): Likewise.
	* config/m68k/m68kelf.h (REGISTER_NAMES): Likewise.
	* config/m68k/netbsd-elf.h (REGISTER_NAMES): Likewise.
	* config/m68k/m68k.c: Use M68K_REGNAME(x) in place of reg_names[x].

diff -u -p -a -r1.17 coff.h
--- gcc-3.4.old/gcc/config/m68k/coff.h	27 Sep 2003 04:48:24 -0000	1.17
+++ gcc-3.4/gcc/config/m68k/coff.h	13 Jan 2004 12:56:19 -0000
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler.
    m68k series COFF object files and debugging, version.
-   Copyright (C) 1994, 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1996, 1997, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -67,14 +67,6 @@ Boston, MA 02111-1307, USA.  */
     else						\
       return "jmp %%pc@(2,%0:w)";			\
   } while (0)
-
-/* Here are the new register names.  */
-
-#undef REGISTER_NAMES
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",	\
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp",	\
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", "argptr" }
 
 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
diff -u -p -a -r1.39 linux.h
--- gcc-3.4/gcc/config/m68k/linux.h	29 Nov 2003 03:08:11 -0000	1.39
+++ gcc-3.4/gcc/config/m68k/linux.h	13 Jan 2004 12:56:19 -0000
@@ -1,6 +1,6 @@
 /* Definitions for Motorola 68k running Linux-based GNU systems with
    ELF format.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -58,17 +58,6 @@ Boston, MA 02111-1307, USA.  */
 #define USER_LABEL_PREFIX ""
 
 #define ASM_COMMENT_START "|"
-
-/* How to refer to registers in assembler output.
-   This sequence is indexed by compiler's hard-register-number.
-   Motorola format uses different register names than defined in m68k.h.  */
-
-#undef REGISTER_NAMES
-
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", "argptr" }
 
 #undef SIZE_TYPE
 #define SIZE_TYPE "unsigned int"
diff -u -p -a -r1.103 m68k.h
--- gcc-3.4/gcc/config/m68k/m68k.h	13 Dec 2003 04:44:07 -0000	1.103
+++ gcc-3.4/gcc/config/m68k/m68k.h	13 Jan 2004 12:56:19 -0000
@@ -1462,9 +1462,26 @@ do { if (cc_prev_status.flags & CC_IN_68
    This sequence is indexed by compiler's hard-register-number (see above).  */
 
 #define REGISTER_NAMES \
-{"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",	\
- "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp",	\
- "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", "argptr" }
+{REGISTER_PREFIX"d0", REGISTER_PREFIX"d1", REGISTER_PREFIX"d2",	\
+ REGISTER_PREFIX"d3", REGISTER_PREFIX"d4", REGISTER_PREFIX"d5",	\
+ REGISTER_PREFIX"d6", REGISTER_PREFIX"d7",			\
+ REGISTER_PREFIX"a0", REGISTER_PREFIX"a1", REGISTER_PREFIX"a2", \
+ REGISTER_PREFIX"a3", REGISTER_PREFIX"a4", REGISTER_PREFIX"a5", \
+ REGISTER_PREFIX"a6", REGISTER_PREFIX"sp",			\
+ REGISTER_PREFIX"fp0", REGISTER_PREFIX"fp1", REGISTER_PREFIX"fp2", \
+ REGISTER_PREFIX"fp3", REGISTER_PREFIX"fp4", REGISTER_PREFIX"fp5", \
+ REGISTER_PREFIX"fp6", REGISTER_PREFIX"fp7", REGISTER_PREFIX"argptr" }
+
+#define M68K_FP_REG_NAME REGISTER_PREFIX"fp"
+
+/* Return a register name by index, handling %fp nicely.
+   We don't replace %fp for targets that don't map it to %a6
+   since it may confuse GAS.  */
+#define M68K_REGNAME(r) ( \
+  ((FRAME_POINTER_REGNUM == 14) \
+    && ((r) == FRAME_POINTER_REGNUM) \
+    && frame_pointer_needed) ? \
+    M68K_FP_REG_NAME : reg_names[(r)])
 
 /* How to renumber registers for dbx and gdb.
    On the Sun-3, the floating point registers have numbers
diff -u -p -a -r1.24 m68kelf.h
--- gcc-3.4/gcc/config/m68k/m68kelf.h	30 Nov 2003 04:20:27 -0000	1.24
+++ gcc-3.4/gcc/config/m68k/m68kelf.h	13 Jan 2004 12:56:19 -0000
@@ -76,18 +76,6 @@ Boston, MA 02111-1307, USA.  */
     else						\
       return "jmp %%pc@(2,%0:w)";			\
   } while (0)
-
-/* How to refer to registers in assembler output.
-   This sequence is indexed by compiler's hard-register-number.
-   Motorola format uses different register names than defined 
-   in m68k.h.  */
-
-#undef REGISTER_NAMES
-
-#define REGISTER_NAMES \
-{"%d0",   "%d1",   "%d2",   "%d3",   "%d4",   "%d5",   "%d6",   "%d7",	     \
- "%a0",   "%a1",   "%a2",   "%a3",   "%a4",   "%a5",   "%a6",   "%sp",	     \
- "%fp0",  "%fp1",  "%fp2",  "%fp3",  "%fp4",  "%fp5",  "%fp6",  "%fp7", "argptr" }
 
 /* This is how to output an assembler line that says to advance the
    location counter to a multiple of 2**LOG bytes.  */
diff -u -p -a -r1.19 netbsd-elf.h
--- gcc-3.4/gcc/config/m68k/netbsd-elf.h	30 Nov 2003 04:20:28 -0000	1.19
+++ gcc-3.4/gcc/config/m68k/netbsd-elf.h	13 Jan 2004 12:56:19 -0000
@@ -173,19 +173,6 @@ while (0)
 
 #undef ASM_COMMENT_START
 #define ASM_COMMENT_START "|"
-
-
-/* How to refer to registers in assembler output.
-   This sequence is indexed by compiler's hard-register-number.
-   Motorola format uses different register names than defined in m68k.h.
-   We also take this chance to convert 'a6' to 'fp' */
-
-#undef REGISTER_NAMES
-
-#define REGISTER_NAMES							\
-{"%d0",   "%d1",   "%d2",   "%d3",   "%d4",   "%d5",   "%d6",   "%d7",	\
- "%a0",   "%a1",   "%a2",   "%a3",   "%a4",   "%a5",   "%fp",   "%sp",	\
- "%fp0",  "%fp1",  "%fp2",  "%fp3",  "%fp4",  "%fp5",  "%fp6",  "%fp7", "argptr" }
 
 
 /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
diff -u -p -r1.122 m68k.c
--- gcc-3.4.old/gcc/config/m68k/m68k.c	5 Jan 2004 04:13:49 -0000	1.122
+++ gcc-3.4/gcc/config/m68k/m68k.c	15 Jan 2004 23:38:08 -0000
@@ -491,25 +491,25 @@ m68k_output_function_prologue (FILE *str
 	fprintf (stream, MOTOROLA ?
 			   "\tpea (%s)\n\tmove.l %s,%s\n" :
 			   "\tpea %s@\n\tmovel %s,%s\n",
-		 reg_names[FRAME_POINTER_REGNUM],
-		 reg_names[STACK_POINTER_REGNUM],
-		 reg_names[FRAME_POINTER_REGNUM]);
+		 M68K_REGNAME(FRAME_POINTER_REGNUM),
+		 M68K_REGNAME(STACK_POINTER_REGNUM),
+		 M68K_REGNAME(FRAME_POINTER_REGNUM));
       else if (fsize_with_regs < 0x8000)
 	asm_fprintf (stream, "\tlink" ASM_DOTW " %s,%I%wd\n",
-		     reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
+		     M68K_REGNAME(FRAME_POINTER_REGNUM), -fsize_with_regs);
       else if (TARGET_68020)
 	asm_fprintf (stream, "\tlink" ASM_DOTL " %s,%I%wd\n",
-		     reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
+		     M68K_REGNAME(FRAME_POINTER_REGNUM), -fsize_with_regs);
       else
 	/* Adding negative number is faster on the 68040.  */
 	asm_fprintf (stream, "\tlink" ASM_DOTW " %s,%I0\n"
 			     "\tadd" ASM_DOT "l %I%wd,%Rsp\n",
-		     reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
+		     M68K_REGNAME(FRAME_POINTER_REGNUM), -fsize_with_regs);
 
       if (dwarf2out_do_frame ())
 	{
 	  char *l;
-          l = (char *) dwarf2out_cfi_label ();   
+          l = (char *) dwarf2out_cfi_label ();
 	  cfa_offset += 4;
 	  dwarf2out_reg_save (l, FRAME_POINTER_REGNUM, -cfa_offset);
 	  dwarf2out_def_cfa (l, FRAME_POINTER_REGNUM, cfa_offset);
@@ -577,17 +577,17 @@ m68k_output_function_prologue (FILE *str
 	}
     }
 
-  /* If the stack limit is not a symbol, check it here.  
+  /* If the stack limit is not a symbol, check it here.
      This has the disadvantage that it may be too late...  */
   if (current_function_limit_stack)
     {
       if (REG_P (stack_limit_rtx))
 	asm_fprintf (stream, "\tcmp" ASM_DOT "l %s,%Rsp\n\ttrapcs\n",
-		     reg_names[REGNO (stack_limit_rtx)]);
+		     M68K_REGNAME(REGNO (stack_limit_rtx)));
       else if (GET_CODE (stack_limit_rtx) != SYMBOL_REF)
 	warning ("stack limit expression is not supported");
     }
-  
+
   if (current_frame.reg_no <= 2)
     {
       /* Store each separately in the same order moveml uses.
@@ -603,22 +603,22 @@ m68k_output_function_prologue (FILE *str
 	    asm_fprintf (stream, MOTOROLA ?
 				   "\t%Omove.l %s,-(%Rsp)\n" :
 				   "\tmovel %s,%Rsp@-\n",
-			 reg_names[15 - i]);
+			 M68K_REGNAME(15 - i));
 	    if (dwarf2out_do_frame ())
 	      {
 		char *l = (char *) dwarf2out_cfi_label ();
 
 		cfa_offset += 4;
- 		if (! frame_pointer_needed)
- 		  dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset);
- 		dwarf2out_reg_save (l, 15 - i, -cfa_offset);
+		if (! frame_pointer_needed)
+		  dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset);
+		dwarf2out_reg_save (l, 15 - i, -cfa_offset);
 	      }
 	  }
     }
   else if (current_frame.reg_rev_mask)
     {
       if (TARGET_COLDFIRE)
-	/* The ColdFire does not support the predecrement form of the 
+	/* The ColdFire does not support the predecrement form of the
 	   MOVEM instruction, so we must adjust the stack pointer and
 	   then use the plain address register indirect mode.
 	   The required register save space was combined earlier with
@@ -653,22 +653,22 @@ m68k_output_function_prologue (FILE *str
       if (TARGET_ID_SHARED_LIBRARY)
 	{
 	  asm_fprintf (stream, "\tmovel %s@(%s), %s\n",
-		       reg_names[PIC_OFFSET_TABLE_REGNUM],
+		       M68K_REGNAME(PIC_OFFSET_TABLE_REGNUM),
 		       m68k_library_id_string,
-		       reg_names[PIC_OFFSET_TABLE_REGNUM]);
+		       M68K_REGNAME(PIC_OFFSET_TABLE_REGNUM));
 	}
       else
 	{
 	  if (MOTOROLA)
 	    asm_fprintf (stream, "\t%Olea (%Rpc, %U_GLOBAL_OFFSET_TABLE_@GOTPC), %s\n",
-	    		 reg_names[PIC_OFFSET_TABLE_REGNUM]);
+			 M68K_REGNAME(PIC_OFFSET_TABLE_REGNUM));
 	  else
 	    {
 	      asm_fprintf (stream, "\tmovel %I%U_GLOBAL_OFFSET_TABLE_, %s\n",
-			   reg_names[PIC_OFFSET_TABLE_REGNUM]);
+			   M68K_REGNAME(PIC_OFFSET_TABLE_REGNUM));
 	      asm_fprintf (stream, "\tlea %Rpc@(0,%s:l),%s\n",
-			   reg_names[PIC_OFFSET_TABLE_REGNUM],
-			   reg_names[PIC_OFFSET_TABLE_REGNUM]);
+			   M68K_REGNAME(PIC_OFFSET_TABLE_REGNUM),
+			   M68K_REGNAME(PIC_OFFSET_TABLE_REGNUM));
 	    }
 	}
     }
@@ -771,31 +771,31 @@ m68k_output_function_epilogue (FILE *str
 		if (MOTOROLA)
 		  asm_fprintf (stream, "\t%Omove.l -%wd(%s,%Ra1.l),%s\n",
 			       offset,
-			       reg_names[FRAME_POINTER_REGNUM],
-			       reg_names[i]);
+			       M68K_REGNAME(FRAME_POINTER_REGNUM),
+			       M68K_REGNAME(i));
 		else
 		  asm_fprintf (stream, "\tmovel %s@(-%wd,%Ra1:l),%s\n",
-			       reg_names[FRAME_POINTER_REGNUM],
+			       M68K_REGNAME(FRAME_POINTER_REGNUM),
 			       offset,
-			       reg_names[i]);
+			       M68K_REGNAME(i));
 	      }
             else if (restore_from_sp)
 	      asm_fprintf (stream, MOTOROLA ?
 				     "\t%Omove.l (%Rsp)+,%s\n" :
 				     "\tmovel %Rsp@+,%s\n",
-			   reg_names[i]);
+			   M68K_REGNAME(i));
             else
 	      {
 	        if (MOTOROLA)
 		  asm_fprintf (stream, "\t%Omove.l -%wd(%s),%s\n",
 			       offset,
-			       reg_names[FRAME_POINTER_REGNUM],
-			       reg_names[i]);
+			       M68K_REGNAME(FRAME_POINTER_REGNUM),
+			       M68K_REGNAME(i));
 		else
 		  asm_fprintf (stream, "\tmovel %s@(-%wd),%s\n",
-			       reg_names[FRAME_POINTER_REGNUM],
+			       M68K_REGNAME(FRAME_POINTER_REGNUM),
 			       offset,
-			       reg_names[i]);
+			       M68K_REGNAME(i));
 	      }
             offset -= 4;
           }
@@ -808,7 +808,7 @@ m68k_output_function_epilogue (FILE *str
           if (big)
             {
               asm_fprintf (stream, "\tadd" ASM_DOT "l %s,%Ra1\n",
-	      		   reg_names[FRAME_POINTER_REGNUM]);
+			   M68K_REGNAME(FRAME_POINTER_REGNUM));
               asm_fprintf (stream, MOTOROLA ?
 				     "\tmovm.l (%Ra1),%I0x%x\n" :
 				     "\tmoveml %Ra1@,%I0x%x\n",
@@ -824,11 +824,11 @@ m68k_output_function_epilogue (FILE *str
 	      if (MOTOROLA)
 		asm_fprintf (stream, "\tmovm.l -%wd(%s),%I0x%x\n",
 			     current_frame.offset + fsize,
-			     reg_names[FRAME_POINTER_REGNUM],
+			     M68K_REGNAME(FRAME_POINTER_REGNUM),
 			     current_frame.reg_mask);
 	      else
 		asm_fprintf (stream, "\tmoveml %s@(-%wd),%I0x%x\n",
-			     reg_names[FRAME_POINTER_REGNUM],
+			     M68K_REGNAME(FRAME_POINTER_REGNUM),
 			     current_frame.offset + fsize,
 			     current_frame.reg_mask);
 	    }
@@ -840,11 +840,11 @@ m68k_output_function_epilogue (FILE *str
 	      if (MOTOROLA)
 		asm_fprintf (stream, "\tmovm.l -%wd(%s,%Ra1.l),%I0x%x\n",
 			     current_frame.offset + fsize,
-			     reg_names[FRAME_POINTER_REGNUM],
+			     M68K_REGNAME(FRAME_POINTER_REGNUM),
 			     current_frame.reg_mask);
 	      else
 		asm_fprintf (stream, "\tmoveml %s@(-%wd,%Ra1:l),%I0x%x\n",
-			     reg_names[FRAME_POINTER_REGNUM],
+			     M68K_REGNAME(FRAME_POINTER_REGNUM),
 			     current_frame.offset + fsize,
 			     current_frame.reg_mask);
 	    }
@@ -860,11 +860,11 @@ m68k_output_function_epilogue (FILE *str
 	      if (MOTOROLA)
 		asm_fprintf (stream, "\tmovm.l -%wd(%s),%I0x%x\n",
 			     current_frame.offset + fsize,
-			     reg_names[FRAME_POINTER_REGNUM],
+			     M68K_REGNAME(FRAME_POINTER_REGNUM),
 			     current_frame.reg_mask);
 	      else
 		asm_fprintf (stream, "\tmoveml %s@(-%wd),%I0x%x\n",
-			     reg_names[FRAME_POINTER_REGNUM],
+			     M68K_REGNAME(FRAME_POINTER_REGNUM),
 			     current_frame.offset + fsize,
 			     current_frame.reg_mask);
 	    }
@@ -877,11 +877,11 @@ m68k_output_function_epilogue (FILE *str
 	  if (MOTOROLA)
 	    asm_fprintf (stream, "\tfmovm -%wd(%s,%Ra1.l),%I0x%x\n",
 		         current_frame.foffset + fsize,
-		         reg_names[FRAME_POINTER_REGNUM],
+		         M68K_REGNAME(FRAME_POINTER_REGNUM),
 		         current_frame.fpu_rev_mask);
 	  else
 	    asm_fprintf (stream, "\tfmovem %s@(-%wd,%Ra1:l),%I0x%x\n",
-			 reg_names[FRAME_POINTER_REGNUM],
+			 M68K_REGNAME(FRAME_POINTER_REGNUM),
 			 current_frame.foffset + fsize,
 			 current_frame.fpu_rev_mask);
 	}
@@ -899,18 +899,17 @@ m68k_output_function_epilogue (FILE *str
 	  if (MOTOROLA)
 	    asm_fprintf (stream, "\tfmovm -%wd(%s),%I0x%x\n",
 			 current_frame.foffset + fsize,
-			 reg_names[FRAME_POINTER_REGNUM],
+			 M68K_REGNAME(FRAME_POINTER_REGNUM),
 			 current_frame.fpu_rev_mask);
 	  else
 	    asm_fprintf (stream, "\tfmovem %s@(-%wd),%I0x%x\n",
-			 reg_names[FRAME_POINTER_REGNUM],
+			 M68K_REGNAME(FRAME_POINTER_REGNUM),
 			 current_frame.foffset + fsize,
 			 current_frame.fpu_rev_mask);
 	}
     }
   if (frame_pointer_needed)
-    fprintf (stream, "\tunlk %s\n",
-	     reg_names[FRAME_POINTER_REGNUM]);
+    fprintf (stream, "\tunlk %s\n", M68K_REGNAME(FRAME_POINTER_REGNUM));
   else if (fsize_with_regs)
     {
       if (fsize_with_regs <= 8)
@@ -2696,7 +2698,7 @@ print_operand (FILE *file, rtx op, int l
     {
       /* This is only for direct addresses with TARGET_PCREL */
       if (GET_CODE (op) != MEM || GET_CODE (XEXP (op, 0)) != SYMBOL_REF
-          || !TARGET_PCREL) 
+          || !TARGET_PCREL)
 	abort ();
       output_addr_const (file, XEXP (op, 0));
     }
@@ -2705,9 +2707,9 @@ print_operand (FILE *file, rtx op, int l
       if (letter == 'R')
 	/* Print out the second register name of a register pair.
 	   I.e., R (6) => 7.  */
-	fputs (reg_names[REGNO (op) + 1], file);
+	fputs (M68K_REGNAME(REGNO (op) + 1), file);
       else
-	fputs (reg_names[REGNO (op)], file);
+	fputs (M68K_REGNAME(REGNO (op)), file);
     }
   else if (GET_CODE (op) == MEM)
     {
@@ -2805,15 +2807,15 @@ print_operand_address (FILE *file, rtx a
   switch (GET_CODE (addr))
     {
       case REG:
-	fprintf (file, MOTOROLA ? "(%s)" : "%s@", reg_names[REGNO (addr)]);
+	fprintf (file, MOTOROLA ? "(%s)" : "%s@", M68K_REGNAME(REGNO (addr)));
 	break;
       case PRE_DEC:
 	fprintf (file, MOTOROLA ? "-(%s)" : "%s@-",
-	         reg_names[REGNO (XEXP (addr, 0))]);
+	         M68K_REGNAME(REGNO (XEXP (addr, 0))));
 	break;
       case POST_INC:
 	fprintf (file, MOTOROLA ? "(%s)+" : "%s@+",
-		 reg_names[REGNO (XEXP (addr, 0))]);
+		 M68K_REGNAME(REGNO (XEXP (addr, 0))));
 	break;
       case PLUS:
 	reg1 = reg2 = ireg = breg = offset = 0;
@@ -2922,14 +2924,14 @@ print_operand_address (FILE *file, rtx a
 	      {
 		ASM_OUTPUT_CASE_FETCH (file,
 			     CODE_LABEL_NUMBER (XEXP (addr, 0)),
-			     reg_names[REGNO (XEXP (ireg, 0))]);
+			     M68K_REGNAME(REGNO (XEXP (ireg, 0))));
 		fprintf (file, "w");
 	      }
 	    else
 	      {
 		ASM_OUTPUT_CASE_FETCH (file,
 			     CODE_LABEL_NUMBER (XEXP (addr, 0)),
-			     reg_names[REGNO (ireg)]);
+			     M68K_REGNAME(REGNO (ireg)));
 		fprintf (file, "l");
 	      }
 	    if (scale != 1)
@@ -2942,7 +2944,7 @@ print_operand_address (FILE *file, rtx a
 	  {
 	    ASM_OUTPUT_CASE_FETCH (file,
 			 CODE_LABEL_NUMBER (XEXP (addr, 0)),
-			 reg_names[REGNO (breg)]);
+			 M68K_REGNAME(REGNO (breg)));
 	    fprintf (file, "l)");
 	    break;
 	  }
@@ -2969,13 +2971,13 @@ print_operand_address (FILE *file, rtx a
 			  fprintf (file, ".w");
 		      }
 		  }
-		fprintf (file, "(%s", reg_names[REGNO (breg)]);
+		fprintf (file, "(%s", M68K_REGNAME(REGNO (breg)));
 		if (ireg != 0)
 		  putc (',', file);
 	      }
 	    else /* !MOTOROLA */
 	      {
-		fprintf (file, "%s@(", reg_names[REGNO (breg)]);
+		fprintf (file, "%s@(", M68K_REGNAME(REGNO (breg)));
 		if (addr != 0)
 		  {
 		    output_addr_const (file, addr);
@@ -3000,21 +3002,21 @@ print_operand_address (FILE *file, rtx a
 	      }
 	    if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND)
 	      fprintf (file, MOTOROLA ? "%s.w" : "%s:w",
-		       reg_names[REGNO (XEXP (ireg, 0))]);
+		       M68K_REGNAME(REGNO (XEXP (ireg, 0))));
 	    else if (ireg != 0)
 	      fprintf (file, MOTOROLA ? "%s.l" : "%s:l",
-		       reg_names[REGNO (ireg)]);
+		       M68K_REGNAME(REGNO (ireg)));
 	    if (scale != 1)
 	      fprintf (file, MOTOROLA ? "*%d" : ":%d", scale);
 	    putc (')', file);
 	    break;
 	  }
 	else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF
-		 && ! (flag_pic && reg1 == pic_offset_table_rtx))	
+		 && ! (flag_pic && reg1 == pic_offset_table_rtx))
 	  {
 	    ASM_OUTPUT_CASE_FETCH (file,
 			 CODE_LABEL_NUMBER (XEXP (addr, 0)),
-			 reg_names[REGNO (reg1)]);
+			 M68K_REGNAME(REGNO (reg1)));
 	    fprintf (file, "l)");
 	    break;
 	  }

