constant of type @var{type}.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_INSTRUCTION_SELECTION (function *@var{fun}, gimple_stmt_iterator *@var{gsi})
+This hook allows a target to perform custom instruction selection for an
+instruction or sequence of instructions before expand to allow expansion to
+generate more efficient code.
+
+@var{fun} is the current function being considered and @var{gsi} is the
+iterator pointing to the current instruction being optimized. The default
+implementation does not do any rewriting and returns false. The result of
+the function should be whether any changes were made to the CFG or not. If a
+change was made then the @var{gsi} should be left at the same position as at
+the function start. The caller is allowed to change the CFG at any point
+before the current statement @var{gsi} is pointing to but not afterwards.
+@end deftypefn
+
@deftypefn {Target Hook} tree TARGET_GOACC_ADJUST_PRIVATE_DECL (location_t @var{loc}, tree @var{var}, int @var{level})
This hook, if defined, is used by accelerator target back-ends to adjust
OpenACC variable declarations that should be made private to the given
@hook TARGET_PREFERRED_ELSE_VALUE
+@hook TARGET_INSTRUCTION_SELECTION
+
@hook TARGET_GOACC_ADJUST_PRIVATE_DECL
@hook TARGET_GOACC_EXPAND_VAR_DECL
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ /* Give the target first try at replacing the instruction. */
+ cfg_changed |= targetm.instruction_selection (fun, &gsi);
+
/* Pre-expand VEC_COND_EXPRs to .VCOND* internal function
calls mapping to supported optabs. */
gimple *g = gimple_expand_vec_cond_expr (&gsi);
(unsigned ifn, tree type, unsigned nops, tree *ops),
default_preferred_else_value)
+DEFHOOK
+(instruction_selection,
+ "This hook allows a target to perform custom instruction selection for an\n\
+instruction or sequence of instructions before expand to allow expansion to\n\
+generate more efficient code.\n\
+\n\
+@var{fun} is the current function being considered and @var{gsi} is the\n\
+iterator pointing to the current instruction being optimized. The default\n\
+implementation does not do any rewriting and returns false. The result of\n\
+the function should be whether any changes were made to the CFG or not. If a\n\
+change was made then the @var{gsi} should be left at the same position as at\n\
+the function start. The caller is allowed to change the CFG at any point\n\
+before the current statement @var{gsi} is pointing to but not afterwards.",
+ bool,
+ (function *fun, gimple_stmt_iterator *gsi),
+ default_instruction_selection)
+
DEFHOOK
(record_offload_symbol,
"Used when offloaded functions are seen in the compilation unit and no named\n\
return build_zero_cst (type);
}
+/* The default implementation of TARGET_INSTRUCTION_SELECTION. */
+
+bool
+default_instruction_selection (function *, gimple_stmt_iterator *)
+{
+ return false;
+}
+
/* Default implementation of TARGET_HAVE_SPECULATION_SAFE_VALUE. */
bool
default_have_speculation_safe_value (bool active ATTRIBUTE_UNUSED)
extern HOST_WIDE_INT default_stack_clash_protection_alloca_probe_range (void);
extern void default_select_early_remat_modes (sbitmap);
extern tree default_preferred_else_value (unsigned, tree, unsigned, tree *);
-
+extern bool default_instruction_selection (function *, gimple_stmt_iterator *);
extern bool default_have_speculation_safe_value (bool);
extern bool speculation_safe_value_not_needed (bool);
extern rtx default_speculation_safe_value (machine_mode, rtx, rtx, rtx);