aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2012-09-01 14:26:28 +0000
committerUros Bizjak <ubizjak@gmail.com>2012-09-01 14:26:28 +0000
commit68fab092d1d3588dcc68b229d62cd36f59fb0937 (patch)
tree0eab0625a3fd56f7d03f4a8eed4bd72c645aec56 /gcc/combine.c
parent758095300dbbbf3f72d2f64a2d1901e6c185f433 (diff)
* target.def (legitimate_combined_insn): New target hook.
* doc/tm.texi.in (TARGET_LEGITIMATE_COMBINED_INSN): New hook. * doc/tm.texi: Regenerated. * combine.c (recog_for_combine): Call targetm.legitimate_combined_insn to allow targets to reject combined insn. * hooks.h (hook_bool_rtx_true): New. * hooks.c (hook_bool_rtx_true): Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@190846 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 18b79623b1c..507b11e61ed 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -10500,11 +10500,13 @@ static int
recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes)
{
rtx pat = *pnewpat;
+ rtx pat_without_clobbers;
int insn_code_number;
int num_clobbers_to_add = 0;
int i;
- rtx notes = 0;
+ rtx notes = NULL_RTX;
rtx old_notes, old_pat;
+ int old_icode;
/* If PAT is a PARALLEL, check to see if it contains the CLOBBER
we use to indicate that something didn't match. If we find such a
@@ -10518,7 +10520,7 @@ recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes)
old_pat = PATTERN (insn);
old_notes = REG_NOTES (insn);
PATTERN (insn) = pat;
- REG_NOTES (insn) = 0;
+ REG_NOTES (insn) = NULL_RTX;
insn_code_number = recog (pat, insn, &num_clobbers_to_add);
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -10564,6 +10566,9 @@ recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes)
print_rtl_single (dump_file, pat);
}
}
+
+ pat_without_clobbers = pat;
+
PATTERN (insn) = old_pat;
REG_NOTES (insn) = old_notes;
@@ -10605,6 +10610,35 @@ recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes)
pat = newpat;
}
+ if (insn_code_number >= 0
+ && insn_code_number != NOOP_MOVE_INSN_CODE)
+ {
+ old_pat = PATTERN (insn);
+ old_notes = REG_NOTES (insn);
+ old_icode = INSN_CODE (insn);
+ PATTERN (insn) = pat;
+ REG_NOTES (insn) = notes;
+
+ /* Allow targets to reject combined insn. */
+ if (!targetm.legitimate_combined_insn (insn))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fputs ("Instruction not appropriate for target.",
+ dump_file);
+
+ /* Callers expect recog_for_combine to strip
+ clobbers from the pattern on failure. */
+ pat = pat_without_clobbers;
+ notes = NULL_RTX;
+
+ insn_code_number = -1;
+ }
+
+ PATTERN (insn) = old_pat;
+ REG_NOTES (insn) = old_notes;
+ INSN_CODE (insn) = old_icode;
+ }
+
*pnewpat = pat;
*pnotes = notes;