From 7efd6cf1ff2f91416a298b70518c94c67599e1c5 Mon Sep 17 00:00:00 2001 From: meissner Date: Sun, 4 Jun 2000 02:03:03 +0000 Subject: [PATCH] add IFCVT_MODIFY macros for the MD file to tweak the conditional execution support. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34386 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 +++++++++++++++ gcc/ifcvt.c | 35 ++++++++++++++++++++++++++++++++++- gcc/tm.texi | 25 +++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 834d7f2ec6e..10c6069c85d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +Sat Jun 3 19:05:30 2000 Michael Meissner + + * 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 * toplev.c (main): Fix misspellings of possibility and language. diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index eee72092afb..512983f5393 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, ®_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 b5afde48e42..4648778daf9 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 -- 2.11.4.GIT