I've committed this to remove the GSI parameter from the existing openacc
tranform target hooks. It seems that the gimple way is to just pass a
statement, and the consumer creates its own iterator if needed. I'll address
the on_device and dim_pos transformers next.
nathan
2015-08-18 Nathan Sidwell <nat...@codesourcery.com>
* target.def (GOACC_FORK_JOIN, GOACC_LOCK_UNLOCK): Remove GSI
parameter.
* targhooks.h (default_goacc_fork_join,
default_goacc_lock_unlock): Lose GSI parameter.
* omp-low.c (execute_oacc_transform): Reformat to remove
indentation. Adjust target hook calls.
(default_goacc_fork_join, default_goacc_lock_unlock): Lose GSI
parameter.
* doc/tm.texi: Rebuilt.
* config/nvptx/nvptx.c (nvptx_xform_fork_join,
nvptx_xform_lock_unlock): Remove GSI parameter.
Index: gcc/config/nvptx/nvptx.c
===================================================================
--- gcc/config/nvptx/nvptx.c (revision 226958)
+++ gcc/config/nvptx/nvptx.c (working copy)
@@ -3587,8 +3587,8 @@ nvptx_dim_limit (unsigned axis)
/* Determine whether fork & joins are needed. */
static bool
-nvptx_xform_fork_join (gimple_stmt_iterator *ARG_UNUSED (gsi), gimple stmt,
- const int dims[], bool ARG_UNUSED (is_fork))
+nvptx_xform_fork_join (gimple stmt, const int dims[],
+ bool ARG_UNUSED (is_fork))
{
tree arg = gimple_call_arg (stmt, 0);
unsigned axis = TREE_INT_CST_LOW (arg);
@@ -3608,10 +3608,8 @@ nvptx_xform_fork_join (gimple_stmt_itera
*/
static bool
-nvptx_xform_lock_unlock (gimple_stmt_iterator *ARG_UNUSED (gsi),
- gimple stmt,
- const int *ARG_UNUSED (dims),
- bool ARG_UNUSED (is_fork))
+nvptx_xform_lock_unlock (gimple stmt, const int *ARG_UNUSED (dims),
+ bool ARG_UNUSED (is_lock))
{
tree arg = gimple_call_arg (stmt, 0);
Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi (revision 226958)
+++ gcc/doc/tm.texi (working copy)
@@ -5753,14 +5753,14 @@ This hook should return the maximum size
or zero if unbounded.
@end deftypefn
-@deftypefn {Target Hook} bool TARGET_GOACC_FORK_JOIN (gimple_stmt_iterator *@var{}, @var{gimple}, const @var{int[]}, @var{bool})
+@deftypefn {Target Hook} bool TARGET_GOACC_FORK_JOIN (gimple, const @var{int[]}, @var{bool})
This hook should convert IFN_GOACC_FORK and IFN_GOACC_JOIN function
calls to target-specific gimple. It is executed during the oacc_xform
pass. It should return true, if the functions should be deleted. The
default hook returns true, if there is no RTL expanders for them.
@end deftypefn
-@deftypefn {Target Hook} bool TARGET_GOACC_LOCK_UNLOCK (gimple_stmt_iterator *@var{}, @var{gimple}, const @var{int[]}, @var{bool})
+@deftypefn {Target Hook} bool TARGET_GOACC_LOCK_UNLOCK (gimple, const @var{int[]}, @var{bool})
This hook should convert IFN_GOACC_LOCK and IFN_GOACC_UNLOCK function
calls to target-specific gimple. It is executed during the oacc_xform
pass. It should return true, if the functions should be deleted. The
Index: gcc/omp-low.c
===================================================================
--- gcc/omp-low.c (revision 226958)
+++ gcc/omp-low.c (working copy)
@@ -14724,55 +14724,51 @@ execute_oacc_transform ()
}
FOR_ALL_BB_FN (bb, cfun)
- {
- for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
- {
- gimple stmt = gsi_stmt (gsi);
-
- if (is_gimple_call (stmt))
- {
- /* acc_on_device must be evaluated at compile time for
- constant arguments. */
- if (gimple_call_builtin_p (stmt, BUILT_IN_ACC_ON_DEVICE))
- oacc_xform_on_device (&gsi, stmt);
-
- if (gimple_call_internal_p (stmt))
- {
- unsigned ifn_code = gimple_call_internal_fn (stmt);
- switch (ifn_code)
- {
- default: break;
-
- case IFN_GOACC_DIM_POS:
- case IFN_GOACC_DIM_SIZE:
- oacc_xform_dim (&gsi, stmt, dims,
- ifn_code == IFN_GOACC_DIM_POS);
- break;
-
- case IFN_GOACC_LOCK:
- case IFN_GOACC_UNLOCK:
- if (targetm.goacc.lock_unlock
- (&gsi, stmt, dims, ifn_code == IFN_GOACC_LOCK))
- goto remove;
-
- case IFN_GOACC_FORK:
- case IFN_GOACC_JOIN:
- if (targetm.goacc.fork_join
- (&gsi, stmt, dims, ifn_code == IFN_GOACC_FORK))
- {
- remove:
- replace_uses_by (gimple_vdef (stmt),
- gimple_vuse (stmt));
- gsi_remove (&gsi, true);
- /* Removal will have advanced the iterator. */
- continue;
- }
- }
- }
- }
- gsi_next (&gsi);
- }
- }
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
+ {
+ gimple stmt = gsi_stmt (gsi);
+
+ if (!is_gimple_call (stmt))
+ ; /* Nothing. */
+ else if (gimple_call_builtin_p (stmt, BUILT_IN_ACC_ON_DEVICE))
+ /* acc_on_device must be evaluated at compile time for
+ constant arguments. */
+ oacc_xform_on_device (&gsi, stmt);
+ else if (gimple_call_internal_p (stmt))
+ {
+ unsigned ifn_code = gimple_call_internal_fn (stmt);
+ switch (ifn_code)
+ {
+ default: break;
+
+ case IFN_GOACC_DIM_POS:
+ case IFN_GOACC_DIM_SIZE:
+ oacc_xform_dim (&gsi, stmt, dims,
+ ifn_code == IFN_GOACC_DIM_POS);
+ break;
+
+ case IFN_GOACC_LOCK:
+ case IFN_GOACC_UNLOCK:
+ if (targetm.goacc.lock_unlock
+ (stmt, dims, ifn_code == IFN_GOACC_LOCK))
+ goto remove;
+
+ case IFN_GOACC_FORK:
+ case IFN_GOACC_JOIN:
+ if (targetm.goacc.fork_join
+ (stmt, dims, ifn_code == IFN_GOACC_FORK))
+ {
+ remove:
+ replace_uses_by (gimple_vdef (stmt),
+ gimple_vuse (stmt));
+ gsi_remove (&gsi, true);
+ /* Removal will have advanced the iterator. */
+ continue;
+ }
+ }
+ }
+ gsi_next (&gsi);
+ }
return 0;
}
@@ -14815,8 +14811,7 @@ default_goacc_dim_limit (unsigned ARG_UN
there is no RTL expander. */
bool
-default_goacc_fork_join (gimple_stmt_iterator *ARG_UNUSED (gsi),
- gimple ARG_UNUSED (stmt),
+default_goacc_fork_join (gimple ARG_UNUSED (stmt),
const int *ARG_UNUSED (dims), bool is_fork)
{
if (is_fork)
@@ -14839,8 +14834,7 @@ default_goacc_fork_join (gimple_stmt_ite
there is no RTL expander. */
bool
-default_goacc_lock_unlock (gimple_stmt_iterator *ARG_UNUSED (gsi),
- gimple ARG_UNUSED (stmt),
+default_goacc_lock_unlock (gimple ARG_UNUSED (stmt),
const int*ARG_UNUSED (dims),
bool is_lock)
{
Index: gcc/target.def
===================================================================
--- gcc/target.def (revision 226958)
+++ gcc/target.def (working copy)
@@ -1667,7 +1667,7 @@ DEFHOOK
calls to target-specific gimple. It is executed during the oacc_xform\n\
pass. It should return true, if the functions should be deleted. The\n\
default hook returns true, if there is no RTL expanders for them.",
-bool, (gimple_stmt_iterator *, gimple, const int[], bool),
+bool, (gimple, const int[], bool),
default_goacc_fork_join)
DEFHOOK
@@ -1676,7 +1676,7 @@ DEFHOOK
calls to target-specific gimple. It is executed during the oacc_xform\n\
pass. It should return true, if the functions should be deleted. The\n\
default hook returns true, if there is no RTL expanders for them.",
-bool, (gimple_stmt_iterator *, gimple, const int[], bool),
+bool, (gimple, const int[], bool),
default_goacc_lock_unlock)
HOOK_VECTOR_END (goacc)
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h (revision 226958)
+++ gcc/targhooks.h (working copy)
@@ -109,10 +109,8 @@ extern void default_destroy_cost_data (v
extern bool default_goacc_validate_dims (tree, int [], int);
extern unsigned default_goacc_dim_limit (unsigned);
-extern bool default_goacc_fork_join (gimple_stmt_iterator *, gimple,
- const int [], bool);
-extern bool default_goacc_lock_unlock (gimple_stmt_iterator *, gimple,
- const int [], bool);
+extern bool default_goacc_fork_join (gimple, const int [], bool);
+extern bool default_goacc_lock_unlock (gimple, const int [], bool);
/* 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. */