++ntok;
break;
+ case O_symbol:
+ {
+ const char *p;
+ size_t len;
+ const struct arc_aux_reg *auxr;
+ unsigned j;
+
+ if (opcode->class != AUXREG)
+ goto de_fault;
+ p = S_GET_NAME (tok[tokidx].X_add_symbol);
+ len = strlen (p);
+
+ auxr = &arc_aux_regs[0];
+ for (j = 0; j < arc_num_aux_regs; j++, auxr++)
+ if (len == auxr->length
+ && strcasecmp (auxr->name, p) == 0
+ && ((auxr->subclass == NONE)
+ || check_cpu_feature (auxr->subclass)))
+ {
+ /* We modify the token array here, safe in the
+ knowledge, that if this was the wrong choice
+ then the original contents will be restored
+ from BKTOK. */
+ tok[tokidx].X_op = O_constant;
+ tok[tokidx].X_add_number = auxr->address;
+ break;
+ }
+
+ if (tok[tokidx].X_op != O_constant)
+ goto de_fault;
+ }
+ /* Fall-through */
case O_constant:
/* Check the range. */
if (operand->bits != 32
break;
}
default:
+ de_fault:
if (operand->default_reloc == 0)
goto match_failed; /* The operand needs relocation. */
return opcode;
}
-static void
-preprocess_operands (const struct arc_opcode *opcode,
- expressionS *tok,
- int ntok)
-{
- int i;
- size_t len;
- const char *p;
- unsigned j;
- const struct arc_aux_reg *auxr;
-
- for (i = 0; i < ntok; i++)
- {
- switch (tok[i].X_op)
- {
- case O_illegal:
- case O_absent:
- break; /* Throw and error. */
-
- case O_symbol:
- if (opcode->class != AUXREG)
- break;
- /* Convert the symbol to a constant if possible. */
- p = S_GET_NAME (tok[i].X_add_symbol);
- len = strlen (p);
-
- auxr = &arc_aux_regs[0];
- for (j = 0; j < arc_num_aux_regs; j++, auxr++)
- if (len == auxr->length
- && (strcasecmp (auxr->name, p) == 0)
- && ((auxr->subclass == NONE)
- || check_cpu_feature (auxr->subclass)))
- {
- tok[i].X_op = O_constant;
- tok[i].X_add_number = auxr->address;
- break;
- }
- break;
- default:
- break;
- }
- }
-}
-
/* Given an opcode name, pre-tockenized set of argumenst and the
opcode flags, take it all the way through emission. */
frag_now->fr_file, frag_now->fr_line, opcode->name,
opcode->opcode);
- preprocess_operands (opcode, tok, ntok);
-
found_something = TRUE;
opcode = find_opcode_match (opcode, tok, &ntok, pflags, nflgs, &cpumatch);
if (opcode)