- turn while into do-while
[libfirm] / ir / be / beabi.c
index 1cec3a6..9fd9753 100644 (file)
@@ -1569,8 +1569,11 @@ static void lower_frame_sels_walker(ir_node *irn, void *data)
                        ir_node      *bl  = get_nodes_block(irn);
                        ir_node      *nw;
                        int          pos = 0;
+                       int          is_value_param = 0;
 
                        if (get_entity_owner(ent) == ctx->value_tp) {
+                               is_value_param = 1;
+
                                /* replace by its copy from the argument type */
                                pos = get_struct_member_index(ctx->value_tp, ent);
                                ent = get_argument_entity(ent, ctx);
@@ -1579,8 +1582,8 @@ static void lower_frame_sels_walker(ir_node *irn, void *data)
                        nw = be_new_FrameAddr(ctx->sp_class, current_ir_graph, bl, ctx->frame, ent);
                        exchange(irn, nw);
 
-                       /* check, if it's a param sel and if have not seen this entity before */
-                       if (get_entity_owner(ent) == ctx->value_tp && get_entity_link(ent) == NULL) {
+                       /* check, if it's a param Sel and if have not seen this entity before */
+                       if (is_value_param && get_entity_link(ent) == NULL) {
                                ent_pos_pair pair;
 
                                pair.ent  = ent;
@@ -2043,7 +2046,7 @@ static void modify_irg(be_abi_irg_t *env)
                                        repl = new_r_Proj(irg, reg_params_bl, load, load_mode, pn_Load_res);
 
                                        if (mode != load_mode) {
-                                               repl = new_r_Conv(irg, reg_params_bl, repl, mode, 0);
+                                               repl = new_r_Conv(irg, reg_params_bl, repl, mode);
                                        }
                                } else {
                                        /* The stack parameter is not primitive (it is a struct or array),
@@ -2059,7 +2062,7 @@ static void modify_irg(be_abi_irg_t *env)
                           which may be wrong. Add Conv's then. */
                        mode = get_irn_mode(args[i]);
                        if (mode != get_irn_mode(repl)) {
-                               repl = new_r_Conv(irg, get_irn_n(repl, -1), repl, mode, 0);
+                               repl = new_r_Conv(irg, get_irn_n(repl, -1), repl, mode);
                        }
                        exchange(args[i], repl);
                }
@@ -2198,7 +2201,7 @@ static ir_entity *get_pic_symbol(be_main_env_t *env, ir_entity *entity)
 static int can_address_relative(ir_entity *entity)
 {
        return get_entity_variability(entity) == variability_initialized
-               || get_entity_visibility(entity) == visibility_local;
+               && get_entity_visibility(entity) != visibility_external_allocated;
 }
 
 /** patches SymConsts to work in position independent code */