+ if(alloc_mem != NULL) {
+ ir_node *addsp_mem;
+ ir_node *sync;
+
+ addsp_mem = new_r_Proj(irg, bl, new_alloc, mode_M, pn_be_AddSP_M);
+
+ // We need to sync the output mem of the AddSP with the input mem
+ // edge into the alloc node
+ ins[0] = get_Alloc_mem(alloc);
+ ins[1] = addsp_mem;
+ sync = new_r_Sync(irg, bl, 2, ins);
+
+ exchange(alloc_mem, sync);
+ }
+
+ exchange(alloc, new_alloc);
+
+ /* fix projnum of alloca res */
+ set_Proj_proj(alloc_res, pn_be_AddSP_res);
+
+ addr = env->isa->stack_dir < 0 ? alloc_res : curr_sp;
+
+ /* copy the address away, since it could be used after further stack pointer modifications. */
+ /* Let it point curr_sp just for the moment, I'll reroute it in a second. */
+ *result_copy = copy = be_new_Copy(env->isa->sp->reg_class, irg, bl, curr_sp);