aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ia64.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2005-09-29 07:00:54 +0000
committerJan Beulich <jbeulich@novell.com>2005-09-29 07:00:54 +0000
commitef0241e727d448bf82983b97aa4c2dbe6b66c0d4 (patch)
treec12875f7d5b4c2cfa2877601e27fe5a6f81b4743 /gas/config/tc-ia64.c
parentc9c5dcdafcab3311b88e0d23f244c9879b9455b6 (diff)
downloadgdb-ef0241e727d448bf82983b97aa4c2dbe6b66c0d4.zip
gdb-ef0241e727d448bf82983b97aa4c2dbe6b66c0d4.tar.gz
gdb-ef0241e727d448bf82983b97aa4c2dbe6b66c0d4.tar.bz2
gas/
2005-09-29 Jan Beulich <jbeulich@novell.com> * config/tc-ia64.c (parse_operands): Always parse first operand of alloc. gas/testsuite/ 2005-09-29 Jan Beulich <jbeulich@novell.com> * gas/ia64/alloc.[sl]: New. * gas/ia64/ia64.exp: Run new test.
Diffstat (limited to 'gas/config/tc-ia64.c')
-rw-r--r--gas/config/tc-ia64.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index 5875551..334eb32 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -6278,34 +6278,38 @@ parse_operands (idesc)
if (idesc->operands[2] == IA64_OPND_SOF
|| idesc->operands[1] == IA64_OPND_SOF)
{
- /* map alloc r1=ar.pfs,i,l,o,r to alloc r1=ar.pfs,(i+l+o),(i+l),r */
+ /* Map alloc r1=ar.pfs,i,l,o,r to alloc r1=ar.pfs,(i+l+o),(i+l),r.
+ Note, however, that due to that mapping operand numbers in error
+ messages for any of the constant operands will not be correct. */
know (strcmp (idesc->name, "alloc") == 0);
- i = (CURR_SLOT.opnd[1].X_op == O_register
- && CURR_SLOT.opnd[1].X_add_number == REG_AR + AR_PFS) ? 2 : 1;
- if (num_operands == i + 3 /* first_arg not included in this count! */
- && CURR_SLOT.opnd[i].X_op == O_constant
- && CURR_SLOT.opnd[i + 1].X_op == O_constant
- && CURR_SLOT.opnd[i + 2].X_op == O_constant
- && CURR_SLOT.opnd[i + 3].X_op == O_constant)
- {
- sof = set_regstack (CURR_SLOT.opnd[i].X_add_number,
- CURR_SLOT.opnd[i + 1].X_add_number,
- CURR_SLOT.opnd[i + 2].X_add_number,
- CURR_SLOT.opnd[i + 3].X_add_number);
-
- /* 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, '=');
- if (sep != '=')
- --num_outputs; /* force error */
- input_line_pointer = saved_input_pointer;
-
- CURR_SLOT.opnd[i].X_add_number = sof;
- CURR_SLOT.opnd[i + 1].X_add_number
- = sof - CURR_SLOT.opnd[i + 2].X_add_number;
- CURR_SLOT.opnd[i + 2] = CURR_SLOT.opnd[i + 3];
- }
+ /* The first operand hasn't been parsed/initialized, yet (but
+ num_operands intentionally doesn't account for that). */
+ i = num_operands > 4 ? 2 : 1;
+#define FORCE_CONST(n) (CURR_SLOT.opnd[n].X_op == O_constant \
+ ? CURR_SLOT.opnd[n].X_add_number \
+ : 0)
+ sof = set_regstack (FORCE_CONST(i),
+ FORCE_CONST(i + 1),
+ FORCE_CONST(i + 2),
+ FORCE_CONST(i + 3));
+#undef FORCE_CONST
+
+ /* 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, '=');
+ if (sep != '=')
+ --num_outputs; /* force error */
+ input_line_pointer = saved_input_pointer;
+
+ CURR_SLOT.opnd[i].X_add_number = sof;
+ if (CURR_SLOT.opnd[i + 1].X_op == O_constant
+ && CURR_SLOT.opnd[i + 2].X_op == O_constant)
+ CURR_SLOT.opnd[i + 1].X_add_number
+ = sof - CURR_SLOT.opnd[i + 2].X_add_number;
+ else
+ CURR_SLOT.opnd[i + 1].X_op = O_illegal;
+ CURR_SLOT.opnd[i + 2] = CURR_SLOT.opnd[i + 3];
}
highest_unmatched_operand = -4;