sparc: split Mulh node into SMulh and UMulh
[libfirm] / ir / be / beabi.c
index 7a5f0c0..a71e41a 100644 (file)
@@ -948,11 +948,11 @@ static ir_node *adjust_free(be_abi_irg_t *env, ir_node *free, ir_node *curr_sp)
        if (type != firm_unknown_type && get_type_size_bytes(type) != 1) {
                ir_tarval *tv   = new_tarval_from_long(get_type_size_bytes(type), mode_Iu);
                ir_node   *cnst = new_rd_Const(dbg, irg, tv);
-               ir_node   *mul  = new_rd_Mul(dbg, block, get_Free_size(free),
+               ir_node   *mul  = new_rd_Mul(dbg, block, get_Free_count(free),
                                             cnst, mode_Iu);
                size = mul;
        } else {
-               size = get_Free_size(free);
+               size = get_Free_count(free);
        }
 
        stack_alignment = 1 << arch_env->stack_alignment;
@@ -1166,9 +1166,10 @@ static ir_type *compute_arg_type(ir_graph *irg, be_abi_call_t *call,
                                                                 ir_type *method_type, ir_entity ***param_map)
 {
        struct obstack *obst = be_get_be_obst(irg);
-       ir_type *frame_type      = get_irg_frame_type(irg);
-       size_t   n_params        = get_method_n_params(method_type);
-       size_t   n_frame_members = get_compound_n_members(frame_type);
+       ir_type   *frame_type      = get_irg_frame_type(irg);
+       size_t     n_params        = get_method_n_params(method_type);
+       size_t     n_frame_members = get_compound_n_members(frame_type);
+       ir_entity *va_start_entity = NULL;
        size_t   f;
        int      ofs  = 0;
 
@@ -1181,21 +1182,24 @@ static ir_type *compute_arg_type(ir_graph *irg, be_abi_call_t *call,
 
        /* collect existing entities for value_param_types */
        for (f = n_frame_members; f > 0; ) {
-               ir_entity         *entity = get_compound_member(frame_type, --f);
-               size_t             num;
-               be_abi_call_arg_t *arg;
+               ir_entity *entity = get_compound_member(frame_type, --f);
+               size_t     num;
 
                set_entity_link(entity, NULL);
                if (!is_parameter_entity(entity))
                        continue;
                num = get_entity_parameter_number(entity);
+               if (num == IR_VA_START_PARAMETER_NUMBER) {
+                       /* move entity to new arg_type */
+                       set_entity_owner(entity, res);
+                       va_start_entity = entity;
+                       continue;
+               }
                assert(num < n_params);
                if (map[num] != NULL)
                        panic("multiple entities for parameter %u in %+F found", f, irg);
 
-               arg = get_call_arg(call, 0, num, 1);
-               if (!arg->on_stack) {
-                       map[num] = NULL;
+               if (num != n_params && !get_call_arg(call, 0, num, 1)->on_stack) {
                        /* don't move this entity */
                        continue;
                }
@@ -1225,8 +1229,12 @@ static ir_type *compute_arg_type(ir_graph *irg, be_abi_call_t *call,
                ofs += get_type_size_bytes(param_type);
                arg->stack_ent = entity;
        }
+       if (va_start_entity != NULL) {
+               set_entity_offset(va_start_entity, ofs);
+       }
        set_type_size_bytes(res, ofs);
        set_type_state(res, layout_fixed);
+
        return res;
 }