From: Sebastian Hack Date: Wed, 18 Jan 2006 17:42:33 +0000 (+0000) Subject: Fixed some bugs X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=c5ef87cddd1f055caec185ba965cc157758b8a50;p=libfirm Fixed some bugs --- diff --git a/ir/be/bearch.c b/ir/be/bearch.c index e5b86a802..0cffa7038 100644 --- a/ir/be/bearch.c +++ b/ir/be/bearch.c @@ -92,7 +92,7 @@ int arch_get_allocatable_regs(const arch_env_t *env, const ir_node *irn, const arch_irn_ops_t *ops = get_irn_ops(env, irn); const arch_register_req_t *req = ops->get_irn_reg_req(ops, &local_req, irn, pos); - if(arch_register_req_is(req, none)) { + if(req->type == arch_register_req_type_none) { bitset_clear_all(bs); return 0; } @@ -116,28 +116,20 @@ int arch_is_register_operand(const arch_env_t *env, int arch_reg_is_allocatable(const arch_env_t *env, const ir_node *irn, int pos, const arch_register_t *reg) { - int res = 0; arch_register_req_t req; arch_get_register_req(env, &req, irn, pos); - switch(req.type) { - case arch_register_req_type_normal: - case arch_register_req_type_should_be_different: - case arch_register_req_type_should_be_same: - res = req.cls == reg->reg_class; - break; - case arch_register_req_type_limited: - { - bitset_t *bs = bitset_alloca(req.cls->n_regs); - req.limited(irn, pos, bs); - res = bitset_is_set(bs, arch_register_get_index(reg)); - } - break; - default: - res = 0; + + if(req.type == arch_register_req_type_none) + return 0; + + if(arch_register_req_is(&req, limited)) { + bitset_t *bs = bitset_alloca(req.cls->n_regs); + req.limited(irn, pos, bs); + return bitset_is_set(bs, arch_register_get_index(reg)); } - return res; + return req.cls == reg->reg_class; } const arch_register_class_t * diff --git a/ir/be/benode.c b/ir/be/benode.c index 673f9ade0..ca32ee4c4 100644 --- a/ir/be/benode.c +++ b/ir/be/benode.c @@ -401,15 +401,20 @@ static void *put_in_reg_req(arch_register_req_t *req, const ir_node *irn, int po static const arch_register_req_t * be_node_get_irn_reg_req(const arch_irn_ops_t *self, arch_register_req_t *req, const ir_node *irn, int pos) { - int out_pos = redir_proj((const ir_node **) &irn, pos); + int out_pos = pos; - if(pos < 0 && get_irn_mode(irn) == mode_T) - return NULL; + if(pos < 0) { + if(get_irn_mode(irn) == mode_T) + return NULL; - if(!is_be_node(irn)) - return NULL; + out_pos = redir_proj((const ir_node **) &irn, pos); + assert(is_be_node(irn)); + return put_out_reg_req(req, irn, out_pos); + } - req = pos >= 0 ? put_in_reg_req(req, irn, pos) : put_out_reg_req(req, irn, out_pos); + else { + return is_be_node(irn) ? put_in_reg_req(req, irn, pos) : NULL; + } return req; }