Fix jumpb's operand types.

Aliasing the jump table to an integer broke statement_get_targetlist with
the new alias def handling, and was really wrong anyway. I probably did
that due to being fed up with things and wanting to get qfcc working again
rather than spending time getting jumpb right.
This commit is contained in:
Bill Currie 2012-12-05 22:20:55 +09:00
parent c06cd8fcc0
commit 34e3ac1468
3 changed files with 3 additions and 2 deletions

View file

@ -847,7 +847,7 @@ VISIBLE opcode_t pr_opcodes[] = {
"%Ga",
},
{"<JUMPB>", "jumpb", OP_JUMPB, false,
ev_integer, ev_integer, ev_invalid,
ev_void, ev_integer, ev_invalid,
PROG_VERSION,
"%Ga[%Gb]",
},

View file

@ -418,6 +418,8 @@ statement_get_targetlist (statement_t *s)
} else if (statement_is_goto (s)) {
target_list[0] = statement_get_target (s);
} else if (statement_is_jumpb (s)) {
if (table->alias)
internal_error (0, "aliased jump table");
e = table->initializer->e.block.head; //FIXME check!!!
for (i = 0; i < count; e = e->next, i++)
target_list[i] = e->e.labelref.label->dest;

View file

@ -345,7 +345,6 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val,
initialize_def (table_sym, array_type (&type_integer, high - low + 1),
table_init, pr.near_data, sc_static);
table_expr = new_symbol_expr (table_sym);
table_expr = new_alias_expr (&type_integer, table_expr);
if (tree->left) {
branch = branch_expr (IFB, temp, low_label);