From f9032113620b9a8e82381aad621f4dd7d1d47c89 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 25 Dec 2021 12:40:24 +0900 Subject: [PATCH] [qfcc] Make operand union anonymous This one was easy enough and gets rid of that little o. wart. --- tools/qfcc/include/statements.h | 2 +- tools/qfcc/source/dags.c | 106 +++++++++---------- tools/qfcc/source/emit.c | 22 ++-- tools/qfcc/source/flow.c | 70 ++++++------ tools/qfcc/source/statements.c | 182 ++++++++++++++++---------------- 5 files changed, 191 insertions(+), 191 deletions(-) diff --git a/tools/qfcc/include/statements.h b/tools/qfcc/include/statements.h index 829723729..d87f4fce5 100644 --- a/tools/qfcc/include/statements.h +++ b/tools/qfcc/include/statements.h @@ -66,7 +66,7 @@ typedef struct operand_s { struct ex_label_s *label; tempop_t tempop; struct operand_s *alias; - } o; + }; } operand_t; /** Overall type of statement. diff --git a/tools/qfcc/source/dags.c b/tools/qfcc/source/dags.c index 974a917f0..fea637564 100644 --- a/tools/qfcc/source/dags.c +++ b/tools/qfcc/source/dags.c @@ -74,13 +74,13 @@ flush_daglabels (void) if ((op = daglabel_chain->op)) { if (op->op_type == op_def) - op->o.def->daglabel = 0; + op->def->daglabel = 0; else if (op->op_type == op_temp) - op->o.tempop.daglabel = 0; + op->tempop.daglabel = 0; else if (op->op_type == op_value) - op->o.value->daglabel = 0; + op->value->daglabel = 0; else if (op->op_type == op_label) - op->o.label->daglabel = 0; + op->label->daglabel = 0; else internal_error (op->expr, "unexpected operand type"); } @@ -166,33 +166,33 @@ operand_label (dag_t *dag, operand_t *op) return 0; if (op->op_type == op_temp) { - //while (op->o.tempop.alias) - // op = op->o.tempop.alias; - if (op->o.tempop.daglabel) - return op->o.tempop.daglabel; + //while (op->tempop.alias) + // op = op->tempop.alias; + if (op->tempop.daglabel) + return op->tempop.daglabel; label = new_label (dag); label->op = op; - op->o.tempop.daglabel = label; + op->tempop.daglabel = label; } else if (op->op_type == op_def) { - def = op->o.def; + def = op->def; if (def->daglabel) return def->daglabel; label = new_label (dag); label->op = op; def->daglabel = label; } else if (op->op_type == op_value) { - val = op->o.value; + val = op->value; if (val->daglabel) return val->daglabel; label = new_label (dag); label->op = op; val->daglabel = label; } else if (op->op_type == op_label) { - if (op->o.label->daglabel) - return op->o.label->daglabel; + if (op->label->daglabel) + return op->label->daglabel; label = new_label (dag); label->op = op; - op->o.label->daglabel = label; + op->label->daglabel = label; } else { internal_error (op->expr, "unexpected operand type: %d", op->op_type); } @@ -225,20 +225,20 @@ dag_node (operand_t *op) if (!op) return 0; if (op->op_type == op_def) { - def = op->o.def; + def = op->def; if (def->daglabel) node = def->daglabel->dagnode; } else if (op->op_type == op_temp) { - while (op->o.tempop.alias) - op = op->o.tempop.alias; - if (op->o.tempop.daglabel) - node = op->o.tempop.daglabel->dagnode; + while (op->tempop.alias) + op = op->tempop.alias; + if (op->tempop.daglabel) + node = op->tempop.daglabel->dagnode; } else if (op->op_type == op_value) { - if (op->o.value->daglabel) - node = op->o.value->daglabel->dagnode; + if (op->value->daglabel) + node = op->value->daglabel->dagnode; } else if (op->op_type == op_label) { - if (op->o.label->daglabel) - node = op->o.label->daglabel->dagnode; + if (op->label->daglabel) + node = op->label->daglabel->dagnode; } return node; } @@ -427,19 +427,19 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n) set_add (node->edges, n->number); } if (op->op_type == op_value - && op->o.value->lltype == ev_pointer - && op->o.value->v.pointer.def) { - def_visit_all (op->o.value->v.pointer.def, 1, + && op->value->lltype == ev_pointer + && op->value->v.pointer.def) { + def_visit_all (op->value->v.pointer.def, 1, dagnode_def_set_edges_visit, n); } if (op->op_type == op_def - && (op->o.def->alias || op->o.def->alias_defs)) { - def_visit_all (op->o.def, 1, + && (op->def->alias || op->def->alias_defs)) { + def_visit_all (op->def, 1, dagnode_def_set_edges_visit, n); } if (op->op_type == op_temp - && (op->o.tempop.alias || op->o.tempop.alias_ops)) { - tempop_visit_all (&op->o.tempop, 1, + && (op->tempop.alias || op->tempop.alias_ops)) { + tempop_visit_all (&op->tempop, 1, dagnode_tempop_set_edges_visit, n); } } @@ -471,7 +471,7 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n) if (num_params && isdigit (*num_params)) { for (i = first_param; i < *num_params - '0'; i++) { flowvar_t *var = flowvars[i + 1]; - def_t *param_def = var->op->o.def; + def_t *param_def = var->op->def; daglabel_t *daglabel; int param_node; @@ -516,7 +516,7 @@ op_is_constant (operand_t *op) if (op->op_type == op_value) return 1; if (op->op_type == op_label) - return op->o.def->constant; + return op->def->constant; return 0; } @@ -535,7 +535,7 @@ dag_tempop_kill_aliases_visit (tempop_t *tempop, void *_l) dagnode_t *node = l->dagnode; daglabel_t *label; - if (tempop == &l->op->o.tempop) + if (tempop == &l->op->tempop) return 0; label = tempop->daglabel; if (label && label->dagnode && !label->dagnode->killed) { @@ -553,7 +553,7 @@ dag_def_kill_aliases_visit (def_t *def, void *_l) dagnode_t *node = l->dagnode; daglabel_t *label; - if (def == l->op->o.def) + if (def == l->op->def) return 0; label = def->daglabel; if (label && label->dagnode && !label->dagnode->killed) { @@ -570,13 +570,13 @@ dag_kill_aliases (daglabel_t *l) operand_t *op = l->op; if (op->op_type == op_temp) { - if (op->o.tempop.alias || op->o.tempop.alias_ops) { - tempop_visit_all (&op->o.tempop, 1, + if (op->tempop.alias || op->tempop.alias_ops) { + tempop_visit_all (&op->tempop, 1, dag_tempop_kill_aliases_visit, l); } } else if (op->op_type == op_def) { - if (op->o.def->alias || op->o.def->alias_defs) { - def_visit_all (op->o.def, 1, dag_def_kill_aliases_visit, l); + if (op->def->alias || op->def->alias_defs) { + def_visit_all (op->def, 1, dag_def_kill_aliases_visit, l); } } else { internal_error (op->expr, "rvalue assignment?"); @@ -606,13 +606,13 @@ dag_live_aliases(operand_t *op) { // FIXME it would be better to propogate the aliasing if (op->op_type == op_temp - && (op->o.tempop.alias || op->o.tempop.alias_ops)) { - tempop_visit_all (&op->o.tempop, 1, dag_tempop_live_aliases, - &op->o.tempop); + && (op->tempop.alias || op->tempop.alias_ops)) { + tempop_visit_all (&op->tempop, 1, dag_tempop_live_aliases, + &op->tempop); } if (op->op_type == op_def - && (op->o.def->alias || op->o.def->alias_defs)) { - def_visit_all (op->o.def, 1, dag_def_live_aliases, op->o.def); + && (op->def->alias || op->def->alias_defs)) { + def_visit_all (op->def, 1, dag_def_live_aliases, op->def); } } @@ -695,10 +695,10 @@ dag_remove_dead_vars (dag_t *dag, set_t *live_vars) if (set_is_member (dag->flownode->global_vars, var->number)) continue; if (l->op->op_type == op_def - && def_visit_all (l->op->o.def, 1, dag_def_alias_live, live_vars)) + && def_visit_all (l->op->def, 1, dag_def_alias_live, live_vars)) continue; if (l->op->op_type == op_temp - && tempop_visit_all (&l->op->o.tempop, 1, dag_tempop_alias_live, + && tempop_visit_all (&l->op->tempop, 1, dag_tempop_alias_live, live_vars)) continue; if (!set_is_member (live_vars, var->number)) @@ -898,11 +898,11 @@ build_statement (const char *opcode, operand_t **operands, expr_t *expr) for (i = 0; i < 3; i++) { if ((op = operands[i])) { while (op->op_type == op_alias) - op = op->o.alias; + op = op->alias; if (op->op_type == op_temp) { - while (op->o.tempop.alias) - op = op->o.tempop.alias; - op->o.tempop.users++; + while (op->tempop.alias) + op = op->tempop.alias; + op->tempop.users++; } } } @@ -1014,8 +1014,8 @@ generate_moveps (dag_t *dag, sblock_t *block, dagnode_t *dagnode) var_iter = set_next (var_iter)) { var = dag->labels[var_iter->element]; dst = var->op; - type = dst->o.def->type; - dstDef = dst->o.def; + type = dst->def->type; + dstDef = dst->def; if (dstDef->alias) { offset = dstDef->offset; dstDef = dstDef->alias; @@ -1075,8 +1075,8 @@ generate_memsetps (dag_t *dag, sblock_t *block, dagnode_t *dagnode) var_iter = set_next (var_iter)) { var = dag->labels[var_iter->element]; dst = var->op; - type = dst->o.def->type; - dstDef = dst->o.def; + type = dst->def->type; + dstDef = dst->def; if (dstDef->alias) { offset = dstDef->offset; dstDef = dstDef->alias; diff --git a/tools/qfcc/source/emit.c b/tools/qfcc/source/emit.c index f61151da3..bec1d9320 100644 --- a/tools/qfcc/source/emit.c +++ b/tools/qfcc/source/emit.c @@ -65,7 +65,7 @@ static def_t *get_operand_def (expr_t *expr, operand_t *op); static def_t * get_tempop_def (expr_t *expr, operand_t *tmpop, type_t *type) { - tempop_t *tempop = &tmpop->o.tempop; + tempop_t *tempop = &tmpop->tempop; if (tempop->def) { return tempop->def; } @@ -108,9 +108,9 @@ get_operand_def (expr_t *expr, operand_t *op) return 0; switch (op->op_type) { case op_def: - return op->o.def; + return op->def; case op_value: - return get_value_def (expr, op->o.value, op->type); + return get_value_def (expr, op->value, op->type); case op_label: op->type = &type_short; zero_def.type = &type_short; @@ -118,7 +118,7 @@ get_operand_def (expr_t *expr, operand_t *op) case op_temp: return get_tempop_def (expr, op, op->type); case op_alias: - return get_operand_def (expr, op->o.alias); + return get_operand_def (expr, op->alias); case op_nil: internal_error (expr, "unexpected nil operand"); } @@ -160,8 +160,8 @@ add_statement_op_ref (operand_t *op, dstatement_t *st, int field) int st_ofs = st - pr.code->code; reloc_t *reloc = new_reloc (0, st_ofs, rel_op_a_op + field); - reloc->next = op->o.label->dest->relocs; - op->o.label->dest->relocs = reloc; + reloc->next = op->label->dest->relocs; + op->label->dest->relocs = reloc; } } @@ -170,11 +170,11 @@ use_tempop (operand_t *op, expr_t *expr) { if (!op || op->op_type != op_temp) return; - while (op->o.tempop.alias) - op = op->o.tempop.alias; - if (--op->o.tempop.users == 0) - free_temp_def (op->o.tempop.def); - if (op->o.tempop.users <= -1) + while (op->tempop.alias) + op = op->tempop.alias; + if (--op->tempop.users == 0) + free_temp_def (op->tempop.def); + if (op->tempop.users <= -1) bug (expr, "temp users went negative: %s", operand_string (op)); } diff --git a/tools/qfcc/source/flow.c b/tools/qfcc/source/flow.c index f981f7c51..4c4e6dedb 100644 --- a/tools/qfcc/source/flow.c +++ b/tools/qfcc/source/flow.c @@ -215,7 +215,7 @@ flowvar_is_global (flowvar_t *var) if (var->op->op_type != op_def) return 0; - def = var->op->o.def; + def = var->op->def; if (def->alias) def = def->alias; if (def->local) @@ -238,7 +238,7 @@ flowvar_is_param (flowvar_t *var) if (var->op->op_type != op_def) return 0; - def = var->op->o.def; + def = var->op->def; if (def->alias) def = def->alias; if (!def->local) @@ -273,12 +273,12 @@ flowvar_get_def (flowvar_t *var) switch (op->op_type) { case op_def: - return op->o.def; + return op->def; case op_value: case op_label: return 0; case op_temp: - return op->o.tempop.def; + return op->tempop.def; case op_alias: internal_error (op->expr, "unexpected alias operand"); case op_nil: @@ -302,14 +302,14 @@ flow_get_var (operand_t *op) return 0; if (op->op_type == op_temp) { - if (!op->o.tempop.flowvar) - op->o.tempop.flowvar = new_flowvar (); - return op->o.tempop.flowvar; + if (!op->tempop.flowvar) + op->tempop.flowvar = new_flowvar (); + return op->tempop.flowvar; } if (op->op_type == op_def) { - if (!op->o.def->flowvar) - op->o.def->flowvar = new_flowvar (); - return op->o.def->flowvar; + if (!op->def->flowvar) + op->def->flowvar = new_flowvar (); + return op->def->flowvar; } return 0; } @@ -369,21 +369,21 @@ static int get_temp_address (function_t *func, operand_t *op) { operand_t *top = op; - if (op->o.tempop.flowaddr) { - return op->o.tempop.flowaddr; + if (op->tempop.flowaddr) { + return op->tempop.flowaddr; } - while (top->o.tempop.alias) { - top = top->o.tempop.alias; + while (top->tempop.alias) { + top = top->tempop.alias; } - if (!top->o.tempop.flowaddr) { - top->o.tempop.flowaddr = func->pseudo_addr; + if (!top->tempop.flowaddr) { + top->tempop.flowaddr = func->pseudo_addr; func->pseudo_addr += top->size; } - if (top->o.tempop.offset) { + if (top->tempop.offset) { internal_error (top->expr, "real tempop with a non-zero offset"); } - op->o.tempop.flowaddr = top->o.tempop.flowaddr + op->o.tempop.offset; - return op->o.tempop.flowaddr; + op->tempop.flowaddr = top->tempop.flowaddr + op->tempop.offset; + return op->tempop.flowaddr; } /** Add an operand's flowvar to the function's list of variables. @@ -415,7 +415,7 @@ add_operand (function_t *func, operand_t *op) if (op->op_type == op_temp) { var->flowaddr = get_temp_address (func, op); } else if (flowvar_is_local (var)) { - var->flowaddr = func->num_statements + def_offset (var->op->o.def); + var->flowaddr = func->num_statements + def_offset (var->op->def); } } } @@ -537,7 +537,7 @@ flow_build_vars (function_t *func) flow_analyze_statement (s, 0, 0, 0, operands); for (j = 0; j < FLOW_OPERANDS; j++) { if (operands[j] && operands[j]->op_type == op_def) { - def_visit_all (operands[j]->o.def, 0, + def_visit_all (operands[j]->def, 0, flow_def_clear_flowvars, 0); } } @@ -546,7 +546,7 @@ flow_build_vars (function_t *func) for (i = 0; i < num_flow_params; i++) { def_t *def = param_symbol (flow_params[i].name)->s.def; def_visit_all (def, 0, flow_def_clear_flowvars, 0); - flow_params[i].op.o.def = def; + flow_params[i].op.def = def; num_vars += count_operand (&flow_params[i].op); } // then run through the statements in the function looking for accessed @@ -664,9 +664,9 @@ flow_kill_aliases (set_t *kill, flowvar_t *var, const set_t *uninit) tmp = set_new (); // collect the kill sets from any aliases if (op->op_type == op_temp) { - tempop_visit_all (&op->o.tempop, 1, flow_tempop_kill_aliases, tmp); + tempop_visit_all (&op->tempop, 1, flow_tempop_kill_aliases, tmp); } else if (op->op_type == op_def) { - def_visit_all (op->o.def, 1, flow_def_kill_aliases, tmp); + def_visit_all (op->def, 1, flow_def_kill_aliases, tmp); } // don't allow aliases to kill definitions in the entry dummy block if (uninit) { @@ -912,13 +912,13 @@ flow_uninit_scan_statements (flownode_t *node, set_t *defs, set_t *uninit) set_difference (defs, var->define); if (var->op->op_type == op_temp) { op = var->op; - if (op->o.tempop.alias) { - var = op->o.tempop.alias->o.tempop.flowvar; + if (op->tempop.alias) { + var = op->tempop.alias->tempop.flowvar; if (var) set_difference (defs, var->define); } - for (op = op->o.tempop.alias_ops; op; op = op->next) { - var = op->o.tempop.flowvar; + for (op = op->tempop.alias_ops; op; op = op->next) { + var = op->tempop.flowvar; if (var) set_difference (defs, var->define); } @@ -1062,9 +1062,9 @@ flow_add_op_var (set_t *set, operand_t *op, int is_use) // var is being treated as assigned as well. Want to handle partial // defs properly, but I am as yet uncertain of how. if (op->op_type == op_temp) { - tempop_visit_all (&op->o.tempop, ol, flow_tempop_add_aliases, set); + tempop_visit_all (&op->tempop, ol, flow_tempop_add_aliases, set); } else { - def_visit_all (op->o.def, ol, flow_def_add_aliases, set); + def_visit_all (op->def, ol, flow_def_add_aliases, set); } } @@ -1073,15 +1073,15 @@ flow_analyze_pointer_operand (operand_t *ptrop, set_t *def) { operand_t *op = 0; - if (ptrop->op_type == op_value && ptrop->o.value->lltype == ev_pointer) { - ex_pointer_t *ptr = &ptrop->o.value->v.pointer; - if (ptrop->o.value->v.pointer.def) { + if (ptrop->op_type == op_value && ptrop->value->lltype == ev_pointer) { + ex_pointer_t *ptr = &ptrop->value->v.pointer; + if (ptrop->value->v.pointer.def) { def_t *alias; alias = alias_def (ptr->def, ptr->type, ptr->val); op = def_operand (alias, ptr->type, ptrop->expr); } - if (ptrop->o.value->v.pointer.tempop) { - op = ptrop->o.value->v.pointer.tempop; + if (ptrop->value->v.pointer.tempop) { + op = ptrop->value->v.pointer.tempop; } if (op) { flow_add_op_var (def, op, 0); diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 7e93658f8..efc9ce2b0 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -97,14 +97,14 @@ optype_str (op_type_e type) static const char * tempop_string (operand_t *tmpop) { - tempop_t *tempop = &tmpop->o.tempop; + tempop_t *tempop = &tmpop->tempop; if (tempop->alias) { return va (0, "", pr_type_name[tempop->type->type], tmpop, tempop->users, tempop->alias, tempop->offset, - tempop->alias->o.tempop.users); + tempop->alias->tempop.users); } return va (0, "", pr_type_name[tempop->type->type], tmpop, tempop->users); @@ -117,51 +117,51 @@ operand_string (operand_t *op) return ""; switch (op->op_type) { case op_def: - return op->o.def->name; + return op->def->name; case op_value: - switch (op->o.value->lltype) { + switch (op->value->lltype) { case ev_string: return va (0, "\"%s\"", - quote_string (op->o.value->v.string_val)); + quote_string (op->value->v.string_val)); case ev_double: - return va (0, "%g", op->o.value->v.double_val); + return va (0, "%g", op->value->v.double_val); case ev_float: - return va (0, "%g", op->o.value->v.float_val); + return va (0, "%g", op->value->v.float_val); case ev_vector: return va (0, "'%g %g %g'", - op->o.value->v.vector_val[0], - op->o.value->v.vector_val[1], - op->o.value->v.vector_val[2]); + op->value->v.vector_val[0], + op->value->v.vector_val[1], + op->value->v.vector_val[2]); case ev_quat: return va (0, "'%g %g %g %g'", - op->o.value->v.quaternion_val[0], - op->o.value->v.quaternion_val[1], - op->o.value->v.quaternion_val[2], - op->o.value->v.quaternion_val[3]); + op->value->v.quaternion_val[0], + op->value->v.quaternion_val[1], + op->value->v.quaternion_val[2], + op->value->v.quaternion_val[3]); case ev_pointer: - if (op->o.value->v.pointer.def) { + if (op->value->v.pointer.def) { return va (0, "ptr %s+%d", - op->o.value->v.pointer.def->name, - op->o.value->v.pointer.val); - } else if(op->o.value->v.pointer.tempop) { - operand_t *tempop = op->o.value->v.pointer.tempop; + op->value->v.pointer.def->name, + op->value->v.pointer.val); + } else if(op->value->v.pointer.tempop) { + operand_t *tempop = op->value->v.pointer.tempop; return va (0, "ptr %s+%d", tempop_string (tempop), - op->o.value->v.pointer.val); + op->value->v.pointer.val); } else { - return va (0, "ptr %d", op->o.value->v.pointer.val); + return va (0, "ptr %d", op->value->v.pointer.val); } case ev_field: - return va (0, "field %d", op->o.value->v.pointer.val); + return va (0, "field %d", op->value->v.pointer.val); case ev_entity: - return va (0, "ent %d", op->o.value->v.integer_val); + return va (0, "ent %d", op->value->v.integer_val); case ev_func: - return va (0, "func %d", op->o.value->v.integer_val); + return va (0, "func %d", op->value->v.integer_val); case ev_integer: - return va (0, "int %d", op->o.value->v.integer_val); + return va (0, "int %d", op->value->v.integer_val); case ev_uinteger: - return va (0, "uint %u", op->o.value->v.uinteger_val); + return va (0, "uint %u", op->value->v.uinteger_val); case ev_short: - return va (0, "short %d", op->o.value->v.short_val); + return va (0, "short %d", op->value->v.short_val); case ev_void: return "(void)"; case ev_invalid: @@ -171,12 +171,12 @@ operand_string (operand_t *op) } break; case op_label: - return op->o.label->name; + return op->label->name; case op_temp: return tempop_string (op); case op_alias: { - const char *alias = operand_string (op->o.alias); + const char *alias = operand_string (op->alias); char *buf = alloca (strlen (alias) + 1); strcpy (buf, alias); return va (0, "alias(%s,%s)", pr_type_name[op->type->type], @@ -194,49 +194,49 @@ _print_operand (operand_t *op) switch (op->op_type) { case op_def: printf ("(%s) ", pr_type_name[op->type->type]); - printf ("%s", op->o.def->name); + printf ("%s", op->def->name); break; case op_value: printf ("(%s) ", pr_type_name[op->type->type]); - switch (op->o.value->lltype) { + switch (op->value->lltype) { case ev_string: - printf ("\"%s\"", op->o.value->v.string_val); + printf ("\"%s\"", op->value->v.string_val); break; case ev_double: - printf ("%g", op->o.value->v.double_val); + printf ("%g", op->value->v.double_val); break; case ev_float: - printf ("%g", op->o.value->v.float_val); + printf ("%g", op->value->v.float_val); break; case ev_vector: - printf ("'%g", op->o.value->v.vector_val[0]); - printf (" %g", op->o.value->v.vector_val[1]); - printf (" %g'", op->o.value->v.vector_val[2]); + printf ("'%g", op->value->v.vector_val[0]); + printf (" %g", op->value->v.vector_val[1]); + printf (" %g'", op->value->v.vector_val[2]); break; case ev_quat: - printf ("'%g", op->o.value->v.quaternion_val[0]); - printf (" %g", op->o.value->v.quaternion_val[1]); - printf (" %g", op->o.value->v.quaternion_val[2]); - printf (" %g'", op->o.value->v.quaternion_val[3]); + printf ("'%g", op->value->v.quaternion_val[0]); + printf (" %g", op->value->v.quaternion_val[1]); + printf (" %g", op->value->v.quaternion_val[2]); + printf (" %g'", op->value->v.quaternion_val[3]); break; case ev_pointer: printf ("(%s)[%d]", - pr_type_name[op->o.value->v.pointer.type->type], - op->o.value->v.pointer.val); + pr_type_name[op->value->v.pointer.type->type], + op->value->v.pointer.val); break; case ev_field: - printf ("%d", op->o.value->v.pointer.val); + printf ("%d", op->value->v.pointer.val); break; case ev_entity: case ev_func: case ev_integer: - printf ("%d", op->o.value->v.integer_val); + printf ("%d", op->value->v.integer_val); break; case ev_uinteger: - printf ("%u", op->o.value->v.uinteger_val); + printf ("%u", op->value->v.uinteger_val); break; case ev_short: - printf ("%d", op->o.value->v.short_val); + printf ("%d", op->value->v.short_val); break; case ev_void: case ev_invalid: @@ -245,16 +245,16 @@ _print_operand (operand_t *op) } break; case op_label: - printf ("block %p", op->o.label->dest); + printf ("block %p", op->label->dest); break; case op_temp: printf ("tmp (%s) %p", pr_type_name[op->type->type], op); - if (op->o.tempop.def) - printf (" %s", op->o.tempop.def->name); + if (op->tempop.def) + printf (" %s", op->tempop.def->name); break; case op_alias: printf ("alias(%s,", pr_type_name[op->type->type]); - _print_operand (op->o.alias); + _print_operand (op->alias); printf (")"); break; case op_nil: @@ -379,7 +379,7 @@ def_operand (def_t *def, type_t *type, expr_t *expr) op = new_operand (op_def, expr, __builtin_return_address (0)); op->type = type; op->size = type_size (type); - op->o.def = def; + op->def = def; return op; } @@ -398,7 +398,7 @@ value_operand (ex_value_t *value, expr_t *expr) operand_t *op; op = new_operand (op_value, expr, __builtin_return_address (0)); op->type = value->type; - op->o.value = value; + op->value = value; return op; } @@ -407,7 +407,7 @@ temp_operand (type_t *type, expr_t *expr) { operand_t *op = new_operand (op_temp, expr, __builtin_return_address (0)); - op->o.tempop.type = type; + op->tempop.type = type; op->type = type; op->size = type_size (type); return op; @@ -422,10 +422,10 @@ tempop_overlap (tempop_t *t1, tempop_t *t2) int size2 = type_size (t2->type); if (t1->alias) { - offs1 += t1->alias->o.tempop.offset; + offs1 += t1->alias->tempop.offset; } if (t2->alias) { - offs2 += t2->alias->o.tempop.offset; + offs2 += t2->alias->tempop.offset; } if (offs1 <= offs2 && offs1 + size1 >= offs2 + size2) return 2; // t1 fully overlaps t2 @@ -449,7 +449,7 @@ tempop_visit_all (tempop_t *tempop, int overlap, if (top->op_type != op_temp) { internal_error (top->expr, "temp alias of non-temp operand"); } - tempop = &top->o.tempop; + tempop = &top->tempop; if ((ret = visit (tempop, data))) return ret; } else { @@ -459,7 +459,7 @@ tempop_visit_all (tempop_t *tempop, int overlap, if (top->op_type != op_temp) { internal_error (top->expr, "temp alias of non-temp operand"); } - tempop = &top->o.tempop; + tempop = &top->tempop; if (tempop == start_tempop) continue; if (overlap && tempop_overlap (tempop, start_tempop) < overlap) @@ -481,7 +481,7 @@ alias_operand (type_t *type, operand_t *op, expr_t *expr) type_size (type), type_size (op->type)); } aop = new_operand (op_alias, expr, __builtin_return_address (0)); - aop->o.alias = op; + aop->alias = op; aop->type = type; aop->size = type_size (type); return aop; @@ -496,7 +496,7 @@ label_operand (expr_t *label) internal_error (label, "not a label expression"); } lop = new_operand (op_label, label, __builtin_return_address (0)); - lop->o.label = &label->e.label; + lop->label = &label->e.label; return lop; } @@ -595,9 +595,9 @@ sblock_t * statement_get_target (statement_t *s) { if (statement_is_cond (s)) - return s->opb->o.label->dest; + return s->opb->label->dest; if (statement_is_goto (s)) - return s->opa->o.label->dest; + return s->opa->label->dest; return 0; } @@ -614,7 +614,7 @@ statement_get_targetlist (statement_t *s) } else if (statement_is_goto (s)) { count = 1; } else if (statement_is_jumpb (s)) { - table = s->opa->o.def; + table = s->opa->def; count = table->type->t.array.size; } target_list = malloc ((count + 1) * sizeof (sblock_t *)); @@ -708,7 +708,7 @@ operand_address (operand_t *reference, expr_t *e) case op_def: // assumes aliasing is only one level deep which should be the // case - def = reference->o.def; + def = reference->def; if (def->alias) { offset = def->offset; def = def->alias; @@ -717,9 +717,9 @@ operand_address (operand_t *reference, expr_t *e) case op_temp: // assumes aliasing is only one level deep which should be the // case - if (reference->o.tempop.alias) { - offset = reference->o.tempop.offset; - reference = reference->o.tempop.alias; + if (reference->tempop.alias) { + offset = reference->tempop.offset; + reference = reference->tempop.alias; } return value_operand (new_pointer_val (offset, type, 0, reference), e); @@ -1160,33 +1160,33 @@ expr_alias (sblock_t *sblock, expr_t *e, operand_t **op) return sblock; } if (aop->op_type == op_temp) { - while (aop->o.tempop.alias) { - aop = aop->o.tempop.alias; + while (aop->tempop.alias) { + aop = aop->tempop.alias; if (aop->op_type != op_temp) internal_error (e, "temp alias of non-temp var"); - if (aop->o.tempop.alias) + if (aop->tempop.alias) bug (e, "aliased temp alias"); } - for (top = aop->o.tempop.alias_ops; top; top = top->next) { - if (top->type == type && top->o.tempop.offset == offset) { + for (top = aop->tempop.alias_ops; top; top = top->next) { + if (top->type == type && top->tempop.offset == offset) { break; } } if (!top) { top = temp_operand (type, e); - top->o.tempop.alias = aop; - top->o.tempop.offset = offset; - top->next = aop->o.tempop.alias_ops; - aop->o.tempop.alias_ops = top; + top->tempop.alias = aop; + top->tempop.offset = offset; + top->next = aop->tempop.alias_ops; + aop->tempop.alias_ops = top; } *op = top; } else if (aop->op_type == op_def) { - def = aop->o.def; + def = aop->def; while (def->alias) def = def->alias; *op = def_operand (alias_def (def, type, offset), 0, e); } else if (aop->op_type == op_value) { - *op = value_operand (aop->o.value, e); + *op = value_operand (aop->value, e); (*op)->type = type; } else { internal_error (e, "invalid alias target: %s: %s", @@ -1919,21 +1919,21 @@ thread_jumps (sblock_t *blocks) continue; s = (statement_t *) sblock->tail; if (statement_is_goto (s)) { - label = &s->opa->o.label; + label = &s->opa->label; if (!(*label)->dest && (*label)->symbol) { error (s->opa->expr, "undefined label `%s'", (*label)->symbol->name); (*label)->symbol = 0; } } else if (statement_is_cond (s)) { - label = &s->opb->o.label; + label = &s->opb->label; } else { continue; } for (l = *label; l->dest && l->dest->statements && statement_is_goto (l->dest->statements); - l = l->dest->statements->opa->o.label) { + l = l->dest->statements->opa->label) { } if (l != *label) { unuse_label (*label); @@ -1986,11 +1986,11 @@ remove_dead_blocks (sblock_t *blocks) s = (statement_t *) sblock->tail; if (statement_is_cond (s) && sb->statements && statement_is_goto (sb->statements) - && s->opb->o.label->dest == sb->next) { + && s->opb->label->dest == sb->next) { debug (0, "merging if/goto %p %p", sblock, sb); - unuse_label (s->opb->o.label); - s->opb->o.label = sb->statements->opa->o.label; - s->opb->o.label->used++; + unuse_label (s->opb->label); + s->opb->label = sb->statements->opa->label; + s->opb->label->used++; invert_conditional (s); sb->reachable = 0; for (sb = sb->next; sb; sb = sb->next) @@ -2013,9 +2013,9 @@ remove_dead_blocks (sblock_t *blocks) if (sb->statements) { s = (statement_t *) sb->tail; if (statement_is_goto (s)) - label = s->opa->o.label; + label = s->opa->label; else if (statement_is_cond (s)) - label = s->opb->o.label; + label = s->opb->label; } unuse_label (label); did_something = 1; @@ -2038,7 +2038,7 @@ search_for_super_dealloc (sblock_t *sblock) continue; } if (st->opa->op_type != op_def - || strcmp (st->opa->o.def->name, "obj_msgSend_super") != 0) { + || strcmp (st->opa->def->name, "obj_msgSend_super") != 0) { continue; } // FIXME this is messy (calls should have their own expression @@ -2149,9 +2149,9 @@ count_temp (operand_t *op) if (!op) return; if (op->op_type == op_temp) { - while (op->o.tempop.alias) - op = op->o.tempop.alias; - op->o.tempop.users++; + while (op->tempop.alias) + op = op->tempop.alias; + op->tempop.users++; } }