FreeBSD/contrib/binutils/gas/config/tc-arm.c
/* Parse a PSR flag operand.  The value returned is FAIL on syntax error,
   or a bitmask suitable to be or-ed into the ARM msr instruction.  */
Parse a PSR flag operand.  The value returned is FAIL on syntax error,
or a bitmask suitable to be or-ed into the ARM msr instruction.
Parse a PSR flag operand . The value returned is FAIL on syntax error or a bitmask suitable to be or - ed into the ARM msr instruction .
static int
parse_psr (char **str)
{
  char *p;
  unsigned long psr_field;
  const struct asm_psr *psr;
  char *start;
  p = *str;
  if (strncasecmp (p, "SPSR", 4) == 0)
    psr_field = SPSR_BIT;
  else if (strncasecmp (p, "CPSR", 4) == 0)
    psr_field = 0;
  else
    {
      start = p;
      do
	p++;
      while (ISALNUM (*p) || *p == '_');
      psr = hash_find_n (arm_v7m_psr_hsh, start, p - start);
      if (!psr)
	return FAIL;
      *str = p;
      return psr->field;
    }
  p += 4;
  if (*p == '_')
    {
      p++;
      start = p;
      do
	p++;
      while (ISALNUM (*p) || *p == '_');
      psr = hash_find_n (arm_psr_hsh, start, p - start);
      if (!psr)
	goto error;
      psr_field |= psr->field;
    }
  else
    {
      if (ISALNUM (*p))
	goto error;    
      psr_field |= (PSR_c | PSR_f);
    }
  *str = p;
  return psr_field;
 error:
  inst.error = _("flag for {c}psr instruction expected");
  return FAIL;
}
static int parse_psr ( char * * str ) { char * p ; unsigned long psr_field ; const struct asm_psr * psr ; char * start ; p = * str ; if ( strncasecmp ( p , " " , 4 ) == 0 ) psr_field = SPSR_BIT ; else if ( strncasecmp ( p , " " , 4 ) == 0 ) psr_field = 0 ; else { start = p ; do p ++ ; while ( ISALNUM ( * p ) || * p == ' ' ) ; psr = hash_find_n ( arm_v7m_psr_hsh , start , p - start ) ; if ( ! psr ) return FAIL ; * str = p ; return psr -> field ; } p += 4 ; if ( * p == ' ' ) { p ++ ; start = p ; do p ++ ; while ( ISALNUM ( * p ) || * p == ' ' ) ; psr = hash_find_n ( arm_psr_hsh , start , p - start ) ; if ( ! psr ) goto error ; psr_field |= psr -> field ; } else { if ( ISALNUM ( * p ) ) goto error ; psr_field |= ( PSR_c | PSR_f ) ; } * str = p ; return psr_field ; error : inst . error = _ ( " " ) ; return FAIL ; }
Parse a PSR flag operand.
Parse a PSR flag operand .
/* CPSR's and SPSR's can now be lowercase.  This is just a convenience
     feature for ease of use and backwards compatibility.  */ /* A suffix follows.  */ /* Garbage after "[CS]PSR".  */