fixed several bugs
authorChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 17 Mar 2006 14:19:05 +0000 (14:19 +0000)
committerChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 17 Mar 2006 14:19:05 +0000 (14:19 +0000)
ir/be/ia32/bearch_ia32.c
ir/be/ia32/ia32_emitter.c
ir/be/ia32/ia32_map_regs.c

index b73420d..793fadf 100644 (file)
@@ -824,7 +824,7 @@ void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *ab
        int       n         = get_method_n_params(method_type);
        int       biggest_n = -1;
        int       stack_idx = 0;
-       int       i, ignore;
+       int       i, ignore_1, ignore_2;
        ir_mode **modes;
        const arch_register_t *reg;
        be_abi_call_flags_t call_flags;
@@ -851,7 +851,7 @@ void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *ab
 //     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, &ignore);
+               biggest_n = ia32_get_n_regparam_class(n, modes, &ignore_1, &ignore_2);
 
                /* loop over all parameters and set the register requirements */
                for (i = 0; i <= biggest_n; i++) {
index 4b652f9..12997a2 100644 (file)
@@ -240,6 +240,8 @@ 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))
+
        if (! buf) {
                buf = xcalloc(1, SNPRINTF_BUF_LEN);
        }
@@ -255,7 +257,7 @@ char *ia32_emit_binop(const ir_node *n, ia32_emit_env_t *env) {
                        else {
                                const arch_register_t *in1 = get_in_reg(n, 2);
                                const arch_register_t *in2 = get_in_reg(n, 3);
-                               const arch_register_t *out = get_ia32_n_res(n) > 0 ? get_out_reg(n, 0) : NULL;
+                               const arch_register_t *out = PRODUCES_RESULT(n) ? get_out_reg(n, 0) : NULL;
                                const arch_register_t *in;
 
                                in  = out ? (REGS_ARE_EQUAL(out, in2) ? in1 : in2) : in2;
@@ -301,6 +303,8 @@ char *ia32_emit_binop(const ir_node *n, ia32_emit_env_t *env) {
                        assert(0 && "unsupported op type");
        }
 
+#undef PRODUCES_RESULT
+
        return buf;
 }
 
index df84f57..378b15e 100644 (file)
@@ -136,8 +136,11 @@ char *ia32_get_mapped_reg_name(pmap *reg_map, const arch_register_t *reg) {
 int ia32_get_n_regparam_class(int n, ir_mode **modes, int *n_int, int *n_float) {
        int i, finished = 0;
 
+       *n_int   = 0;
+       *n_float = 0;
+
        for (i = 0; i < n && !finished; i++) {
-               if (mode_is_int(modes[i])) {
+               if (mode_is_int(modes[i]) || mode_is_reference(modes[i])) {
                        *n_int = *n_int + 1;
                }
                else if (mode_is_float(modes[i])) {