From: Christian Würdig Date: Wed, 22 Mar 2006 10:09:06 +0000 (+0000) Subject: fixed SymConst address handling (stores and moves) X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=8e821c6ddccc31f4d974c8a520d9a89d82a39a08;p=libfirm fixed SymConst address handling (stores and moves) --- diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c index 143ae0d91..d39137044 100644 --- a/ir/be/ia32/ia32_emitter.c +++ b/ir/be/ia32/ia32_emitter.c @@ -297,7 +297,10 @@ char *ia32_emit_binop(const ir_node *n, ia32_emit_env_t *env) { break; case ia32_AddrModeD: if (get_ia32_cnst(n)) { - lc_esnprintf(ia32_get_arg_env(), buf, SNPRINTF_BUF_LEN, "%s, %s", ia32_emit_am(n, env), get_ia32_cnst(n)); + lc_esnprintf(ia32_get_arg_env(), buf, SNPRINTF_BUF_LEN, "%s,%s%s", + ia32_emit_am(n, env), + get_ia32_sc(n) ? " OFFSET FLAT:" : " ", /* In case of a symconst we must add OFFSET to */ + get_ia32_cnst(n)); /* tell the assembler to store it's address. */ } else { const arch_register_t *in1 = get_in_reg(n, 2); diff --git a/ir/be/ia32/ia32_spec.pl b/ir/be/ia32/ia32_spec.pl index 3b03f16c3..afc7581b7 100644 --- a/ir/be/ia32/ia32_spec.pl +++ b/ir/be/ia32/ia32_spec.pl @@ -371,7 +371,7 @@ $comment_string = "/*"; } else { if (get_ia32_sc(n)) { -6. lea %D1, %C /* Load address of SymConst into register */ +6. mov %D1, OFFSET FLAT:%C /* Move address of SymConst into register */ } else { 6. mov %D1, %C /* Mov Const into register */ @@ -553,7 +553,7 @@ $comment_string = "/*"; "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val", "cmp_attr" => " return ia32_compare_immop_attr(attr_a, attr_b);\n", "reg_req" => { "in" => [ "gp", "gp", "fp", "none" ] }, - "emit" => '. movs%M %ia32_emit_am, %S3 /* Store(%S3) -> (%A1) */' + "emit" => '. movs%M %ia32_emit_binop /* Store(%S3) -> (%A1) */' }, # CopyB diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c index 7331314a9..1cec30fd6 100644 --- a/ir/be/ia32/ia32_transform.c +++ b/ir/be/ia32/ia32_transform.c @@ -1204,7 +1204,7 @@ static ir_node *gen_Store(ia32_transform_env_t *env) { ir_node *new_op; /* in case of storing a const (but not a symconst) -> make it an attribute */ - if (is_ia32_Const(val) && get_ia32_op_type(val) == ia32_Const) { + if (is_ia32_Const(val)) { sval = noreg; } @@ -1219,7 +1219,7 @@ static ir_node *gen_Store(ia32_transform_env_t *env) { } /* stored const is an attribute (saves a register) */ - if (is_ia32_Const(val) && get_ia32_op_type(val) == ia32_Const) { + if (is_ia32_Const(val)) { set_ia32_Immop_attr(new_op, val); }