case ir_bk_parity:
case ir_bk_popcount:
case ir_bk_bswap:
- assert(get_Proj_proj(proj) == pn_Builtin_1_result);
+ assert(get_Proj_proj(proj) == pn_Builtin_max+1);
return new_node;
case ir_bk_trap:
case ir_bk_debugbreak:
case ir_bk_parity:
case ir_bk_popcount:
case ir_bk_bswap:
- assert(get_Proj_proj(proj) == pn_Builtin_1_result);
+ assert(get_Proj_proj(proj) == pn_Builtin_max+1);
return new_node;
case ir_bk_trap:
case ir_bk_debugbreak:
assert(get_Proj_proj(proj) == pn_Builtin_M);
return new_node;
case ir_bk_inport:
- if (get_Proj_proj(proj) == pn_Builtin_1_result) {
+ if (get_Proj_proj(proj) == pn_Builtin_max+1) {
return new_r_Proj(new_node, get_irn_mode(proj), pn_ia32_Inport_res);
} else {
assert(get_Proj_proj(proj) == pn_Builtin_M);
return new_r_Proj(new_node, mode_M, pn_ia32_Inport_M);
}
case ir_bk_inner_trampoline:
- if (get_Proj_proj(proj) == pn_Builtin_1_result) {
+ if (get_Proj_proj(proj) == pn_Builtin_max+1) {
return get_Tuple_pred(new_node, 1);
} else {
assert(get_Proj_proj(proj) == pn_Builtin_M);
#include "pset.h"
#include "util.h"
+typedef struct pns_lookup {
+ long nr; /**< the proj number */
+ const char *name; /**< the name of the Proj */
+} pns_lookup_t;
+
+typedef struct proj_lookup {
+ unsigned code; /**< the opcode of the Proj predecessor */
+ unsigned num_data; /**< number of data entries */
+ const pns_lookup_t *data; /**< the data */
+} proj_lookup_t;
+
+#include "gen_irdump.c.inl"
+
/** Dump only irgs with names that start with this prefix. */
static ident *dump_file_filter_id = NULL;
return bad;
}
-typedef struct pns_lookup {
- long nr; /**< the proj number */
- const char *name; /**< the name of the Proj */
-} pns_lookup_t;
-
-typedef struct proj_lookup {
- unsigned code; /**< the opcode of the Proj predecessor */
- unsigned num_data; /**< number of data entries */
- const pns_lookup_t *data; /**< the data */
-} proj_lookup_t;
-
-/** the lookup table for Proj(Start) names */
-static const pns_lookup_t start_lut[] = {
-#define X(a) { pn_Start_##a, #a }
- X(X_initial_exec),
- X(M),
- X(P_frame_base),
- X(T_args),
-#undef X
-};
-
-/** the lookup table for Proj(Cond) names */
-static const pns_lookup_t cond_lut[] = {
-#define X(a) { pn_Cond_##a, #a }
- X(false),
- X(true)
-#undef X
-};
-
-/** the lookup table for Proj(Call) names */
-static const pns_lookup_t call_lut[] = {
-#define X(a) { pn_Call_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(T_result),
-#undef X
-};
-
-/** the lookup table for Proj(Div) names */
-static const pns_lookup_t div_lut[] = {
-#define X(a) { pn_Div_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res)
-#undef X
-};
-
-/** the lookup table for Proj(Mod) names */
-static const pns_lookup_t mod_lut[] = {
-#define X(a) { pn_Mod_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res)
-#undef X
-};
-
-/** the lookup table for Proj(Load) names */
-static const pns_lookup_t load_lut[] = {
-#define X(a) { pn_Load_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res)
-#undef X
-};
-
-/** the lookup table for Proj(Store) names */
-static const pns_lookup_t store_lut[] = {
-#define X(a) { pn_Store_##a, #a }
- X(M),
- X(X_regular),
- X(X_except)
-#undef X
-};
-
-/** the lookup table for Proj(Alloc) names */
-static const pns_lookup_t alloc_lut[] = {
-#define X(a) { pn_Alloc_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res)
-#undef X
-};
-
-/** the lookup table for Proj(CopyB) names */
-static const pns_lookup_t copyb_lut[] = {
-#define X(a) { pn_CopyB_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
-#undef X
-};
-
-/** the lookup table for Proj(InstOf) names */
-static const pns_lookup_t instof_lut[] = {
-#define X(a) { pn_InstOf_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res),
-#undef X
-};
-
-/** the lookup table for Proj(Raise) names */
-static const pns_lookup_t raise_lut[] = {
-#define X(a) { pn_Raise_##a, #a }
- X(M),
- X(X),
-#undef X
-};
-
-/** the lookup table for Proj(Bound) names */
-static const pns_lookup_t bound_lut[] = {
-#define X(a) { pn_Bound_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res),
-#undef X
-};
-
-/** the Proj lookup table */
-static const proj_lookup_t proj_lut[] = {
-#define E(a) ARRAY_SIZE(a), a
- { iro_Start, E(start_lut) },
- { iro_Cond, E(cond_lut) },
- { iro_Call, E(call_lut) },
- { iro_Div, E(div_lut) },
- { iro_Mod, E(mod_lut) },
- { iro_Load, E(load_lut) },
- { iro_Store, E(store_lut) },
- { iro_Alloc, E(alloc_lut) },
- { iro_CopyB, E(copyb_lut) },
- { iro_InstOf, E(instof_lut) },
- { iro_Raise, E(raise_lut) },
- { iro_Bound, E(bound_lut) }
-#undef E
-};
-
/**
* Dump additional node attributes of some nodes to a file F.
*/
turn_into_tuple(node, 2);
set_irn_n(node, pn_Builtin_M, call_mem);
- set_irn_n(node, pn_Builtin_1_result, call_res);
+ set_irn_n(node, pn_Builtin_max+1, call_res);
}
static void lower_builtin(ir_node *node, void *env)
ir_node *cmp_low = new_rd_Cmp(dbgi, block, entry->low_word, zero_unsigned, ir_relation_equal);
ir_node *cmp_high = new_rd_Cmp(dbgi, block, entry->high_word, zero_unsigned, ir_relation_equal);
ir_node *ffs_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high);
- ir_node *high_proj = new_r_Proj(ffs_high, mode_Is, pn_Builtin_1_result);
+ ir_node *high_proj = new_r_Proj(ffs_high, mode_Is, pn_Builtin_max+1);
ir_node *high = new_rd_Add(dbgi, block, high_proj, number_of_bits, mode_Is);
ir_node *ffs_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low);
- ir_node *low = new_r_Proj(ffs_low, mode_Is, pn_Builtin_1_result);
+ ir_node *low = new_r_Proj(ffs_low, mode_Is, pn_Builtin_max+1);
ir_node *mux_high = new_rd_Mux(dbgi, block, cmp_high, high, zero_signed, mode_Is);
if (! allow_ifconv(cmp_high, high, zero_signed))
ir_node *zero_unsigned = new_rd_Const(dbgi, irg, get_mode_null(mode_Iu));
ir_node *cmp_high = new_rd_Cmp(dbgi, block, entry->high_word, zero_unsigned, ir_relation_equal);
ir_node *clz_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high);
- ir_node *high = new_r_Proj(clz_high, mode_Is, pn_Builtin_1_result);
+ ir_node *high = new_r_Proj(clz_high, mode_Is, pn_Builtin_max+1);
ir_node *clz_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low);
- ir_node *low_proj = new_r_Proj(clz_low, mode_Is, pn_Builtin_1_result);
+ ir_node *low_proj = new_r_Proj(clz_low, mode_Is, pn_Builtin_max+1);
ir_node *low = new_rd_Add(dbgi, block, low_proj, number_of_bits, mode_Is);
res = new_rd_Mux(dbgi, block, cmp_high, high, low, mode_Is);
ir_node *zero_unsigned = new_rd_Const(dbgi, irg, get_mode_null(mode_Iu));
ir_node *cmp_low = new_rd_Cmp(dbgi, block, entry->low_word, zero_unsigned, ir_relation_equal);
ir_node *ffs_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high);
- ir_node *high_proj = new_r_Proj(ffs_high, mode_Is, pn_Builtin_1_result);
+ ir_node *high_proj = new_r_Proj(ffs_high, mode_Is, pn_Builtin_max+1);
ir_node *high = new_rd_Add(dbgi, block, high_proj, number_of_bits, mode_Is);
ir_node *ffs_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low);
- ir_node *low = new_r_Proj(ffs_low, mode_Is, pn_Builtin_1_result);
+ ir_node *low = new_r_Proj(ffs_low, mode_Is, pn_Builtin_max+1);
res = new_rd_Mux(dbgi, block, cmp_low, low, high, mode_Is);
ir_node *in_low[1] = {entry->low_word};
ir_node *popcount_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high);
ir_node *popcount_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low);
- ir_node *high = new_r_Proj(popcount_high, mode_Is, pn_Builtin_1_result);
- ir_node *low = new_r_Proj(popcount_low, mode_Is, pn_Builtin_1_result);
+ ir_node *high = new_r_Proj(popcount_high, mode_Is, pn_Builtin_max+1);
+ ir_node *low = new_r_Proj(popcount_low, mode_Is, pn_Builtin_max+1);
res = new_rd_Add(dbgi, block, high, low, mode_Is);
break;
assert(arity == 2);
parity_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high);
- high = new_r_Proj(parity_high, mode_Is, pn_Builtin_1_result);
+ high = new_r_Proj(parity_high, mode_Is, pn_Builtin_max+1);
parity_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low);
- low = new_r_Proj(parity_low, mode_Is, pn_Builtin_1_result);
+ low = new_r_Proj(parity_low, mode_Is, pn_Builtin_max+1);
res = new_rd_Eor(dbgi, block, high, low, mode_Is);
break;
}
turn_into_tuple(builtin, 2);
set_irn_n(builtin, pn_Builtin_M, mem);
- set_irn_n(builtin, pn_Builtin_1_result, res);
+ set_irn_n(builtin, pn_Builtin_max+1, res);
}
/**
irn = new_rd_Builtin(dbg, block, get_irg_no_mem(current_ir_graph), 1, &op, ir_bk_bswap, tp);
set_irn_pinned(irn, op_pin_state_floats);
- irn = new_r_Proj(irn, get_irn_mode(op), pn_Builtin_1_result);
+ irn = new_r_Proj(irn, get_irn_mode(op), pn_Builtin_max+1);
replace_call(irn, call, mem, NULL, NULL);
return 1;
} /* i_mapper_bswap */
{% endfor %}
''')
+irdump_template = env.from_string(
+'''/* Warning: automatically generated code */
+{% for node in nodes %}
+{%- if node.outs %}
+static const pns_lookup_t {{node.name}}_lut[] = {
+ {%- for out in node.outs %}
+ { pn_{{node.name}}_{{out[0]}}, "{{out[0]}}" },
+ {%- endfor %}
+};
+{% endif -%}
+{%- endfor %}
+
+static const proj_lookup_t proj_lut[] = {
+ {%- for node in nodes -%}
+ {%- if node.outs %}
+ { iro_{{node.name}}, ARRAY_SIZE({{node.name}}_lut), {{node.name}}_lut },
+ {%- endif %}
+ {%- endfor %}
+};
+''')
+
irop_template = env.from_string(
'''/* Warning: automatically generated code */
{% for node in nodes %}
file.write(irop_template.render(nodes = real_nodes))
file.close()
+ file = open(gendir + "/gen_irdump.c.inl", "w")
+ file.write(irdump_template.render(nodes = real_nodes))
+ file.close()
+
file = open(gendir2 + "/opcodes.h", "w")
file.write(opcodes_h_template.render(nodes = real_nodes))
file.close()
]
arity = "variable"
outs = [
- ("M", "memory result"),
- ("1_result", "first result"),
+ ("M", "memory result"),
+ # results follow here
]
flags = [ "uses_memory" ]
attrs = [