[gamecode] Use text for all v6p opcode names

This makes the v6p instruction table consistent with the ruamoko
instruction table, and clears up some of the ugliness with the load,
store, and assign instructions (. .= and = are now spelled out). I think
I'd still prefer an enum code (faster) but at least this is more
readable.
This commit is contained in:
Bill Currie 2022-01-20 09:26:01 +09:00
parent 30008aeb13
commit 143030fec4
5 changed files with 405 additions and 405 deletions

File diff suppressed because it is too large Load diff

View file

@ -327,8 +327,8 @@ dagnode_match (const dagnode_t *n, const daglabel_t *op,
if (n->killed) if (n->killed)
return 0; return 0;
if (!strcmp (op->opcode, ".") if (!strcmp (op->opcode, "load")
&& n->label->opcode && !strcmp (n->label->opcode, ".=")) && n->label->opcode && !strcmp (n->label->opcode, "store"))
return dagnode_deref_match (n, op, children); return dagnode_deref_match (n, op, children);
if (n->label->opcode != op->opcode) if (n->label->opcode != op->opcode)
return 0; return 0;
@ -452,12 +452,12 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n)
int first_param = 0; int first_param = 0;
flowvar_t **flowvars = dag->flownode->graph->func->vars; flowvar_t **flowvars = dag->flownode->graph->func->vars;
if (!strncmp (n->label->opcode, "<RCALL", 6)) { if (!strncmp (n->label->opcode, "rcall", 5)) {
num_params = n->label->opcode + 6; num_params = n->label->opcode + 6;
first_param = 2; first_param = 2;
} else if (!strncmp (n->label->opcode, "<CALL", 5)) { } else if (!strncmp (n->label->opcode, "call", 4)) {
num_params = n->label->opcode + 5; num_params = n->label->opcode + 5;
} else if (!strcmp (n->label->opcode, "<RETURN>")) { } else if (!strcmp (n->label->opcode, "return")) {
daglabel_t *label = n->children[0]->label; daglabel_t *label = n->children[0]->label;
if (!label->op) { if (!label->op) {
set_iter_t *lab_i; set_iter_t *lab_i;
@ -997,7 +997,7 @@ generate_moves (dag_t *dag, sblock_t *block, dagnode_t *dagnode)
var = dag->labels[var_iter->element]; var = dag->labels[var_iter->element];
operands[2] = var->op; operands[2] = var->op;
dst = operands[2]; dst = operands[2];
st = build_statement ("<MOVE>", operands, var->expr); st = build_statement ("move", operands, var->expr);
sblock_add_statement (block, st); sblock_add_statement (block, st);
} }
return dst; return dst;
@ -1019,7 +1019,7 @@ generate_moveps (dag_t *dag, sblock_t *block, dagnode_t *dagnode)
operands[1] = make_operand (dag, block, dagnode, 1); operands[1] = make_operand (dag, block, dagnode, 1);
if (dagnode->children[2]) { if (dagnode->children[2]) {
operands[2] = make_operand (dag, block, dagnode, 2); operands[2] = make_operand (dag, block, dagnode, 2);
st = build_statement ("<MOVEP>", operands, dagnode->label->expr); st = build_statement ("movep", operands, dagnode->label->expr);
sblock_add_statement (block, st); sblock_add_statement (block, st);
if ((var_iter = set_first (dagnode->identifiers))) { if ((var_iter = set_first (dagnode->identifiers))) {
var = dag->labels[var_iter->element]; var = dag->labels[var_iter->element];
@ -1039,7 +1039,7 @@ generate_moveps (dag_t *dag, sblock_t *block, dagnode_t *dagnode)
} }
operands[2] = value_operand (new_pointer_val (offset, type, dstDef, 0), operands[2] = value_operand (new_pointer_val (offset, type, dstDef, 0),
operands[1]->expr); operands[1]->expr);
st = build_statement ("<MOVEP>", operands, var->expr); st = build_statement ("movep", operands, var->expr);
sblock_add_statement (block, st); sblock_add_statement (block, st);
} }
} }
@ -1063,7 +1063,7 @@ generate_memsets (dag_t *dag, sblock_t *block, dagnode_t *dagnode)
var = dag->labels[var_iter->element]; var = dag->labels[var_iter->element];
operands[2] = var->op; operands[2] = var->op;
dst = operands[2]; dst = operands[2];
st = build_statement ("<MEMSET>", operands, var->expr); st = build_statement ("memset", operands, var->expr);
sblock_add_statement (block, st); sblock_add_statement (block, st);
} }
return dst; return dst;
@ -1085,7 +1085,7 @@ generate_memsetps (dag_t *dag, sblock_t *block, dagnode_t *dagnode)
operands[1] = make_operand (dag, block, dagnode, 1); operands[1] = make_operand (dag, block, dagnode, 1);
if (dagnode->children[2]) { if (dagnode->children[2]) {
operands[2] = make_operand (dag, block, dagnode, 2); operands[2] = make_operand (dag, block, dagnode, 2);
st = build_statement ("<MEMSETP>", operands, dagnode->label->expr); st = build_statement ("memsetp", operands, dagnode->label->expr);
sblock_add_statement (block, st); sblock_add_statement (block, st);
} else { } else {
for (var_iter = set_first (dagnode->identifiers); var_iter; for (var_iter = set_first (dagnode->identifiers); var_iter;
@ -1100,7 +1100,7 @@ generate_memsetps (dag_t *dag, sblock_t *block, dagnode_t *dagnode)
} }
operands[2] = value_operand (new_pointer_val (offset, type, dstDef, 0), operands[2] = value_operand (new_pointer_val (offset, type, dstDef, 0),
operands[1]->expr); operands[1]->expr);
st = build_statement ("<MEMSETP>", operands, var->expr); st = build_statement ("memsetp", operands, var->expr);
sblock_add_statement (block, st); sblock_add_statement (block, st);
} }
} }
@ -1123,7 +1123,7 @@ generate_assignments (dag_t *dag, sblock_t *block, operand_t *src,
if (!dst) if (!dst)
dst = operands[1]; dst = operands[1];
st = build_statement ("=", operands, var->expr); st = build_statement ("assign", operands, var->expr);
sblock_add_statement (block, st); sblock_add_statement (block, st);
} }
return dst; return dst;

