From: Christian Würdig Date: Fri, 17 Mar 2006 15:37:07 +0000 (+0000) Subject: made emit more nasm compatible X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=9a31e289b01a04f5559712ad37cd912f494fe724;p=libfirm made emit more nasm compatible add new 8bit store node --- diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 793fadfb3..7904c6fc0 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -562,6 +562,9 @@ static void transform_to_Store(ia32_transform_env_t *env) { if (mode_is_float(mode)) { new_op = new_rd_ia32_fStore(env->dbg, env->irg, env->block, ptr, noreg, val, nomem, mode_T); } + else if (get_mode_size_bits(mode) == 8) { + new_op = new_rd_ia32_Store8Bit(env->dbg, env->irg, env->block, ptr, noreg, val, nomem, mode_T); + } else { new_op = new_rd_ia32_Store(env->dbg, env->irg, env->block, ptr, noreg, val, nomem, mode_T); } @@ -848,8 +851,8 @@ void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *ab } /* set register parameters */ -// if (cc & cc_reg_param) { - if (1) { + if (cc & cc_reg_param) { +// if (1) { /* determine the number of parameters passed via registers */ biggest_n = ia32_get_n_regparam_class(n, modes, &ignore_1, &ignore_2); diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c index 12997a261..754ee97a4 100644 --- a/ir/be/ia32/ia32_emitter.c +++ b/ir/be/ia32/ia32_emitter.c @@ -240,7 +240,12 @@ char *ia32_emit_binop(const ir_node *n, ia32_emit_env_t *env) { /* verify that this function is never called on non-AM supporting operations */ assert(get_ia32_am_support(n) != ia32_am_None && "emit binop expects addressmode support"); -#define PRODUCES_RESULT(n) !(is_ia32_St(n) || is_ia32_CondJmp(n) || is_ia32_fCondJmp(n) || is_ia32_SwitchJmp(n)) +#define PRODUCES_RESULT(n) \ + (!(is_ia32_St(n) || \ + is_ia32_Store8Bit(n) || \ + is_ia32_CondJmp(n) || \ + is_ia32_fCondJmp(n) || \ + is_ia32_SwitchJmp(n))) if (! buf) { buf = xcalloc(1, SNPRINTF_BUF_LEN); @@ -1128,7 +1133,7 @@ static void ia32_emit_func_prolog(FILE *F, ir_graph *irg) { entity *irg_ent = get_irg_entity(irg); const char *irg_name = get_entity_name(irg_ent); -// fprintf(F, "\t.text\n"); + fprintf(F, "\tsection .text\n"); if (get_entity_visibility(irg_ent) == visibility_external_visible) { fprintf(F, "global %s\n", irg_name); } @@ -1142,7 +1147,7 @@ static void ia32_emit_func_prolog(FILE *F, ir_graph *irg) { static void ia32_emit_func_epilog(FILE *F, ir_graph *irg) { const char *irg_name = get_entity_name(get_irg_entity(irg)); - fprintf(F, "\tret\n"); + fprintf(F, "\tret\n\n"); //printf(F, "\t.size\t%s, .-%s\n\n", irg_name, irg_name); } diff --git a/ir/be/ia32/ia32_spec.pl b/ir/be/ia32/ia32_spec.pl index 38d5167ca..8e242b047 100644 --- a/ir/be/ia32/ia32_spec.pl +++ b/ir/be/ia32/ia32_spec.pl @@ -403,6 +403,15 @@ $comment_string = ';'; "emit" => '. mov %ia32_emit_binop ; Store(%A3) -> (%A1) ' }, +"Store8Bit" => { + "op_flags" => "L|F", + "state" => "exc_pinned", + "comment" => "construct 8Bit 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", "eax ebx ecx edx", "none" ] }, + "emit" => '. mov %ia32_emit_binop ; Store(%A3) -> (%A1)' +}, + "Lea" => { "irn_flags" => "R", "comment" => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8", diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c index ebb470731..702d9d95a 100644 --- a/ir/be/ia32/ia32_transform.c +++ b/ir/be/ia32/ia32_transform.c @@ -1233,6 +1233,9 @@ static ir_node *gen_Store(ia32_transform_env_t *env) { if (mode_is_float(env->mode)) { new_op = new_rd_ia32_fStore(env->dbg, env->irg, env->block, ptr, noreg, sval, mem, env->mode); } + else if (get_mode_size_bits(env->mode) == 8) { + new_op = new_rd_ia32_Store8Bit(env->dbg, env->irg, env->block, ptr, noreg, sval, mem, env->mode); + } else { new_op = new_rd_ia32_Store(env->dbg, env->irg, env->block, ptr, noreg, sval, mem, env->mode); } @@ -1619,6 +1622,9 @@ static ir_node *gen_FrameStore(ia32_transform_env_t *env) { if (mode_is_float(mode)) { new_op = new_rd_ia32_fStore(env->dbg, env->irg, env->block, ptr, noreg, val, mem, mode_T); } + else if (get_mode_size_bits(mode) == 8) { + new_op = new_rd_ia32_Store8Bit(env->dbg, env->irg, env->block, ptr, noreg, val, mem, mode_T); + } else { new_op = new_rd_ia32_Store(env->dbg, env->irg, env->block, ptr, noreg, val, mem, mode_T); }