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