diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-17 14:27:53 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-17 14:27:53 +0000 |
commit | 0ced2f6670a6e8e50191f9106cb0bb3b05a52642 (patch) | |
tree | d2ecd0c60ed67c2846e74417898a4295251bce67 /gcc/genrecog.c | |
parent | 985550e9a89b11e17b07a4582bdc30ceefcab064 (diff) | |
download | gcc-0ced2f6670a6e8e50191f9106cb0bb3b05a52642.tar.gz |
* genrecog.c (write_switch): Return the first condition that needs a
label.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36903 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genrecog.c')
-rw-r--r-- | gcc/genrecog.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/genrecog.c b/gcc/genrecog.c index b512181e10d..d1437988947 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -1650,6 +1650,7 @@ write_switch (start, depth) { 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. */ @@ -1674,6 +1675,9 @@ write_switch (start, depth) 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); @@ -1697,7 +1701,10 @@ write_switch (start, depth) 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. */ - ret = p; + if (needs_label != NULL) + ret = needs_label; + else + ret = p; while (p && p->tests->type == DT_pred && p->tests->u.pred.index >= 0) @@ -1774,6 +1781,9 @@ write_switch (start, depth) do { + if (p != start && p->need_label && needs_label == NULL) + needs_label = p; + printf (" case "); switch (type) { @@ -1800,7 +1810,7 @@ write_switch (start, depth) printf (" default:\n break;\n }\n"); - return p; + return needs_label != NULL ? needs_label : p; } else { |