[Mid-end] Add TARGET_GIMPLE_FOLD_BUILTIN target hook.
gcc/ * coretypes.h (gimple_stmt_iterator_d): Forward declare. (gimple_stmt_iterator): New typedef. * gimple.h (gimple_stmt_iterator): Rename to... (gimple_stmt_iterator_d): ... This. * doc/tm.texi.in (TARGET_FOLD_BUILTIN): Detail restriction that trees be valid for GIMPLE and GENERIC. (TARGET_GIMPLE_FOLD_BUILTIN): New. * gimple-fold.c (gimple_fold_call): Call target hook gimple_fold_builtin. * hooks.c (hook_bool_gsiptr_false): New. * hooks.h (hook_bool_gsiptr_false): New. * target.def (fold_stmt): New. * doc/tm.texi: Regenerate. From-SVN: r198142
This commit is contained in:
parent
9191d7a84a
commit
ea679d553f
|
@ -1,3 +1,19 @@
|
|||
2013-04-22 James Greenhalgh <james.greenhalgh@arm.com>
|
||||
|
||||
* coretypes.h (gimple_stmt_iterator_d): Forward declare.
|
||||
(gimple_stmt_iterator): New typedef.
|
||||
* gimple.h (gimple_stmt_iterator): Rename to...
|
||||
(gimple_stmt_iterator_d): ... This.
|
||||
* doc/tm.texi.in (TARGET_FOLD_BUILTIN): Detail restriction that
|
||||
trees be valid for GIMPLE and GENERIC.
|
||||
(TARGET_GIMPLE_FOLD_BUILTIN): New.
|
||||
* gimple-fold.c (gimple_fold_call): Call target hook
|
||||
gimple_fold_builtin.
|
||||
* hooks.c (hook_bool_gsiptr_false): New.
|
||||
* hooks.h (hook_bool_gsiptr_false): New.
|
||||
* target.def (fold_stmt): New.
|
||||
* doc/tm.texi: Regenerate.
|
||||
|
||||
2013-04-22 Vladimir Makarov <vmakarov@redhat.com>
|
||||
|
||||
PR target/57018
|
||||
|
|
|
@ -62,6 +62,8 @@ union gimple_statement_d;
|
|||
typedef union gimple_statement_d *gimple;
|
||||
typedef const union gimple_statement_d *const_gimple;
|
||||
typedef gimple gimple_seq;
|
||||
struct gimple_stmt_iterator_d;
|
||||
typedef gimple_stmt_iterator_d gimple_stmt_iterator;
|
||||
union section;
|
||||
typedef union section section;
|
||||
struct gcc_options;
|
||||
|
|
|
@ -10931,8 +10931,16 @@ Fold a call to a machine specific built-in function that was set up by
|
|||
@samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the
|
||||
built-in function. @var{n_args} is the number of arguments passed to
|
||||
the function; the arguments themselves are pointed to by @var{argp}.
|
||||
The result is another tree containing a simplified expression for the
|
||||
call's result. If @var{ignore} is true the value will be ignored.
|
||||
The result is another tree, valid for both GIMPLE and GENERIC,
|
||||
containing a simplified expression for the call's result. If
|
||||
@var{ignore} is true the value will be ignored.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {Target Hook} bool TARGET_GIMPLE_FOLD_BUILTIN (gimple_stmt_iterator *@var{gsi})
|
||||
Fold a call to a machine specific built-in function that was set up
|
||||
by @samp{TARGET_INIT_BUILTINS}. @var{gsi} points to the gimple
|
||||
statement holding the function call. Returns true if any change
|
||||
was made to the GIMPLE stream.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {Target Hook} int TARGET_COMPARE_VERSION_PRIORITY (tree @var{decl1}, tree @var{decl2})
|
||||
|
|
|
@ -10775,10 +10775,13 @@ Fold a call to a machine specific built-in function that was set up by
|
|||
@samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the
|
||||
built-in function. @var{n_args} is the number of arguments passed to
|
||||
the function; the arguments themselves are pointed to by @var{argp}.
|
||||
The result is another tree containing a simplified expression for the
|
||||
call's result. If @var{ignore} is true the value will be ignored.
|
||||
The result is another tree, valid for both GIMPLE and GENERIC,
|
||||
containing a simplified expression for the call's result. If
|
||||
@var{ignore} is true the value will be ignored.
|
||||
@end deftypefn
|
||||
|
||||
@hook TARGET_GIMPLE_FOLD_BUILTIN
|
||||
|
||||
@hook TARGET_COMPARE_VERSION_PRIORITY
|
||||
This hook is used to compare the target attributes in two functions to
|
||||
determine which function's features get higher priority. This is used
|
||||
|
|
|
@ -1143,6 +1143,8 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
|
|||
gimplify_and_update_call_from_tree (gsi, result);
|
||||
changed = true;
|
||||
}
|
||||
else if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_MD)
|
||||
changed |= targetm.gimple_fold_builtin (gsi);
|
||||
}
|
||||
|
||||
return changed;
|
||||
|
|
|
@ -139,7 +139,7 @@ enum plf_mask {
|
|||
|
||||
/* Iterator object for GIMPLE statement sequences. */
|
||||
|
||||
typedef struct
|
||||
struct gimple_stmt_iterator_d
|
||||
{
|
||||
/* Sequence node holding the current statement. */
|
||||
gimple_seq_node ptr;
|
||||
|
@ -150,8 +150,7 @@ typedef struct
|
|||
block/sequence is removed. */
|
||||
gimple_seq *seq;
|
||||
basic_block bb;
|
||||
} gimple_stmt_iterator;
|
||||
|
||||
};
|
||||
|
||||
/* Data structure definitions for GIMPLE tuples. NOTE: word markers
|
||||
are for 64 bit hosts. */
|
||||
|
|
|
@ -147,6 +147,14 @@ hook_bool_FILEptr_rtx_false (FILE *a ATTRIBUTE_UNUSED,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Generic hook that takes (gimple_stmt_iterator *) and returns
|
||||
false. */
|
||||
bool
|
||||
hook_bool_gsiptr_false (gimple_stmt_iterator *a ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
|
||||
bool
|
||||
hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree a ATTRIBUTE_UNUSED,
|
||||
|
|
|
@ -42,6 +42,7 @@ extern bool hook_bool_tree_false (tree);
|
|||
extern bool hook_bool_const_tree_false (const_tree);
|
||||
extern bool hook_bool_tree_true (tree);
|
||||
extern bool hook_bool_const_tree_true (const_tree);
|
||||
extern bool hook_bool_gsiptr_false (gimple_stmt_iterator *);
|
||||
extern bool hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree,
|
||||
HOST_WIDE_INT,
|
||||
HOST_WIDE_INT,
|
||||
|
|
|
@ -1289,13 +1289,24 @@ DEFHOOK
|
|||
"",
|
||||
tree, (unsigned int /*location_t*/ loc, tree fndecl, void *arglist), NULL)
|
||||
|
||||
/* Fold a target-specific builtin. */
|
||||
/* Fold a target-specific builtin to a tree valid for both GIMPLE
|
||||
and GENERIC. */
|
||||
DEFHOOK
|
||||
(fold_builtin,
|
||||
"",
|
||||
tree, (tree fndecl, int n_args, tree *argp, bool ignore),
|
||||
hook_tree_tree_int_treep_bool_null)
|
||||
|
||||
/* Fold a target-specific builtin to a valid GIMPLE tree. */
|
||||
DEFHOOK
|
||||
(gimple_fold_builtin,
|
||||
"Fold a call to a machine specific built-in function that was set up\n\
|
||||
by @samp{TARGET_INIT_BUILTINS}. @var{gsi} points to the gimple\n\
|
||||
statement holding the function call. Returns true if any change\n\
|
||||
was made to the GIMPLE stream.",
|
||||
bool, (gimple_stmt_iterator *gsi),
|
||||
hook_bool_gsiptr_false)
|
||||
|
||||
/* Target hook is used to compare the target attributes in two functions to
|
||||
determine which function's features get higher priority. This is used
|
||||
during function multi-versioning to figure out the order in which two
|
||||
|
|
Loading…
Reference in New Issue