aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/ifcvt.c35
-rw-r--r--gcc/tm.texi25
3 files changed, 74 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 834d7f2..10c6069 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+Sat Jun 3 19:05:30 2000 Michael Meissner <meissner@redhat.com>
+
+ * ifcvt (process_insns): If IFCVT_MODIFY_INSN is defined, call it
+ with the pattern to do machine dependent work.
+ (cond_exec_process_if_block): If IFCVT_MODIFY_TESTS is defined,
+ use it to modify the true/false tests used in conditional
+ execution. If IFCVT_MODIFY_FINAL and IFCVT_MODIFY_CANCEL are
+ defined, invoke them if the conversion to conditional execution
+ was successful or not.
+
+ * tm.texi (IFCVT_MODIFY_TESTS): Document.
+ (IFCVT_MODIFY_INSN): Ditto.
+ (IFCVT_MODIFY_FINAL): Ditto.
+ (IFCVT_MODIFY_CANCEL): Ditto.
+
Sat Jun 3 15:26:13 2000 Matt Kraai <kraai@alumni.carnegiemellon.edu>
* toplev.c (main): Fix misspellings of possibility and language.
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;
}
diff --git a/gcc/tm.texi b/gcc/tm.texi
index b5afde4..4648778 100644
--- a/gcc/tm.texi
+++ b/gcc/tm.texi
@@ -7973,4 +7973,29 @@ A C expression for the maximum number of instructions to execute via
conditional execution instructions instead of a branch. A value of
@code{BRANCH_COST}+1 is the default if the machine does not use cc0, and
1 if it does use cc0.
+
+@findex IFCVT_MODIFY_TESTS
+@item IFCVT_MODIFY_TESTS
+A C expression to modify the tests in @code{TRUE_EXPR}, and
+@code{FALSE_EXPPR} for use in converting insns in @code{TEST_BB},
+@code{THEN_BB}, @code{ELSE_BB}, and @code{JOIN_BB} basic blocks to
+conditional execution. Set either @code{TRUE_EXPR} or @code{FALSE_EXPR}
+to a null pointer if the tests cannot be converted.
+
+@findex IFCVT_MODIFY_INSN
+@item IFCVT_MODIFY_INSN
+A C expression to modify the @code{PATTERN} of an @code{INSN} that is to
+be converted to conditional execution format.
+
+@findex IFCVT_MODIFY_FINAL
+@item IFCVT_MODIFY_FINAL
+A C expression to perform any final machine dependent modifications in
+converting code to conditional execution in the basic blocks
+@code{TEST_BB}, @code{THEN_BB}, @code{ELSE_BB}, and @code{JOIN_BB}.
+
+@findex IFCVT_MODIFY_CANCEL
+@item IFCVT_MODIFY_CANCEL
+A C expression to cancel any machine dependent modifications in
+converting code to conditional execution in the basic blocks
+@code{TEST_BB}, @code{THEN_BB}, @code{ELSE_BB}, and @code{JOIN_BB}.
@end table