Hi,
I found a few changes were needed to the dwarf2 pass when trying to
implement epilogue unwind for SH, mainly that the current handling of
annulled-taken branches does not seem correct; the delay slot insn
should be handled in a manner similar to an insn in the fallthru block.
Cross-tested on SH and MIPS, and bootstrapped/tested on x86_64.
Thanks,
Chung-Lin
2012-05-18 Chung-Lin Tang <[email protected]>
* dwarf2cfi.c (scan_trace): Update CFA before exiting scan.
Handle annulled-taken branch (!INSN_FROM_TARGET_P) case.
Index: dwarf2cfi.c
===================================================================
--- dwarf2cfi.c (revision 187548)
+++ dwarf2cfi.c (working copy)
@@ -2401,6 +2401,7 @@ scan_trace (dw_trace_info *trace)
{
/* Propagate across fallthru edges. */
dwarf2out_flush_queued_reg_saves ();
+ def_cfa_1 (&this_cfa);
maybe_record_trace_start (insn, NULL);
break;
}
@@ -2455,6 +2456,18 @@ scan_trace (dw_trace_info *trace)
cur_cfa = &this_cfa;
continue;
}
+ else
+ {
+ /* If ELT is a annulled branch-taken instruction (i.e.
executed
+ only when branch is not taken), the args_size and CFA
should
+ not change through the jump. */
+ create_trace_edges (control);
+
+ /* Update and continue with the trace. */
+ add_cfi_insn = insn;
+ scan_insn_after (elt);
+ continue;
+ }
}
/* The insns in the delay slot should all be considered to happen