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] convert USE_GAS into a compile-time constant


On Tue, Feb 17, 2004 at 01:23:21AM +0100, Bernardo Innocenti wrote:
> Gunther Nikl wrote:
> 
> >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.
> 
> Good idea.
> 
> I can't see you in the "Write after approval" list.  Shall I commit these
> approved patches for you?

  Yes, please - at least the HPUX_ASM patch.

> By the way, m68k-*-aout seems to be the only target that doesn't define 
> USE_GAS. As Ian Lance Taylor said, it should be safe to assume nobody is
> using m68k-*-aout without GAS, therefore we might remove USE_GAS.

  I just checked whether USE_GAS could go and I think it might go. m68k.md
  uses it together with a check with MOTOROLA. Using "jbsr" directly is safe
  there.
  The uses in m68k.c are slightly more difficult to jude. One USE_GAS use
  could safely be removed (second use in m68k_output_mi_thunk): it uses the
  same test as the m68k.md cases. The first use in m68k_output_mi_thunk is
  a bit more difficult for the case "!MOTOROLA": there jra %0,a1" should be
  selected because all GAS versions support "jra" (and there isn't a target
  with !MOTOROLA and USE_GAS). m68k_output_pic_call should probably use the
  instruction selected by USE_GAS.

> No, wait!  OpenBSD still needs it :-(((

  OpenBSD uses GAS without the need to state it and its !MOTOROLA :-)

  I am attaching an updated patch which removes USE_GAS which should be
  safe. If you think removing USE_GAS should be done later, then please
  commit the approved USE_GAS convert patch.

  Gunther

-- cut --

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

	* config.gcc (m68k-*): Remove USE_GAS from tm_defines.
	* config/m68k/m68k.c (m68k_output_pic_call, m68k_output_mi_thunk):
	Do support GAS only.
	* config/m68k/m68k.md (anonymous call and call_value define_insn):
	Likewise.

--- config.gcc~	Mon Feb 16 11:08:39 2004
+++ config.gcc	Tue Feb 17 10:18:51 2004
@@ -1178,20 +1178,20 @@ m68k-*-aout*)
 	;;
 m68k-*-coff*)
 	tmake_file=m68k/t-m68kbare
-	tm_defines="MOTOROLA USE_GAS"
+	tm_defines="MOTOROLA"
 	tm_file="m68k/m68k.h m68k/m68k-none.h m68k/m68kemb.h dbxcoff.h m68k/coff.h dbx.h"
 	use_fixproto=yes
 	;;
 m68020-*-elf* | m68k-*-elf*)
 	tm_file="m68k/m68k.h m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h"
-	tm_defines="MOTOROLA USE_GAS"
+	tm_defines="MOTOROLA"
 	tmake_file=m68k/t-m68kelf
 	extra_parts="crtbegin.o crtend.o"
 	use_fixproto=yes
 	;;
 m68010-*-netbsdelf* | m68k*-*-netbsdelf*)
 	tm_file="${tm_file} dbxelf.h elfos.h netbsd.h netbsd-elf.h m68k/netbsd-elf.h"
-	tm_defines="MOTOROLA USE_GAS"
+	tm_defines="MOTOROLA"
 	case ${target} in
 	m68010*)
 		target_cpu_default="0"
@@ -1211,7 +1211,7 @@ m68k*-*-openbsd*)
 	;;
 m68k-*-uclinux*)		# Motorola m68k/ColdFire running uClinux with uClibc
 	tm_file="m68k/m68k.h m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/uclinux.h"
- 	tm_defines="MOTOROLA USE_GAS"
+ 	tm_defines="MOTOROLA"
 	tmake_file=m68k/t-uclinux
 	use_fixproto=no
 	;;
@@ -1219,13 +1219,13 @@ m68k-*-linux*)		# Motorola m68k's runnin
 				# with ELF format using glibc 2
 				# aka the GNU/Linux C library 6.
 	tm_file="m68k/m68k.h dbxelf.h elfos.h svr4.h linux.h m68k/linux.h"
-	tm_defines="MOTOROLA USE_GAS"
+	tm_defines="MOTOROLA"
 	tmake_file="t-slibgcc-elf-ver t-linux"
 	;;
 m68k-*-rtems*)
 	tmake_file="m68k/t-m68kbare m68k/t-crtstuff t-rtems m68k/t-rtems"
 	tm_file="m68k/m68k.h m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h"
-	tm_defines="MOTOROLA USE_GAS"
+	tm_defines="MOTOROLA"
 	extra_parts="crtbegin.o crtend.o"
 	;;
 mcore-*-elf)
diff -up m68k.old/m68k.c m68k/m68k.c
--- m68k.old/m68k.c	Mon Feb 16 15:07:08 2004
+++ m68k/m68k.c	Tue Feb 17 10:09:44 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
   else if (optimize_size || TARGET_ID_SHARED_LIBRARY)
     out = "move.l %0@GOT(%%a5), %%a1\n\tjsr (%%a1)";
   else
@@ -3373,20 +3369,7 @@ m68k_output_mi_thunk (FILE *file, tree t
       if (TARGET_PCREL)
 	fmt = "bra.l %o0";
       else if ((flag_pic == 1) || TARGET_68020)
-	{
-	  if (MOTOROLA)
-#if defined(USE_GAS)
-	    fmt = "bra.l %0@PLTPC";
-#else
-	    fmt = "bra %0@PLTPC";
-#endif
-	  else /* !MOTOROLA */
-#ifdef USE_GAS
-	    fmt = "bra.l %0";
-#else
-	    fmt = "jra %0,a1";
-#endif
-	}
+	fmt = MOTOROLA ? "bra.l %0@PLTPC" : "jra %0,a1";
       else if (optimize_size || TARGET_ID_SHARED_LIBRARY)
         fmt = "move.l %0@GOT(%%a5), %%a1\n\tjmp (%%a1)";
       else
@@ -3394,11 +3377,7 @@ m68k_output_mi_thunk (FILE *file, tree t
     }
   else
     {
-#if MOTOROLA && !defined (USE_GAS)
-      fmt = "jmp %0";
-#else
       fmt = "jra %0";
-#endif
     }
 
   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	Tue Feb 17 09:56:28 2004
@@ -6241,11 +6241,7 @@
 
   "! flag_pic"
 {
-#if MOTOROLA && !defined (USE_GAS)
-  return "jsr %0";
-#else
   return "jbsr %0";
-#endif
 })
 
 ;; 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
 })
 
 ;; 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]