added ir/opt include
authorChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Tue, 17 Oct 2006 15:43:43 +0000 (15:43 +0000)
committerChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Tue, 17 Oct 2006 15:43:43 +0000 (15:43 +0000)
ir/be/arm/Makefile.in
ir/be/be.h
ir/be/bemain.c
ir/be/firm/Makefile.in
ir/be/ia32/Makefile.in
ir/be/ia32/bearch_ia32.c
ir/be/ia32/ia32_emitter.c
ir/be/mips/Makefile.in
ir/be/ppc32/Makefile.in

index 182253d..bfd4965 100644 (file)
@@ -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
 
index fe69d85..30e60b2 100644 (file)
@@ -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;
 
 /**
index 0243bc4..751c445 100644 (file)
@@ -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);
index 99229b1..a678236 100644 (file)
@@ -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
 
index 8f69efc..2452da4 100644 (file)
@@ -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
 
index a1203e7..ca5c0a6 100644 (file)
@@ -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
index b3b40f9..a992cf1 100644 (file)
@@ -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:
index 3a58a9e..a16d595 100644 (file)
@@ -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
 
index aeac7a7..f72df58 100644 (file)
@@ -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