commit 0e85eb82829f4cadf856ae4d60749d63a195588a
parent b067c4eea4e6a12c1157321f65d08a1595690d8e
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Wed, 13 Apr 2016 11:01:53 -0400
handle the bad jump case
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/emit.c b/emit.c
@@ -537,6 +537,7 @@ emitfn(Fn *fn, FILE *f)
);
break;
case JJmp:
+ Jmp:
if (b->s1 != b->link)
fprintf(f, "\tjmp %sbb%d /* %s */\n",
locprefix, id0+b->s1->id, b->s1->name);
@@ -546,14 +547,13 @@ emitfn(Fn *fn, FILE *f)
if (0 <= c && c <= NXICmp) {
if (b->link == b->s2) {
s = b->s1;
- } else if (b->link == b->s1) {
- c = cneg(c);
- s = b->s2;
+ b->s1 = b->s2;
+ b->s2 = s;
} else
- die("unhandled jump");
- fprintf(f, "\tj%s %sbb%d /* %s */\n",
- ctoa[c], locprefix, id0+s->id, s->name);
- break;
+ c = cneg(c);
+ fprintf(f, "\tj%s %sbb%d /* %s */\n", ctoa[c],
+ locprefix, id0+b->s2->id, b->s2->name);
+ goto Jmp;
}
die("unhandled jump %d", b->jmp.type);
}