This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
dwarf2out and multiple entry points take 2
- To: patches at x86-64 dot org, rth at cygnus dot com, gcc-patches at gcc dot gnu dot org
- Subject: dwarf2out and multiple entry points take 2
- From: Jan Hubicka <jh at suse dot cz>
- Date: Wed, 28 Feb 2001 18:39:10 +0100
Hi
Hope to get it right this time. It seems to output sane info in trivial cases.
Wed Feb 28 18:37:30 CET 2001 Jan Hubicka <jh@suse.cz>
* dwarf2out.c (dwarf2out_frame_debug): Support alternate entry points.
* final.c (final_scan_insn): Call dwarf2out_frame_debug for CODE_LABEL.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.244
diff -c -3 -p -r1.244 dwarf2out.c
*** dwarf2out.c 2001/02/21 14:42:17 1.244
--- dwarf2out.c 2001/02/28 17:36:57
*************** dwarf2out_frame_debug (insn)
*** 1740,1745 ****
--- 1743,1781 ----
cfa_store = cfa;
cfa_temp.reg = -1;
cfa_temp.offset = 0;
+
+ n_alternate_entry_points = 0;
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+ if (GET_CODE (insn) == CODE_LABEL && LABEL_ALTERNATE_NAME (insn))
+ n_alternate_entry_points ++;
+
+ /* For each alternate entry point amit an store_state command. We will pop
+ the state once we will reach it. */
+ while (n_alternate_entry_points--)
+ {
+ register dw_cfi_ref xcfi;
+
+ /* Set the location counter to the new label. */
+ xcfi = new_cfi ();
+ xcfi->dw_cfi_opc = DW_CFA_remember_state;
+ add_fde_cfi (NULL, xcfi);
+ }
+ return;
+ }
+ /* An alternate entry point. Pop the state we pushed during initialization
+ and re-initialize our tables. */
+ if (GET_CODE (insn) == CODE_LABEL && LABEL_ALTERNATE_NAME (insn))
+ {
+ register dw_cfi_ref xcfi;
+ label = dwarf2out_cfi_label ();
+
+ /* On entry, the Canonical Frame Address is at SP. */
+ dwarf2out_def_cfa (label, STACK_POINTER_REGNUM, INCOMING_FRAME_SP_OFFSET);
+
+ /* Restore the frame state we had right before entering function. */
+ xcfi = new_cfi ();
+ xcfi->dw_cfi_opc = DW_CFA_restore_state;
+ add_fde_cfi (label, xcfi);
return;
}
Index: final.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/final.c,v
retrieving revision 1.159
diff -c -3 -p -r1.159 final.c
*** final.c 2001/02/18 20:50:41 1.159
--- final.c 2001/02/28 17:38:07
*************** final_scan_insn (insn, file, optimize, p
*** 2332,2337 ****
--- 2332,2343 ----
break;
case CODE_LABEL:
+ #if defined (DWARF2_UNWIND_INFO)
+ /* If we push arguments, we need to check all insns for stack
+ adjustments. */
+ if (dwarf2out_do_frame ())
+ dwarf2out_frame_debug (insn);
+ #endif
/* The target port might emit labels in the output function for
some insn, e.g. sh.c output_branchy_insn. */
if (CODE_LABEL_NUMBER (insn) <= max_labelno)