From 7378f4a755ffdffdde608a822644869643f2c523 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Fri, 17 Mar 2006 14:19:05 +0000 Subject: [PATCH] fixed several bugs --- ir/be/ia32/bearch_ia32.c | 4 ++-- ir/be/ia32/ia32_emitter.c | 6 +++++- ir/be/ia32/ia32_map_regs.c | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index b73420d72..793fadfb3 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -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++) { diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c index 4b652f9a1..12997a261 100644 --- a/ir/be/ia32/ia32_emitter.c +++ b/ir/be/ia32/ia32_emitter.c @@ -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; } diff --git a/ir/be/ia32/ia32_map_regs.c b/ir/be/ia32/ia32_map_regs.c index df84f57b0..378b15e0d 100644 --- a/ir/be/ia32/ia32_map_regs.c +++ b/ir/be/ia32/ia32_map_regs.c @@ -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])) { -- 2.20.1