Commit 30928bcc authored by Matthias Braun's avatar Matthias Braun
Browse files

ia32: fix 8/16 bit push/pop

parent 2c1a285e
......@@ -187,7 +187,8 @@ static void ia32_set_frame_offset(ir_node *irn, int bias)
/* Pop nodes modify the stack pointer before calculating the
* destination address, so fix this here
*/
bias -= 4;
ir_mode *mode = get_ia32_ls_mode(irn);
bias -= get_mode_size_bytes(mode);
}
}
add_ia32_am_offs_int(irn, bias);
......@@ -198,11 +199,15 @@ static int ia32_get_sp_bias(const ir_node *node)
if (is_ia32_Call(node))
return -(int)get_ia32_call_attr_const(node)->pop;
if (is_ia32_Push(node))
return 4;
if (is_ia32_Push(node)) {
ir_mode *ls_mode = get_ia32_ls_mode(node);
return get_mode_size_bytes(ls_mode);
}
if (is_ia32_Pop(node) || is_ia32_PopMem(node))
return -4;
if (is_ia32_Pop(node) || is_ia32_PopMem(node)) {
ir_mode *ls_mode = get_ia32_ls_mode(node);
return -get_mode_size_bytes(ls_mode);
}
if (is_ia32_Leave(node) || is_ia32_CopyEbpEsp(node)) {
return SP_BIAS_RESET;
......
......@@ -424,6 +424,7 @@ static void peephole_IncSP_Store_to_push(ir_node *irn)
ir_node *push = new_bd_ia32_Push(get_irn_dbg_info(store), block, noreg, noreg,
mem, val, curr_sp);
set_ia32_ls_mode(push, ia32_mode_gp);
copy_mark(store, push);
if (first_push == NULL)
......@@ -595,6 +596,7 @@ static void peephole_Load_IncSP_to_pop(ir_node *irn)
ir_node *pop = new_bd_ia32_Pop(get_irn_dbg_info(load), block, mem, pred_sp);
arch_set_irn_register_out(pop, pn_ia32_Load_res, reg);
set_ia32_ls_mode(pop, ia32_mode_gp);
copy_mark(load, pop);
......@@ -659,6 +661,7 @@ static ir_node *create_pop(dbg_info *dbgi, ir_node *block,
ir_graph *irg = get_irn_irg(block);
ir_node *pop = new_bd_ia32_Pop(dbgi, block, get_irg_no_mem(irg), stack);
set_ia32_ls_mode(pop, ia32_mode_gp);
stack = new_r_Proj(pop, ia32_mode_gp, pn_ia32_Pop_stack);
arch_set_irn_register(stack, esp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment