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]

[PATCH] Fix parsing of sh rN_bank operands


The attached patch is needed for sh-*-gas to parse instructions of the form,
e.g. ldc.l @r0+,r0_bank correctly. Currently r0_bank is being accidentally
considered the same as just r0.

I don't have commit rights, so please check it in. Thanks,

Jifl

2000-03-03  Jonathan Larmour  <jlarmour@redhat.co.uk>

	* config/tc-sh.c (parse_reg): Match r[0..7]_bank operands before
	normal operands


-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault
Index: tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.6
diff -u -5 -p -r1.6 tc-sh.c
--- tc-sh.c	2000/02/24 19:46:28	1.6
+++ tc-sh.c	2000/03/03 10:44:09
@@ -263,10 +263,17 @@ parse_reg (src, mode, reg)
      make sure that we won't accidentally recognize a symbol name such as
      'sram' as being a reference to the register 'sr'.  */
 
   if (src[0] == 'r')
     {
+      if (src[1] >= '0' && src[1] <= '7' && strncmp(&src[2], "_bank", 5) == 0
+	  && ! isalnum ((unsigned char) src[7]))
+	{
+	  *mode = A_REG_B;
+	  *reg  = (src[1] - '0');
+	  return 7;
+	}
       if (src[1] == '1')
 	{
 	  if (src[2] >= '0' && src[2] <= '5'
 	      && ! isalnum ((unsigned char) src[3]))
 	    {
@@ -279,17 +286,10 @@ parse_reg (src, mode, reg)
 	  && ! isalnum ((unsigned char) src[2]))
 	{
 	  *mode = A_REG_N;
 	  *reg = (src[1] - '0');
 	  return 2;
-	}
-      if (src[1] >= '0' && src[1] <= '7' && strncmp(&src[2], "_bank", 5) == 0
-	  && ! isalnum ((unsigned char) src[7]))
-	{
-	  *mode = A_REG_B;
-	  *reg  = (src[1] - '0');
-	  return 7;
 	}
 
       if (src[1] == 'e' && ! isalnum ((unsigned char) src[2]))
 	{
 	  *mode = A_RE;

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