[PATCH] Fix unwind info with -freorder-blocks-and-partition (PR rtl-optimization/34999)

Jakub Jelinek jakub@redhat.com
Sat Jul 25 00:23:00 GMT 2009


On Fri, Jul 24, 2009 at 02:58:40PM -0700, Richard Henderson wrote:
> On 07/24/2009 01:53 PM, Jakub Jelinek wrote:
>> ... merging adjacent DW_CFA_def_cfa_offset*.
>
> Why shouldn't you be taking the absolute last value of the cfa?  I can't  
> see why you'd only be discarding adjacent cfa definitions.

Wouldn't it change behavior if some other cfa op in between two
def_cfa_offset ops depends on the current cfa?  Or are there never any
dependencies between cfa ops within the same FDE (just that the last one
wins)?  If so, yes, we could pick always the last value from anything
(e.g. let .cfi_restore XX cancel previous .cfi_register or .cfa_offset for
the same register, etc.).

Looking at execute_cfa_program, likely there aren't really any dependencies,
so we could just for each register gather the last of
DW_CFA_offset{,_extended}/DW_CFA_restore{,_extended}/DW_CFA_same_value/DW_CFA_undefined/DW_CFA_register/
DW_CFA_expression/DW_CFA_offset_extended_sf/DW_CFA_val_offset{,_sf}/DW_CFA_val_expression/
DW_CFA_GNU_negative_offset_extended
and emit that (of course ignoring anything in between
remember_state/restore_state, and perhaps not adding anything if it was
DW_CFA_restore*.  Similarly with DW_CFA_def_cfa* (there taking care because
not all ops redefine everything).  And the same (as done in the patch
already) for DW_CFA_GNU_args_size.  Complications are DW_CFA_GNU_window_save
and DW_CFA_remember_state without following DW_CFA_restore_state, in both
cases it would be perhaps easiest to flush the current state before that op,
then add that op and continue accumulating the state again.

> Though it certainly looks like output_call_frame_info could stand to be  
> split into some subroutines...

Can I address that in a follow-up?

	Jakub



More information about the Gcc-patches mailing list