ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode,
- const arch_register_class_t *cls)
+ const arch_register_req_t *req)
{
- const arch_register_req_t *req;
ir_graph *irg = get_irn_irg(block);
struct obstack *obst = be_get_be_obst(irg);
backend_info_t *info;
memset(info->out_infos, 0, 1 * sizeof(info->out_infos[0]));
info->in_reqs = OALLOCN(obst, const arch_register_req_t*, n_ins);
- if (cls == NULL) {
- req = arch_no_register_req;
- } else {
- req = cls->class_req;
- }
info->out_infos[0].req = req;
for (i = 0; i < n_ins; ++i) {
info->in_reqs[i] = req;
* Creates a new phi with associated backend informations
*/
ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode,
- const arch_register_class_t *cls);
+ const arch_register_req_t *req);
/**
* Search for output of start node with a specific register
if (need_phi) {
ir_mode *mode = get_irn_mode(node);
- ir_node *phi = be_new_Phi(block, n_preds, phi_ins, mode, cls);
+ ir_node *phi = be_new_Phi(block, n_preds, phi_ins, mode,
+ cls->class_req);
DB((dbg, LEVEL_3, "Create Phi %+F (for %+F) -", phi, node));
#ifdef DEBUG_libfirm
/* override or replace spills list... */
spill = OALLOC(&env->obst, spill_t);
spill->after = determine_spill_point(phi);
- spill->spill = be_new_Phi(block, arity, ins, mode_M, NULL);
+ spill->spill = be_new_Phi(block, arity, ins, mode_M, arch_no_register_req);
spill->next = NULL;
sched_add_after(block, spill->spill);
for (i = 0; i < n_preds; ++i) {
ins[i] = dummy;
}
- phi = be_new_Phi(block, n_preds, ins, env->mode, env->phi_cls);
+ phi = be_new_Phi(block, n_preds, ins, env->mode, env->phi_req);
sched_add_after(block, phi);
ARR_APP1(ir_node*, env->new_phis, phi);
stat_ev_ctx_pop("bessaconstr");
}
+static void determine_phi_req(be_ssa_construction_env_t *env, ir_node *value)
+{
+ const arch_register_req_t *req = arch_get_irn_register_req(value);
+ env->mode = get_irn_mode(value);
+ if (req->width == 1) {
+ env->phi_req = req->cls->class_req;
+ } else {
+ /* construct a new register req... */
+ ir_graph *irg = get_irn_irg(value);
+ struct obstack *obst = be_get_be_obst(irg);
+ arch_register_req_t *new_req = OALLOCZ(obst, arch_register_req_t);
+ new_req->cls = req->cls;
+ new_req->type = req->type & arch_register_req_type_aligned;
+ new_req->width = req->width;
+ env->phi_req = new_req;
+ }
+}
+
void be_ssa_construction_add_copy(be_ssa_construction_env_t *env,
ir_node *copy)
{
assert(env->iterated_domfront_calculated == 0);
if (env->mode == NULL) {
- env->mode = get_irn_mode(copy);
- env->phi_cls = arch_get_irn_reg_class(copy);
+ determine_phi_req(env, copy);
} else {
assert(env->mode == get_irn_mode(copy));
}
assert(env->iterated_domfront_calculated == 0);
if (env->mode == NULL) {
- env->mode = get_irn_mode(copies[0]);
- env->phi_cls = arch_get_irn_reg_class(copies[0]);
+ determine_phi_req(env, copies[0]);
}
for (i = 0; i < copies_len; ++i) {
ir_graph *irg;
const be_dom_front_info_t *domfronts;
ir_mode *mode;
- const arch_register_class_t *phi_cls;
+ const arch_register_req_t *phi_req;
waitq *worklist;
const ir_nodeset_t *ignore_uses;
ir_node **new_phis;
DBG((dbg, LEVEL_2, "\tcreate Phi-M for %+F\n", phi));
/* create a Phi-M */
- spill_info->spill = be_new_Phi(block, arity, phi_in, mode_M, NULL);
+ spill_info->spill = be_new_Phi(block, arity, phi_in, mode_M,
+ arch_no_register_req);
sched_add_after(block, spill_info->spill);
if (spill_to_kill != NULL) {