aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/combine.c38
-rw-r--r--gcc/doc/tm.texi4
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/hooks.c6
-rw-r--r--gcc/hooks.h1
-rw-r--r--gcc/target.def9
7 files changed, 71 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9363aa4..545fee0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2012-09-01 Uros Bizjak <ubizjak@gmail.com>
+
+ * 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.
+
2012-08-31 Martin Jambor <mjambor@suse.cz>
* ipa-inline-analysis.c (estimate_function_body_sizes): Allocate
@@ -62,8 +72,9 @@
2012-08-29 Oleg Endo <olegendo@gcc.gnu.org>
* config/sh/iterators.md: New file.
- * config/sh/sync.md (I124, I12, i124suffix): Delete. Replace usage with
- new iterators QIHISI, QIHI, bw, bwl respectively throughout the file.
+ * config/sh/sync.md (I124, I12, i124suffix): Delete. Replace usage
+ with new iterators QIHISI, QIHI, bw, bwl respectively throughout
+ the file.
* config/sh/sh.md: Include new file iterators.md.
(zero_extendhisi2, zero_extendqisi2): Fold into zero_extend<mode>si2.
(*zero_extendhisi2_compact, *zero_extendqisi2_compact): Fold into
diff --git a/gcc/combine.c b/gcc/combine.c
index 18b7962..507b11e 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;
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 79e7fe8..a4dc7c1 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -10938,6 +10938,10 @@ By default, the RTL loop optimizer does not use a present doloop pattern for
loops containing function calls or branch on table instructions.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_LEGITIMATE_COMBINED_INSN (rtx @var{insn})
+Take an instruction in @var{insn} and return @code{false} if the instruction is not appropriate as a combination of two or more instructions. The default is to accept all instructions.
+@end deftypefn
+
@defmac MD_CAN_REDIRECT_BRANCH (@var{branch1}, @var{branch2})
Take a branch insn in @var{branch1} and another in @var{branch2}.
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 569413b..54414f1 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -10796,6 +10796,8 @@ By default, the RTL loop optimizer does not use a present doloop pattern for
loops containing function calls or branch on table instructions.
@end deftypefn
+@hook TARGET_LEGITIMATE_COMBINED_INSN
+
@defmac MD_CAN_REDIRECT_BRANCH (@var{branch1}, @var{branch2})
Take a branch insn in @var{branch1} and another in @var{branch2}.
diff --git a/gcc/hooks.c b/gcc/hooks.c
index ae59c33..c004639 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -269,6 +269,12 @@ hook_bool_tree_bool_false (tree a ATTRIBUTE_UNUSED, bool b ATTRIBUTE_UNUSED)
}
bool
+hook_bool_rtx_true (rtx a ATTRIBUTE_UNUSED)
+{
+ return true;
+}
+
+bool
hook_bool_rtx_false (rtx a ATTRIBUTE_UNUSED)
{
return false;
diff --git a/gcc/hooks.h b/gcc/hooks.h
index 2e10d1f..8eec169 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -50,6 +50,7 @@ extern bool hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree,
HOST_WIDE_INT,
HOST_WIDE_INT,
const_tree);
+extern bool hook_bool_rtx_true (rtx);
extern bool hook_bool_rtx_false (rtx);
extern bool hook_bool_rtx_int_false (rtx, int);
extern bool hook_bool_uintp_uintp_false (unsigned int *, unsigned int *);
diff --git a/gcc/target.def b/gcc/target.def
index 6f1968d..321d64f 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1984,6 +1984,15 @@ DEFHOOK
const char *, (const_rtx insn),
default_invalid_within_doloop)
+/* Returns true for a legitimate combined insn. */
+DEFHOOK
+(legitimate_combined_insn,
+"Take an instruction in @var{insn} and return @code{false} if the instruction\
+ is not appropriate as a combination of two or more instructions. The\
+ default is to accept all instructions.",
+ bool, (rtx insn),
+ hook_bool_rtx_true)
+
DEFHOOK
(valid_dllimport_attribute_p,
"@var{decl} is a variable or function with @code{__attribute__((dllimport))}\