View file

@ -1205,20 +1205,20 @@ flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
case st_ptrmemset: case st_ptrmemset:
flow_add_op_var (use, s->opa, 1); flow_add_op_var (use, s->opa, 1);
flow_add_op_var (use, s->opb, 1); flow_add_op_var (use, s->opb, 1);
if (!strcmp (s->opcode, "<MOVE>") if (!strcmp (s->opcode, "move")
|| !strcmp (s->opcode, "<MEMSET>")) { || !strcmp (s->opcode, "memset")) {
flow_add_op_var (def, s->opc, 0); flow_add_op_var (def, s->opc, 0);
res_op = s->opc; res_op = s->opc;
} else if (!strcmp (s->opcode, "<MOVEP>")) { } else if (!strcmp (s->opcode, "movep")) {
flow_add_op_var (use, s->opc, 0); flow_add_op_var (use, s->opc, 0);
aux_op2 = flow_analyze_pointer_operand (s->opa, use); aux_op2 = flow_analyze_pointer_operand (s->opa, use);
res_op = flow_analyze_pointer_operand (s->opc, def); res_op = flow_analyze_pointer_operand (s->opc, def);
aux_op1 = s->opc; aux_op1 = s->opc;
} else if (!strcmp (s->opcode, "<MEMSETP>")) { } else if (!strcmp (s->opcode, "memsetp")) {
flow_add_op_var (use, s->opc, 0); flow_add_op_var (use, s->opc, 0);
res_op = flow_analyze_pointer_operand (s->opc, def); res_op = flow_analyze_pointer_operand (s->opc, def);
aux_op1 = s->opc; aux_op1 = s->opc;
} else if (!strcmp (s->opcode, ".=")) { } else if (!strcmp (s->opcode, "store")) {
flow_add_op_var (use, s->opc, 1); flow_add_op_var (use, s->opc, 1);
res_op = flow_analyze_pointer_operand (s->opb, def); res_op = flow_analyze_pointer_operand (s->opb, def);
aux_op1 = s->opc; aux_op1 = s->opc;
@ -1250,19 +1250,19 @@ flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
} }
break; break;
case st_func: case st_func:
if (strcmp (s->opcode, "<RETURN>") == 0 if (strcmp (s->opcode, "return") == 0
|| strcmp (s->opcode, "<DONE>") == 0) { || strcmp (s->opcode, "done") == 0) {
flow_add_op_var (use, s->opa, 1); flow_add_op_var (use, s->opa, 1);
} else if (strcmp (s->opcode, "<RETURN_V>") == 0) { } else if (strcmp (s->opcode, "return_v") == 0) {
if (use) { if (use) {
flow_add_op_var (use, &flow_params[0].op, 1); flow_add_op_var (use, &flow_params[0].op, 1);
} }
} }
if (strncmp (s->opcode, "<CALL", 5) == 0) { if (strncmp (s->opcode, "call", 4) == 0) {
start = 0; start = 0;
calln = s->opcode[5] - '0'; calln = s->opcode[5] - '0';
flow_add_op_var (use, s->opa, 1); flow_add_op_var (use, s->opa, 1);
} else if (strncmp (s->opcode, "<RCALL", 6) == 0) { } else if (strncmp (s->opcode, "rcall", 5) == 0) {
start = 2; start = 2;
calln = s->opcode[6] - '0'; calln = s->opcode[6] - '0';
flow_add_op_var (use, s->opa, 1); flow_add_op_var (use, s->opa, 1);
@ -1296,9 +1296,9 @@ flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
} }
break; break;
case st_flow: case st_flow:
if (strcmp (s->opcode, "<GOTO>") != 0) { if (strcmp (s->opcode, "jump") != 0) {
flow_add_op_var (use, s->opa, 1); flow_add_op_var (use, s->opa, 1);
if (strcmp (s->opcode, "<JUMPB>") == 0) if (strcmp (s->opcode, "jumpb") == 0)
flow_add_op_var (use, s->opb, 1); flow_add_op_var (use, s->opb, 1);
} }
if (operands) { if (operands) {

View file

@ -53,26 +53,26 @@ typedef struct v6p_uint_opcode_s {
} v6p_uint_opcode_t; } v6p_uint_opcode_t;
static v6p_uint_opcode_t v6p_uint_opcodes[] = { static v6p_uint_opcode_t v6p_uint_opcodes[] = {
{OP_LOAD_I_v6p, {".", "load.i", ev_entity, ev_field, ev_uint }}, {OP_LOAD_I_v6p, {"load", "load.i", ev_entity, ev_field, ev_uint }},
{OP_LOADBI_I_v6p, {".", "loadbi.i", ev_ptr, ev_short, ev_uint }}, {OP_LOADBI_I_v6p, {"load", "loadbi.i", ev_ptr, ev_short, ev_uint }},
{OP_ADDRESS_I_v6p, {"&", "address.i", ev_uint, ev_invalid, ev_ptr }}, {OP_ADDRESS_I_v6p, {"lea", "address.i",ev_uint, ev_invalid, ev_ptr }},
{OP_STORE_I_v6p, {"=", "store.i", ev_uint, ev_uint, ev_invalid }}, {OP_STORE_I_v6p, {"assign", "store.i", ev_uint, ev_uint, ev_invalid }},
{OP_STOREP_I_v6p, {".=", "storep.i", ev_uint, ev_ptr, ev_invalid }}, {OP_STOREP_I_v6p, {"store", "storep.i", ev_uint, ev_ptr, ev_invalid }},
{OP_STOREB_I_v6p, {".=", "storeb.i", ev_uint, ev_ptr, ev_int }}, {OP_STOREB_I_v6p, {"store", "storeb.i", ev_uint, ev_ptr, ev_int }},
{OP_STOREBI_I_v6p, {".=", "storebi.i", ev_uint, ev_ptr, ev_short }}, {OP_STOREBI_I_v6p, {"store", "storebi.i",ev_uint, ev_ptr, ev_short }},
{OP_IF_v6p, {"<IF>", "if", ev_uint, ev_short, ev_invalid }}, {OP_IF_v6p, {"if", "if", ev_uint, ev_short, ev_invalid }},
{OP_IFNOT_v6p, {"<IFNOT>", "ifnot", ev_uint, ev_short, ev_invalid }}, {OP_IFNOT_v6p, {"ifnot", "ifnot", ev_uint, ev_short, ev_invalid }},
{OP_ADD_I_v6p, {"+", "add.i", ev_uint, ev_uint, ev_uint }}, {OP_ADD_I_v6p, {"add", "add.i", ev_uint, ev_uint, ev_uint }},
{OP_SUB_I_v6p, {"-", "sub.i", ev_uint, ev_uint, ev_uint }}, {OP_SUB_I_v6p, {"sub", "sub.i", ev_uint, ev_uint, ev_uint }},
{OP_MUL_I_v6p, {"*", "mul.i", ev_uint, ev_uint, ev_uint }}, {OP_MUL_I_v6p, {"mul", "mul.i", ev_uint, ev_uint, ev_uint }},
{OP_DIV_I_v6p, {"/", "div.i", ev_uint, ev_uint, ev_uint }}, {OP_DIV_I_v6p, {"div", "div.i", ev_uint, ev_uint, ev_uint }},
{OP_BITAND_I_v6p, {"&", "bitand.i", ev_uint, ev_uint, ev_uint }}, {OP_BITAND_I_v6p, {"bitand", "bitand.i", ev_uint, ev_uint, ev_uint }},
{OP_BITOR_I_v6p, {"|", "bitor.i", ev_uint, ev_uint, ev_uint }}, {OP_BITOR_I_v6p, {"bitor", "bitor.i", ev_uint, ev_uint, ev_uint }},
{OP_BITXOR_I_v6p, {"^", "bitxor.i", ev_uint, ev_uint, ev_uint }}, {OP_BITXOR_I_v6p, {"bitxor", "bitxor.i", ev_uint, ev_uint, ev_uint }},
{OP_REM_I_v6p, {"%", "rem.i", ev_uint, ev_uint, ev_uint }}, {OP_REM_I_v6p, {"rem", "rem.i", ev_uint, ev_uint, ev_uint }},
{OP_MOD_I_v6p, {"%%", "mod.i", ev_uint, ev_uint, ev_uint }}, {OP_MOD_I_v6p, {"mod", "mod.i", ev_uint, ev_uint, ev_uint }},
{OP_SHL_I_v6p, {"<<", "shl.i", ev_uint, ev_uint, ev_uint }}, {OP_SHL_I_v6p, {"shl", "shl.i", ev_uint, ev_uint, ev_uint }},
{OP_BITNOT_I_v6p, {"<<", "bitnot.i", ev_uint, ev_invalid, ev_int }}, {OP_BITNOT_I_v6p, {"bitnot", "bitnot.i", ev_uint, ev_invalid, ev_int }},
{} {}
}; };

View file

@ -571,28 +571,28 @@ static const char *
convert_op (int op) convert_op (int op)
{ {
switch (op) { switch (op) {
case OR: return "||"; case OR: return "or";
case AND: return "&&"; case AND: return "and";
case EQ: return "=="; case EQ: return "eq";
case NE: return "!="; case NE: return "ne";
case LE: return "<="; case LE: return "le";
case GE: return ">="; case GE: return "ge";
case LT: return "<"; case LT: return "lt";
case GT: return ">"; case GT: return "gt";
case '+': return "+"; case '+': return "add";
case '-': return "-"; case '-': return "sub";
case '*': return "*"; case '*': return "mul";
case '/': return "/"; case '/': return "div";
case '%': return "%"; case '%': return "rem";
case MOD: return "%%"; case MOD: return "mod";
case '&': return "&"; case '&': return "bitand";
case '|': return "|"; case '|': return "bitor";
case '^': return "^"; case '^': return "bitxor";
case '~': return "~"; case '~': return "bitnot";
case '!': return "!"; case '!': return "not";
case SHL: return "<<"; case SHL: return "shl";
case SHR: return ">>"; case SHR: return "shr";
case '.': return "."; case '.': return "load";
default: default:
return 0; return 0;
} }
@ -603,7 +603,7 @@ statement_is_cond (statement_t *s)
{ {
if (!s) if (!s)
return 0; return 0;
return !strncmp (s->opcode, "<IF", 3); return !strncmp (s->opcode, "if", 2);
} }
int int
@ -611,7 +611,7 @@ statement_is_goto (statement_t *s)
{ {
if (!s) if (!s)
return 0; return 0;
return !strcmp (s->opcode, "<GOTO>"); return !strcmp (s->opcode, "jump");
} }
int int
@ -619,7 +619,7 @@ statement_is_jumpb (statement_t *s)
{ {
if (!s) if (!s)
return 0; return 0;
return !strcmp (s->opcode, "<JUMPB>"); return !strcmp (s->opcode, "jumpb");
} }
int int
@ -627,9 +627,9 @@ statement_is_call (statement_t *s)
{ {
if (!s) if (!s)
return 0; return 0;
if (!strncmp (s->opcode, "<CALL", 5)) if (!strncmp (s->opcode, "call", 4))
return 1; return 1;
if (!strncmp (s->opcode, "<RCALL", 6)) if (!strncmp (s->opcode, "rcall", 5))
return 2; return 2;
return 0; return 0;
} }
@ -639,7 +639,7 @@ statement_is_return (statement_t *s)
{ {
if (!s) if (!s)
return 0; return 0;
return !strncmp (s->opcode, "<RETURN", 7); return !strncmp (s->opcode, "return", 6);
} }
sblock_t * sblock_t *
@ -687,18 +687,18 @@ statement_get_targetlist (statement_t *s)
static void static void
invert_conditional (statement_t *s) invert_conditional (statement_t *s)
{ {
if (!strcmp (s->opcode, "<IF>")) if (!strcmp (s->opcode, "if"))
s->opcode = "<IFNOT>"; s->opcode = "ifnot";
else if (!strcmp (s->opcode, "<IFNOT>")) else if (!strcmp (s->opcode, "ifnot"))
s->opcode = "<IF>"; s->opcode = "if";
else if (!strcmp (s->opcode, "<IFBE>")) else if (!strcmp (s->opcode, "ifbe"))
s->opcode = "<IFA>"; s->opcode = "ifa";
else if (!strcmp (s->opcode, "<IFB>")) else if (!strcmp (s->opcode, "ifb"))
s->opcode = "<IFAE>"; s->opcode = "ifae";
else if (!strcmp (s->opcode, "<IFAE>")) else if (!strcmp (s->opcode, "ifae"))
s->opcode = "<IFB>"; s->opcode = "ifb";
else if (!strcmp (s->opcode, "<IFA>")) else if (!strcmp (s->opcode, "ifa"))
s->opcode = "<IFBE>"; s->opcode = "ifbe";
} }
typedef sblock_t *(*statement_f) (sblock_t *, expr_t *); typedef sblock_t *(*statement_f) (sblock_t *, expr_t *);
@ -712,7 +712,7 @@ static sblock_t *
expr_address (sblock_t *sblock, expr_t *e, operand_t **op) expr_address (sblock_t *sblock, expr_t *e, operand_t **op)
{ {
statement_t *s; statement_t *s;
s = new_statement (st_expr, "&", e); s = new_statement (st_expr, "lea", e);
sblock = statement_subexpr (sblock, e->e.address.lvalue, &s->opa); sblock = statement_subexpr (sblock, e->e.address.lvalue, &s->opa);
if (e->e.address.offset) { if (e->e.address.offset) {
sblock = statement_subexpr (sblock, e->e.address.offset, &s->opb); sblock = statement_subexpr (sblock, e->e.address.offset, &s->opb);
@ -797,8 +797,8 @@ expr_assign_copy (sblock_t *sblock, expr_t *e, operand_t **op, operand_t *src)
operand_t *dst = 0; operand_t *dst = 0;
operand_t *size = 0; operand_t *size = 0;
static const char *opcode_sets[][2] = { static const char *opcode_sets[][2] = {
{"<MOVE>", "<MOVEP>"}, {"move", "movep"},
{"<MEMSET>", "<MEMSETP>"}, {"memset", "memsetp"},
}; };
const unsigned max_count = 1 << 16; const unsigned max_count = 1 << 16;
const char **opcode_set = opcode_sets[0]; const char **opcode_set = opcode_sets[0];
@ -887,7 +887,7 @@ expr_assign (sblock_t *sblock, expr_t *e, operand_t **op)
operand_t *src = 0; operand_t *src = 0;
operand_t *dst = 0; operand_t *dst = 0;
operand_t *ofs = 0; operand_t *ofs = 0;
const char *opcode = "="; const char *opcode = "assign";
st_type_t type; st_type_t type;
if (src_expr->type == ex_assign) { if (src_expr->type == ex_assign) {
@ -931,7 +931,7 @@ dereference_dst:
// dst_expr is a dereferenced pointer, so need to un-dereference it // dst_expr is a dereferenced pointer, so need to un-dereference it
// to get the pointer and switch to storep instructions. // to get the pointer and switch to storep instructions.
dst_expr = expr_file_line (address_expr (dst_expr, 0, 0), e); dst_expr = expr_file_line (address_expr (dst_expr, 0, 0), e);
opcode = ".="; // FIXME find a nicer representation (lose strings?) opcode = "store";// FIXME find a nicer representation (lose strings?)
if (dst_expr->type == ex_address && dst_expr->e.address.offset if (dst_expr->type == ex_address && dst_expr->e.address.offset
&& !is_const_ptr (dst_expr->e.address.lvalue)) { && !is_const_ptr (dst_expr->e.address.lvalue)) {
sblock = statement_subexpr (sblock, sblock = statement_subexpr (sblock,
@ -952,7 +952,7 @@ dereference_dst:
} }
if (is_entity (dst->type) && ofs && is_field (ofs->type)) { if (is_entity (dst->type) && ofs && is_field (ofs->type)) {
s = new_statement (st_expr, "&", dst_expr); s = new_statement (st_expr, "lea", dst_expr);
s->opa = dst; s->opa = dst;
s->opb = ofs; s->opb = ofs;
s->opc = temp_operand (&type_ptr, dst_expr); s->opc = temp_operand (&type_ptr, dst_expr);
@ -1012,7 +1012,7 @@ expr_call (sblock_t *sblock, expr_t *call, operand_t **op)
ind--; ind--;
param = new_param_expr (get_type (a), ind); param = new_param_expr (get_type (a), ind);
if (count && options.code.progsversion != PROG_ID_VERSION && ind < 2) { if (count && options.code.progsversion != PROG_ID_VERSION && ind < 2) {
pref = "R"; pref = "r";
sblock = statement_subexpr (sblock, param, &arguments[ind]); sblock = statement_subexpr (sblock, param, &arguments[ind]);
if (options.code.vector_calls && a->type == ex_value if (options.code.vector_calls && a->type == ex_value
&& a->e.value->lltype == ev_vector) && a->e.value->lltype == ev_vector)
@ -1037,7 +1037,7 @@ expr_call (sblock_t *sblock, expr_t *call, operand_t **op)
arg = p; arg = p;
sblock = statement_subexpr (sblock, a, &arg); sblock = statement_subexpr (sblock, a, &arg);
if (arg != p) { if (arg != p) {
s = new_statement (st_assign, "=", a); s = new_statement (st_assign, "assign", a);
s->opa = arg; s->opa = arg;
s->opb = p; s->opb = p;
sblock_add_statement (sblock, s); sblock_add_statement (sblock, s);
@ -1045,7 +1045,7 @@ expr_call (sblock_t *sblock, expr_t *call, operand_t **op)
} }
} }
} }
opcode = va (0, "<%sCALL%d>", pref, count); opcode = va (0, "%scall%d", pref, count);
s = new_statement (st_func, opcode, call); s = new_statement (st_func, opcode, call);
sblock = statement_subexpr (sblock, func, &s->opa); sblock = statement_subexpr (sblock, func, &s->opa);
s->opb = arguments[0]; s->opb = arguments[0];
@ -1059,13 +1059,13 @@ static sblock_t *
statement_branch (sblock_t *sblock, expr_t *e) statement_branch (sblock_t *sblock, expr_t *e)
{ {
static const char *opcodes[] = { static const char *opcodes[] = {
"<IFNOT>", "ifnot",
"<IFB>", "ifb",
"<IFA>", "ifa",
0, // special handling 0, // special handling
"<IF>", "if",
"<IFAE>", "ifae",
"<IFBE>", "ifbe",
0, // not used here 0, // not used here
}; };
statement_t *s = 0; statement_t *s = 0;
@ -1076,11 +1076,11 @@ statement_branch (sblock_t *sblock, expr_t *e)
} }
if (e->e.branch.type == pr_branch_jump) { if (e->e.branch.type == pr_branch_jump) {
if (e->e.branch.index) { if (e->e.branch.index) {
s = new_statement (st_flow, "<JUMPB>", e); s = new_statement (st_flow, "jumpb", e);
sblock = statement_subexpr (sblock, e->e.branch.target, &s->opa); sblock = statement_subexpr (sblock, e->e.branch.target, &s->opa);
sblock = statement_subexpr (sblock, e->e.branch.index, &s->opb); sblock = statement_subexpr (sblock, e->e.branch.index, &s->opb);
} else { } else {
s = new_statement (st_flow, "<GOTO>", e); s = new_statement (st_flow, "jump", e);
s->opa = label_operand (e->e.branch.target); s->opa = label_operand (e->e.branch.target);
} }
} else { } else {
@ -1102,10 +1102,10 @@ statement_return (sblock_t *sblock, expr_t *e)
statement_t *s; statement_t *s;
debug (e, "RETURN"); debug (e, "RETURN");
opcode = "<RETURN>"; opcode = "return";
if (!e->e.retrn.ret_val) { if (!e->e.retrn.ret_val) {
if (options.code.progsversion != PROG_ID_VERSION) { if (options.code.progsversion != PROG_ID_VERSION) {
opcode = "<RETURN_V>"; opcode = "return_v";
} else { } else {
e->e.retrn.ret_val = new_float_expr (0); e->e.retrn.ret_val = new_float_expr (0);
} }
@ -1125,7 +1125,7 @@ statement_return (sblock_t *sblock, expr_t *e)
static statement_t * static statement_t *
lea_statement (operand_t *pointer, operand_t *offset, expr_t *e) lea_statement (operand_t *pointer, operand_t *offset, expr_t *e)
{ {
statement_t *s = new_statement (st_expr, "&", e); statement_t *s = new_statement (st_expr, "lea", e);
s->opa = pointer; s->opa = pointer;
s->opb = offset; s->opb = offset;
s->opc = temp_operand (&type_ptr, e); s->opc = temp_operand (&type_ptr, e);
@ -1162,14 +1162,14 @@ expr_deref (sblock_t *sblock, expr_t *deref, operand_t **op)
dst_addr = operand_address (*op, e); dst_addr = operand_address (*op, e);
s = new_statement (st_ptrmove, "<MOVEP>", deref); s = new_statement (st_ptrmove, "movep", deref);
s->opa = src_addr; s->opa = src_addr;
//FIXME large types //FIXME large types
s->opb = short_operand (type_size (type), e); s->opb = short_operand (type_size (type), e);
s->opc = dst_addr; s->opc = dst_addr;
sblock_add_statement (sblock, s); sblock_add_statement (sblock, s);
} else { } else {
s = new_statement (st_expr, ".", deref); s = new_statement (st_expr, "load", deref);
s->opa = ptr; s->opa = ptr;
s->opb = offs; s->opb = offs;
s->opc = *op; s->opc = *op;
@ -1186,7 +1186,7 @@ expr_deref (sblock_t *sblock, expr_t *deref, operand_t **op)
sblock = statement_subexpr (sblock, e, &ptr); sblock = statement_subexpr (sblock, e, &ptr);
if (!*op) if (!*op)
*op = temp_operand (type, e); *op = temp_operand (type, e);
s = new_statement (st_expr, ".", deref); s = new_statement (st_expr, "load", deref);
s->opa = ptr; s->opa = ptr;
s->opb = short_operand (0, e); s->opb = short_operand (0, e);
s->opc = *op; s->opc = *op;
@ -1295,7 +1295,7 @@ expr_cast (sblock_t *sblock, expr_t *e, operand_t **op)
operand_t *src = 0; operand_t *src = 0;
sblock = statement_subexpr (sblock, e->e.expr.e1, &src); sblock = statement_subexpr (sblock, e->e.expr.e1, &src);
*op = temp_operand (e->e.expr.type, e); *op = temp_operand (e->e.expr.type, e);
s = new_statement (st_expr, "<CONV>", e); s = new_statement (st_expr, "conv", e);
s->opa = src; s->opa = src;
s->opc = *op; s->opc = *op;
sblock_add_statement (sblock, s); sblock_add_statement (sblock, s);
@ -1483,7 +1483,7 @@ expr_nil (sblock_t *sblock, expr_t *e, operand_t **op)
sblock = statement_subexpr (sblock, new_int_expr(0), &zero); sblock = statement_subexpr (sblock, new_int_expr(0), &zero);
sblock = statement_subexpr (sblock, size_expr, &size); sblock = statement_subexpr (sblock, size_expr, &size);
s = new_statement (st_memset, "<MEMSET>", e); s = new_statement (st_memset, "memset", e);
s->opa = zero; s->opa = zero;
s->opb = size; s->opb = size;
s->opc = *op; s->opc = *op;
@ -1549,7 +1549,7 @@ statement_state (sblock_t *sblock, expr_t *e)
{ {
statement_t *s; statement_t *s;
s = new_statement (st_state, "<STATE>", e); s = new_statement (st_state, "state", e);
sblock = statement_subexpr (sblock, e->e.state.frame, &s->opa); sblock = statement_subexpr (sblock, e->e.state.frame, &s->opa);
sblock = statement_subexpr (sblock, e->e.state.think, &s->opb); sblock = statement_subexpr (sblock, e->e.state.think, &s->opb);
sblock = statement_subexpr (sblock, e->e.state.step, &s->opc); sblock = statement_subexpr (sblock, e->e.state.step, &s->opc);
@ -1738,7 +1738,7 @@ statement_memset (sblock_t *sblock, expr_t *e)
expr_t *dst = e->e.memset.dst; expr_t *dst = e->e.memset.dst;
expr_t *val = e->e.memset.val; expr_t *val = e->e.memset.val;
expr_t *count = e->e.memset.count; expr_t *count = e->e.memset.count;
const char *opcode = "<MEMSET>"; const char *opcode = "memset";
statement_t *s; statement_t *s;
if (is_constant (count)) { if (is_constant (count)) {
@ -2115,9 +2115,9 @@ check_final_block (sblock_t *sblock)
sblock->next = new_sblock (); sblock->next = new_sblock ();
sblock = sblock->next; sblock = sblock->next;
} }
s = new_statement (st_func, "<RETURN_V>", 0); s = new_statement (st_func, "return_v", 0);
if (options.traditional || options.code.progsversion == PROG_ID_VERSION) { if (options.traditional || options.code.progsversion == PROG_ID_VERSION) {
s->opcode = save_string ("<RETURN>"); s->opcode = save_string ("return");
s->opa = return_operand (&type_void, 0); s->opa = return_operand (&type_void, 0);
} }
sblock_add_statement (sblock, s); sblock_add_statement (sblock, s);