put register classes into arch_env struct, no need for complicated callbacks
[libfirm] / ir / be / sparc / sparc_cconv.c
index 4f83049..ae3cb84 100644 (file)
  */
 static const arch_register_t *map_i_to_o_reg(const arch_register_t *reg)
 {
-       unsigned idx = arch_register_get_index(reg);
+       unsigned idx = reg->global_index;
        assert(REG_I0 <= idx && idx <= REG_I7);
        idx += REG_O0 - REG_I0;
        assert(REG_O0 <= idx && idx <= REG_O7);
-       return &sparc_gp_regs[idx];
+       return &sparc_registers[idx];
 }
 
 calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
@@ -71,7 +71,6 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
                ir_mode            *mode       = get_type_mode(param_type);
                int                 bits       = get_mode_size_bits(mode);
                reg_or_stackslot_t *param      = &params[i];
-               param->type = param_type;
 
                if (regnum < n_param_regs) {
                        const arch_register_t *reg = param_regs[regnum++];
@@ -79,6 +78,7 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
                                reg = map_i_to_o_reg(reg);
                        param->reg0 = reg;
                } else {
+                       param->type   = param_type;
                        param->offset = stack_offset;
                        /* increase offset 4 bytes so everything is aligned */
                        stack_offset += bits > 32 ? bits/8 : 4;