/* Control flow graph building code for GNU compiler.
- Copyright (C) 1987-2014 Free Software Foundation, Inc.
+ Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GCC.
#include "system.h"
#include "coretypes.h"
#include "tm.h"
+#include "hash-set.h"
+#include "machmode.h"
+#include "vec.h"
+#include "double-int.h"
+#include "input.h"
+#include "alias.h"
+#include "symtab.h"
+#include "wide-int.h"
+#include "inchash.h"
#include "tree.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "predict.h"
+#include "hashtab.h"
+#include "function.h"
+#include "dominance.h"
+#include "cfg.h"
+#include "cfgrtl.h"
+#include "cfganal.h"
+#include "cfgbuild.h"
#include "basic-block.h"
#include "regs.h"
#include "flags.h"
-#include "function.h"
#include "except.h"
+#include "statistics.h"
+#include "real.h"
+#include "fixed-value.h"
+#include "insn-config.h"
+#include "expmed.h"
+#include "dojump.h"
+#include "explow.h"
+#include "calls.h"
+#include "emit-rtl.h"
+#include "varasm.h"
+#include "stmt.h"
#include "expr.h"
#include "diagnostic-core.h"
#include "timevar.h"
block. */
bool
-inside_basic_block_p (const_rtx insn)
+inside_basic_block_p (const rtx_insn *insn)
{
switch (GET_CODE (insn))
{
the basic block. */
bool
-control_flow_insn_p (const_rtx insn)
+control_flow_insn_p (const rtx_insn *insn)
{
switch (GET_CODE (insn))
{
FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
{
- rtx insn, x;
+ rtx_insn *insn;
enum rtx_code code;
edge e;
edge_iterator ei;
if (code == JUMP_INSN)
{
rtx tmp;
+ rtx_jump_table_data *table;
/* Recognize a non-local goto as a branch outside the
current function. */
;
/* Recognize a tablejump and do the right thing. */
- else if (tablejump_p (insn, NULL, &tmp))
+ else if (tablejump_p (insn, NULL, &table))
{
- rtvec vec;
+ rtvec vec = table->get_labels ();
int j;
- if (GET_CODE (PATTERN (tmp)) == ADDR_VEC)
- vec = XVEC (PATTERN (tmp), 0);
- else
- vec = XVEC (PATTERN (tmp), 1);
-
for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
make_label_edge (edge_cache, bb,
XEXP (RTVEC_ELT (vec, j), 0), 0);
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
make_label_edge (edge_cache, bb,
- XEXP (XEXP (SET_SRC (tmp), 2), 0), 0);
+ LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)), 0);
}
/* If this is a computed jump, then mark it as reaching
everything on the forced_labels list. */
else if (computed_jump_p (insn))
{
- for (x = forced_labels; x; x = XEXP (x, 1))
- make_label_edge (edge_cache, bb, XEXP (x, 0), EDGE_ABNORMAL);
+ for (rtx_insn_list *x = forced_labels; x; x = x->next ())
+ make_label_edge (edge_cache, bb, x->insn (), EDGE_ABNORMAL);
}
/* Returns create an exit out. */
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),
+ for (rtx_insn_list *x = nonlocal_goto_handler_labels;
+ x;
+ x = x->next ())
+ make_label_edge (edge_cache, bb, x->insn (),
EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
}
}
static void
-purge_dead_tablejump_edges (basic_block bb, rtx table)
+purge_dead_tablejump_edges (basic_block bb, rtx_jump_table_data *table)
{
- rtx insn = BB_END (bb), tmp;
+ rtx_insn *insn = BB_END (bb);
+ rtx tmp;
rtvec vec;
int j;
edge_iterator ei;
edge e;
- if (GET_CODE (PATTERN (table)) == ADDR_VEC)
- vec = XVEC (PATTERN (table), 0);
- else
- vec = XVEC (PATTERN (table), 1);
+ vec = table->get_labels ();
for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
mark_tablejump_edge (XEXP (RTVEC_ELT (vec, j), 0));
&& SET_DEST (tmp) == pc_rtx
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
- mark_tablejump_edge (XEXP (XEXP (SET_SRC (tmp), 2), 0));
+ mark_tablejump_edge (LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)));
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{
find_bb_boundaries (basic_block bb)
{
basic_block orig_bb = bb;
- rtx insn = BB_HEAD (bb);
- rtx end = BB_END (bb), x;
- rtx table;
- rtx flow_transfer_insn = NULL_RTX;
+ rtx_insn *insn = BB_HEAD (bb);
+ rtx_insn *end = BB_END (bb), *x;
+ rtx_jump_table_data *table;
+ rtx_insn *flow_transfer_insn = NULL;
edge fallthru = NULL;
if (insn == BB_END (bb))
fallthru = split_block (bb, PREV_INSN (insn));
if (flow_transfer_insn)
{
- SET_BB_END (bb) = flow_transfer_insn;
+ BB_END (bb) = flow_transfer_insn;
/* Clean up the bb field for the insns between the blocks. */
for (x = NEXT_INSN (flow_transfer_insn);
bb = fallthru->dest;
remove_edge (fallthru);
- flow_transfer_insn = NULL_RTX;
+ flow_transfer_insn = NULL;
if (code == CODE_LABEL && LABEL_ALT_ENTRY_P (insn))
make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun), bb, 0);
}
ordinary jump, we need to take care and move basic block boundary. */
if (flow_transfer_insn)
{
- SET_BB_END (bb) = flow_transfer_insn;
+ BB_END (bb) = flow_transfer_insn;
/* Clean up the bb field for the insns that do not belong to BB. */
x = flow_transfer_insn;