/* Forward declarations: */
static void dot_alias (int);
-static int parse_operand (expressionS *, int);
+static int parse_operand_and_eval (expressionS *, int);
static void emit_one_bundle (void);
static bfd_reloc_code_real_type ia64_gen_real_reloc_type (struct symbol *,
bfd_reloc_code_real_type);
static int
parse_predicate_and_operand (expressionS *e, unsigned *qp, const char *po)
{
- int sep = parse_operand (e, ',');
+ int sep = parse_operand_and_eval (e, ',');
*qp = e->X_add_number - REG_P;
if (e->X_op != O_register || *qp > 63)
else if (*qp == 0)
as_warn (_("Pointless use of p0 as first operand to .%s"), po);
if (sep == ',')
- sep = parse_operand (e, ',');
+ sep = parse_operand_and_eval (e, ',');
else
e->X_op = O_absent;
return sep;
if (!in_prologue ("fframe"))
return;
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
if (e.X_op != O_constant)
{
if (!in_prologue ("vframe"))
return;
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
reg = e.X_add_number - REG_GR;
if (e.X_op != O_register || reg > 127)
{
if (!in_prologue ("vframesp"))
return;
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
if (e.X_op != O_constant)
{
as_bad (_("Operand to .vframesp must be a constant (sp-relative offset)"));
if (!in_prologue ("save"))
return;
- sep = parse_operand (&e1, ',');
+ sep = parse_operand_and_eval (&e1, ',');
if (sep == ',')
- sep = parse_operand (&e2, ',');
+ sep = parse_operand_and_eval (&e2, ',');
else
e2.X_op = O_absent;
if (!in_body ("restore"))
return;
- sep = parse_operand (&e1, ',');
+ sep = parse_operand_and_eval (&e1, ',');
if (e1.X_op != O_register || e1.X_add_number != REG_GR + 12)
as_bad (_("First operand to .restore must be stack pointer (sp)"));
{
expressionS e2;
- sep = parse_operand (&e2, ',');
+ sep = parse_operand_and_eval (&e2, ',');
if (e2.X_op != O_constant || e2.X_add_number < 0)
{
as_bad (_("Second operand to .restore must be a constant >= 0"));
sep = parse_predicate_and_operand (&e, &qp, po);
else
{
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
qp = 0;
}
convert_expr_to_ab_reg (&e, &ab, ®, po, 1 + pred);
if (!in_prologue ("altrp"))
return;
- parse_operand (&e, 0);
+ parse_operand_and_eval (&e, 0);
reg = e.X_add_number - REG_BR;
if (e.X_op != O_register || reg > 7)
{
if (!in_prologue (po))
return;
- sep = parse_operand (&e1, ',');
+ sep = parse_operand_and_eval (&e1, ',');
if (sep == ',')
- sep = parse_operand (&e2, ',');
+ sep = parse_operand_and_eval (&e2, ',');
else
e2.X_op = O_absent;
if (!in_prologue ("save.g"))
return;
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
grmask = e.X_add_number;
if (e.X_op != O_constant
unsigned reg;
int n = popcount (grmask);
- parse_operand (&e, 0);
+ parse_operand_and_eval (&e, 0);
reg = e.X_add_number - REG_GR;
if (e.X_op != O_register || reg > 127)
{
if (!in_prologue ("save.f"))
return;
- parse_operand (&e, 0);
+ parse_operand_and_eval (&e, 0);
if (e.X_op != O_constant
|| e.X_add_number <= 0
if (!in_prologue ("save.b"))
return;
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
brmask = e.X_add_number;
if (e.X_op != O_constant
unsigned reg;
int n = popcount (brmask);
- parse_operand (&e, 0);
+ parse_operand_and_eval (&e, 0);
reg = e.X_add_number - REG_GR;
if (e.X_op != O_register || reg > 127)
{
if (!in_prologue ("save.gf"))
return;
- if (parse_operand (&e1, ',') == ',')
- parse_operand (&e2, 0);
+ if (parse_operand_and_eval (&e1, ',') == ',')
+ parse_operand_and_eval (&e2, 0);
else
e2.X_op = O_absent;
if (!in_prologue ("spill"))
return;
- parse_operand (&e, 0);
+ parse_operand_and_eval (&e, 0);
if (e.X_op != O_constant)
{
sep = parse_predicate_and_operand (&e, &qp, po);
else
{
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
qp = 0;
}
convert_expr_to_ab_reg (&e, &ab, ®, po, 1 + pred);
if (sep == ',')
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
else
e.X_op = O_absent;
convert_expr_to_xy_reg (&e, &xy, &treg, po, 2 + pred);
sep = parse_predicate_and_operand (&e, &qp, po);
else
{
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
qp = 0;
}
convert_expr_to_ab_reg (&e, &ab, ®, po, 1 + pred);
if (sep == ',')
- sep = parse_operand (&e, ',');
+ sep = parse_operand_and_eval (&e, ',');
else
e.X_op = O_absent;
if (e.X_op != O_constant)
if (!in_body ("label_state"))
return;
- parse_operand (&e, 0);
+ parse_operand_and_eval (&e, 0);
if (e.X_op == O_constant)
save_prologue_count (e.X_add_number, unwind.prologue_count);
else
if (!in_body ("copy_state"))
return;
- parse_operand (&e, 0);
+ parse_operand_and_eval (&e, 0);
if (e.X_op == O_constant)
unwind.prologue_count = get_saved_prologue_count (e.X_add_number);
else
if (!in_prologue ("unwabi"))
return;
- sep = parse_operand (&e1, ',');
+ sep = parse_operand_and_eval (&e1, ',');
if (sep == ',')
- parse_operand (&e2, 0);
+ parse_operand_and_eval (&e2, 0);
else
e2.X_op = O_absent;
if (!is_it_end_of_statement ())
{
expressionS e;
- int n, sep = parse_operand (&e, ',');
+ int n, sep = parse_operand_and_eval (&e, ',');
if (e.X_op != O_constant
|| e.X_add_number < 0
n = popcount (mask);
if (sep == ',')
- parse_operand (&e, 0);
+ parse_operand_and_eval (&e, 0);
else
e.X_op = O_absent;
if (e.X_op == O_constant
int sep, regno;
expressionS pr, *pr1, *pr2;
- sep = parse_operand (&pr, ',');
+ sep = parse_operand_and_eval (&pr, ',');
if (pr.X_op == O_register
&& pr.X_add_number >= REG_P
&& pr.X_add_number <= REG_P + 63)
memset (e, 0, sizeof (*e));
e->X_op = O_absent;
SKIP_WHITESPACE ();
- expression_and_evaluate (e);
+ expression (e);
sep = *input_line_pointer;
if (more && (sep == ',' || sep == more))
++input_line_pointer;
return sep;
}
+static int
+parse_operand_and_eval (expressionS *e, int more)
+{
+ int sep = parse_operand (e, more);
+ resolve_expression (e);
+ return sep;
+}
+
+static int
+parse_operand_maybe_eval (expressionS *e, int more, enum ia64_opnd op)
+{
+ int sep = parse_operand (e, more);
+ switch (op)
+ {
+ case IA64_OPND_IMM14:
+ case IA64_OPND_IMM22:
+ case IA64_OPND_IMMU64:
+ case IA64_OPND_TGT25:
+ case IA64_OPND_TGT25b:
+ case IA64_OPND_TGT25c:
+ case IA64_OPND_TGT64:
+ case IA64_OPND_TAG13:
+ case IA64_OPND_TAG13b:
+ case IA64_OPND_LDXMOV:
+ break;
+ default:
+ resolve_expression (e);
+ break;
+ }
+ return sep;
+}
+
/* Returns the next entry in the opcode table that matches the one in
IDESC, and frees the entry in IDESC. If no matching entry is
found, NULL is returned instead. */
{
if (i < NELEMS (CURR_SLOT.opnd))
{
- sep = parse_operand (CURR_SLOT.opnd + i, '=');
+ sep = parse_operand_maybe_eval (CURR_SLOT.opnd + i, '=',
+ idesc->operands[i]);
if (CURR_SLOT.opnd[i].X_op == O_absent)
break;
}
/* now we can parse the first arg: */
saved_input_pointer = input_line_pointer;
input_line_pointer = first_arg;
- sep = parse_operand (CURR_SLOT.opnd + 0, '=');
+ sep = parse_operand_maybe_eval (CURR_SLOT.opnd + 0, '=',
+ idesc->operands[0]);
if (sep != '=')
--num_outputs; /* force error */
input_line_pointer = saved_input_pointer;