gas/
authorJan Beulich <jbeulich@novell.com>
Thu, 29 Sep 2005 07:00:54 +0000 (07:00 +0000)
committerJan Beulich <jbeulich@novell.com>
Thu, 29 Sep 2005 07:00:54 +0000 (07:00 +0000)
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.

gas/ChangeLog
gas/config/tc-ia64.c
gas/testsuite/ChangeLog
gas/testsuite/gas/ia64/alloc.l [new file with mode: 0644]
gas/testsuite/gas/ia64/alloc.s [new file with mode: 0644]
gas/testsuite/gas/ia64/ia64.exp

index ed2b33147f99a08f6a97e7aef351090f6c4ae4cf..65c7e7aea605a5401f4872ed4d14a7334f388e00 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-29  Jan Beulich  <jbeulich@novell.com>
+
+       * config/tc-ia64.c (parse_operands): Always parse first operand of
+       alloc.
+
 2005-09-29  Arnold Metselaar <arnold.metselaar@planet.nl>
            Alan Modra  <amodra@bigpond.net.au>
 
index 5875551c78d8f265a510e179f936a226cbdeda5d..334eb3285d26d918c7f1a2147160a03cd2cd92a6 100644 (file)
@@ -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;
index 13be2738c7697247aa94260f098f642de6d4583e..9e690887575ab90c3dff22d9fed29bcdc7558504 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-29  Jan Beulich  <jbeulich@novell.com>
+
+       * gas/ia64/alloc.[sl]: New.
+       * gas/ia64/ia64.exp: Run new test.
+
 2005-09-28  Jan Beulich  <jbeulich@novell.com>
 
        * gas/i386/x86-64-stack.s, gas/i386/x86-64-stack.d,
diff --git a/gas/testsuite/gas/ia64/alloc.l b/gas/testsuite/gas/ia64/alloc.l
new file mode 100644 (file)
index 0000000..42a866a
--- /dev/null
@@ -0,0 +1,11 @@
+# Currently in the error messages the operand numbers for the constants
+# aren't correct, which is why the patterns only check for ranges.
+.*: Assembler messages:
+.*:7: Error: Operand [345] of .alloc. should be .*
+.*:8: Error: Operand [345] of .alloc. should be .*
+.*:9: Error: Operand [345] of .alloc. should be .*
+.*:10: Error: Operand [56] of .alloc. should be .*
+.*:11: Error: Operand [234] of .alloc. should be .*
+.*:12: Error: Operand [234] of .alloc. should be .*
+.*:13: Error: Operand [234] of .alloc. should be .*
+.*:14: Error: Operand [45] of .alloc. should be .*
diff --git a/gas/testsuite/gas/ia64/alloc.s b/gas/testsuite/gas/ia64/alloc.s
new file mode 100644 (file)
index 0000000..0fcdb84
--- /dev/null
@@ -0,0 +1,14 @@
+// Make sure error messages on 'alloc' don't needlessly refer to operand 1
+// (which gets parsed late) when only one of the other operands is wrong.
+
+       .text
+
+alloc:
+       alloc           r2 = ar.pfs, x, 0, 0, 0
+       alloc           r2 = ar.pfs, 0, x, 0, 0
+       alloc           r2 = ar.pfs, 0, 0, x, 0
+       alloc           r2 = ar.pfs, 0, 0, 0, x
+       alloc           r3 = x, 0, 0, 0
+       alloc           r3 = 0, x, 0, 0
+       alloc           r3 = 0, 0, x, 0
+       alloc           r3 = 0, 0, 0, x
index 8b4b999ad2116dfc1a794eda7ed73bfe00113ddb..5ecdff31dcae6d7ab1c277f9dfb6f01bbf3332ec 100644 (file)
@@ -76,6 +76,7 @@ if [istarget "ia64-*"] then {
        run_dump_test "group-2"
     }
 
+    run_list_test "alloc" ""
     run_dump_test "bundling"
     run_list_test "label" ""
     run_list_test "last" ""
This page took 0.045397 seconds and 4 git commands to generate.