let backends report their machine_size and the size of long double if supported
authorMatthias Braun <matze@braunis.de>
Wed, 15 Jun 2011 12:59:56 +0000 (14:59 +0200)
committerMatthias Braun <matze@braunis.de>
Fri, 17 Jun 2011 14:12:59 +0000 (16:12 +0200)
include/libfirm/be.h
ir/be/TEMPLATE/bearch_TEMPLATE.c
ir/be/amd64/bearch_amd64.c
ir/be/arm/bearch_arm.c
ir/be/ia32/bearch_ia32.c
ir/be/sparc/bearch_sparc.c

index 2d71276..1131763 100644 (file)
@@ -78,12 +78,19 @@ typedef struct backend_params {
        /** Backend settings for if-conversion. */
        arch_allow_ifconv_func allow_ifconv;
 
+       /** size of machine words. This is usually the size of the general purpose
+        * integer registers. */
+       unsigned machine_size;
+
        /**
         * some backends like x87 can only do arithmetic in a specific float
-        * mode (but convert to/from other float modes).
+        * mode (load/store are still done in the "normal" float/double modes).
         */
        ir_mode *mode_float_arithmetic;
 
+       /** size of a long double floating mode in bits (or 0 if not supported) */
+       unsigned long_double_size;
+
        /** Size of the trampoline code. */
        unsigned trampoline_size;
 
index afa533f..1596442 100644 (file)
@@ -322,7 +322,9 @@ static const backend_params *TEMPLATE_get_backend_params(void)
                0,     /* 0: little-endian, 1: big-endian */
                NULL,  /* architecture dependent settings, will be set later */
                TEMPLATE_is_mux_allowed,  /* parameter for if conversion */
+               32,    /* machine size - a 32bit CPU */
                NULL,  /* float arithmetic mode */
+               0,     /* size of long double */
                0,     /* no trampoline support: size 0 */
                0,     /* no trampoline support: align 0 */
                NULL,  /* no trampoline support: no trampoline builder */
index 71b68fb..02748da 100644 (file)
@@ -502,7 +502,9 @@ static const backend_params *amd64_get_backend_params(void) {
                0,     /* little endian */
                NULL,  /* will be set later */
                amd64_is_mux_allowed,  /* parameter for if conversion */
+               64,    /* machine size */
                NULL,  /* float arithmetic mode */
+               0,     /* size of long double */
                0,     /* no trampoline support: size 0 */
                0,     /* no trampoline support: align 0 */
                NULL,  /* no trampoline support: no trampoline builder */
index dd7f71f..3f93bbe 100644 (file)
@@ -573,7 +573,9 @@ static const backend_params *arm_get_libfirm_params(void)
                1,     /* big endian */
                &ad,   /* will be set later */
                arm_is_mux_allowed, /* allow_ifconv function */
+               32,    /* machine size */
                NULL,  /* float arithmetic mode (TODO) */
+               0,     /* size of long double */
                0,     /* no trampoline support: size 0 */
                0,     /* no trampoline support: align 0 */
                NULL,  /* no trampoline support: no trampoline builder */
index 9a2f9df..7dc3931 100644 (file)
@@ -2092,7 +2092,9 @@ static const backend_params *ia32_get_libfirm_params(void)
                0,     /* little endian */
                NULL,  /* will be set later */
                ia32_is_mux_allowed,
+               32,    /* machine_size */
                NULL,  /* float arithmetic mode, will be set below */
+               0,     /* size of long double */
                12,    /* size of trampoline code */
                4,     /* alignment of trampoline code */
                ia32_create_trampoline_fkt,
@@ -2106,8 +2108,13 @@ static const backend_params *ia32_get_libfirm_params(void)
        init_asm_constraints();
 
        p.dep_param    = &ad;
-       if (! ia32_cg_config.use_sse2)
+       if (! ia32_cg_config.use_sse2) {
                p.mode_float_arithmetic = mode_E;
+               p.long_double_size = 96;
+       } else {
+               p.mode_float_arithmetic = NULL;
+               p.long_double_size = 64;
+       }
        return &p;
 }
 
index 3b93687..d37c804 100644 (file)
@@ -604,7 +604,9 @@ static const backend_params *sparc_get_backend_params(void)
                1,     /* big endian */
                &arch_dep,              /* will be set later */
                sparc_is_mux_allowed,   /* parameter for if conversion */
+               32,    /* machine size */
                NULL,  /* float arithmetic mode */
+               128,   /* size of long double */
                0,     /* no trampoline support: size 0 */
                0,     /* no trampoline support: align 0 */
                NULL,  /* no trampoline support: no trampoline builder */