* gen.c (format_name_cmp): New function.
authorAndrew Cagney <cagney@redhat.com>
Sun, 24 Mar 2002 00:43:28 +0000 (00:43 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sun, 24 Mar 2002 00:43:28 +0000 (00:43 +0000)
(insn_list_insert): Use the instruction field name as an
additional key.  Different field names indicate different
semantics.

sim/igen/ChangeLog
sim/igen/gen.c

index a65864b66449ef6b870207712e4651f8899abfde..a0d69a5556f686623a1713457b1a20049f60a218 100644 (file)
@@ -1,3 +1,10 @@
+2002-03-23  Andrew Cagney  <ac131313@redhat.com>
+
+       * gen.c (format_name_cmp): New function.
+       (insn_list_insert): Use the instruction field name as an
+       additional key.  Different field names indicate different
+       semantics.
+
 2002-03-07  Chris Demetriou  <cgd@broadcom.com>
 
        * igen.c (print_itrace_format): Add support for a new "%#lx" format.
index de8861906651ed26dcfcfcfd280f3cd5bdcfd221..7c24b46813f690691c8ca262e528bec15b9acda6 100644 (file)
@@ -308,7 +308,18 @@ new_opcode_bits (opcode_bits *old_bits,
     }
 }
 
-
+/* Same as strcmp().  */
+static int
+format_name_cmp (const char *l, const char *r)
+{
+  if (l == NULL && r == NULL)
+    return 0;
+  if (l != NULL && r == NULL)
+    return -1;
+  if (l == NULL && r != NULL)
+    return +1;
+  return strcmp (l, r);
+}
 
 
 typedef enum {
@@ -351,6 +362,18 @@ insn_list_insert (insn_list **cur_insn_ptr,
       else if (cmp > 0)
        continue;
 
+      /* key#4 sort according to the format-name.  If two apparently
+        identical instructions have unique format-names, then the
+        instructions are different.  This is because the
+        format-name's use is overloaded, it not only indicates the
+        format name but also provides a unique semantic name for the
+        function.  */
+      cmp = format_name_cmp (insn->format_name, (*cur_insn_ptr)->insn->format_name);
+      if (cmp < 0)
+       break;
+      else if (cmp > 0)
+       continue;
+
       /* duplicate keys, report problem */
       switch (duplicate_action)
        {
This page took 0.025744 seconds and 4 git commands to generate.