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]

Do not


Hi Guys

  I am applying the patch below to fix a small problem with the
  PowerPC instruction parser.  If an opcode had any fake operands,
  these were being counted along with the real ones when computing the
  total number of operands expected for that opcode.  Since fake
  operands do not really exist, they should not be counted.

Cheers
        Nick

2002-09-13  Nick Clifton  <nickc@redhat.com>

	* config/tc-ppc.c (md_assemble): Do not count FAKE operands
	when deciding if any operands have been skipped.

Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.59
diff -c -3 -p -w -r1.59 tc-ppc.c
*** gas/config/tc-ppc.c	5 Sep 2002 00:01:18 -0000	1.59
--- gas/config/tc-ppc.c	13 Sep 2002 09:11:44 -0000
*************** md_assemble (str)
*** 2069,2074 ****
--- 2069,2076 ----
        if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0)
  	{
  	  unsigned int opcount;
+ 	  unsigned int num_operands_expected;
+ 	  unsigned int i;
  
  	  /* There is an optional operand.  Count the number of
  	     commas in the input line.  */
*************** md_assemble (str)
*** 2085,2094 ****
  		}
  	    }
  
  	  /* If there are fewer operands in the line then are called
  	     for by the instruction, we want to skip the optional
  	     operand.  */
! 	  if (opcount < strlen (opcode->operands))
  	    skip_optional = 1;
  
  	  break;
--- 2087,2102 ----
  		}
  	    }
  
+ 	  /* Compute the number of expected operands.
+ 	     Do not count fake operands.  */
+ 	  for (num_operands_expected = 0, i = 0; opcode->operands[i]; i ++)
+ 	    if ((powerpc_operands [opcode->operands[i]].flags & PPC_OPERAND_FAKE) == 0)
+ 	      ++ num_operands_expected;
+ 
  	  /* If there are fewer operands in the line then are called
  	     for by the instruction, we want to skip the optional
  	     operand.  */
! 	  if (opcount < num_operands_expected)
  	    skip_optional = 1;
  
  	  break;



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