This is the mail archive of the binutils@sources.redhat.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]
Other format: [Raw text]

MN10300 gas: reject invalid uses of `epsw'


When assembling for the original mn10300/AM30, we accept `epsw' as a
symbol name.  On AM33, `epsw' became a register name, that can be
copied only to data registers with `mov epsw, d[0-3]'.  We currently
accept silently instructions such as `mov epsw, a[0-3]' and encode
`epsw' as a symbol name.

I'm pretty sure we should treat epsw as a register name whenever we
encounter it on AM33, but I'm not sure what to do about epsw and pc
when we encounter them while assembling for the AM30.  It seems to me
that they should be regarded as symbol names, since code written
originally for the AM30 could not have known that these names were
going to be reserved, and might well have used them.  On the other
hand, when porting code from AM30 to AM33, it might be nice to have
uses of register names available on AM33 as errors, so I'm confused as
to what would be best to do.

Comments?  Ok to install?  Ok for the 2.12 branch?

Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/tc-mn10300.c (other_registers): Added `epsw'.  Mark `pc'
	and `epsw' as available on AM33 and above only.
	(other_register_name): Add logic to handle machine type encoded in
	reg_number.

Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrieving revision 1.34
diff -u -p -r1.34 tc-mn10300.c
--- gas/config/tc-mn10300.c 2002/01/23 01:52:18 1.34
+++ gas/config/tc-mn10300.c 2002/02/11 16:19:29
@@ -1,5 +1,5 @@
 /* tc-mn10300.c -- Assembler code for the Matsushita 10300
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -234,10 +234,14 @@ static const struct reg_name xr_register
 #define XR_REG_NAME_CNT					\
   (sizeof (xr_registers) / sizeof (struct reg_name))
 
+/* We abuse the `value' field, that would be otherwise unused, to
+   encode the architecture on which (access to) the register was
+   introduced.  */
 static const struct reg_name other_registers[] =
 {
+  { "epsw", AM33 },
   { "mdr", 0 },
-  { "pc", 0 },
+  { "pc", AM33 },
   { "psw", 0 },
   { "sp", 0 },
 };
@@ -494,10 +498,11 @@ other_register_name (expressionP)
   *input_line_pointer = c;
 
   /* Look to see if it's in the register table.  */
-  if (reg_number >= 0)
+  if (reg_number == 0
+      || (reg_number == AM33 && HAVE_AM33))
     {
       expressionP->X_op = O_register;
-      expressionP->X_add_number = reg_number;
+      expressionP->X_add_number = 0;
 
       /* Make the rest nice.  */
       expressionP->X_add_symbol = NULL;

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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