X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fbe%2Fia32%2Fbearch_ia32.c;h=20e8a343dca7998fc276c8f3cf227cd10a332c1e;hb=c1290d60b0536494704dce14a479f26cbc075225;hp=22ef49febb05b183dd2a15b4dc4db994786ec166;hpb=d78ff68d0afb420d8586aa9d0a28289941487101;p=libfirm diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 22ef49feb..20e8a343d 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -74,6 +74,7 @@ static ir_node *my_skip_proj(const ir_node *n) { return (ir_node *)n; } + /** * Return register requirements for an ia32 node. * If the node returns a tuple (mode_T) then the proj's @@ -82,11 +83,16 @@ static ir_node *my_skip_proj(const ir_node *n) { static const arch_register_req_t *ia32_get_irn_reg_req(const void *self, arch_register_req_t *req, const ir_node *irn, int pos) { const ia32_register_req_t *irn_req; long node_pos = pos == -1 ? 0 : pos; - ir_mode *mode = get_irn_mode(irn); + ir_mode *mode = is_Block(irn) ? NULL : get_irn_mode(irn); firm_dbg_module_t *mod = firm_dbg_register(DEBUG_MODULE); - if (mode == mode_T || mode == mode_M) { - DBG((mod, LEVEL_1, "ignoring mode_T, mode_M node %+F\n", irn)); + if (is_Block(irn) || mode == mode_M || mode == mode_X) { + DBG((mod, LEVEL_1, "ignoring Block, mode_M, mode_X node %+F\n", irn)); + return NULL; + } + + if (mode == mode_T && pos < 0) { + DBG((mod, LEVEL_1, "ignoring request OUT requirements for node %+F\n", irn)); return NULL; } @@ -156,6 +162,10 @@ static void ia32_set_irn_reg(const void *self, ir_node *irn, const arch_register int pos = 0; const ia32_irn_ops_t *ops = self; + if (get_irn_mode(irn) == mode_X) { + return; + } + DBG((ops->cg->mod, LEVEL_1, "ia32 assigned register %s to node %+F\n", reg->name, irn)); if (is_Proj(irn)) { @@ -179,6 +189,11 @@ static const arch_register_t *ia32_get_irn_reg(const void *self, const ir_node * const arch_register_t *reg = NULL; if (is_Proj(irn)) { + + if (get_irn_mode(irn) == mode_X) { + return NULL; + } + pos = ia32_translate_proj_pos(irn); irn = my_skip_proj(irn); } @@ -239,13 +254,13 @@ typedef struct { ir_graph *irg; } ia32_abi_env_t; -static void *ia32_abi_init(const be_abi_call_t *call, const arch_isa_t *isa, ir_graph *irg) +static void *ia32_abi_init(const be_abi_call_t *call, const arch_env_t *aenv, ir_graph *irg) { ia32_abi_env_t *env = xmalloc(sizeof(env[0])); be_abi_call_flags_t fl = be_abi_call_get_flags(call); env->flags = fl.bits; env->irg = irg; - env->isa = isa; + env->isa = aenv->isa; return env; } @@ -469,6 +484,9 @@ static void ia32_finish_irg_walker(ir_node *irn, void *env) { /* check if there is a sub which need to be transformed */ ia32_transform_sub_to_neg_add(irn, cg); + + /* transform a LEA into an Add if possible */ + ia32_transform_lea_to_add(irn, cg); } /** @@ -688,6 +706,7 @@ static void *ia32_cg_init(FILE *F, const be_irg_t *birg) { cg->opt.doam = 1; cg->opt.placecnst = 1; cg->opt.immops = 1; + cg->opt.extbb = 1; #ifndef NDEBUG if (isa->name_obst_size) { @@ -868,7 +887,7 @@ void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *ab /* set stack parameters */ for (i = stack_idx; i < n; i++) { - be_abi_call_param_stack(abi, i); + be_abi_call_param_stack(abi, i, 1); }