From: Andrew Cagney <ac131313@cygnus.com>
To: cgd@broadcom.com
Cc: gdb@sources.redhat.com
Subject: Re: problem w/ igen, multiple -M models, and -G gen-multi-sim.
Date: Thu, 14 Mar 2002 18:46:00 -0000 [thread overview]
Message-ID: <3C916070.50007@cygnus.com> (raw)
In-Reply-To: <yov5zo1dsec2.fsf@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]
> what's happening is that make_gen_semantics_list() is calling
> insn_list_insert() to insert the DMxC1_COP1Sb on to the semantics list
> (OK), but insn_list_insert finds that all of the keys it cares about
> are the same, thinks it's a duplicate of DMxC1_COP1Sa, and merges it
> into DMxC1_COP1Sa (not so OK), and as a result no semantic function is
> generated for DMxC1_COP1Sb.
Sounds like another key is needed (I keep adding them :-).
> I don't know what the right solution here is, but I figured others
> might want to be aware of the problem and might have comments.
>
> Having talked w/ Andrew a bit about the future of the MIPS sim, it's
> going to move away from using -M like this, and instead use multiple
> igen runs to generate simulators for different machines. So, this
> isn't something that I need a solution to.
>
> I just wanted people who might care in the future to have a reference
> in the list archives. If a solution comes out of this, well, that'd
> be fine by me, too. 8-)
Turns out that such instructions need to be given unique field-names as
they would otherwise generate functions with the same name. Just explot it.
See attached. It works for your example.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1486 bytes --]
2002-03-14 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.
Index: gen.c
===================================================================
RCS file: /cvs/src/src/sim/igen/gen.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 gen.c
--- gen.c 1999/04/16 01:35:04 1.1.1.1
+++ gen.c 2002/03/15 02:41:39
@@ -308,7 +308,18 @@
}
}
-
+/* 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 {
@@ -346,6 +357,18 @@
/* key#3 sort according to the non-constant fields of each instruction */
cmp = insn_field_cmp (insn->words, (*cur_insn_ptr)->insn->words);
+ if (cmp < 0)
+ break;
+ 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)
next prev parent reply other threads:[~2002-03-15 2:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-12 12:47 cgd
2002-03-14 18:46 ` Andrew Cagney [this message]
2002-03-14 21:20 ` cgd
2002-03-14 22:21 ` Andrew Cagney
2002-03-23 16:46 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3C916070.50007@cygnus.com \
--to=ac131313@cygnus.com \
--cc=cgd@broadcom.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox