made emit more nasm compatible
authorChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 17 Mar 2006 15:37:07 +0000 (15:37 +0000)
committerChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 17 Mar 2006 15:37:07 +0000 (15:37 +0000)
add new 8bit store node

ir/be/ia32/bearch_ia32.c
ir/be/ia32/ia32_emitter.c
ir/be/ia32/ia32_spec.pl
ir/be/ia32/ia32_transform.c

index 793fadf..7904c6f 100644 (file)
@@ -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);
 
index 12997a2..754ee97 100644 (file)
@@ -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);
 }
 
index 38d5167..8e242b0 100644 (file)
@@ -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",
index ebb4707..702d9d9 100644 (file)
@@ -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);
        }