X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeabi.c;h=607cdb7455ce64eb78be4321b716047638c55363;hb=a4219fc055a51f1adfff90c85838f3831028a7f3;hp=e7cbdd4a3cfa4bc3dace46742a552fadd51e8a62;hpb=b53410a0e9548f99c2b37699f01766f50f1055ff;p=libfirm diff --git a/ir/be/beabi.c b/ir/be/beabi.c index e7cbdd4a3..607cdb745 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -95,7 +95,6 @@ struct be_abi_irg_t { ir_node *start; /**< The be_Start params node. */ pmap *regs; /**< A map of all callee-save and ignore regs to their Projs to the RegParams node. */ - int start_block_bias; /**< The stack bias at the end of the start block. */ pmap *keep_map; /**< mapping blocks to keep nodes. */ @@ -108,6 +107,17 @@ static ir_heights_t *ir_heights; /** Flag: if set, try to omit the frame pointer in all routines. */ static int be_omit_fp = 1; +static ir_node *be_abi_reg_map_get(pmap *map, const arch_register_t *reg) +{ + return (ir_node*)pmap_get(map, reg); +} + +static void be_abi_reg_map_set(pmap *map, const arch_register_t* reg, + ir_node *node) +{ + pmap_insert(map, reg, node); +} + /* _ ____ ___ ____ _ _ _ _ / \ | __ )_ _| / ___|__ _| | | |__ __ _ ___| | _____ @@ -460,7 +470,8 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) /* Insert a store for primitive arguments. */ if (is_atomic_type(param_type)) { - ir_node *mem_input = do_seq ? curr_mem : new_r_NoMem(irg); + ir_node *nomem = get_irg_no_mem(irg); + ir_node *mem_input = do_seq ? curr_mem : nomem; ir_node *store = new_rd_Store(dbgi, bl, mem_input, addr, param, cons_none); mem = new_r_Proj(store, mode_M, pn_Store_M); } else { @@ -574,10 +585,6 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) for (s = 0; s < ARR_LEN(states); ++s) { const arch_register_t *reg = states[s]; const arch_register_class_t *cls = arch_register_get_class(reg); -#if 0 - ir_node *regnode = be_abi_reg_map_get(env->regs, reg); - ir_fprintf(stderr, "Adding %+F\n", regnode); -#endif ir_node *regnode = new_r_Unknown(irg, arch_register_class_mode(cls)); in[n_ins++] = regnode; } @@ -1855,8 +1862,9 @@ static void modify_irg(ir_graph *irg) if (is_atomic_type(param_type) && get_irn_n_edges(args[i]) > 0) { ir_mode *mode = get_type_mode(param_type); ir_mode *load_mode = arg->load_mode; + ir_node *nomem = get_irg_no_mem(irg); - ir_node *load = new_r_Load(start_bl, new_r_NoMem(irg), addr, load_mode, cons_floats); + ir_node *load = new_r_Load(start_bl, nomem, addr, load_mode, cons_floats); repl = new_r_Proj(load, load_mode, pn_Load_res); if (mode != load_mode) { @@ -2090,14 +2098,14 @@ static void fix_pic_symconsts(ir_node *node, void *data) /* we need an extra indirection for global data outside our current module. The loads are always safe and can therefore float and need no memory input */ - load = new_r_Load(block, new_r_NoMem(irg), add, mode, cons_floats); + load = new_r_Load(block, get_irg_no_mem(irg), add, mode, cons_floats); load_res = new_r_Proj(load, mode, pn_Load_res); set_irn_n(node, i, load_res); } } -be_abi_irg_t *be_abi_introduce(ir_graph *irg) +void be_abi_introduce(ir_graph *irg) { be_abi_irg_t *env = XMALLOCZ(be_abi_irg_t); ir_node *old_frame = get_irg_frame(irg); @@ -2161,7 +2169,8 @@ be_abi_irg_t *be_abi_introduce(ir_graph *irg) exchange(dummy, env->init_sp); exchange(old_frame, get_irg_frame(irg)); - return env; + pmap_destroy(env->regs); + env->regs = NULL; } void be_abi_free(ir_graph *irg) @@ -2170,35 +2179,12 @@ void be_abi_free(ir_graph *irg) if (env->call != NULL) be_abi_call_free(env->call); - if (env->regs != NULL) - pmap_destroy(env->regs); + assert(env->regs == NULL); free(env); be_set_irg_abi(irg, NULL); } -/** - * called after nodes have been transformed so some node references can be - * replaced with new nodes - */ -void be_abi_transform_fixup(ir_graph *irg) -{ - be_abi_irg_t *abi = be_get_irg_abi(irg); - pmap *new_regs; - pmap_entry *entry; - if (abi == NULL || abi->regs == NULL) - return; - - new_regs = pmap_create(); - foreach_pmap(abi->regs, entry) { - ir_node *value = (ir_node*)entry->value; - ir_node *transformed = be_transform_node(value); - pmap_insert(new_regs, entry->key, transformed); - } - pmap_destroy(abi->regs); - abi->regs = new_regs; -} - void be_put_allocatable_regs(const ir_graph *irg, const arch_register_class_t *cls, bitset_t *bs) { @@ -2239,21 +2225,6 @@ void be_set_allocatable_regs(const ir_graph *irg, } } -ir_node *be_abi_get_callee_save_irn(ir_graph *irg, const arch_register_t *reg) -{ - const be_abi_irg_t *abi = be_get_irg_abi(irg); - assert(reg->type & arch_register_type_callee_save); - assert(pmap_contains(abi->regs, (void *) reg)); - return (ir_node*)pmap_get(abi->regs, (void *) reg); -} - -ir_node *be_abi_get_ignore_irn(ir_graph *irg, const arch_register_t *reg) -{ - const be_abi_irg_t *abi = be_get_irg_abi(irg); - assert(pmap_contains(abi->regs, (void *) reg)); - return (ir_node*)pmap_get(abi->regs, (void *) reg); -} - BE_REGISTER_MODULE_CONSTRUCTOR(be_init_abi); void be_init_abi(void) {