This is the mail archive of the binutils@sourceware.org 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]

Re: powerpc regnames


On Fri, Oct 19, 2007 at 09:30:53AM +0200, Tristan Gingold wrote:
> I suppose gcc is correct and gas has to be fixed.  I anyone confirm I  
> will work on a patch.

Regardless of whether gcc is correct or not it makes sense to fix this
in gas.

	* config/tc-ppc.c (ppc_parse_name): Skip leading '%'.
	(md_assemble): When parsing PPC_OPERAND_CR, add '%' to set of
	chars that can start a name.

Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.128
diff -u -p -r1.128 tc-ppc.c
--- gas/config/tc-ppc.c	17 Oct 2007 16:45:55 -0000	1.128
+++ gas/config/tc-ppc.c	19 Oct 2007 10:34:12 -0000
@@ -684,6 +684,8 @@ ppc_parse_name (const char *name, expres
   if (! cr_operand)
     return 0;
 
+  if (*name == '%')
+    ++name;
   val = reg_name_search (cr_names, sizeof cr_names / sizeof cr_names[0],
 			 name);
   if (val < 0)
@@ -2454,10 +2456,16 @@ md_assemble (char *str)
 	{
 	  if (! register_name (&ex))
 	    {
+	      char save_lex = lex_type['%'];
+
 	      if ((operand->flags & PPC_OPERAND_CR) != 0)
-		cr_operand = TRUE;
+		{
+		  cr_operand = TRUE;
+		  lex_type['%'] |= LEX_BEGIN_NAME;
+		}
 	      expression (&ex);
 	      cr_operand = FALSE;
+	      lex_type['%'] = save_lex;
 	    }
 	}
 

-- 
Alan Modra
Australia Development Lab, IBM


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