/* FIXME: Need to check `want'. */
+ resolve_register (&exp);
+
switch (exp.X_op)
{
case O_illegal:
/* First try for parenthesized register ... */
expression (tok);
+ resolve_register (tok);
if (*input_line_pointer == ')' && tok->X_op == O_register)
{
tok->X_op = (saw_comma ? O_cpregister : O_pregister);
if (tok->X_op == O_illegal || tok->X_op == O_absent)
goto err;
+ resolve_register (tok);
+
saw_comma = 0;
saw_arg = 1;
++tok;
relocation type as well. */
if (*input_line_pointer == '@')
parse_reloc_symbol (tok);
+ else
+ resolve_register (tok);
debug_exp (tok);
/* Normal operand parsing. */
input_line_pointer = s;
(void) expression (operandp);
+ resolve_register (operandp);
}
new_pos = input_line_pointer;
input_line_pointer = buf;
get_symbol_name (&name);
symbolP = symbol_find (name);
- while (symbolP && S_GET_SEGMENT (symbolP) != reg_section)
+ while (symbolP && symbol_equated_p (symbolP))
{
const expressionS *e = symbol_get_value_expression(symbolP);
- if (e->X_op != O_symbol || e->X_add_number)
+ if (e->X_add_number)
break;
symbolP = e->X_add_symbol;
}
e->X_op = O_absent;
SKIP_WHITESPACE ();
expression (e);
+ resolve_register (e);
sep = *input_line_pointer;
if (more && (sep == ',' || sep == more))
++input_line_pointer;
regno = get_spec_regno (sregp);
*sregend = c;
+ resolve_register (expp_reg);
+
/* Let the caller issue errors; we've made sure the operands are
invalid. */
if (expp_reg->X_op != O_illegal
else
{
expression (&ex);
+ resolve_register (&ex);
}
switch (ex.X_op)
else
{
expression (&ex);
+ resolve_register (&ex);
}
switch (ex.X_op)
expression (op);
if (op->X_op == O_absent)
as_bad (_("missing operand"));
+ else
+ resolve_register (op);
/* Our caller is likely to check that the entire expression was parsed.
If we have found a hex constant with an 'h' suffix, ilp will be left
tmp = input_line_pointer; /* Save line pointer. */
input_line_pointer = str;
expression (exp);
+ resolve_register (exp);
s = input_line_pointer;
input_line_pointer = tmp; /* Restore line pointer. */
hold = input_line_pointer;
input_line_pointer = *pstr;
expression (pexp);
+ resolve_register (pexp);
*pstr = input_line_pointer;
input_line_pointer = hold;
str = input_line_pointer;
input_line_pointer = hold;
+ resolve_register (&ex);
+
if (ex.X_op == O_illegal)
as_bad (_("illegal operand"));
else if (ex.X_op == O_absent)
/* Parse the operand. */
if (! register_name (&ex))
- expression (&ex);
+ {
+ expression (&ex);
+ resolve_register (&ex);
+ }
str = input_line_pointer;
input_line_pointer = hold;
expression (&ex);
param = input_line_pointer;
input_line_pointer = save_ptr;
+ resolve_register (&ex);
if (ex.X_op == O_register || ex.X_op == O_constant)
{
insn->opcode |= ex.X_add_number << arg_encode[arg].pos;
t = input_line_pointer; /* Save line pointer. */
input_line_pointer = str;
expression (exp);
+ resolve_register (exp);
s = input_line_pointer;
input_line_pointer = t; /* Restore line pointer. */
return s; /* Return pointer to where parsing stopped. */
else
{
expression (&ex);
+ resolve_register (&ex);
if ((operand->flags & V850_NOT_IMM0)
&& ex.X_op == O_constant
expression (op);
if (op->X_op == O_absent)
as_bad (_("missing operand"));
+ else
+ resolve_register (op);
return input_line_pointer;
}
}
input_line_pointer = (char*) s ;
expression (op);
+ resolve_register (op);
switch (op->X_op)
{
case O_absent:
return 1;
}
+
+/* "Look through" register equates. */
+void resolve_register (expressionS *expP)
+{
+ symbolS *sym;
+ offsetT acc = 0;
+ const expressionS *e = expP;
+
+ if (expP->X_op != O_symbol)
+ return;
+
+ do
+ {
+ sym = e->X_add_symbol;
+ acc += e->X_add_number;
+ e = symbol_get_value_expression (sym);
+ }
+ while (symbol_equated_p (sym));
+
+ if (e->X_op == O_register)
+ {
+ *expP = *e;
+ expP->X_add_number += acc;
+ }
+}
\f
/* This lives here because it belongs equally in expr.c & read.c.
expr.c is just a branch office read.c anyway, and putting it
extern uint32_t generic_bignum_to_int32 (void);
extern uint64_t generic_bignum_to_int64 (void);
extern int resolve_expression (expressionS *);
+extern void resolve_register (expressionS *);
extern bool literal_prefix_dollar_hex;
return;
}
#endif
+ /* Make sure symbol_equated_p() recognizes the symbol as an equate. */
+ exp.X_add_symbol = make_expr_symbol (&exp);
+ exp.X_add_number = 0;
+ exp.X_op = O_symbol;
symbol_set_value_expression (symbolP, &exp);
S_SET_SEGMENT (symbolP, reg_section);
set_zero_frag (symbolP);
}
S_SET_VALUE (symbolP, valu);
+ if (sec == reg_section)
+ symbolP->x->value.X_op = O_register;
symbol_clear_list_pointers (symbolP);
return (((struct local_symbol *) s)->frag
== &predefined_address_frag);
/* Permit register names to be redefined. */
- return s->bsym->section == reg_section;
+ return s->x->value.X_op == O_register;
}
int