const arch_register_t *reg;
const arch_register_req_t *req;
- if (arch_get_irn_reg_class(irn, i) != env->cls)
+ req = arch_get_register_req(irn, i);
+ if (req->cls != env->cls)
continue;
reg = arch_get_irn_register(op);
if(arch_register_type_is(reg, joker))
continue;
- req = arch_get_register_req(irn, i);
if (!arch_register_req_is(req, limited))
continue;
if (arch_register_type_is(reg, ignore))
return 0;
+ if (is_Reg_Phi(irn) || is_Perm_Proj(irn))
+ return 1;
+
req = arch_get_register_req(irn, -1);
- if (is_Reg_Phi(irn) || is_Perm_Proj(irn) || is_2addr_code(req))
+ if (is_2addr_code(req))
return 1;
return 0;
return safe_costs+best_weight;
}
-static void co_collect_units(ir_node *irn, void *env) {
- copy_opt_t *co = env;
+static void co_collect_units(ir_node *irn, void *env)
+{
+ const arch_register_req_t *req = arch_get_register_req(irn, -1);
+ copy_opt_t *co = env;
unit_t *unit;
- if (!is_curr_reg_class(co, irn))
+ if (req->cls != co->cls)
return;
if (!co_is_optimizable_root(irn))
return;
int o, arg_pos;
ir_node *arg = get_irn_n(irn, i);
- assert(is_curr_reg_class(co, arg) && "Argument not in same register class.");
+ assert(arch_get_irn_reg_class(arg, -1) == co->cls && "Argument not in same register class.");
if (arg == irn)
continue;
if (nodes_interfere(co->cenv, irn, arg)) {
unit->nodes[1] = get_Perm_src(irn);
unit->costs[1] = co->get_costs(co, irn, unit->nodes[1], -1);
} else {
- const arch_register_req_t *req = arch_get_register_req(irn, -1);
-
/* Src == Tgt of a 2-addr-code instruction */
if (is_2addr_code(req)) {
const unsigned other = req->other_same;
}
static void build_graph_walker(ir_node *irn, void *env) {
- copy_opt_t *co = env;
+ const arch_register_req_t *req = arch_get_register_req(irn, -1);
+ copy_opt_t *co = env;
int pos, max;
const arch_register_t *reg;
- if (!is_curr_reg_class(co, irn) || arch_irn_is(irn, ignore))
+ if (req->cls != co->cls || arch_irn_is(irn, ignore))
return;
reg = arch_get_irn_register(irn);
} else if (is_Perm_Proj(irn)) { /* Perms */
ir_node *arg = get_Perm_src(irn);
add_edges(co, irn, arg, co->get_costs(co, irn, arg, 0));
- }
- else { /* 2-address code */
- const arch_register_req_t *req = arch_get_register_req(irn, -1);
+ } else { /* 2-address code */
if (is_2addr_code(req)) {
const unsigned other = req->other_same;
int i;
#define ASSERT_OU_AVAIL(co) assert((co)->units.next && "Representation as optimization-units not build")
#define ASSERT_GS_AVAIL(co) assert((co)->nodes && "Representation as graph not build")
-#define get_irn_col(irn) arch_register_get_index(arch_get_irn_register(irn))
-#define set_irn_col(co, irn, col) arch_set_irn_register(irn, arch_register_for_index((co)->cls, col))
-#define is_curr_reg_class(co, irn) (arch_get_irn_reg_class(irn, -1) == (co)->cls)
+#define get_irn_col(irn) arch_register_get_index(arch_get_irn_register(irn))
+#define set_irn_col(co, irn, col) arch_set_irn_register(irn, arch_register_for_index((co)->cls, col))
#define list_entry_units(lh) list_entry(lh, unit_t, units)
/* Consider all phis of this block */
for (phi = get_irn_link(bl); phi; phi = get_irn_link(phi)) {
- int i, max;
- ir_node *arg, *phi_block, *arg_block;
- const arch_register_t *phi_reg, *arg_reg;
- const arch_register_class_t *cls;
+ ir_node *phi_block = get_nodes_block(phi);
+ const arch_register_t *phi_reg = get_reg(phi);
+ const arch_register_class_t *cls = phi_reg->reg_class;
+ int max;
+ int i;
assert(is_Phi(phi) && "Can only handle phi-destruction :)");
- phi_block = get_nodes_block(phi);
- phi_reg = get_reg(phi);
- cls = arch_get_irn_reg_class(phi, -1);
-
/* process all arguments of the phi */
for (i = 0, max = get_irn_arity(phi); i < max; ++i) {
- arg = get_irn_n(phi, i);
- arg_block = get_Block_cfgpred_block(phi_block, i);
- arg_reg = get_reg(arg);
+ ir_node *arg = get_irn_n(phi, i);
+ ir_node *arg_block = get_Block_cfgpred_block(phi_block, i);
+ const arch_register_t *arg_reg = get_reg(arg);
if (arch_irn_is(arg, ignore))
continue;
long proj = get_Proj_proj(node);
ir_mode *mode = get_irn_mode(node);
ir_node *sse_load;
- const arch_register_class_t *cls;
- ir_node *res;
+ ir_node *res;
/* The following is kinda tricky: If we're using SSE, then we have to
* move the result value of the call in floating point registers to an
/* transform call modes */
if (mode_is_data(mode)) {
- cls = arch_get_irn_reg_class(node, -1);
+ const arch_register_class_t *cls = arch_get_irn_reg_class(node, -1);
mode = cls->mode;
}