This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

Re: Minor dubious fix for am33 gas


On Apr  1, 2000, Jeffrey A Law <law@cygnus.com> wrote:

> Though as you note, recognizing them may cause problems with older
> am30/mn10300 code if they used those names for in assembly code.

In fact, we'd already cause trouble compiling mn10300 code containing
symbols such as `r0'.  This patch fixes this bug.  While I was at it,
I cleaned up some constants so as to use #defines instead of
literals.  Ok to install?  Head and branch?

BTW, the extra register names need not be defined at all.  The code to
handle them is all already in place.  Adding them to the array was not
needed.

Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@cygnus.com>
	
	* config/tc-mn10300.c (md_pseudo_table): Use constant names.
	(md_begin): Likewise.
	(HAVE_AM33): New macro.
	(md_assemble): Use it.  Match r_regs and xr_regs only if
	HAVE_AM33.
	
Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrieving revision 1.3
diff -u -r1.3 tc-mn10300.c
--- gas/config/tc-mn10300.c	1999/12/01 10:40:07	1.3
+++ gas/config/tc-mn10300.c	2000/04/03 12:44:04
@@ -1,5 +1,5 @@
 /* tc-mn10300.c -- Assembler code for the Matsushita 10300
-   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -118,12 +118,14 @@
 /* The target specific pseudo-ops which we support.  */
 const pseudo_typeS md_pseudo_table[] =
 {
-  { "am30",	set_arch_mach,		300 },
-  { "am33",	set_arch_mach,		330 },
-  { "mn10300",	set_arch_mach,		300 },
+  { "am30",	set_arch_mach,		AM30 },
+  { "am33",	set_arch_mach,		AM33 },
+  { "mn10300",	set_arch_mach,		MN103 },
   {NULL, 0, 0}
 };
 
+#define HAVE_AM33 (current_machine == AM33)
+
 /* Opcode hash table.  */
 static struct hash_control *mn10300_hash;
 
@@ -879,10 +881,10 @@
   linkrelax = 1;
 
   /* Set the default machine type.  */
-  if (!bfd_set_arch_mach (stdoutput, bfd_arch_mn10300, 300))
+  if (!bfd_set_arch_mach (stdoutput, bfd_arch_mn10300, MN103))
     as_warn (_("could not set architecture and machine"));
 
-  current_machine = 300;
+  current_machine = MN103;
 }
 
 void
@@ -942,7 +944,7 @@
       /* If the instruction is not available on the current machine
 	 then it can not possibly match.  */
       if (opcode->machine
-	  && (opcode->machine != current_machine))
+	  && !(opcode->machine == AM33 && HAVE_AM33))
 	goto error;
 
       for (op_idx = 1, opindex_ptr = opcode->operands;
@@ -1207,25 +1209,25 @@
 		      value |= 0x08;
 		      *input_line_pointer = c;
 		    }
-		  else if (current_machine == 330
+		  else if (HAVE_AM33
 			   && strcasecmp (start, "exreg0") == 0)
 		    {
 		      value |= 0x04;
 		      *input_line_pointer = c;
 		    }
-		  else if (current_machine == 330
+		  else if (HAVE_AM33
 			   && strcasecmp (start, "exreg1") == 0)
 		    {
 		      value |= 0x02;
 		      *input_line_pointer = c;
 		    }
-		  else if (current_machine == 330
+		  else if (HAVE_AM33
 			   && strcasecmp (start, "exother") == 0)
 		    {
 		      value |= 0x01;
 		      *input_line_pointer = c;
 		    }
-		  else if (current_machine == 330
+		  else if (HAVE_AM33
 			   && strcasecmp (start, "all") == 0)
 		    {
 		      value |= 0xff;
@@ -1262,13 +1264,13 @@
 	      str = hold;
 	      goto error;
 	    }
-	  else if (r_register_name (&ex))
+	  else if (HAVE_AM33 && r_register_name (&ex))
 	    {
 	      input_line_pointer = hold;
 	      str = hold;
 	      goto error;
 	    }
-	  else if (xr_register_name (&ex))
+	  else if (HAVE_AM33 && xr_register_name (&ex))
 	    {
 	      input_line_pointer = hold;
 	      str = hold;
@@ -1298,7 +1300,8 @@
 		int mask;
 
 		mask = MN10300_OPERAND_DREG | MN10300_OPERAND_AREG;
-		mask |= MN10300_OPERAND_RREG | MN10300_OPERAND_XRREG;
+		if (HAVE_AM33)
+		  mask |= MN10300_OPERAND_RREG | MN10300_OPERAND_XRREG;
 		if ((operand->flags & mask) == 0)
 		  {
 		    input_line_pointer = hold;


-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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