+2000-10-17 Alexandre Oliva <aoliva@redhat.com>
+
+ * genrecog.c (write_switch): Return the first condition that needs a
+ label.
+
2000-10-17 Bernd Schmidt <bernds@redhat.co.uk>
* c-tree.h (warn_sequence_point): Move declaration to...
2000-10-17 Bernd Schmidt <bernds@redhat.co.uk>
* c-tree.h (warn_sequence_point): Move declaration to...
{
struct decision *p = start;
enum decision_type type = p->tests->type;
{
struct decision *p = start;
enum decision_type type = p->tests->type;
+ struct decision *needs_label = NULL;
/* If we have two or more nodes in sequence that test the same one
thing, we may be able to use a switch statement. */
/* If we have two or more nodes in sequence that test the same one
thing, we may be able to use a switch statement. */
code = p->tests->u.code;
do
{
code = p->tests->u.code;
do
{
+ if (p != start && p->need_label && needs_label == NULL)
+ needs_label = p;
+
printf (" case ");
print_code (code);
printf (":\n goto L%d;\n", p->success.first->number);
printf (" case ");
print_code (code);
printf (":\n goto L%d;\n", p->success.first->number);
we don't actually write the test here, as it gets kinda messy.
It is trivial to leave this to later by telling our caller that
we only processed the CODE tests. */
we don't actually write the test here, as it gets kinda messy.
It is trivial to leave this to later by telling our caller that
we only processed the CODE tests. */
+ if (needs_label != NULL)
+ ret = needs_label;
+ else
+ ret = p;
while (p && p->tests->type == DT_pred
&& p->tests->u.pred.index >= 0)
while (p && p->tests->type == DT_pred
&& p->tests->u.pred.index >= 0)
+ if (p != start && p->need_label && needs_label == NULL)
+ needs_label = p;
+
printf (" case ");
switch (type)
{
printf (" case ");
switch (type)
{
printf (" default:\n break;\n }\n");
printf (" default:\n break;\n }\n");
+ return needs_label != NULL ? needs_label : p;