X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fia32%2Fia32_emitter.c;h=d9e12706d38531b084646b014ffce855770a34cb;hb=eb593ca265a302849042866b57a3cf7a6e9495ab;hp=d377143b0af700954862016768d01af9254fa5f0;hpb=5cb14f12bacb0c7d1c646112b4660d57e14236a2;p=libfirm diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c index d377143b0..d9e12706d 100644 --- a/ir/be/ia32/ia32_emitter.c +++ b/ir/be/ia32/ia32_emitter.c @@ -74,6 +74,7 @@ static ia32_code_gen_t *cg; static int do_pic; static char pic_base_label[128]; static ir_label_t exc_label_id; +static int mark_spill_reload = 0; /** Return the next block in Block schedule */ static ir_node *get_prev_block_sched(const ir_node *block) @@ -701,10 +702,6 @@ static int determine_final_pnc(const ir_node *node, int flags_pos, pnc = get_mirrored_pnc(pnc); pnc |= ia32_pn_Cmp_float; } else { -#if 0 - assert(is_ia32_Cmp(flags) || is_ia32_Test(flags) - || is_ia32_Cmp8Bit(flags) || is_ia32_Test8Bit(flags)); -#endif flags_attr = get_ia32_attr_const(flags); if (flags_attr->data.ins_permuted) @@ -1934,9 +1931,25 @@ static void ia32_emit_node(ir_node *node) DBG((dbg, LEVEL_1, "emitting code for %+F\n", node)); - if (is_ia32_irn(node) && get_ia32_exc_label(node)) { - /* emit the exception label of this instruction */ - ia32_assign_exc_label(node); + if (is_ia32_irn(node)) { + if (get_ia32_exc_label(node)) { + /* emit the exception label of this instruction */ + ia32_assign_exc_label(node); + } + if (mark_spill_reload) { + if (is_ia32_is_spill(node)) { + be_emit_cstring("\txchg %ebx, %ebx /* spill mark */\n"); + be_emit_write_line(); + } + if (is_ia32_is_reload(node)) { + be_emit_cstring("\txchg %edx, %edx /* reload mark */\n"); + be_emit_write_line(); + } + if (is_ia32_is_remat(node)) { + be_emit_cstring("\txchg %ecx, %ecx /* remat mark */\n"); + be_emit_write_line(); + } + } } if (op->ops.generic) { emit_func_ptr func = (emit_func_ptr) op->ops.generic; @@ -2232,7 +2245,20 @@ void ia32_gen_routine(ia32_code_gen_t *ia32_cg, ir_graph *irg) DEL_ARR_F(exc_list); } +static const lc_opt_table_entry_t ia32_emitter_options[] = { + LC_OPT_ENT_BOOL("mark_spill_reload", "mark spills and reloads with ud opcodes", &mark_spill_reload), + LC_OPT_LAST +}; + void ia32_init_emitter(void) { + lc_opt_entry_t *be_grp; + lc_opt_entry_t *ia32_grp; + + be_grp = lc_opt_get_grp(firm_opt_get_root(), "be"); + ia32_grp = lc_opt_get_grp(be_grp, "ia32"); + + lc_opt_add_table(ia32_grp, ia32_emitter_options); + FIRM_DBG_REGISTER(dbg, "firm.be.ia32.emitter"); }