aboutsummaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index eee7209..512983f 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -207,6 +207,7 @@ cond_exec_process_insns (start, end, test, prob_val, mod_ok)
{
int must_be_last = FALSE;
rtx insn;
+ rtx pattern;
for (insn = start; ; insn = NEXT_INSN (insn))
{
@@ -239,9 +240,20 @@ cond_exec_process_insns (start, end, test, prob_val, mod_ok)
}
/* Now build the conditional form of the instruction. */
+ pattern = PATTERN (insn);
+
+ /* If the machine needs to modify the insn being conditionally executed,
+ say for example to force a constant integer operand into a temp
+ register, do so here. */
+#ifdef IFCVT_MODIFY_INSN
+ IFCVT_MODIFY_INSN (pattern, insn);
+ if (! pattern)
+ return FALSE;
+#endif
+
validate_change (insn, &PATTERN (insn),
gen_rtx_COND_EXEC (VOIDmode, copy_rtx (test),
- PATTERN (insn)), 1);
+ pattern), 1);
if (GET_CODE (insn) == CALL_INSN && prob_val)
validate_change (insn, &REG_NOTES (insn),
@@ -369,6 +381,17 @@ cond_exec_process_if_block (test_bb, then_bb, else_bb, join_bb)
GET_MODE (true_expr), XEXP (true_expr, 0),
XEXP (true_expr, 1));
+#ifdef IFCVT_MODIFY_TESTS
+ /* If the machine description needs to modify the tests, such as setting a
+ conditional execution register from a comparison, it can do so here. */
+ IFCVT_MODIFY_TESTS (true_expr, false_expr, test_bb, then_bb, else_bb,
+ join_bb);
+
+ /* See if the conversion failed */
+ if (!true_expr || !false_expr)
+ goto fail;
+#endif
+
true_prob_val = find_reg_note (test_bb->end, REG_BR_PROB, NULL_RTX);
if (true_prob_val)
{
@@ -398,6 +421,11 @@ cond_exec_process_if_block (test_bb, then_bb, else_bb, join_bb)
if (! apply_change_group ())
return FALSE;
+#ifdef IFCVT_MODIFY_FINAL
+ /* Do any machine dependent final modifications */
+ IFCVT_MODIFY_FINAL (test_bb, then_bb, else_bb, join_bb);
+#endif
+
/* Conversion succeeded. */
if (rtl_dump_file)
fprintf (rtl_dump_file, "%d insn%s converted to conditional execution.\n",
@@ -408,6 +436,11 @@ cond_exec_process_if_block (test_bb, then_bb, else_bb, join_bb)
return TRUE;
fail:
+#ifdef IFCVT_MODIFY_CANCEL
+ /* Cancel any machine dependent changes. */
+ IFCVT_MODIFY_CANCEL (test_bb, then_bb, else_bb, join_bb);
+#endif
+
cancel_changes (0);
return FALSE;
}