summaryrefslogtreecommitdiff
path: root/gcc/genopinit.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>1996-09-30 17:23:14 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>1996-09-30 17:23:14 +0000
commit10939e158381ca014510e6db8b48c97ab02cc00a (patch)
tree0b527d69e33da1d6fb0dd547db44a7c2f6ecd13a /gcc/genopinit.c
parentf44d616016e99ffc8080912386557e31c09605fc (diff)
downloadgcc-10939e158381ca014510e6db8b48c97ab02cc00a.tar.gz
Search modes in reverse order to avoid problems with EXTRA_CC_MODES
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12873 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genopinit.c')
-rw-r--r--gcc/genopinit.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
index a14f9a82a25..3087e381c99 100644
--- a/gcc/genopinit.c
+++ b/gcc/genopinit.c
@@ -1,5 +1,5 @@
/* Generate code to initialize optabs from machine description.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -185,9 +185,7 @@ gen_insn (insn)
/* We have to be concerned about matching "gt" and
missing "gtu", e.g., so verify we have reached the
- end of thing we are to match. We do not have this
- problem with modes since no mode is a prefix of
- another. */
+ end of thing we are to match. */
if (*p == 0 && *q == 0 && rtx_class[op] == '<')
break;
}
@@ -199,7 +197,11 @@ gen_insn (insn)
break;
case 'a':
case 'b':
- for (i = 0; i < (int) MAX_MACHINE_MODE; i++)
+ /* This loop will stop at the first prefix match, so
+ look through the modes in reverse order, in case
+ EXTRA_CC_MODES was used and CC is a prefix of the
+ CC modes (as it should be). */
+ for (i = ((int) MAX_MACHINE_MODE) - 1; i >= 0; i--)
{
for (p = mode_name[i], q = np; *p; p++, q++)
if (tolower (*p) != *q)
@@ -211,7 +213,7 @@ gen_insn (insn)
break;
}
- if (i == (int) MAX_MACHINE_MODE)
+ if (i < 0)
matches = 0;
else if (*pp == 'a')
m1 = i, np += strlen (mode_name[i]);