Commit 4639555c by Ian Lance Taylor

Search modes in reverse order to avoid problems with EXTRA_CC_MODES

From-SVN: r12873
parent 86944ea4
/* Generate code to initialize optabs from machine description. /* 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. This file is part of GNU CC.
...@@ -185,9 +185,7 @@ gen_insn (insn) ...@@ -185,9 +185,7 @@ gen_insn (insn)
/* We have to be concerned about matching "gt" and /* We have to be concerned about matching "gt" and
missing "gtu", e.g., so verify we have reached the missing "gtu", e.g., so verify we have reached the
end of thing we are to match. We do not have this end of thing we are to match. */
problem with modes since no mode is a prefix of
another. */
if (*p == 0 && *q == 0 && rtx_class[op] == '<') if (*p == 0 && *q == 0 && rtx_class[op] == '<')
break; break;
} }
...@@ -199,7 +197,11 @@ gen_insn (insn) ...@@ -199,7 +197,11 @@ gen_insn (insn)
break; break;
case 'a': case 'a':
case 'b': 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++) for (p = mode_name[i], q = np; *p; p++, q++)
if (tolower (*p) != *q) if (tolower (*p) != *q)
...@@ -211,7 +213,7 @@ gen_insn (insn) ...@@ -211,7 +213,7 @@ gen_insn (insn)
break; break;
} }
if (i == (int) MAX_MACHINE_MODE) if (i < 0)
matches = 0; matches = 0;
else if (*pp == 'a') else if (*pp == 'a')
m1 = i, np += strlen (mode_name[i]); m1 = i, np += strlen (mode_name[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment