aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-grid.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2018-06-26 13:34:59 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2018-06-26 13:34:59 +0000
commit4f5b9c803ac4edc639d8bf4a827ba40e4dab4db0 (patch)
treeda6d4a4811016c1d51edbe927f601eb11d9c3835 /gcc/omp-grid.c
parent3da2f26ca45060ddd8514010090353a2adec334a (diff)
downloadgcc-4f5b9c803ac4edc639d8bf4a827ba40e4dab4db0.zip
gcc-4f5b9c803ac4edc639d8bf4a827ba40e4dab4db0.tar.gz
gcc-4f5b9c803ac4edc639d8bf4a827ba40e4dab4db0.tar.bz2
Introduce dump_location_t
gcc/ChangeLog: * cfgloop.c (get_loop_location): Convert return type from location_t to dump_user_location_t, replacing INSN_LOCATION lookups by implicit construction from rtx_insn *, and using dump_user_location_t::from_function_decl for the fallback case. * cfgloop.h (get_loop_location): Convert return type from location_t to dump_user_location_t. * cgraphunit.c (walk_polymorphic_call_targets): Update call to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. * coverage.c (get_coverage_counts): Update calls to dump_printf_loc to pass in dump_location_t rather than a location_t. * doc/optinfo.texi (Dump types): Convert example of dump_printf_loc from taking "locus" to taking "insn". Update description of the "_loc" calls to cover dump_location_t. * dumpfile.c: Include "backend.h", "gimple.h", "rtl.h", and "selftest.h". (dump_user_location_t::dump_user_location_t): New constructors, from gimple *stmt and rtx_insn *. (dump_user_location_t::from_function_decl): New function. (dump_loc): Make static. (dump_gimple_stmt_loc): Convert param "loc" from location_t to const dump_location_t &. (dump_generic_expr_loc): Delete. (dump_printf_loc): Convert param "loc" from location_t to const dump_location_t &. (selftest::test_impl_location): New function. (selftest::dumpfile_c_tests): New function. * dumpfile.h: Include "profile-count.h". (class dump_user_location_t): New class. (struct dump_impl_location_t): New struct. (class dump_location_t): New class. (dump_printf_loc): Convert 2nd param from source_location to const dump_location_t &. (dump_generic_expr_loc): Delete. (dump_gimple_stmt_loc): Convert 2nd param from source_location to const dump_location_t &. * gimple-fold.c (fold_gimple_assign): Update call to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. (gimple_fold_call): Likewise. * gimple-loop-interchange.cc (loop_cand::analyze_iloop_reduction_var): Update for change to check_reduction_path. (tree_loop_interchange::interchange): Update for change to find_loop_location. * graphite-isl-ast-to-gimple.c (scop_to_isl_ast): Update for change in return-type of find_loop_location. (graphite_regenerate_ast_isl): Likewise. * graphite-optimize-isl.c (optimize_isl): Likewise. * graphite.c (graphite_transform_loops): Likewise. * ipa-devirt.c (ipa_devirt): Update call to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise. * ipa.c (walk_polymorphic_call_targets): Likewise. * loop-unroll.c (report_unroll): Convert "locus" param from location_t to dump_location_t. (decide_unrolling): Update for change to get_loop_location's return type. * omp-grid.c (struct grid_prop): Convert field "target_loc" from location_t to dump_user_location_t. (grid_find_single_omp_among_assignments_1): Updates calls to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. (grid_parallel_clauses_gridifiable): Convert "tloc" from location_t to dump_location_t. Updates calls to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. (grid_inner_loop_gridifiable_p): Likewise. (grid_dist_follows_simple_pattern): Likewise. (grid_gfor_follows_tiling_pattern): Likewise. (grid_target_follows_gridifiable_pattern): Likewise. (grid_attempt_target_gridification): Convert initialization of local "grid" from memset to zero-initialization; FIXME: does this require C++11? Update call to dump_printf_loc to pass in a optinfo_location rather than a location_t, via the gimple stmt. * profile.c (read_profile_edge_counts): Updates call to dump_printf_loc to pass in a dump_location_t rather than a location_t (compute_branch_probabilities): Likewise. * selftest-run-tests.c (selftest::run_tests): Call dumpfile_c_tests. * selftest.h (dumpfile_c_tests): New decl. * tree-loop-distribution.c (pass_loop_distribution::execute): Update for change in return type of find_loop_location. * tree-parloops.c (parallelize_loops): Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Convert "locus" from location_t to dump_user_location_t. (canonicalize_loop_induction_variables): Likewise. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_loop): Update for change in return type of find_loop_location. * tree-ssa-loop-niter.c (number_of_iterations_exit): Update call to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the stmt. * tree-ssa-sccvn.c (eliminate_dom_walker::before_dom_children): Likewise. * tree-vect-loop-manip.c (find_loop_location): Convert return type from source_location to dump_user_location_t. (vect_do_peeling): Update for above change. (vect_loop_versioning): Update for change in type of vect_location. * tree-vect-loop.c (check_reduction_path): Convert "loc" param from location_t to dump_user_location_t. (vect_estimate_min_profitable_iters): Update for change in type of vect_location. * tree-vect-slp.c (vect_print_slp_tree): Convert param "loc" from location_t to dump_location_t. (vect_slp_bb): Update for change in type of vect_location. * tree-vectorizer.c (vect_location): Convert from source_location to dump_user_location_t. (try_vectorize_loop_1): Update for change in vect_location's type. (vectorize_loops): Likewise. (increase_alignment): Likewise. * tree-vectorizer.h (vect_location): Convert from source_location to dump_user_location_t. (find_loop_location): Convert return type from source_location to dump_user_location_t. (check_reduction_path): Convert 1st param from location_t to dump_user_location_t. * value-prof.c (check_counter): Update call to dump_printf_loc to pass in a dump_user_location_t rather than a location_t; update call to error_at for change in type of "locus". (check_ic_target): Update call to dump_printf_loc to pass in a dump_user_location_t rather than a location_t, via the call_stmt. From-SVN: r262149
Diffstat (limited to 'gcc/omp-grid.c')
-rw-r--r--gcc/omp-grid.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/gcc/omp-grid.c b/gcc/omp-grid.c
index ffa301e..6edc92f 100644
--- a/gcc/omp-grid.c
+++ b/gcc/omp-grid.c
@@ -91,7 +91,7 @@ struct grid_prop
bool tiling;
/* Location of the target construct for optimization information
messages. */
- location_t target_loc;
+ dump_user_location_t target_loc;
/* The collapse clause of the involved loops. Collapse value of all of them
must be the same for gridification to take place. */
size_t collapse;
@@ -177,10 +177,10 @@ grid_find_single_omp_among_assignments_1 (gimple_seq seq, grid_prop *grid,
GRID_MISSED_MSG_PREFIX "%s construct "
"contains multiple OpenMP constructs\n",
name);
- dump_printf_loc (MSG_NOTE, gimple_location (*ret),
+ dump_printf_loc (MSG_NOTE, *ret,
"The first OpenMP construct within "
"a parallel\n");
- dump_printf_loc (MSG_NOTE, gimple_location (stmt),
+ dump_printf_loc (MSG_NOTE, stmt,
"The second OpenMP construct within "
"a parallel\n");
}
@@ -195,7 +195,7 @@ grid_find_single_omp_among_assignments_1 (gimple_seq seq, grid_prop *grid,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "%s construct contains "
"a complex statement\n", name);
- dump_printf_loc (MSG_NOTE, gimple_location (stmt),
+ dump_printf_loc (MSG_NOTE, stmt,
"This statement cannot be analyzed for "
"gridification\n");
}
@@ -286,7 +286,7 @@ grid_find_ungridifiable_statement (gimple_stmt_iterator *gsi,
loop that is evaluated for possible gridification. */
static bool
-grid_parallel_clauses_gridifiable (gomp_parallel *par, location_t tloc)
+grid_parallel_clauses_gridifiable (gomp_parallel *par, dump_user_location_t tloc)
{
tree clauses = gimple_omp_parallel_clauses (par);
while (clauses)
@@ -300,7 +300,7 @@ grid_parallel_clauses_gridifiable (gomp_parallel *par, location_t tloc)
GRID_MISSED_MSG_PREFIX "because there is "
"a num_threads clause of the parallel "
"construct\n");
- dump_printf_loc (MSG_NOTE, gimple_location (par),
+ dump_printf_loc (MSG_NOTE, par,
"Parallel construct has a num_threads clause\n");
}
return false;
@@ -311,7 +311,7 @@ grid_parallel_clauses_gridifiable (gomp_parallel *par, location_t tloc)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc,
GRID_MISSED_MSG_PREFIX "a reduction clause "
"is present\n ");
- dump_printf_loc (MSG_NOTE, gimple_location (par),
+ dump_printf_loc (MSG_NOTE, par,
"Parallel construct has a reduction clause\n");
}
return false;
@@ -341,7 +341,7 @@ grid_inner_loop_gridifiable_p (gomp_for *gfor, grid_prop *grid)
GRID_MISSED_MSG_PREFIX "the inner loop "
"loop bounds computation contains a complex "
"statement\n");
- dump_printf_loc (MSG_NOTE, gimple_location (gfor),
+ dump_printf_loc (MSG_NOTE, gfor,
"Loop construct cannot be analyzed for "
"gridification\n");
}
@@ -361,7 +361,7 @@ grid_inner_loop_gridifiable_p (gomp_for *gfor, grid_prop *grid)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "the inner loop "
"has a non-automatic schedule clause\n");
- dump_printf_loc (MSG_NOTE, gimple_location (gfor),
+ dump_printf_loc (MSG_NOTE, gfor,
"Loop construct has a non automatic "
"schedule clause\n");
}
@@ -375,7 +375,7 @@ grid_inner_loop_gridifiable_p (gomp_for *gfor, grid_prop *grid)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "a reduction "
"clause is present\n ");
- dump_printf_loc (MSG_NOTE, gimple_location (gfor),
+ dump_printf_loc (MSG_NOTE, gfor,
"Loop construct has a reduction schedule "
"clause\n");
}
@@ -404,7 +404,7 @@ grid_inner_loop_gridifiable_p (gomp_for *gfor, grid_prop *grid)
GRID_MISSED_MSG_PREFIX "the inner loop contains "
"statement %s which cannot be transformed\n",
gimple_code_name[(int) gimple_code (bad)]);
- dump_printf_loc (MSG_NOTE, gimple_location (bad),
+ dump_printf_loc (MSG_NOTE, bad,
"This statement cannot be analyzed for "
"gridification\n");
}
@@ -422,7 +422,7 @@ grid_inner_loop_gridifiable_p (gomp_for *gfor, grid_prop *grid)
static bool
grid_dist_follows_simple_pattern (gomp_for *dist, grid_prop *grid)
{
- location_t tloc = grid->target_loc;
+ dump_user_location_t tloc = grid->target_loc;
gimple *stmt = grid_find_single_omp_among_assignments (gimple_omp_body (dist),
grid, "distribute");
gomp_parallel *par;
@@ -468,7 +468,7 @@ grid_gfor_follows_tiling_pattern (gomp_for *gfor, grid_prop *grid)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "an inner loop is not "
"a simple for loop\n");
- dump_printf_loc (MSG_NOTE, gimple_location (gfor),
+ dump_printf_loc (MSG_NOTE, gfor,
"This statement is not a simple for loop\n");
}
return false;
@@ -484,7 +484,7 @@ grid_gfor_follows_tiling_pattern (gomp_for *gfor, grid_prop *grid)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "an inner loop does not "
"have use the same collapse clause\n");
- dump_printf_loc (MSG_NOTE, gimple_location (gfor),
+ dump_printf_loc (MSG_NOTE, gfor,
"Loop construct uses a different collapse clause\n");
}
return false;
@@ -524,7 +524,7 @@ grid_gfor_follows_tiling_pattern (gomp_for *gfor, grid_prop *grid)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "the distribute and "
"an internal loop do not agree on tile size\n");
- dump_printf_loc (MSG_NOTE, gimple_location (gfor),
+ dump_printf_loc (MSG_NOTE, gfor,
"Loop construct does not seem to loop over "
"a tile size\n");
}
@@ -636,7 +636,7 @@ grid_dist_follows_tiling_pattern (gimple_seq seq, grid_prop *grid,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "the distribute "
"construct contains a try..catch region\n");
- dump_printf_loc (MSG_NOTE, gimple_location (try_stmt),
+ dump_printf_loc (MSG_NOTE, try_stmt,
"This statement cannot be analyzed for "
"tiled gridification\n");
}
@@ -661,7 +661,7 @@ grid_dist_follows_tiling_pattern (gimple_seq seq, grid_prop *grid,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "the distribute "
"construct contains a call\n");
- dump_printf_loc (MSG_NOTE, gimple_location (stmt),
+ dump_printf_loc (MSG_NOTE, stmt,
"This statement cannot be analyzed for "
"tiled gridification\n");
}
@@ -677,7 +677,7 @@ grid_dist_follows_tiling_pattern (gimple_seq seq, grid_prop *grid,
GRID_MISSED_MSG_PREFIX "a parallel "
"construct contains another parallel "
"construct\n");
- dump_printf_loc (MSG_NOTE, gimple_location (stmt),
+ dump_printf_loc (MSG_NOTE, stmt,
"This parallel construct is nested in "
"another one\n");
}
@@ -698,7 +698,7 @@ grid_dist_follows_tiling_pattern (gimple_seq seq, grid_prop *grid,
GRID_MISSED_MSG_PREFIX "a loop "
"construct is not nested within a parallel "
"construct\n");
- dump_printf_loc (MSG_NOTE, gimple_location (stmt),
+ dump_printf_loc (MSG_NOTE, stmt,
"This loop construct is not nested in "
"a parallel construct\n");
}
@@ -714,7 +714,7 @@ grid_dist_follows_tiling_pattern (gimple_seq seq, grid_prop *grid,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
GRID_MISSED_MSG_PREFIX "the distribute "
"construct contains a complex statement\n");
- dump_printf_loc (MSG_NOTE, gimple_location (stmt),
+ dump_printf_loc (MSG_NOTE, stmt,
"This statement cannot be analyzed for "
"tiled gridification\n");
}
@@ -734,7 +734,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, grid_prop *grid)
if (gimple_omp_target_kind (target) != GF_OMP_TARGET_KIND_REGION)
return false;
- location_t tloc = gimple_location (target);
+ dump_user_location_t tloc = target;
grid->target_loc = tloc;
gimple *stmt
= grid_find_single_omp_among_assignments (gimple_omp_body (target),
@@ -1257,14 +1257,13 @@ grid_attempt_target_gridification (gomp_target *target,
gbind *tgt_bind)
{
/* removed group_size */
- grid_prop grid;
- memset (&grid, 0, sizeof (grid));
+ grid_prop grid = {};
if (!target || !grid_target_follows_gridifiable_pattern (target, &grid))
return;
location_t loc = gimple_location (target);
if (dump_enabled_p ())
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, target,
"Target construct will be turned into a gridified HSA "
"kernel\n");