X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Flower%2Flower_hl.c;h=98ebc325c886d8920c43d35b86e4369caa2edbb0;hb=cb4ccdf2eae3bec5f1886f6ff44ebb395d0ba5af;hp=70730bd8ef4873f4a873cf7a70e74401375f769b;hpb=83811ec18bcb88ff5a45c8b10303636d34bf67ee;p=libfirm diff --git a/ir/lower/lower_hl.c b/ir/lower/lower_hl.c index 70730bd8e..98ebc325c 100644 --- a/ir/lower/lower_hl.c +++ b/ir/lower/lower_hl.c @@ -23,9 +23,7 @@ * @author Boris Boesler, Goetz Lindenmaier, Michael Beck * @version $Id$ */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include "lowering.h" #include "irmode_t.h" @@ -52,13 +50,14 @@ static void lower_sel(ir_node *sel) { assert(is_Sel(sel)); + /* Do not lower frame type/global offset table access: must be lowered by the backend. */ + ptr = get_Sel_ptr(sel); + if (ptr == get_irg_frame(current_ir_graph)) + return; + ent = get_Sel_entity(sel); owner = get_entity_owner(ent); - /* Do not lower frame type access: must be lowered by the backend. */ - if (is_frame_type(owner)) - return; - /* * Cannot handle value param entities here. * Must be lowered by the backend. @@ -66,7 +65,6 @@ static void lower_sel(ir_node *sel) { if (is_value_param_type(owner)) return; - ptr = get_Sel_ptr(sel); dbg = get_irn_dbg_info(sel); mode = get_irn_mode(sel); @@ -101,11 +99,11 @@ static void lower_sel(ir_node *sel) { index = get_Sel_index(sel, 0); if (is_Array_type(owner)) { - ir_node *last_size; ir_type *arr_ty = owner; - int dims = get_array_n_dimensions(arr_ty); - int *map = alloca(sizeof(int) * dims); - int i; + int dims = get_array_n_dimensions(arr_ty); + int *map = ALLOCAN(int, dims); + ir_node *last_size; + int i; assert(dims == get_Sel_n_indexs(sel) && "array dimension must match number of indices of Sel node"); @@ -354,7 +352,7 @@ static void lower_bitfields_loads(ir_node *proj, ir_node *load) { int offset, bit_offset, bits, bf_bits, old_cse; dbg_info *db; - if (get_irn_op(sel) != op_Sel) + if (!is_Sel(sel)) return; ent = get_Sel_entity(sel); @@ -447,7 +445,7 @@ static void lower_bitfields_stores(ir_node *store) { dbg_info *db; /* check bitfield access */ - if (get_irn_op(sel) != op_Sel) + if (!is_Sel(sel)) return; ent = get_Sel_entity(sel); @@ -568,9 +566,8 @@ static void lower_bf_access(ir_node *irn, void *env) { { long proj = get_Proj_proj(irn); ir_node *pred = get_Proj_pred(irn); - ir_op *op = get_irn_op(pred); - if ((proj == pn_Load_res) && (op == op_Load)) + if (proj == pn_Load_res && is_Load(pred)) lower_bitfields_loads(irn, pred); break; } @@ -590,7 +587,7 @@ static void lower_bf_access(ir_node *irn, void *env) { */ void lower_highlevel_graph(ir_graph *irg, int lower_bitfields) { - if(lower_bitfields) { + if (lower_bitfields) { /* First step: lower bitfield access: must be run as long as Sels still * exists. */ irg_walk_graph(irg, NULL, lower_bf_access, NULL); @@ -598,12 +595,14 @@ void lower_highlevel_graph(ir_graph *irg, int lower_bitfields) { /* Finally: lower SymConst-Size and Sel nodes, Casts, unaligned Load/Stores. */ irg_walk_graph(irg, NULL, lower_irnode, NULL); - set_irg_phase_low(irg); -} /* lower_highlevel */ +} /* lower_highlevel_graph */ +/* + * does the same as lower_highlevel() for all nodes on the const code irg + */ void lower_const_code(void) { walk_const_code(NULL, lower_irnode, NULL); -} +} /* lower_const_code */ /* * Replaces SymConsts by a real constant if possible.