remove has_compound_ret_parameter, we already had cc_compound_ret
[libfirm] / ir / be / sparc / sparc_cconv.c
index af2c09c..5e4c648 100644 (file)
@@ -60,6 +60,7 @@ static const arch_register_t* const param_regs[] = {
        &sparc_registers[REG_I4],
        &sparc_registers[REG_I5],
 };
+COMPILETIME_ASSERT(ARRAY_SIZE(param_regs) == SPARC_N_PARAM_REGS, sparcparamregs)
 
 static const arch_register_t* const float_result_regs[] = {
        &sparc_registers[REG_F0],
@@ -202,6 +203,16 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
                int                 bits       = get_mode_size_bits(mode);
                reg_or_stackslot_t *param      = &params[i];
 
+               if (i == 0 &&
+                   (get_method_calling_convention(function_type) & cc_compound_ret)) {
+                       assert(mode_is_reference(mode) && bits == 32);
+                       /* special case, we have reserved space for this on the between
+                        * type */
+                       param->type   = param_type;
+                       param->offset = -SPARC_MIN_STACKSIZE+SPARC_AGGREGATE_RETURN_OFFSET;
+                       continue;
+               }
+
                if (regnum < n_param_regs) {
                        const arch_register_t *reg = param_regs[regnum];
                        if (irg == NULL || omit_fp)
@@ -314,7 +325,6 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
                struct obstack *obst      = &birg->obst;
                size_t          r;
 
-               assert(birg->allocatable_regs == NULL);
                birg->allocatable_regs = rbitset_obstack_alloc(obst, N_SPARC_REGISTERS);
                rbitset_set_all(birg->allocatable_regs, N_SPARC_REGISTERS);
                for (r = 0; r < n_ignores; ++r) {