#if 0
#define strcmp_check(S1, S2) ((S1) == (S2) \
? 0 \
- : (strcmp ((S1), (S2)) \
- ? 1 \
- : (abort (), 0)))
+ : (gcc_assert (strcmp ((S1), (S2))), 1))
#else
#define strcmp_check(S1, S2) ((S1) != (S2))
#endif
static void write_attr_set (struct attr_desc *, int, rtx,
const char *, const char *, rtx,
int, int);
+static void write_insn_cases (struct insn_ent *, int);
static void write_attr_case (struct attr_desc *, struct attr_value *,
int, const char *, const char *, int, rtx);
static void write_attr_valueq (struct attr_desc *, const char *);
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
return rt_val;
va_start (p, fmt);
- if (len > sizeof str - 1) /* Leave room for \0. */
- abort ();
+ gcc_assert (len < sizeof str); /* Leave room for \0. */
vsprintf (str, fmt, p);
va_end (p);
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
return copy;
rtx newexp;
int i;
- if (GET_CODE (value) == CONST_STRING)
+ switch (GET_CODE (value))
{
+ case CONST_STRING:
if (! strcmp_check (XSTR (value, 0), XSTR (exp, 1)))
newexp = true_rtx;
else
newexp = false_rtx;
- }
- else if (GET_CODE (value) == SYMBOL_REF)
- {
- char *p;
- char string[256];
-
- if (GET_CODE (exp) != EQ_ATTR)
- abort ();
-
- if (strlen (XSTR (exp, 0)) + strlen (XSTR (exp, 1)) + 2 > 256)
- abort ();
-
- strcpy (string, XSTR (exp, 0));
- strcat (string, "_");
- strcat (string, XSTR (exp, 1));
- for (p = string; *p; p++)
- *p = TOUPPER (*p);
-
- newexp = attr_rtx (EQ, value,
- attr_rtx (SYMBOL_REF,
- DEF_ATTR_STRING (string)));
- }
- else if (GET_CODE (value) == COND)
- {
- /* We construct an IOR of all the cases for which the requested attribute
- value is present. Since we start with FALSE, if it is not present,
- FALSE will be returned.
+ break;
+
+ case SYMBOL_REF:
+ {
+ char *p;
+ char string[256];
+
+ gcc_assert (GET_CODE (exp) == EQ_ATTR);
+ gcc_assert (strlen (XSTR (exp, 0)) + strlen (XSTR (exp, 1)) + 2
+ <= 256);
+
+ strcpy (string, XSTR (exp, 0));
+ strcat (string, "_");
+ strcat (string, XSTR (exp, 1));
+ for (p = string; *p; p++)
+ *p = TOUPPER (*p);
+
+ newexp = attr_rtx (EQ, value,
+ attr_rtx (SYMBOL_REF,
+ DEF_ATTR_STRING (string)));
+ break;
+ }
+ case COND:
+ /* We construct an IOR of all the cases for which the
+ requested attribute value is present. Since we start with
+ FALSE, if it is not present, FALSE will be returned.
+
Each case is the AND of the NOT's of the previous conditions with the
current condition; in the default case the current condition is TRUE.
-
+
For each possible COND value, call ourselves recursively.
-
+
The extra TRUE and FALSE expressions will be eliminated by another
call to the simplification routine. */
insn_code, insn_index),
insn_code, insn_index);
newexp = insert_right_side (IOR, orexp, right, insn_code, insn_index);
+ break;
+
+ default:
+ gcc_unreachable ();
}
- else
- abort ();
/* If uses an address, must return original expression. But set the
ATTR_IND_SIMPLIFIED_P bit so we don't try to simplify it again. */
return !(XINT (s2, 0) &~ XINT (s1, 0));
default:
- abort ();
+ gcc_unreachable ();
}
}
/* Returns true if S1 is a subset of complement of S2. */
-static bool attr_alt_subset_of_compl_p (rtx s1, rtx s2)
+static bool
+attr_alt_subset_of_compl_p (rtx s1, rtx s2)
{
switch ((XINT (s1, 1) << 1) | XINT (s2, 1))
{
return false;
default:
- abort ();
+ gcc_unreachable ();
}
}
XINT (result, 0) = XINT (s1, 0) | XINT (s2, 0);
break;
default:
- abort ();
+ gcc_unreachable ();
}
XINT (result, 1) = XINT (s1, 1) & XINT (s2, 1);
XINT (result, 0) = XINT (s1, 0) & XINT (s2, 0);
break;
default:
- abort ();
+ gcc_unreachable ();
}
XINT (result, 1) = XINT (s1, 1) | XINT (s2, 1);
}
/* Sanity check on num_insn_ents. */
- if (iv != ivbuf + num_insn_ents)
- abort ();
+ gcc_assert (iv == ivbuf + num_insn_ents);
/* Process one insn code at a time. */
for (i = -2; i < insn_code_number; i++)
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
printf (" >> ");
break;
default:
- abort ();
+ gcc_unreachable ();
}
write_test_expr (XEXP (exp, 1), flags | comparison_operator);
printf ("-");
break;
default:
- abort ();
+ gcc_unreachable ();
}
write_test_expr (XEXP (exp, 0), flags);
}
attr = find_attr (&XSTR (exp, 0), 0);
- if (! attr)
- abort ();
+ gcc_assert (attr);
/* Now is the time to expand the value of a constant attribute. */
if (attr->is_const)
}
}
+/* Write a series of case statements for every instruction in list IE.
+ INDENT is the amount of indentation to write before each case. */
+
+static void
+write_insn_cases (struct insn_ent *ie, int indent)
+{
+ for (; ie != 0; ie = ie->next)
+ if (ie->def->insn_code != -1)
+ {
+ write_indent (indent);
+ if (GET_CODE (ie->def->def) == DEFINE_PEEPHOLE)
+ printf ("case %d: /* define_peephole, line %d */\n",
+ ie->def->insn_code, ie->def->lineno);
+ else
+ printf ("case %d: /* %s */\n",
+ ie->def->insn_code, XSTR (ie->def->def, 0));
+ }
+}
+
/* Write out the computation for one attribute value. */
static void
int write_case_lines, const char *prefix, const char *suffix,
int indent, rtx known_true)
{
- struct insn_ent *ie;
-
if (av->num_insns == 0)
return;
}
if (write_case_lines)
- {
- for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->def->insn_code != -1)
- {
- write_indent (indent);
- printf ("case %d: /* %s */\n",
- ie->def->insn_code, XSTR (ie->def->def, 0));
- }
- }
+ write_insn_cases (av->first_insn, indent);
else
{
write_indent (indent);
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
printf ("{\n");
printf (" rtx insn;\n");
printf ("\n");
- printf (" if (slot >= %d)\n", max_slots);
- printf (" abort ();\n");
+ printf (" gcc_assert (slot < %d);\n", max_slots);
printf ("\n");
/* Allow dbr_schedule to pass labels, etc. This can happen if try_split
converts a compound instruction into a loop. */
if (num_delays > 1)
{
attr = find_attr (&delay_type_str, 0);
- if (! attr)
- abort ();
+ gcc_assert (attr);
common_av = find_most_used (attr);
printf (" insn = delay_insn;\n");
printf (" }\n\n");
/* Ensure matched. Otherwise, shouldn't have been called. */
- printf (" if (slot < %d)\n", max_slots);
- printf (" abort ();\n\n");
+ printf (" gcc_assert (slot >= %d);\n\n", max_slots);
}
/* If just one type of delay slot, write simple switch. */
printf (" {\n");
attr = find_attr (&delay_1_0_str, 0);
- if (! attr)
- abort ();
+ gcc_assert (attr);
common_av = find_most_used (attr);
for (av = attr->first_value; av; av = av->next)
sprintf (str, "*%s_%d_%d", kind, delay->num, i / 3);
pstr = str;
attr = find_attr (&pstr, 0);
- if (! attr)
- abort ();
+ gcc_assert (attr);
common_av = find_most_used (attr);
for (av = attr->first_value; av; av = av->next)
}
printf (" default:\n");
- printf (" abort ();\n");
+ printf (" gcc_unreachable ();\n");
printf (" }\n");
}
struct attr_desc *attr;
attr = find_attr (&name, 1);
- if (attr->default_val)
- abort ();
+ gcc_assert (!attr->default_val);
attr->is_numeric = 1;
attr->is_const = 0;
rtx exp;
char *p;
- if (n < 0)
- abort ();
+ gcc_assert (n >= 0);
if (n < 20 && int_values[n])
return int_values[n];
{
struct attr_desc *attr = find_attr (&num_delay_slots_str, 0);
struct attr_value *av;
- struct insn_ent *ie;
if (attr)
{
length_used = 0;
walk_attr_value (av->value);
if (length_used)
- {
- for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->def->insn_code != -1)
- printf (" case %d: /* %s */\n",
- ie->def->insn_code, XSTR (ie->def->def, 0));
- printf (" return 0;\n");
- }
+ write_insn_cases (av->first_insn, 4);
}
printf (" default:\n");