Commit e7e64a25 by Adrian Straetling Committed by Ulrich Weigand

target.h (insn_valid_within_doloop): Rename into "invalid_within_doloop".

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.

From-SVN: r100797
parent fd078f52
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> 2005-06-09 Bernd Schmidt <bernd.schmidt@analog.com>
* config/bfin/bfin.opt (mlong-calls): New. * config/bfin/bfin.opt (mlong-calls): New.
......
...@@ -552,7 +552,7 @@ struct processor_costs power4_cost = { ...@@ -552,7 +552,7 @@ struct processor_costs power4_cost = {
static bool rs6000_function_ok_for_sibcall (tree, tree); 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 rtx rs6000_generate_compare (enum rtx_code);
static void rs6000_maybe_dead (rtx); static void rs6000_maybe_dead (rtx);
static void rs6000_emit_stack_tie (void); static void rs6000_emit_stack_tie (void);
...@@ -907,7 +907,7 @@ static const char alt_reg_names[][8] = ...@@ -907,7 +907,7 @@ static const char alt_reg_names[][8] =
#define TARGET_FUNCTION_OK_FOR_SIBCALL rs6000_function_ok_for_sibcall #define TARGET_FUNCTION_OK_FOR_SIBCALL rs6000_function_ok_for_sibcall
#undef TARGET_INSN_VALID_WITHIN_DOLOOP #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 #undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS rs6000_rtx_costs #define TARGET_RTX_COSTS rs6000_rtx_costs
...@@ -12529,21 +12529,22 @@ rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) ...@@ -12529,21 +12529,22 @@ rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
return false; 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. */ PowerPC uses the COUNT register for branch on table instructions. */
static bool static const char *
rs6000_insn_valid_within_doloop (rtx insn) rs6000_invalid_within_doloop (rtx insn)
{ {
if (CALL_P (insn)) if (CALL_P (insn))
return false; return "Function call in the loop.";
if (JUMP_P (insn) if (JUMP_P (insn)
&& (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC && (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
|| GET_CODE (PATTERN (insn)) == ADDR_VEC)) || GET_CODE (PATTERN (insn)) == ADDR_VEC))
return false; return "Computed branch in the loop.";
return true; return NULL;
} }
static int static int
......
...@@ -8284,8 +8284,8 @@ s390_reorg (void) ...@@ -8284,8 +8284,8 @@ s390_reorg (void)
#undef TARGET_CC_MODES_COMPATIBLE #undef TARGET_CC_MODES_COMPATIBLE
#define TARGET_CC_MODES_COMPATIBLE s390_cc_modes_compatible #define TARGET_CC_MODES_COMPATIBLE s390_cc_modes_compatible
#undef TARGET_INSN_VALID_WITHIN_DOLOOP #undef TARGET_INVALID_WITHIN_DOLOOP
#define TARGET_INSN_VALID_WITHIN_DOLOOP hook_bool_rtx_true #define TARGET_INVALID_WITHIN_DOLOOP hook_constcharptr_rtx_null
#ifdef HAVE_AS_TLS #ifdef HAVE_AS_TLS
#undef TARGET_ASM_OUTPUT_DWARF_DTPREL #undef TARGET_ASM_OUTPUT_DWARF_DTPREL
......
...@@ -9377,13 +9377,14 @@ simplified expression for the call's result. If @var{ignore} is true ...@@ -9377,13 +9377,14 @@ simplified expression for the call's result. If @var{ignore} is true
the value will be ignored. the value will be ignored.
@end deftypefn @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 Take an instruction in @var{insn} and return NULL if it is valid within a
low-overhead loop. low-overhead loop, otherwise return a string why doloop could not be applied.
Many targets use special registers for low-overhead looping. This function Many targets use special registers for low-overhead looping. For any
should return false for any instruction that clobbers these. 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 By default, the RTL loop optimizer does not use a present doloop pattern for
loops containing function calls or branch on table instructions. loops containing function calls or branch on table instructions.
@end deftypefn @end deftypefn
......
...@@ -192,12 +192,6 @@ hook_bool_rtx_false (rtx a ATTRIBUTE_UNUSED) ...@@ -192,12 +192,6 @@ hook_bool_rtx_false (rtx a ATTRIBUTE_UNUSED)
} }
bool bool
hook_bool_rtx_true (rtx a ATTRIBUTE_UNUSED)
{
return true;
}
bool
hook_bool_uintp_uintp_false (unsigned int *a ATTRIBUTE_UNUSED, hook_bool_uintp_uintp_false (unsigned int *a ATTRIBUTE_UNUSED,
unsigned int *b 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 ...@@ -255,3 +249,10 @@ hook_tree_tree_tree_bool_null (tree t0 ATTRIBUTE_UNUSED, tree t1 ATTRIBUTE_UNUSE
{ {
return NULL; 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;
}
...@@ -35,7 +35,6 @@ extern bool hook_bool_tree_hwi_hwi_tree_false (tree, HOST_WIDE_INT, HOST_WIDE_IN ...@@ -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, extern bool hook_bool_tree_hwi_hwi_tree_true (tree, HOST_WIDE_INT, HOST_WIDE_INT,
tree); tree);
extern bool hook_bool_rtx_false (rtx); 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_uintp_uintp_false (unsigned int *, unsigned int *);
extern bool hook_bool_rtx_int_int_intp_false (rtx, int, int, 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 bool hook_bool_constcharptr_size_t_false (const char *, size_t);
...@@ -66,4 +65,5 @@ extern rtx hook_rtx_tree_int_null (tree, int); ...@@ -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 tree hook_tree_tree_tree_tree_3rd_identity (tree, tree, tree);
extern const char *hook_constcharptr_tree_null (tree); extern const char *hook_constcharptr_tree_null (tree);
extern tree hook_tree_tree_tree_bool_null (tree, tree, bool); extern tree hook_tree_tree_tree_bool_null (tree, tree, bool);
extern const char *hook_constcharptr_rtx_null (rtx);
#endif #endif
...@@ -203,12 +203,16 @@ doloop_valid_p (struct loop *loop, struct niter_desc *desc) ...@@ -203,12 +203,16 @@ doloop_valid_p (struct loop *loop, struct niter_desc *desc)
{ {
/* Different targets have different necessities for low-overhead /* Different targets have different necessities for low-overhead
looping. Call the back end for each instruction within the loop looping. Call the back end for each instruction within the loop
to let it decide whether the insn is valid. */ to let it decide whether the insn prohibits a low-overhead loop.
if (!targetm.insn_valid_within_doloop (insn)) 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; result = false;
goto cleanup; goto cleanup;
} }
} }
} }
result = true; result = true;
......
...@@ -137,8 +137,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -137,8 +137,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_HAVE_NAMED_SECTIONS false #define TARGET_HAVE_NAMED_SECTIONS false
#endif #endif
#ifndef TARGET_INSN_VALID_WITHIN_DOLOOP #ifndef TARGET_INVALID_WITHIN_DOLOOP
#define TARGET_INSN_VALID_WITHIN_DOLOOP default_insn_valid_within_doloop #define TARGET_INVALID_WITHIN_DOLOOP default_invalid_within_doloop
#endif #endif
#ifndef TARGET_HAVE_TLS #ifndef TARGET_HAVE_TLS
...@@ -564,7 +564,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -564,7 +564,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TARGET_DWARF_CALLING_CONVENTION, \ TARGET_DWARF_CALLING_CONVENTION, \
TARGET_DWARF_HANDLE_FRAME_UNSPEC, \ TARGET_DWARF_HANDLE_FRAME_UNSPEC, \
TARGET_STDARG_OPTIMIZE_HOOK, \ TARGET_STDARG_OPTIMIZE_HOOK, \
TARGET_INSN_VALID_WITHIN_DOLOOP, \ TARGET_INVALID_WITHIN_DOLOOP, \
TARGET_CALLS, \ TARGET_CALLS, \
TARGET_CXX, \ TARGET_CXX, \
TARGET_HAVE_NAMED_SECTIONS, \ TARGET_HAVE_NAMED_SECTIONS, \
......
...@@ -528,8 +528,9 @@ struct gcc_target ...@@ -528,8 +528,9 @@ struct gcc_target
to be checked for va_list references. */ to be checked for va_list references. */
bool (*stdarg_optimize_hook) (struct stdarg_info *ai, tree lhs, tree rhs); bool (*stdarg_optimize_hook) (struct stdarg_info *ai, tree lhs, tree rhs);
/* Returns true if target supports the insn within a doloop block. */ /* Returns NULL if target supports the insn within a doloop block,
bool (*insn_valid_within_doloop) (rtx); otherwise it returns an error message. */
const char * (*invalid_within_doloop) (rtx);
/* Functions relating to calls - argument passing, returns, etc. */ /* Functions relating to calls - argument passing, returns, etc. */
struct calls { struct calls {
......
...@@ -262,34 +262,28 @@ default_scalar_mode_supported_p (enum machine_mode mode) ...@@ -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 This function checks whether a given INSN is valid within a low-overhead
loop. A called function may clobber any special registers required for loop. If INSN is invalid it returns the reason for that, otherwise it
low-overhead looping. Additionally, some targets (eg, PPC) use the count 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 register for branch on table instructions. We reject the doloop pattern in
these cases. */ these cases. */
bool const char *
default_insn_valid_within_doloop (rtx insn) default_invalid_within_doloop (rtx insn)
{ {
if (CALL_P (insn)) if (CALL_P (insn))
{ return "Function call in loop.";
if (dump_file)
fprintf (dump_file, "Doloop: Function call in loop.\n");
return false;
}
if (JUMP_P (insn) if (JUMP_P (insn)
&& (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC && (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
|| GET_CODE (PATTERN (insn)) == ADDR_VEC)) || GET_CODE (PATTERN (insn)) == ADDR_VEC))
{ return "Computed branch in the loop.";
if (dump_file)
fprintf (dump_file, "Doloop: Computed branch in the loop.\n");
return false;
}
return true; return NULL;
} }
bool bool
......
...@@ -46,7 +46,7 @@ extern void default_unwind_emit (FILE *, rtx); ...@@ -46,7 +46,7 @@ extern void default_unwind_emit (FILE *, rtx);
extern bool default_scalar_mode_supported_p (enum machine_mode); 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 /* 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. */ hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment