From: Christian Würdig Date: Tue, 17 Oct 2006 15:43:43 +0000 (+0000) Subject: added ir/opt include X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=48f0393daa5d5a14ed7e3e32ee2b090759c9371e;p=libfirm added ir/opt include --- diff --git a/ir/be/arm/Makefile.in b/ir/be/arm/Makefile.in index 182253df0..bfd49654c 100644 --- a/ir/be/arm/Makefile.in +++ b/ir/be/arm/Makefile.in @@ -30,7 +30,7 @@ CPPFLAGS += -I$(top_srcdir)/ir/adt -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/ -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr -I$(top_srcdir)/ir/tv \ -I$(top_srcdir)/ir/debug -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st \ -I$(top_srcdir)/ir/stat -I$(top_srcdir)/ir/external -I$(top_srcdir)/ir/ana2 -I$(top_srcdir)/ir/lower \ - -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower + -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower -I$(top_srcdir)/ir/opt include $(top_srcdir)/MakeTargets diff --git a/ir/be/be.h b/ir/be/be.h index fe69d858f..30e60b251 100644 --- a/ir/be/be.h +++ b/ir/be/be.h @@ -6,6 +6,7 @@ #include "archop.h" #include "lower_dw.h" #include "dbginfo.h" +#include "ifconv.h" #define LC_STOP_AND_RESET_TIMER(timer) do { lc_timer_stop(timer); lc_timer_reset(timer); } while(0) @@ -29,6 +30,8 @@ typedef struct backend_params { /** the context parameter for the create intrinsic function */ void *create_intrinsic_ctx; + /** backend settings for if-conversion */ + opt_if_conv_info_t *if_conv_info; } backend_params; /** diff --git a/ir/be/bemain.c b/ir/be/bemain.c index 0243bc4dd..751c445e2 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -498,7 +498,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name) /** * Create execution frequencies from profile data or estimate some */ - if(be_profile_has_data()) { + if (be_profile_has_data()) { birg->execfreqs = be_create_execfreqs_from_profile(irg); } else { birg->execfreqs = compute_execfreq(irg, 10); @@ -537,7 +537,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name) Since the code generator made a lot of new nodes and skipped a lot of old ones, we should do dead node elimination here. Note that this requires disabling the edges here. - */ + */ edges_deactivate(irg); //dead_node_elimination(irg); edges_activate(irg); diff --git a/ir/be/firm/Makefile.in b/ir/be/firm/Makefile.in index 99229b1ce..a67823616 100644 --- a/ir/be/firm/Makefile.in +++ b/ir/be/firm/Makefile.in @@ -23,7 +23,7 @@ CPPFLAGS += -I$(top_srcdir)/ir/adt -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/ -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr -I$(top_srcdir)/ir/tv \ -I$(top_srcdir)/ir/debug -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st \ -I$(top_srcdir)/ir/stat -I$(top_srcdir)/ir/external -I$(top_srcdir)/ir/ana2 \ - -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower + -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower -I$(top_srcdir)/ir/opt include $(top_srcdir)/MakeTargets diff --git a/ir/be/ia32/Makefile.in b/ir/be/ia32/Makefile.in index 8f69efc68..2452da47c 100644 --- a/ir/be/ia32/Makefile.in +++ b/ir/be/ia32/Makefile.in @@ -31,7 +31,7 @@ CPPFLAGS += -I$(top_srcdir)/ir/adt -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/ -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr -I$(top_srcdir)/ir/tv \ -I$(top_srcdir)/ir/debug -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st \ -I$(top_srcdir)/ir/stat -I$(top_srcdir)/ir/external -I$(top_srcdir)/ir/ana2 \ - -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower + -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower -I$(top_srcdir)/ir/opt include $(top_srcdir)/MakeTargets diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index a1203e76c..ca5c0a6c1 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -1731,6 +1731,25 @@ static int ia32_get_reg_class_alignment(const void *self, const arch_register_cl return bytes; } +/** + * Allows or disallows the creation of a Psi for the given Cond selector. + * @return 1 if allowed, 0 otherwise + */ +static int ia32_is_psi_allowed(ir_node *sel, ir_node *false_res, ir_node *true_res) { + ir_node *cmp, *cmp_a; + ir_mode *mode; + + if (get_irn_mode(sel) != mode_b) + return 0; + + cmp = get_Proj_pred(sel); + cmp_a = get_Cmp_left(cmp); + mode = get_irn_mode(cmp_a); + + /* we don't want long long an floating point Psi */ + return ! mode_is_float(mode) && get_mode_size_bits(mode) <= 32; +} + static ia32_intrinsic_env_t intrinsic_env = { NULL, /**< the irg, these entities belong to */ NULL, /**< entity for first div operand (move into FPU) */ @@ -1743,13 +1762,17 @@ static ia32_intrinsic_env_t intrinsic_env = { * Returns the libFirm configuration parameter for this backend. */ static const backend_params *ia32_get_libfirm_params(void) { + static const opt_if_conv_info_t ifconv = { + 4, /* maxdepth, doesn't matter for Psi-conversion */ + ia32_is_psi_allowed /* allows or disallows Psi creation for given selector */ + }; static const arch_dep_params_t ad = { - 1, /* also use subs */ - 4, /* maximum shifts */ + 1, /* also use subs */ + 4, /* maximum shifts */ 31, /* maximum shift amount */ - 1, /* allow Mulhs */ - 1, /* allow Mulus */ + 1, /* allow Mulhs */ + 1, /* allow Mulus */ 32 /* Mulh allowed up to 32 bit */ }; static backend_params p = { @@ -1758,9 +1781,11 @@ static const backend_params *ia32_get_libfirm_params(void) { 1, /* need dword lowering */ ia32_create_intrinsic_fkt, &intrinsic_env, /* context for ia32_create_intrinsic_fkt */ + NULL, /* will be set later */ }; - p.dep_param = &ad; + p.dep_param = &ad; + p.if_conv_info = &ifconv; return &p; } #ifdef WITH_LIBCORE diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c index b3b40f9f7..a992cf1f7 100644 --- a/ir/be/ia32/ia32_emitter.c +++ b/ir/be/ia32/ia32_emitter.c @@ -276,7 +276,6 @@ static int ia32_get_x87_name(lc_appendable_t *app, ir_node *irn = arg->v_ptr; int nr = occ->width - 1; ia32_attr_t *attr; - char *n; int res = 0; if (! irn) @@ -286,16 +285,7 @@ static int ia32_get_x87_name(lc_appendable_t *app, buf = attr->x87[nr]->name; res += lc_appendable_chadd(app, '%'); - - if (buf[2] == '0') { - /* just omit 'st' (skip the 0) */ - res += lc_appendable_snadd(app, buf, strlen(buf) - 1); - } - else { - res += lc_appendable_snadd(app, "st(", 3); - res += lc_appendable_chadd(app, buf[2]); - res += lc_appendable_chadd(app, ')'); - } + res += lc_appendable_snadd(app, buf, strlen(buf)); return res; } @@ -566,7 +556,8 @@ const char *ia32_emit_x87_binop(const ir_node *n, ia32_emit_env_t *env) { in = out ? (REGS_ARE_EQUAL(out, in2) ? in1 : in2) : in2; out = out ? out : in1; - snprintf(buf, SNPRINTF_BUF_LEN, "%s, %s", get_x87_reg_name(out, buf1), get_x87_reg_name(in, buf2)); + snprintf(buf, SNPRINTF_BUF_LEN, "%%%s, %%%s", + arch_register_get_name(out), arch_register_get_name(in)); } break; case ia32_AddrModeS: diff --git a/ir/be/mips/Makefile.in b/ir/be/mips/Makefile.in index 3a58a9e24..a16d5956a 100644 --- a/ir/be/mips/Makefile.in +++ b/ir/be/mips/Makefile.in @@ -29,7 +29,7 @@ CPPFLAGS += -I$(top_srcdir)/ir/adt -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/ -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr -I$(top_srcdir)/ir/tv \ -I$(top_srcdir)/ir/debug -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st \ -I$(top_srcdir)/ir/stat -I$(top_srcdir)/ir/external -I$(top_srcdir)/ir/ana2 -I$(top_srcdir)/ir/lower \ - -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower + -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower -I$(top_srcdir)/ir/opt include $(top_srcdir)/MakeTargets diff --git a/ir/be/ppc32/Makefile.in b/ir/be/ppc32/Makefile.in index aeac7a7d1..f72df5814 100644 --- a/ir/be/ppc32/Makefile.in +++ b/ir/be/ppc32/Makefile.in @@ -29,7 +29,7 @@ CPPFLAGS += -I$(top_srcdir)/ir/adt -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/ -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr -I$(top_srcdir)/ir/tv \ -I$(top_srcdir)/ir/debug -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st \ -I$(top_srcdir)/ir/stat -I$(top_srcdir)/ir/external -I$(top_srcdir)/ir/ana2 \ - -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower + -I$(topdir)/ir/config -I$(top_srcdir)/ir/arch -I$(top_srcdir)/ir/lower -I$(top_srcdir)/ir/opt include $(top_srcdir)/MakeTargets