From fd636a3ed524e0dd797ca0c952d366d7695f3772 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Tue, 19 Sep 2006 15:30:55 +0000 Subject: [PATCH] Fixed generation of Pop with frame pointer enabled --- ir/be/ia32/bearch_ia32.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 711c341ad..c83eb297e 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -290,6 +290,24 @@ static arch_irn_flags_t ia32_get_flags(const void *self, const ir_node *irn) { } } +typedef struct { + be_abi_call_flags_bits_t flags; + const arch_isa_t *isa; + const arch_env_t *aenv; + ir_graph *irg; +} ia32_abi_env_t; + +static void *ia32_abi_init(const be_abi_call_t *call, const arch_env_t *aenv, ir_graph *irg) +{ + ia32_abi_env_t *env = xmalloc(sizeof(env[0])); + be_abi_call_flags_t fl = be_abi_call_get_flags(call); + env->flags = fl.bits; + env->irg = irg; + env->aenv = aenv; + env->isa = aenv->isa; + return env; +} + static entity *ia32_get_frame_entity(const void *self, const ir_node *irn) { return is_ia32_irn(irn) ? get_ia32_frame_ent(irn) : NULL; } @@ -309,7 +327,9 @@ static void ia32_set_frame_offset(const void *self, ir_node *irn, int bias) { * address, so fix this here */ if(is_ia32_Pop(irn)) { - bias -= 4; + ia32_abi_env_t *cb_env = get_abi_cb(ops->cg->birg->abi); + if (cb_env->flags.try_omit_fp) + bias -= 4; } DBG((ops->cg->mod, LEVEL_1, "stack biased %+F with %d\n", irn, bias)); @@ -340,24 +360,6 @@ static int ia32_get_sp_bias(const void *self, const ir_node *irn) { return 0; } -typedef struct { - be_abi_call_flags_bits_t flags; - const arch_isa_t *isa; - const arch_env_t *aenv; - ir_graph *irg; -} ia32_abi_env_t; - -static void *ia32_abi_init(const be_abi_call_t *call, const arch_env_t *aenv, ir_graph *irg) -{ - ia32_abi_env_t *env = xmalloc(sizeof(env[0])); - be_abi_call_flags_t fl = be_abi_call_get_flags(call); - env->flags = fl.bits; - env->irg = irg; - env->aenv = aenv; - env->isa = aenv->isa; - return env; -} - /** * Put all registers which are saved by the prologue/epilogue in a set. * -- 2.20.1