sparc: fix too short Save offsets
authorMatthias Braun <matze@braunis.de>
Thu, 26 Jan 2012 19:11:14 +0000 (20:11 +0100)
committerMatthias Braun <matze@braunis.de>
Thu, 9 Feb 2012 17:01:51 +0000 (18:01 +0100)
We have to perform the stackframe-type alignment adjustments before we
set the immediates of the Save instruction are adjusted.

ir/be/sparc/bearch_sparc_t.h
ir/be/sparc/sparc_finish.c
ir/be/sparc/sparc_stackframe.c

index d5cc225..264e971 100644 (file)
@@ -83,6 +83,7 @@ void sparc_lower_64bit(void);
 
 bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv);
 void sparc_create_stacklayout(ir_graph *irg, calling_convention_t *cconv);
+void sparc_adjust_stack_entity_offsets(ir_graph *irg);
 void sparc_fix_stack_bias(ir_graph *irg);
 
 #endif
index 7695934..0021d33 100644 (file)
@@ -637,6 +637,7 @@ void sparc_finish_graph(ir_graph *irg)
        irg_walk_graph(irg, NULL, sparc_collect_frame_entity_nodes, fec_env);
        be_assign_entities(fec_env, sparc_set_frame_entity, at_begin);
        be_free_frame_entity_coalescer(fec_env);
+       sparc_adjust_stack_entity_offsets(irg);
 
        sparc_introduce_prolog_epilog(irg);
 
index ce542b3..b14a17c 100644 (file)
@@ -280,7 +280,7 @@ void sparc_create_stacklayout(ir_graph *irg, calling_convention_t *cconv)
 /* Assign entity offsets, to all stack-related entities.
  * The offsets are relative to the begin of the stack frame.
  */
-static void process_frame_types(ir_graph *irg)
+void sparc_adjust_stack_entity_offsets(ir_graph *irg)
 {
        be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
 
@@ -324,6 +324,7 @@ static void process_frame_types(ir_graph *irg)
                unsigned misalign = (SPARC_MIN_STACKSIZE+frame_size) % frame_align;
                frame_size += misalign;
        }
+       set_type_size_bytes(frame_type, frame_size);
 
        ir_type *arg_type = layout->arg_type;
 
@@ -338,8 +339,6 @@ void sparc_fix_stack_bias(ir_graph *irg)
 
        ir_node *start_block = get_irg_start_block(irg);
 
-       process_frame_types(irg);
-
        ir_reserve_resources(irg, IR_RESOURCE_BLOCK_VISITED);
        inc_irg_block_visited(irg);
        process_bias(start_block, sp_relative, 0, 0);