This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch,m68k] Get rid of #ifdef MOTOROLA


On Mon, Nov 10, 2003 at 08:54:52PM +0100, Bernardo Innocenti wrote:
> >  I am going to test the patch.
> 
> Thank you!

  I tested your patch and found only one problem - a missing ",".
  To test your patch I first compiled two cross-compilers, one with and one
  without your patch. Then I used both compilers to build a native compiler
  for m68k-amigaos from the sources with the patch installed. All objects
  in gcc/ and the resulting cc1 were identical. I think thats a good sign.
  I did compare the objects for m68k.c with and without patch too. The size
  difference was 8 bytes with the patched version the smaller one.
  I noticed that compiling m68k.c by GCC 2.95.4 increases the size of the
  object file because GCC emits unused string literals from the (0) case.
  That doesn't happen with 3.[34].

  Attached are my changes to your patch and one small unification I believe
  beeing correct but ;-)

  Gunther

-- cut1 --
--- m68k.c~	Tue Nov 11 13:51:34 2003
+++ m68k.c	Tue Nov 11 15:21:14 2003
@@ -47,7 +47,10 @@ Boston, MA 02111-1307, USA.  */
    if-statements and ?: on it.  This way we have compile-time error checking
    for both the MOTOROLA and MIT code paths.  We do rely on the host compiler
    to optimize away all constant tests.  */
-#ifndef MOTOROLA
+#ifdef MOTOROLA
+#undef MOTOROLA
+#define MOTOROLA 1
+#else
 #define MOTOROLA 0 /* Use the MIT syntax */
 #endif
 
@@ -550,7 +553,7 @@ m68k_output_function_prologue (FILE *str
 	  else
 	    asm_fprintf (stream, MOTOROLA ?
 				   "\tlea (%wd,%Rsp),%Rsp\n" :
-				   "\tlea %Rsp@(%wd),%Rsp\n"
+				   "\tlea %Rsp@(%wd),%Rsp\n",
 			 -fsize_with_regs);
 	}
       else /* fsize_with_regs >= 0x8000 */
@@ -754,8 +757,9 @@ m68k_output_function_epilogue (FILE *str
     {
       /* Because the ColdFire doesn't support moveml with
          complex address modes we make an extra correction here.  */
-      asm_fprintf (stream, "\t%Omove" ASM_DOT "l %I%wd,%Ra1\n",
-	           TARGET_COLDFIRE ? -fsize - current_frame.offset : -fsize);
+      if (TARGET_COLDFIRE)
+	fsize += current_frame.offset;
+      asm_fprintf (stream, "\t%Omove" ASM_DOT "l %I%wd,%Ra1\n", -fsize);
 
       fsize = 0, big = true;
     }
@@ -2985,10 +2989,16 @@ print_operand_address (FILE *file, rtx a
 		if (addr != 0)
 		  {
 		    output_addr_const (file, addr);
-		    if ((flag_pic == 1) && (breg == pic_offset_table_rtx))
-		      fprintf (file, ":w");
-		    if ((flag_pic == 2) && (breg == pic_offset_table_rtx))
-		      fprintf (file, ":l");
+		    if (breg == pic_offset_table_rtx)
+		      switch (flag_pic)
+		        {
+		        case 1:
+		          fprintf (file, ":w"); break;
+		        case 2:
+		          fprintf (file, ":l"); break;
+		        default:
+		          break;
+		        }
 		  }
 		if (addr != 0 && ireg != 0)
 		  putc (',', file);
-- cut1 --

-- cut2 --
--- m68k.c~	Tue Nov 11 15:21:14 2003
+++ m68k.c	Tue Nov 11 15:23:14 2003
@@ -2980,8 +2980,6 @@ print_operand_address (FILE *file, rtx a
 		      }
 		  }
 		fprintf (file, "(%s", reg_names[REGNO (breg)]);
-		if (ireg != 0)
-		  putc (',', file);
 	      }
 	    else /* !MOTOROLA */
 	      {
@@ -3000,9 +2998,9 @@ print_operand_address (FILE *file, rtx a
 		          break;
 		        }
 		  }
-		if (addr != 0 && ireg != 0)
-		  putc (',', file);
 	      } /* !MOTOROLA */
+	    if (ireg != 0)
+	      putc (',', file);
 	    if (ireg != 0 && GET_CODE (ireg) == MULT)
 	      {
 		scale = INTVAL (XEXP (ireg, 1));
-- cut2 --


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]