summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-09 11:17:23 +0000
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-09 11:17:23 +0000
commit1606e68a803638a3a3de0678de340d60a480cb71 (patch)
treefae4f203782bfda9e5f07b9ca8e588b44eaa0dd2
parentf7646c6a0c63dcafdfbda632c366b48654f4024a (diff)
downloadgcc-1606e68a803638a3a3de0678de340d60a480cb71.tar.gz
2005-06-09 Adrian Straetling <straetling@de.ibm.com>
* target.h (insn_valid_within_doloop): Rename into "invalid_within_doloop". Change return type to "const char *". Update Comment. * targhooks.h (default_insn_valid_within_doloop): Rename into "default_invalid_within_doloop". * targhooks.c (default_insn_valid_within_doloop): Likewise. Update Comment. * target-def.h (TARGET_INSN_VALID_WITHIN_DOLOOP): Rename target hook into "TARGET_INVALID_WITHIN_DOLOOP". Default it to "default_invalid_within_doloop". * hooks.c (hook_constcharptr_rtx_null): New function. (hook_bool_rtx_true): Remove. * hooks.h (hook_constcharptr_rtx_null): Declare. (hook_bool_rtx_true): Remove. * loop-doloop.c (doloop_valid_p): Temporarily store return value of "invalid_within_doloop" and print error message if non-null. Update Comment. * doc/tm.texi: Update documentation. * config/s390/s390.c: Adjust to new hook name and new default hook. * config/rs6000/rs6000.c: (rs6000_insn_valid_within_doloop): Rename into "rs6000_invalid_within_doloop". (rs6000_invalid_within_doloop): Change return type to "static const char *" and replace return values. Update Comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100797 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog26
-rw-r--r--gcc/config/rs6000/rs6000.c17
-rw-r--r--gcc/config/s390/s390.c4
-rw-r--r--gcc/doc/tm.texi11
-rw-r--r--gcc/hooks.c13
-rw-r--r--gcc/hooks.h2
-rw-r--r--gcc/loop-doloop.c12
-rw-r--r--gcc/target-def.h6
-rw-r--r--gcc/target.h5
-rw-r--r--gcc/targhooks.c26
-rw-r--r--gcc/targhooks.h2
11 files changed, 76 insertions, 48 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ea4d25d0400..845e42c361d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,29 @@
+2005-06-09 Adrian Straetling <straetling@de.ibm.com>
+
+ * target.h (insn_valid_within_doloop): Rename into
+ "invalid_within_doloop". Change return type to "const char *".
+ Update Comment.
+ * targhooks.h (default_insn_valid_within_doloop): Rename into
+ "default_invalid_within_doloop".
+ * targhooks.c (default_insn_valid_within_doloop): Likewise.
+ Update Comment.
+ * target-def.h (TARGET_INSN_VALID_WITHIN_DOLOOP): Rename target hook
+ into "TARGET_INVALID_WITHIN_DOLOOP". Default it to
+ "default_invalid_within_doloop".
+ * hooks.c (hook_constcharptr_rtx_null): New function.
+ (hook_bool_rtx_true): Remove.
+ * hooks.h (hook_constcharptr_rtx_null): Declare.
+ (hook_bool_rtx_true): Remove.
+ * loop-doloop.c (doloop_valid_p): Temporarily store return value of
+ "invalid_within_doloop" and print error message if non-null.
+ Update Comment.
+ * doc/tm.texi: Update documentation.
+ * config/s390/s390.c: Adjust to new hook name and new default hook.
+ * config/rs6000/rs6000.c: (rs6000_insn_valid_within_doloop): Rename
+ into "rs6000_invalid_within_doloop".
+ (rs6000_invalid_within_doloop): Change return type to "static const
+ char *" and replace return values. Update Comment.
+
2005-06-09 Bernd Schmidt <bernd.schmidt@analog.com>
* config/bfin/bfin.opt (mlong-calls): New.
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 8d80e7c3863..4a56a441e0f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -552,7 +552,7 @@ struct processor_costs power4_cost = {
static bool rs6000_function_ok_for_sibcall (tree, tree);
-static bool rs6000_insn_valid_within_doloop (rtx);
+static bool rs6000_invalid_within_doloop (rtx);
static rtx rs6000_generate_compare (enum rtx_code);
static void rs6000_maybe_dead (rtx);
static void rs6000_emit_stack_tie (void);
@@ -907,7 +907,7 @@ static const char alt_reg_names[][8] =
#define TARGET_FUNCTION_OK_FOR_SIBCALL rs6000_function_ok_for_sibcall
#undef TARGET_INSN_VALID_WITHIN_DOLOOP
-#define TARGET_INSN_VALID_WITHIN_DOLOOP rs6000_insn_valid_within_doloop
+#define TARGET_INSN_VALID_WITHIN_DOLOOP rs6000_invalid_within_doloop
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS rs6000_rtx_costs
@@ -12529,21 +12529,22 @@ rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
return false;
}
-/* TRUE if INSN insn is valid within a low-overhead loop.
+/* NULL if INSN insn is valid within a low-overhead loop.
+ Otherwise return why doloop cannot be applied.
PowerPC uses the COUNT register for branch on table instructions. */
-static bool
-rs6000_insn_valid_within_doloop (rtx insn)
+static const char *
+rs6000_invalid_within_doloop (rtx insn)
{
if (CALL_P (insn))
- return false;
+ return "Function call in the loop.";
if (JUMP_P (insn)
&& (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
|| GET_CODE (PATTERN (insn)) == ADDR_VEC))
- return false;
+ return "Computed branch in the loop.";
- return true;
+ return NULL;
}
static int
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 5b82a8e92b3..fa8a8830eb4 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -8284,8 +8284,8 @@ s390_reorg (void)
#undef TARGET_CC_MODES_COMPATIBLE
#define TARGET_CC_MODES_COMPATIBLE s390_cc_modes_compatible
-#undef TARGET_INSN_VALID_WITHIN_DOLOOP
-#define TARGET_INSN_VALID_WITHIN_DOLOOP hook_bool_rtx_true
+#undef TARGET_INVALID_WITHIN_DOLOOP
+#define TARGET_INVALID_WITHIN_DOLOOP hook_constcharptr_rtx_null
#ifdef HAVE_AS_TLS
#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 427a23ed580..b2310e0ffc3 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9377,13 +9377,14 @@ simplified expression for the call's result. If @var{ignore} is true
the value will be ignored.
@end deftypefn
-@deftypefn {Target Hook} bool TARGET_INSN_VALID_WITHIN_DOLOOP (rtx @var{insn})
+@deftypefn {Target Hook} const char * TARGET_INVALID_WITHIN_DOLOOP (rtx @var{insn})
-Take an instruction in @var{insn} and return true if it is valid within a
-low-overhead loop.
+Take an instruction in @var{insn} and return NULL if it is valid within a
+low-overhead loop, otherwise return a string why doloop could not be applied.
-Many targets use special registers for low-overhead looping. This function
-should return false for any instruction that clobbers these.
+Many targets use special registers for low-overhead looping. For any
+instruction that clobbers these this function should return a string indicating
+the reason why the doloop could not be applied.
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
diff --git a/gcc/hooks.c b/gcc/hooks.c
index 30ba6d100da..23038ff3612 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -192,12 +192,6 @@ hook_bool_rtx_false (rtx a ATTRIBUTE_UNUSED)
}
bool
-hook_bool_rtx_true (rtx a ATTRIBUTE_UNUSED)
-{
- return true;
-}
-
-bool
hook_bool_uintp_uintp_false (unsigned int *a ATTRIBUTE_UNUSED,
unsigned int *b ATTRIBUTE_UNUSED)
{
@@ -255,3 +249,10 @@ hook_tree_tree_tree_bool_null (tree t0 ATTRIBUTE_UNUSED, tree t1 ATTRIBUTE_UNUSE
{
return NULL;
}
+
+/* Generic hook that takes a rtx and returns a NULL string. */
+const char *
+hook_constcharptr_rtx_null (rtx r ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
diff --git a/gcc/hooks.h b/gcc/hooks.h
index b78f4970549..2d9b3a3bde7 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -35,7 +35,6 @@ extern bool hook_bool_tree_hwi_hwi_tree_false (tree, HOST_WIDE_INT, HOST_WIDE_IN
extern bool hook_bool_tree_hwi_hwi_tree_true (tree, HOST_WIDE_INT, HOST_WIDE_INT,
tree);
extern bool hook_bool_rtx_false (rtx);
-extern bool hook_bool_rtx_true (rtx);
extern bool hook_bool_uintp_uintp_false (unsigned int *, unsigned int *);
extern bool hook_bool_rtx_int_int_intp_false (rtx, int, int, int *);
extern bool hook_bool_constcharptr_size_t_false (const char *, size_t);
@@ -66,4 +65,5 @@ extern rtx hook_rtx_tree_int_null (tree, int);
extern tree hook_tree_tree_tree_tree_3rd_identity (tree, tree, tree);
extern const char *hook_constcharptr_tree_null (tree);
extern tree hook_tree_tree_tree_bool_null (tree, tree, bool);
+extern const char *hook_constcharptr_rtx_null (rtx);
#endif
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index dd15aab919f..c40777b82c4 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -203,12 +203,16 @@ doloop_valid_p (struct loop *loop, struct niter_desc *desc)
{
/* Different targets have different necessities for low-overhead
looping. Call the back end for each instruction within the loop
- to let it decide whether the insn is valid. */
- if (!targetm.insn_valid_within_doloop (insn))
- {
+ to let it decide whether the insn prohibits a low-overhead loop.
+ It will then return the cause for it to emit to the dump file. */
+ const char * invalid = targetm.invalid_within_doloop (insn);
+ if (invalid)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Doloop: %s\n", invalid);
result = false;
goto cleanup;
- }
+ }
}
}
result = true;
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 7d71aeafc4c..fb04095b77d 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -137,8 +137,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_HAVE_NAMED_SECTIONS false
#endif
-#ifndef TARGET_INSN_VALID_WITHIN_DOLOOP
-#define TARGET_INSN_VALID_WITHIN_DOLOOP default_insn_valid_within_doloop
+#ifndef TARGET_INVALID_WITHIN_DOLOOP
+#define TARGET_INVALID_WITHIN_DOLOOP default_invalid_within_doloop
#endif
#ifndef TARGET_HAVE_TLS
@@ -564,7 +564,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TARGET_DWARF_CALLING_CONVENTION, \
TARGET_DWARF_HANDLE_FRAME_UNSPEC, \
TARGET_STDARG_OPTIMIZE_HOOK, \
- TARGET_INSN_VALID_WITHIN_DOLOOP, \
+ TARGET_INVALID_WITHIN_DOLOOP, \
TARGET_CALLS, \
TARGET_CXX, \
TARGET_HAVE_NAMED_SECTIONS, \
diff --git a/gcc/target.h b/gcc/target.h
index 0cdd82d034d..d6b9f5e3ef2 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -528,8 +528,9 @@ struct gcc_target
to be checked for va_list references. */
bool (*stdarg_optimize_hook) (struct stdarg_info *ai, tree lhs, tree rhs);
- /* Returns true if target supports the insn within a doloop block. */
- bool (*insn_valid_within_doloop) (rtx);
+ /* Returns NULL if target supports the insn within a doloop block,
+ otherwise it returns an error message. */
+ const char * (*invalid_within_doloop) (rtx);
/* Functions relating to calls - argument passing, returns, etc. */
struct calls {
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 42992b78c34..1de5809db13 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -262,34 +262,28 @@ default_scalar_mode_supported_p (enum machine_mode mode)
}
}
-/* TRUE if INSN insn is valid within a low-overhead loop.
+/* NULL if INSN insn is valid within a low-overhead loop, otherwise returns
+ an error message.
This function checks whether a given INSN is valid within a low-overhead
- loop. A called function may clobber any special registers required for
- low-overhead looping. Additionally, some targets (eg, PPC) use the count
+ loop. If INSN is invalid it returns the reason for that, otherwise it
+ returns NULL. A called function may clobber any special registers required
+ for low-overhead looping. Additionally, some targets (eg, PPC) use the count
register for branch on table instructions. We reject the doloop pattern in
these cases. */
-bool
-default_insn_valid_within_doloop (rtx insn)
+const char *
+default_invalid_within_doloop (rtx insn)
{
if (CALL_P (insn))
- {
- if (dump_file)
- fprintf (dump_file, "Doloop: Function call in loop.\n");
- return false;
- }
+ return "Function call in loop.";
if (JUMP_P (insn)
&& (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
|| GET_CODE (PATTERN (insn)) == ADDR_VEC))
- {
- if (dump_file)
- fprintf (dump_file, "Doloop: Computed branch in the loop.\n");
- return false;
- }
+ return "Computed branch in the loop.";
- return true;
+ return NULL;
}
bool
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index b4906ae1b3a..8de68a29537 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -46,7 +46,7 @@ extern void default_unwind_emit (FILE *, rtx);
extern bool default_scalar_mode_supported_p (enum machine_mode);
-extern bool default_insn_valid_within_doloop (rtx);
+extern const char * default_invalid_within_doloop (rtx);
/* These are here, and not in hooks.[ch], because not all users of
hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS. */