#define TRISTATE_NOT(a) \
((a) == I ? I : !(a))
+/* 0 means no warning about that code yet, 1 means warned. */
+static char did_you_mean_codes[NUM_RTX_CODE];
+
/* Recursively calculate the set of rtx codes accepted by the
predicate expression EXP, writing the result to CODES. */
static void
case NOT:
compute_predicate_codes (XEXP (exp, 0), op0_codes);
for (i = 0; i < NUM_RTX_CODE; i++)
- codes[i] = TRISTATE_NOT (codes[i]);
+ codes[i] = TRISTATE_NOT (op0_codes[i]);
break;
case IF_THEN_ELSE:
while ((code = scan_comma_elt (&next_code)) != 0)
{
size_t n = next_code - code;
+ int found_it = 0;
for (i = 0; i < NUM_RTX_CODE; i++)
if (!strncmp (code, GET_RTX_NAME (i), n)
&& GET_RTX_NAME (i)[n] == '\0')
{
codes[i] = Y;
+ found_it = 1;
break;
}
+ if (!found_it)
+ {
+ message_with_line (pattern_lineno, "match_code \"%.*s\" matches nothing",
+ (int) n, code);
+ error_count ++;
+ for (i = 0; i < NUM_RTX_CODE; i++)
+ if (!strncasecmp (code, GET_RTX_NAME (i), n)
+ && GET_RTX_NAME (i)[n] == '\0'
+ && !did_you_mean_codes[i])
+ {
+ did_you_mean_codes[i] = 1;
+ message_with_line (pattern_lineno, "(did you mean \"%s\"?)", GET_RTX_NAME (i));
+ }
+ }
+
}
}
break;
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
}
{
test->u.pred.data = pred;
allows_const_int = pred->codes[CONST_INT];
- code = pred->singleton;
+ if (was_code == MATCH_PARALLEL
+ && pred->singleton != PARALLEL)
+ message_with_line (pattern_lineno,
+ "predicate '%s' used in match_parallel "
+ "does not allow only PARALLEL", pred->name);
+ else
+ code = pred->singleton;
}
+ else
+ message_with_line (pattern_lineno,
+ "warning: unknown predicate '%s' in '%s' expression",
+ pred_name, GET_RTX_NAME (was_code));
}
/* Can't enforce a mode if we allow const_int. */
if (allows_const_int)
mode = VOIDmode;
- /* Accept the operand, ie. record it in `operands'. */
+ /* Accept the operand, i.e. record it in `operands'. */
test = new_decision_test (DT_accept_op, &place);
test->u.opno = XINT (pattern, 0);
{
if (fmt[i] == 'i')
{
- if (i == 0)
+ gcc_assert (i < 2);
+
+ if (!i)
{
test = new_decision_test (DT_elt_zero_int, &place);
test->u.intval = XINT (pattern, i);
}
- else if (i == 1)
+ else
{
test = new_decision_test (DT_elt_one_int, &place);
test->u.intval = XINT (pattern, i);
}
- else
- abort ();
}
else if (fmt[i] == 'w')
{
= ((int) XWINT (pattern, i) == XWINT (pattern, i))
? DT_elt_zero_wide_safe : DT_elt_zero_wide;
- if (i != 0)
- abort ();
+ gcc_assert (!i);
test = new_decision_test (type, &place);
test->u.intval = XWINT (pattern, i);
}
else if (fmt[i] == 'E')
{
- if (i != 0)
- abort ();
+ gcc_assert (!i);
test = new_decision_test (DT_veclen, &place);
test->u.veclen = XVECLEN (pattern, i);
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
}
/* If we didn't insert any tests or accept nodes, hork. */
- if (this->tests == NULL)
- abort ();
+ gcc_assert (this->tests);
ret:
free (subpos);
cmp = strcmp (d1->position, d2->position);
if (cmp != 0)
{
- if (toplevel)
- abort ();
+ gcc_assert (!toplevel);
/* If the d2->position was lexically lower, swap. */
if (cmp > 0)
return 1;
default:
- abort ();
+ gcc_unreachable ();
}
}
}
/* Trying to merge bits at different positions isn't possible. */
- if (strcmp (oldh->first->position, addh->first->position))
- abort ();
+ gcc_assert (!strcmp (oldh->first->position, addh->first->position));
for (add = addh->first; add ; add = next)
{
printf ("(int) XWINT (x%d, 0)", depth);
break;
default:
- abort ();
+ gcc_unreachable ();
}
printf (")\n%s {\n", indent);
print_host_wide_int (p->tests->u.intval);
break;
default:
- abort ();
+ gcc_unreachable ();
}
printf (":\n%s goto L%d;\n", indent, p->success.first->number);
p->success.first->need_label = 1;
break;
case DT_c_test:
- printf ("(%s)", p->u.c_test);
+ print_c_condition (p->u.c_test);
break;
case DT_accept_insn:
- switch (subroutine_type)
- {
- case RECOG:
- if (p->u.insn.num_clobbers_to_add == 0)
- abort ();
- printf ("pnum_clobbers != NULL");
- break;
-
- default:
- abort ();
- }
+ gcc_assert (subroutine_type == RECOG);
+ gcc_assert (p->u.insn.num_clobbers_to_add);
+ printf ("pnum_clobbers != NULL");
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
if (test->next)
{
test = test->next;
- if (test->type != DT_accept_insn)
- abort ();
+ gcc_assert (test->type == DT_accept_insn);
}
}
/* Sanity check that we're now at the end of the list of tests. */
- if (test->next)
- abort ();
+ gcc_assert (!test->next);
if (test->type == DT_accept_insn)
{
if (test->u.insn.num_clobbers_to_add != 0)
printf ("%s*pnum_clobbers = %d;\n",
indent, test->u.insn.num_clobbers_to_add);
- printf ("%sreturn %d;\n", indent, test->u.insn.code_number);
+ printf ("%sreturn %d; /* %s */\n", indent,
+ test->u.insn.code_number,
+ insn_name_ptr[test->u.insn.code_number]);
break;
case SPLIT:
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
else
case PEEPHOLE2:
return -1;
default:
- abort ();
+ gcc_unreachable ();
}
}
char c_test_pos[2];
/* We should never see an insn whose C test is false at compile time. */
- if (truth == 0)
- abort ();
+ gcc_assert (truth);
record_insn_name (next_insn_code, (type == RECOG ? XSTR (insn, 0) : NULL));
break;
default:
- abort ();
+ gcc_unreachable ();
}
}