GET_MODE_BITSIZE (inmode));
}
-/* Unshare sequence SEQ produced by if conversion. We care to mark
- all arguments that may be shared with outer instruction stream. */
-static void
-unshare_ifcvt_sequence (struct noce_if_info *if_info, rtx seq)
+/* Return sequence of instructions generated by if conversion. This
+ function calls end_sequence() to end the current stream, ensures
+ that are instructions are unshared, recognizable non-jump insns.
+ On failure, this function returns a NULL_RTX. */
+
+static rtx
+end_ifcvt_sequence (struct noce_if_info *if_info)
{
+ rtx y;
+ rtx seq = get_insns ();
+
set_used_flags (if_info->x);
set_used_flags (if_info->cond);
unshare_all_rtl_in_chain (seq);
+ end_sequence ();
+
+ if (seq_contains_jump (seq))
+ return NULL_RTX;
+
+ /* Make sure that all of the instructions emitted are recognizable.
+ As an excersise for the reader, build a general mechanism that
+ allows proper placement of required clobbers. */
+ for (y = seq; y ; y = NEXT_INSN (y))
+ if (recog_memoized (y) == -1)
+ return NULL_RTX;
+ return seq;
}
/* Convert "if (a != b) x = a; else x = b" into "x = a" and
{
start_sequence ();
noce_emit_move_insn (if_info->x, y);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
-
- /* Make sure that all of the instructions emitted are
- recognizable. As an excersise for the reader, build
- a general mechanism that allows proper placement of
- required clobbers. */
- for (y = seq; y ; y = NEXT_INSN (y))
- if (recog_memoized (y) == -1)
- return FALSE;
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
+ return FALSE;
emit_insn_before_setloc (seq, if_info->jump,
INSN_LOCATOR (if_info->insn_a));
if (target != if_info->x)
noce_emit_move_insn (if_info->x, target);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
- emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATOR (if_info->insn_a));
+ seq = end_ifcvt_sequence (if_info);
+ if (! seq)
+ return FALSE;
+ emit_insn_before_setloc (seq, if_info->jump,
+ INSN_LOCATOR (if_info->insn_a));
return TRUE;
}
else
if (target != if_info->x)
noce_emit_move_insn (if_info->x, target);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
-
- if (seq_contains_jump (seq))
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
return FALSE;
- emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATOR (if_info->insn_a));
-
+ emit_insn_before_setloc (seq, if_info->jump,
+ INSN_LOCATOR (if_info->insn_a));
return TRUE;
}
if (target != if_info->x)
noce_emit_move_insn (if_info->x, target);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
+ return FALSE;
+
emit_insn_before_setloc (seq, if_info->jump,
- INSN_LOCATOR (if_info->insn_a));
+ INSN_LOCATOR (if_info->insn_a));
return TRUE;
}
end_sequence ();
if (target != if_info->x)
noce_emit_move_insn (if_info->x, target);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
-
- if (seq_contains_jump (seq))
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
return FALSE;
emit_insn_before_setloc (seq, if_info->jump,
- INSN_LOCATOR (if_info->insn_a));
-
+ INSN_LOCATOR (if_info->insn_a));
return TRUE;
}
end_sequence ();
if (target != if_info->x)
noce_emit_move_insn (if_info->x, target);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
-
- if (seq_contains_jump (seq))
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
return FALSE;
emit_insn_before_setloc (seq, if_info->jump,
- INSN_LOCATOR (if_info->insn_a));
-
+ INSN_LOCATOR (if_info->insn_a));
return TRUE;
}
if (target != if_info->x)
noce_emit_move_insn (if_info->x, target);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
+ return FALSE;
+
emit_insn_before_setloc (seq, if_info->jump,
- INSN_LOCATOR (if_info->insn_a));
+ INSN_LOCATOR (if_info->insn_a));
return TRUE;
}
else
else if (target != x)
noce_emit_move_insn (x, target);
- tmp = get_insns ();
- unshare_ifcvt_sequence (if_info, tmp);
- end_sequence ();
+ tmp = end_ifcvt_sequence (if_info);
+ if (!tmp)
+ return FALSE;
+
emit_insn_before_setloc (tmp, if_info->jump, INSN_LOCATOR (if_info->insn_a));
return TRUE;
if (target != if_info->x)
noce_emit_move_insn (if_info->x, target);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
-
- if (seq_contains_jump (seq))
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
return FALSE;
emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATOR (if_info->insn_a));
if (target != if_info->x)
noce_emit_move_insn (if_info->x, target);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
-
- if (seq_contains_jump (seq))
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
return FALSE;
emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATOR (if_info->insn_a));
}
noce_emit_move_insn (if_info->x, t);
- seq = get_insns ();
- unshare_ifcvt_sequence (if_info, seq);
- end_sequence ();
- emit_insn_before_setloc (seq, if_info->jump,
- INSN_LOCATOR (if_info->insn_a));
+
+ seq = end_ifcvt_sequence (if_info);
+ if (!seq)
+ return FALSE;
+
+ emit_insn_before_setloc (seq, if_info->jump, INSN_LOCATOR (if_info->insn_a));
return TRUE;
}