X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Flower%2Flower_mode_b.c;h=c541e1f1e74ed2245cfb08ccf4963b037267a33f;hb=2c8cc375a52fbfb9bdf15ebed6278a6d7b23a6ff;hp=1dd5a1e758ea58aa690af88b510f967a4fb0cbfa;hpb=e36a82c5aafb53c1b28723c88db898f8ccc3e6bb;p=libfirm diff --git a/ir/lower/lower_mode_b.c b/ir/lower/lower_mode_b.c index 1dd5a1e75..c541e1f1e 100644 --- a/ir/lower/lower_mode_b.c +++ b/ir/lower/lower_mode_b.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -90,11 +90,11 @@ static void maybe_kill_node(ir_node *node) static ir_node *create_not(dbg_info *dbgi, ir_node *node) { - ir_node *block = get_nodes_block(node); - ir_mode *mode = config->lowered_mode; - tarval *tv_one = get_mode_one(mode); - ir_graph *irg = get_irn_irg(node); - ir_node *one = new_rd_Const(dbgi, irg, tv_one); + ir_node *block = get_nodes_block(node); + ir_mode *mode = config->lowered_mode; + ir_tarval *tv_one = get_mode_one(mode); + ir_graph *irg = get_irn_irg(node); + ir_node *one = new_rd_Const(dbgi, irg, tv_one); return new_rd_Eor(dbgi, block, node, one, mode); } @@ -117,13 +117,13 @@ static ir_type *create_lowered_type(void) ir_node *ir_create_mux_set(ir_node *cond, ir_mode *dest_mode) { - ir_graph *irg = get_irn_irg(cond); - ir_node *block = get_nodes_block(cond); - tarval *tv_one = get_mode_one(dest_mode); - ir_node *one = new_r_Const(irg, tv_one); - tarval *tv_zero = get_mode_null(dest_mode); - ir_node *zero = new_r_Const(irg, tv_zero); - ir_node *set = new_r_Mux(block, cond, zero, one, dest_mode); + ir_graph *irg = get_irn_irg(cond); + ir_node *block = get_nodes_block(cond); + ir_tarval *tv_one = get_mode_one(dest_mode); + ir_node *one = new_r_Const(irg, tv_one); + ir_tarval *tv_zero = get_mode_null(dest_mode); + ir_node *zero = new_r_Const(irg, tv_zero); + ir_node *set = new_r_Mux(block, cond, zero, one, dest_mode); return set; } @@ -149,9 +149,6 @@ ir_node *ir_create_cond_set(ir_node *cond_value, ir_mode *dest_mode) set_irn_in(lower_block, ARRAY_SIZE(lower_in), lower_in); phi = new_r_Phi(lower_block, ARRAY_SIZE(phi_in), phi_in, dest_mode); - assert(get_Block_phis(lower_block) == NULL); - set_Block_phis(lower_block, phi); - set_Phi_next(phi, NULL); /* make sure we do visit the cond_value later... */ ARR_APP1(ir_node*, check_later, cond_value); @@ -161,9 +158,9 @@ ir_node *ir_create_cond_set(ir_node *cond_value, ir_mode *dest_mode) static void adjust_method_type(ir_type *method_type) { - int i; - int n_params; - int n_res; + size_t i; + size_t n_params; + size_t n_res; n_params = get_method_n_params(method_type); for (i = 0; i < n_params; ++i) { @@ -187,10 +184,9 @@ static ir_node *lower_node(ir_node *node) dbg_info *dbgi = get_irn_dbg_info(node); ir_node *block = get_nodes_block(node); ir_mode *mode = config->lowered_mode; + ir_node *res = (ir_node*)get_irn_link(node); ir_graph *irg; - ir_node *res; - res = get_irn_link(node); if (res != NULL) return res; @@ -271,10 +267,10 @@ static ir_node *lower_node(ir_node *node) } case iro_Conv: { - ir_node *pred = get_Conv_op(node); - ir_mode *mode = get_irn_mode(pred); - tarval *tv_zeroc = get_mode_null(mode); - ir_node *zero_cmp = new_rd_Const(dbgi, irg, tv_zeroc); + ir_node *pred = get_Conv_op(node); + ir_mode *mode = get_irn_mode(pred); + ir_tarval *tv_zeroc = get_mode_null(mode); + ir_node *zero_cmp = new_rd_Const(dbgi, irg, tv_zeroc); ir_node *cmp = new_rd_Cmp(dbgi, block, pred, zero_cmp); ir_node *proj = new_rd_Proj(dbgi, cmp, mode_b, pn_Cmp_Lg); @@ -293,13 +289,13 @@ static ir_node *lower_node(ir_node *node) if ((mode_is_int(cmp_mode) || mode_is_reference(cmp_mode)) && (get_mode_size_bits(cmp_mode) < get_mode_size_bits(mode) || (mode_is_signed(cmp_mode) && is_Const(right) && is_Const_null(right)))) { - int pnc = get_Proj_proj(node); - int need_not = 0; - ir_node *a = NULL; - ir_node *b = NULL; - int bits; - tarval *tv; - ir_node *shift_cnt; + int pnc = get_Proj_proj(node); + int need_not = 0; + ir_node *a = NULL; + ir_node *b = NULL; + int bits; + ir_tarval *tv; + ir_node *shift_cnt; if (pnc == pn_Cmp_Lt) { /* a < b -> (a - b) >> 31 */ @@ -363,13 +359,13 @@ synth_zero_one: } case iro_Const: { - tarval *tv = get_Const_tarval(node); + ir_tarval *tv = get_Const_tarval(node); if (tv == get_tarval_b_true()) { - tarval *tv_one = get_mode_one(mode); - res = new_rd_Const(dbgi, irg, tv_one); + ir_tarval *tv_one = get_mode_one(mode); + res = new_rd_Const(dbgi, irg, tv_one); } else if (tv == get_tarval_b_false()) { - tarval *tv_zero = get_mode_null(mode); - res = new_rd_Const(dbgi, irg, tv_zero); + ir_tarval *tv_zero = get_mode_null(mode); + res = new_rd_Const(dbgi, irg, tv_zero); } else { panic("invalid boolean const %+F", node); } @@ -428,7 +424,7 @@ static void lower_mode_b_walker(ir_node *node, void *env) changed = true; } if (changed) { - bool *global_changed = env; + bool *global_changed = (bool*)env; *global_changed = true; add_identities(node); } @@ -439,8 +435,8 @@ void ir_lower_mode_b(ir_graph *irg, const lower_mode_b_config_t *nconfig) ir_entity *entity = get_irg_entity(irg); ir_type *type = get_entity_type(entity); bool changed = false; - int i; - int n; + size_t i; + size_t n; config = nconfig; lowered_nodes = NEW_ARR_F(ir_node*, 0); @@ -459,13 +455,12 @@ void ir_lower_mode_b(ir_graph *irg, const lower_mode_b_config_t *nconfig) irg_walk_graph(irg, firm_clear_link, NULL, NULL); irg_walk_graph(irg, lower_mode_b_walker, NULL, &changed); - for (i = 0; i < ARR_LEN(check_later); ++i) { + for (i = 0, n = ARR_LEN(check_later); i < n; ++i) { ir_node *node = check_later[i]; irg_walk_core(node, lower_mode_b_walker, NULL, &changed); } - n = ARR_LEN(lowered_nodes); - for (i = 0; i < n; ++i) { + for (i = 0, n = ARR_LEN(lowered_nodes); i < n; ++i) { ir_node *node = lowered_nodes[i]; maybe_kill_node(node); }