This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Thumb32 assembler (9/69)
- From: Zack Weinberg <zack at codesourcery dot com>
- To: binutils <binutils at sourceware dot org>
- Date: Tue, 26 Apr 2005 02:53:30 -0700
- Subject: Thumb32 assembler (9/69)
Preparation for removing the special *_reg_required_here functons:
fold some of the special cases into arm_reg_parse.
zw
* config/tc-arm.c (arm_reg_parse): Handle alternative syntax
for Maverick registers and coprocessor numbers here ...
(mav_reg_required_here, co_proc_number): ... not here.
===================================================================
Index: gas/config/tc-arm.c
--- gas/config/tc-arm.c (revision 10)
+++ gas/config/tc-arm.c (revision 11)
@@ -1317,6 +1317,31 @@
if (reg && reg->type == type)
return reg->number;
+ /* Alternative syntaxes are accepted for a few register classes. */
+ switch (type)
+ {
+ case REG_TYPE_MVF:
+ case REG_TYPE_MVD:
+ case REG_TYPE_MVFX:
+ case REG_TYPE_MVDX:
+ /* Generic coprocessor register names are allowed for these. */
+ if (reg->type == REG_TYPE_CN)
+ return reg->number;
+ break;
+
+ case REG_TYPE_CP:
+ /* For backward compatibility, a bare number is valid here. */
+ {
+ unsigned long processor = strtoul (start, ccp, 10);
+ if (*ccp != start && processor <= 15)
+ return processor;
+ }
+ break;
+
+ default:
+ break;
+ }
+
*ccp = start;
return FAIL;
}
@@ -1548,27 +1573,19 @@
static int
mav_reg_required_here (char ** str, int shift, enum arm_reg_type regtype)
{
- struct reg_entry *reg;
- char *start = *str;
+ int reg;
- reg = arm_reg_parse_multi (str);
- if (!reg
- || (reg->type != regtype
- /* Accept generic coprocessor register if applicable. */
- && (reg->type != REG_TYPE_CN || (regtype != REG_TYPE_MVF
- && regtype != REG_TYPE_MVD
- && regtype != REG_TYPE_MVFX
- && regtype != REG_TYPE_MVDX))))
+ if ((reg = arm_reg_parse (str, regtype)) == FAIL)
{
inst.error = gettext (reg_expected_msgs[regtype]);
- *str = start;
return FAIL;
}
-
- if (shift >= 0)
- inst.instruction |= reg->number << shift;
-
- return reg->number;
+ else
+ {
+ if (shift >= 0)
+ inst.instruction |= reg << shift;
+ return reg;
+ }
}
/* Expects *str -> the characters "acc0", possibly with leading blanks.
@@ -2608,23 +2625,12 @@
co_proc_number (char ** str)
{
int processor;
- char *start;
skip_whitespace (*str);
- start = *str;
-
- /* The data sheet seems to imply that just a number on its own is valid
- here, but the RISC iX assembler seems to accept a prefix 'p'. We will
- accept either. */
if ((processor = arm_reg_parse (str, REG_TYPE_CP)) == FAIL)
{
- processor = strtoul (start, str, 10);
- if (start == *str || processor > 15)
- {
- *str = start;
- inst.error = reg_expected_msgs[REG_TYPE_CP];
- return FAIL;
- }
+ inst.error = reg_expected_msgs[REG_TYPE_CP];
+ return FAIL;
}
inst.instruction |= processor << 8;