From 6bd1a463416deb6342dcc4c5d72de994f377e6b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Thu, 29 Jun 2006 12:34:44 +0000 Subject: [PATCH] BugFix: create_push: sync memories of IncSP and Store --- ir/be/ia32/ia32_optimize.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/ir/be/ia32/ia32_optimize.c b/ir/be/ia32/ia32_optimize.c index 755a2818a..b5a56070b 100644 --- a/ir/be/ia32/ia32_optimize.c +++ b/ir/be/ia32/ia32_optimize.c @@ -437,8 +437,9 @@ static void ia32_optimize_CondJmp(ir_node *irn, ia32_code_gen_t *cg) { * Creates a Push from Store(IncSP(gp_reg_size)) */ static void ia32_create_Push(ir_node *irn, ia32_code_gen_t *cg) { - ir_node *sp = get_irn_n(irn, 0); - ir_node *val, *next, *push, *bl, *proj_M, *proj_res, *old_proj_M; + ir_node *sp = get_irn_n(irn, 0); + ir_graph *irg = cg->irg; + ir_node *val, *next, *push, *bl, *proj_M, *proj_res, *old_proj_M, *mem; const ir_edge_t *edge; heights_t *h; @@ -479,11 +480,26 @@ static void ia32_create_Push(ir_node *irn, ia32_code_gen_t *cg) { sched_remove(irn); sched_remove(sp); + /* + build memory input: + if the IncSP points to NoMem -> just use the memory input from store + if IncSP points to somewhere else -> sync memory of IncSP and Store + */ + mem = be_get_IncSP_mem(sp); + if (mem == get_irg_no_mem(irg)) + mem = get_irn_n(irn, 3); + else { + ir_node *in[2]; + + in[0] = mem; + in[1] = get_irn_n(irn, 3); + mem = new_r_Sync(irg, bl, 2, in); + } + bl = get_nodes_block(irn); - push = new_rd_ia32_Push(NULL, current_ir_graph, bl, - be_get_IncSP_pred(sp), val, be_get_IncSP_mem(sp)); - proj_res = new_r_Proj(current_ir_graph, bl, push, get_irn_mode(sp), pn_ia32_Push_stack); - proj_M = new_r_Proj(current_ir_graph, bl, push, mode_M, pn_ia32_Push_M); + push = new_rd_ia32_Push(NULL, irg, bl, be_get_IncSP_pred(sp), val, mem); + proj_res = new_r_Proj(irg, bl, push, get_irn_mode(sp), pn_ia32_Push_stack); + proj_M = new_r_Proj(irg, bl, push, mode_M, pn_ia32_Push_M); /* copy a possible constant from the store */ set_ia32_id_cnst(push, get_ia32_id_cnst(irn)); -- 2.20.1