IA32: align the stack at 32bit
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 18 Sep 2006 15:22:00 +0000 (15:22 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 18 Sep 2006 15:22:00 +0000 (15:22 +0000)
ABI: align stack parameters

ir/be/beabi.c
ir/be/ia32/bearch_ia32.c

index 401503c..3d28942 100644 (file)
@@ -407,11 +407,12 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp, i
        for(i = 0; i < n_params; ++i) {
                be_abi_call_arg_t *arg = get_call_arg(call, 0, i);
                assert(arg);
-               if(arg->on_stack) {
-                       stack_size += arg->space_before;
-                       stack_size =  round_up2(stack_size, arg->alignment);
-                       stack_size += get_type_size_bytes(get_method_param_type(mt, i));
-                       stack_size += arg->space_after;
+               if (arg->on_stack) {
+                       int arg_size = get_type_size_bytes(get_method_param_type(mt, i));
+
+                       stack_size += round_up2(arg->space_before, arg->alignment);
+                       stack_size += round_up2(arg_size, arg->alignment);
+                       stack_size += round_up2(arg->space_after, arg->alignment);
                        obstack_int_grow(obst, i);
                        n_pos++;
                }
index 692f49b..711c341 100644 (file)
@@ -1623,7 +1623,8 @@ static void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_cal
 
        /* set stack parameters */
        for (i = stack_idx; i < n; i++) {
-               be_abi_call_param_stack(abi, i, 1, 0, 0);
+               /* parameters on the stack are 32 bit aligned */
+               be_abi_call_param_stack(abi, i, 4, 0, 0);
        }