Emit code for jump tables.

With this, the entirety of the ruamoko tree builds (though the progs will
be broken in various ways: mostly unrelocated references).
This commit is contained in:
Bill Currie 2011-03-03 19:08:26 +09:00
parent a281033920
commit ee9045c377

View file

@ -268,11 +268,17 @@ statement_branch (sblock_t *sblock, expr_t *e)
s->opa = new_operand (op_label);
s->opa->o.label = &e->e.expr.e1->e.label;
} else {
opcode = convert_op (e->e.expr.op);
s = new_statement (opcode, e);
sblock = statement_subexpr (sblock, e->e.expr.e1, &s->opa);
s->opb = new_operand (op_label);
s->opb->o.label = &e->e.expr.e2->e.label;
if (e->e.expr.op == 'g') {
s = new_statement ("<JUMPB>", e);
sblock = statement_subexpr (sblock, e->e.expr.e1, &s->opa);
sblock = statement_subexpr (sblock, e->e.expr.e2, &s->opb);
} else {
opcode = convert_op (e->e.expr.op);
s = new_statement (opcode, e);
sblock = statement_subexpr (sblock, e->e.expr.e1, &s->opa);
s->opb = new_operand (op_label);
s->opb->o.label = &e->e.expr.e2->e.label;
}
}
sblock_add_statement (sblock, s);
@ -875,6 +881,7 @@ statement_expr (sblock_t *sblock, expr_t *e)
case 'c':
sblock = expr_call (sblock, e, 0);
break;
case 'g':
case 'i':
case 'n':
case IFBE: