* 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
+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.
\f
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);
#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
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
#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
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
}
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)
{
{
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;
+}
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);
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
{
/* 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;
#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
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, \
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 {
}
}
-/* 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
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. */