#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "cfglayout.h"
{
/* A hack -- there seems to be no easy generic way how to make a
conditional jump from a ccmode comparison. */
- gcc_assert (cinsn);
+ if (!cinsn)
+ abort ();
cond = XEXP (SET_SRC (pc_set (cinsn)), 0);
- gcc_assert (GET_CODE (cond) == comp);
- gcc_assert (rtx_equal_p (op0, XEXP (cond, 0)));
- gcc_assert (rtx_equal_p (op1, XEXP (cond, 1)));
+ if (GET_CODE (cond) != comp
+ || !rtx_equal_p (op0, XEXP (cond, 0))
+ || !rtx_equal_p (op1, XEXP (cond, 1)))
+ abort ();
emit_jump_insn (copy_insn (PATTERN (cinsn)));
jump = get_last_insn ();
JUMP_LABEL (jump) = JUMP_LABEL (cinsn);
}
else
{
- gcc_assert (!cinsn);
+ if (cinsn)
+ abort ();
op0 = force_operand (op0, NULL_RTX);
op1 = force_operand (op1, NULL_RTX);
enum machine_mode mode;
/* BB must end in a simple conditional jump. */
- if (!bb->succ || !bb->succ->succ_next || bb->succ->succ_next->succ_next)
+ if (EDGE_COUNT (bb->succs) != 2)
return NULL_RTX;
if (!any_condjump_p (BB_END (bb)))
return NULL_RTX;
/* With branches inside loop. */
- if (!flow_bb_inside_loop_p (loop, bb->succ->dest)
- || !flow_bb_inside_loop_p (loop, bb->succ->succ_next->dest))
+ if (!flow_bb_inside_loop_p (loop, EDGE_SUCC (bb, 0)->dest)
+ || !flow_bb_inside_loop_p (loop, EDGE_SUCC (bb, 1)->dest))
return NULL_RTX;
/* It must be executed just once each iteration (because otherwise we
/* Unswitch the loop on this condition. */
nloop = unswitch_loop (loops, loop, bbs[i], cond, cinsn);
- gcc_assert (nloop);
+ if (!nloop)
+ abort ();
/* Invoke itself on modified loops. */
unswitch_single_loop (loops, nloop, rconds, num + 1);
rtx seq;
/* Some sanity checking. */
- gcc_assert (flow_bb_inside_loop_p (loop, unswitch_on));
-
- gcc_assert (unswitch_on->succ);
- gcc_assert (unswitch_on->succ->succ_next);
- gcc_assert (!unswitch_on->succ->succ_next->succ_next);
-
- gcc_assert (just_once_each_iteration_p (loop, unswitch_on));
- gcc_assert (!loop->inner);
- gcc_assert (flow_bb_inside_loop_p (loop, unswitch_on->succ->dest));
- gcc_assert (flow_bb_inside_loop_p (loop,
- unswitch_on->succ->succ_next->dest));
+ if (!flow_bb_inside_loop_p (loop, unswitch_on))
+ abort ();
+ if (EDGE_COUNT (unswitch_on->succs) != 2)
+ abort ();
+ if (!just_once_each_iteration_p (loop, unswitch_on))
+ abort ();
+ if (loop->inner)
+ abort ();
+ if (!flow_bb_inside_loop_p (loop, EDGE_SUCC (unswitch_on, 0)->dest))
+ abort ();
+ if (!flow_bb_inside_loop_p (loop, EDGE_SUCC (unswitch_on, 1)->dest))
+ abort ();
entry = loop_preheader_edge (loop);
unswitch_on_alt = unswitch_on->rbi->copy;
true_edge = BRANCH_EDGE (unswitch_on_alt);
false_edge = FALLTHRU_EDGE (unswitch_on);
- latch_edge = loop->latch->rbi->copy->succ;
+ latch_edge = EDGE_SUCC (loop->latch->rbi->copy, 0);
/* Create a block with the condition. */
prob = true_edge->probability;
if (irred_flag)
{
switch_bb->flags |= BB_IRREDUCIBLE_LOOP;
- switch_bb->succ->flags |= EDGE_IRREDUCIBLE_LOOP;
- switch_bb->succ->succ_next->flags |= EDGE_IRREDUCIBLE_LOOP;
+ EDGE_SUCC (switch_bb, 0)->flags |= EDGE_IRREDUCIBLE_LOOP;
+ EDGE_SUCC (switch_bb, 1)->flags |= EDGE_IRREDUCIBLE_LOOP;
}
else
{
switch_bb->flags &= ~BB_IRREDUCIBLE_LOOP;
- switch_bb->succ->flags &= ~EDGE_IRREDUCIBLE_LOOP;
- switch_bb->succ->succ_next->flags &= ~EDGE_IRREDUCIBLE_LOOP;
+ EDGE_SUCC (switch_bb, 0)->flags &= ~EDGE_IRREDUCIBLE_LOOP;
+ EDGE_SUCC (switch_bb, 1)->flags &= ~EDGE_IRREDUCIBLE_LOOP;
}
/* Loopify from the copy of LOOP body, constructing the new loop. */
nloop = loopify (loops, latch_edge,
- loop->header->rbi->copy->pred, switch_bb);
+ EDGE_PRED (loop->header->rbi->copy, 0), switch_bb,
+ BRANCH_EDGE (switch_bb), FALLTHRU_EDGE (switch_bb), true);
/* Remove branches that are now unreachable in new loops. */
remove_path (loops, true_edge);