Tue Nov 10 09:50:25 1992 Ian Lance Taylor (ian@cygnus.com)
+ * tc-m68k.c (m68k_reg_parse): If REGISTER_PREFIX isn't defined,
+ still accept (but don't require) OPTIONAL_REGISTER_PREFIX before
+ the register name.
+ * tc-m68k.h (OPTIONAL_REGISTER_PREFIX): Define to be "%", if not
+ M68KCOFF.
+
* obj-coffbfd.c (fill_section): set STYP_NOLOAD bit for .bss
section.
* advance the pointer.
*/
-enum _register
-m68k_reg_parse(ccp)
- register char **ccp;
+enum _register m68k_reg_parse(ccp)
+register char **ccp;
{
char *start = *ccp;
+ char c;
+ char *p;
+ symbolS *symbolP;
#ifdef REGISTER_PREFIX
- if (*start == REGISTER_PREFIX)
- ++start;
+ if (*start != REGISTER_PREFIX)
+ return FAIL;
+ p = start + 1;
+#else
+ p = start;
+ if (*p == OPTIONAL_REGISTER_PREFIX)
+ p++, start++;
#endif
+ if (!isalpha (*p) || !is_name_beginner (*p))
+ return FAIL;
- if (isalpha(*start) && is_name_beginner(*start))
- {
- char c;
- char *p = start;
- symbolS *symbolP;
-
- c = *p++;
- while (isalpha(c) || isdigit(c) || c == '_')
- {
- c = *p++;
- }
+ c = *p++;
+ while (isalpha(c) || isdigit(c) || c == '_')
+ {
+ c = *p++;
+ }
- * -- p = 0;
- symbolP = symbol_find(start);
- *p = c;
+ * -- p = 0;
+ symbolP = symbol_find(start);
+ *p = c;
- if (symbolP && S_GET_SEGMENT(symbolP) == SEG_REGISTER)
+ if (symbolP && S_GET_SEGMENT(symbolP) == SEG_REGISTER)
{
*ccp = p;
return S_GET_VALUE(symbolP);
}
- }
- return FAIL;
-
+ return FAIL;
}
#define SKIP_WHITE() { str++; if(*str==' ') str++;}
#ifdef REGISTER_PREFIX
alt_notend_table[REGISTER_PREFIX] = 1;
#endif
+#ifdef OPTIONAL_REGISTER_PREFIX
+ alt_notend_table[OPTIONAL_REGISTER_PREFIX] = 1;
+#endif
#ifndef MIT_SYNTAX_ONLY
/* Insert pseudo ops, these have to go into the opcode table since