/* Control flow graph building code for GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
#include "function.h"
#include "except.h"
#include "expr.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
#include "timevar.h"
+#include "sbitmap.h"
static void make_edges (basic_block, basic_block, int);
static void make_label_edge (sbitmap, basic_block, rtx, int);
if (GET_CODE (PATTERN (insn)) == TRAP_IF
&& XEXP (PATTERN (insn), 0) == const1_rtx)
return true;
- if (!flag_non_call_exceptions)
+ if (!cfun->can_throw_non_call_exceptions)
return false;
break;
else if (returnjump_p (insn))
cached_make_edge (edge_cache, bb, EXIT_BLOCK_PTR, 0);
+ /* Recognize asm goto and do the right thing. */
+ else if ((tmp = extract_asm_operands (PATTERN (insn))) != NULL)
+ {
+ int i, n = ASM_OPERANDS_LABEL_LENGTH (tmp);
+ for (i = 0; i < n; ++i)
+ make_label_edge (edge_cache, bb,
+ XEXP (ASM_OPERANDS_LABEL (tmp, i), 0), 0);
+ }
+
/* Otherwise, we have a plain conditional or unconditional jump. */
else
{
handler for this CALL_INSN. If we're handling non-call
exceptions then any insn can reach any of the active handlers.
Also mark the CALL_INSN as reaching any nonlocal goto handler. */
- else if (code == CALL_INSN || flag_non_call_exceptions)
+ else if (code == CALL_INSN || cfun->can_throw_non_call_exceptions)
{
/* Add any appropriate EH edges. */
rtl_make_eh_edge (edge_cache, bb, insn);
- if (code == CALL_INSN && nonlocal_goto_handler_labels)
+ if (code == CALL_INSN)
{
- /* ??? This could be made smarter: in some cases it's possible
- to tell that certain calls will not do a nonlocal goto.
- For example, if the nested functions that do the nonlocal
- gotos do not have their addresses taken, then only calls to
- those functions or to other nested functions that use them
- could possibly do nonlocal gotos. */
if (can_nonlocal_goto (insn))
- for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
- make_label_edge (edge_cache, bb, XEXP (x, 0),
- EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
+ {
+ /* ??? This could be made smarter: in some cases it's
+ possible to tell that certain calls will not do a
+ nonlocal goto. For example, if the nested functions
+ that do the nonlocal gotos do not have their addresses
+ taken, then only calls to those functions or to other
+ nested functions that use them could possibly do
+ nonlocal gotos. */
+ for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
+ make_label_edge (edge_cache, bb, XEXP (x, 0),
+ EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
+ }
+
+ if (flag_tm)
+ {
+ rtx note;
+ for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
+ if (REG_NOTE_KIND (note) == REG_TM)
+ make_label_edge (edge_cache, bb, XEXP (note, 0),
+ EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
+ }
}
}
if (code == CODE_LABEL && LABEL_ALT_ENTRY_P (insn))
make_edge (ENTRY_BLOCK_PTR, bb, 0);
}
+ else if (code == BARRIER)
+ {
+ /* __builtin_unreachable () may cause a barrier to be emitted in
+ the middle of a BB. We need to split it in the same manner as
+ if the barrier were preceded by a control_flow_insn_p insn. */
+ if (!flow_transfer_insn)
+ flow_transfer_insn = prev_nonnote_insn_bb (insn);
+ }
if (control_flow_insn_p (insn))
flow_transfer_insn = insn;