This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
preofile.c versus setjmp
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com, patches at x86-64 dot org
- Subject: preofile.c versus setjmp
- From: Jan Hubicka <jh at suse dot cz>
- Date: Tue, 7 Aug 2001 13:33:33 +0200
Hi
This patch adds fake entry edge for setjmp, so the code handles it correctly.
It is depedent on the next patch, as it uses the REG_SETJMP, instead of
NOTE_INSN_SETJMP, but I would love to see it in, with the trivial case, even
in case the next patch gets blocked.
Honza
Po srp 6 22:06:51 CEST 2001 Jan Hubicka <jh@suse.cz>
* profile.c (branch_prob): Add fake edges for setjmp.
*** profile.c.setjmp Mon Aug 6 21:20:02 2001
--- profile.c Mon Aug 6 21:38:59 2001
*************** branch_prob ()
*** 547,552 ****
--- 547,579 ----
basic_block bb = BASIC_BLOCK (i);
edge e;
+ /* Add fake edges from entry block to the call insns that may return
+ twice. The CFG is not quite correct then, as call insn plays more
+ role of CODE_LABEL, but for our purposes, everything should be OK,
+ as we never insert code to the beggining of basic block. */
+ for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = NEXT_INSN (insn))
+ {
+ if (GET_CODE (insn) == CALL_INSN
+ && find_reg_note (insn, REG_SETJMP, NULL))
+ {
+ if (GET_CODE (bb->head) == CODE_LABEL
+ || insn != NEXT_INSN (bb->head))
+ {
+ e = split_block (bb, PREV_INSN (insn));
+ make_edge (NULL, ENTRY_BLOCK_PTR, e->dest, EDGE_FAKE);
+ break;
+ }
+ else
+ {
+ /* We should not get abort here, as call to setjmp should not
+ be the very first instruction of function. */
+ if (!i)
+ abort ();
+ make_edge (NULL, ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
+ }
+ }
+ }
+
for (e = bb->succ; e; e = e->succ_next)
{
if ((e->flags & (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL))