From: Matthias Braun Date: Fri, 8 Sep 2006 12:14:00 +0000 (+0000) Subject: bugfixes for am_offs changes X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=61f4d246e707173f272e6ead6f42360a4674f951;p=libfirm bugfixes for am_offs changes --- diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 077c866cf..1c948ea65 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -298,7 +298,7 @@ static void ia32_set_frame_offset(const void *self, ir_node *irn, int bias) { if (get_ia32_frame_ent(irn)) { ia32_am_flavour_t am_flav = get_ia32_am_flavour(irn); - /* Pop nodes modify the stack pointer before reading the destination + /* Pop nodes modify the stack pointer before calculating the destination * address, so fix this here */ if(is_ia32_Pop(irn)) { @@ -311,8 +311,7 @@ static void ia32_set_frame_offset(const void *self, ir_node *irn, int bias) { if (get_ia32_op_type(irn) == ia32_Normal) { set_ia32_cnst(irn, buf); - } - else { + } else { add_ia32_am_offs(irn, buf); am_flav |= ia32_O; set_ia32_am_flavour(irn, am_flav); @@ -327,7 +326,7 @@ static int ia32_get_sp_bias(const void *self, const ir_node *irn) { if(is_ia32_Push(pred) && proj == 0) return 4; - else if(is_ia32_Pop(pred) && proj == 1) + if(is_ia32_Pop(pred) && proj == 1) return -4; } diff --git a/ir/be/ia32/ia32_new_nodes.c b/ir/be/ia32/ia32_new_nodes.c index ba1e3a6d3..1c1aaea4c 100644 --- a/ir/be/ia32/ia32_new_nodes.c +++ b/ir/be/ia32/ia32_new_nodes.c @@ -542,14 +542,13 @@ void set_ia32_am_flavour(ir_node *node, ia32_am_flavour_t am_flavour) { */ char *get_ia32_am_offs(const ir_node *node) { ia32_attr_t *attr = get_ia32_attr(node); - char *res = NULL; + static char res[64]; if (! attr->am_offs) { return NULL; } - res = obstack_alloc(get_irg_obstack(get_irn_irg(node)), 64); - snprintf(res, 64, "%+ld", attr->am_offs); + snprintf(res, sizeof(res), "%+ld", attr->am_offs); return res; } @@ -572,12 +571,12 @@ static void extend_ia32_am_offs(ir_node *node, char *offset, char op) { if (! offset || strlen(offset) < 1) return; - sscanf(offset, "%d", &o); + assert(sscanf(offset, "%d", &o) == 1); if (op == '-') attr->am_offs -= o; else if (op == '+') - attr->am_offs -= o; + attr->am_offs += o; else assert(0); } diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c index e35e71cab..4540b6f9d 100644 --- a/ir/be/ia32/ia32_transform.c +++ b/ir/be/ia32/ia32_transform.c @@ -1472,7 +1472,7 @@ static ir_node *gen_Store(ia32_transform_env_t *env) { /* base is an constant address */ if (is_imm) { - if (get_ia32_immop_type(ptr) == ia32_ImmSymConst) { + if (get_ia32_op_type(ptr) == ia32_SymConst) { set_ia32_am_sc(new_op, get_ia32_id_cnst(ptr)); am_flav = ia32_am_N; }