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]

[patch/m68k] convert USE_GAS into a compile-time constant


Hello!

This patch converts all uses of USE_GAS into a compile-time boolean. That
way it can be used in C expressions just like MOTOROLA. Tested by compiling
cc1 with m68k-elf as target.

Gunther

-- cut --

2004-02-16  Gunther Nikl  <gni@gecko.de>

	* config/m68k/m68k.h: Make USE_GAS a compile-time boolean.
	* config/m68k/m68k.c (m68k_output_pic_call, m68k_output_mi_thunk):
	Replace "#ifdef USE_GAS" with C statements.
	* config/m68k/m68k.md (anonymous call and call_value define_insn):
	Likewise.

diff -up m68k.old/m68k.h m68k/m68k.h
--- m68k.old/m68k.h	Mon Feb 16 11:08:51 2004
+++ m68k/m68k.h	Mon Feb 16 15:07:19 2004
@@ -32,6 +32,14 @@ Boston, MA 02111-1307, USA.  */
 # define MOTOROLA 0  /* Use the MIT assembly syntax.  */
 #endif
 
+/* Make USE_GAS a compile-time boolean to be used similar to MOTOROLA.  */
+#ifdef USE_GAS
+# undef USE_GAS
+# define USE_GAS 1
+#else
+# define USE_GAS 0
+#endif
+
 /* Note that some other tm.h files include this one and then override
    many of the definitions that relate to assembler syntax.  */
 
diff -up m68k.old/m68k.c m68k/m68k.c
--- m68k.old/m68k.c	Mon Feb 16 15:07:08 2004
+++ m68k/m68k.c	Mon Feb 16 15:07:19 2004
@@ -1009,11 +1009,7 @@ m68k_output_pic_call(rtx dest)
   else if (TARGET_PCREL)
     out = "bsr.l %o0";
   else if ((flag_pic == 1) || TARGET_68020)
-#if defined(USE_GAS)
-    out = "bsr.l %0@PLTPC";
-#else
-    out = "bsr %0@PLTPC";
-#endif
+    out = USE_GAS ? "bsr.l %0@PLTPC" : "bsr %0@PLTPC";
   else if (optimize_size || TARGET_ID_SHARED_LIBRARY)
     out = "move.l %0@GOT(%%a5), %%a1\n\tjsr (%%a1)";
   else
@@ -3375,17 +3371,9 @@ m68k_output_mi_thunk (FILE *file, tree t
       else if ((flag_pic == 1) || TARGET_68020)
 	{
 	  if (MOTOROLA)
-#if defined(USE_GAS)
-	    fmt = "bra.l %0@PLTPC";
-#else
-	    fmt = "bra %0@PLTPC";
-#endif
+	    fmt = USE_GAS ? "bra.l %0@PLTPC" : "bra %0@PLTPC";
 	  else /* !MOTOROLA */
-#ifdef USE_GAS
-	    fmt = "bra.l %0";
-#else
-	    fmt = "jra %0,a1";
-#endif
+	    fmt = USE_GAS ? "bra.l %0" : "jra %0,a1";
 	}
       else if (optimize_size || TARGET_ID_SHARED_LIBRARY)
         fmt = "move.l %0@GOT(%%a5), %%a1\n\tjmp (%%a1)";
@@ -3394,11 +3382,7 @@ m68k_output_mi_thunk (FILE *file, tree t
     }
   else
     {
-#if MOTOROLA && !defined (USE_GAS)
-      fmt = "jmp %0";
-#else
-      fmt = "jra %0";
-#endif
+      fmt = MOTOROLA && !USE_GAS ? "jmp %0" : "jra %0";
     }
 
   output_asm_insn (fmt, xops);
diff -up m68k.old/m68k.md m68k/m68k.md
--- m68k.old/m68k.md	Wed Feb 11 11:11:37 2004
+++ m68k/m68k.md	Mon Feb 16 15:07:19 2004
@@ -6241,11 +6241,7 @@
 
   "! flag_pic"
 {
-#if MOTOROLA && !defined (USE_GAS)
-  return "jsr %0";
-#else
-  return "jbsr %0";
-#endif
+  return MOTOROLA && !USE_GAS ? "jsr %0" : "jbsr %0";
 })
 
 ;; This is a PIC call sequence.
@@ -6283,11 +6279,7 @@
   ;; Operand 2 not really used on the m68000.
   "! flag_pic"
 {
-#if MOTOROLA && !defined (USE_GAS)
-  return "jsr %1";
-#else
-  return "jbsr %1";
-#endif
+  return MOTOROLA && !USE_GAS ? "jsr %1" : "jbsr %1";
 })
 
 ;; This is a PIC call_value

-- cut --


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