Split omp-low into multiple files

2016-12-14  Martin Jambor  <mjambor@suse.cz>

	* omp-general.h: New file.
	* omp-general.c: New file.
	* omp-expand.h: Likewise.
	* omp-expand.c: Likewise.
	* omp-offload.h: Likewise.
	* omp-offload.c: Likewise.
	* omp-grid.c: Likewise.
	* omp-grid.c: Likewise.
	* omp-low.h: Include omp-general.h and omp-grid.h.  Removed includes
	of params.h, symbol-summary.h, lto-section-names.h, cilk.h, tree-eh.h,
	ipa-prop.h, tree-cfgcleanup.h, cfgloop.h, except.h, expr.h, stmt.h,
	varasm.h, calls.h, explow.h, dojump.h, flags.h, tree-into-ssa.h,
	tree-cfg.h, cfganal.h, alias.h, emit-rtl.h, optabs.h, expmed.h,
	alloc-pool.h, cfghooks.h, rtl.h and memmodel.h.
	(omp_find_combined_for): Declare.
	(find_omp_clause): Renamed to omp_find_clause and moved to
	omp-general.h.
	(free_omp_regions): Renamed to omp_free_regions and moved to
	omp-expand.h.
	(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
	to omp-general.h.
	(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
	omp-general.h.
	(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
	moved to omp-general.h.
	(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
	omp-general.h.
	(oacc_fn_attrib_kernels_p): Moved to omp-general.h.
	(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
	omp-general.c.
	(omp_expand_local): Moved to omp-expand.h.
	(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
	omp-expand.h.
	(omp_finish_file): Moved to omp-offload.h.
	(default_goacc_validate_dims): Renamed to
	oacc_default_goacc_validate_dims and moved to omp-offload.h.
	(offload_funcs, offload_vars): Moved to omp-offload.h.
	* omp-low.c: Include omp-general.h, omp-offload.h and omp-grid.h.
	(omp_region): Moved to omp-expand.c.
	(omp_for_data_loop): Moved to omp-general.h.
	(omp_for_data): Likewise.
	(oacc_loop): Moved to omp-offload.c.
	(oacc_loop_flags): Moved to omp-general.h.
	(offload_funcs, offload_vars): Moved to omp-offload.c.
	(root_omp_region): Moved to omp-expand.c.
	(omp_any_child_fn_dumped): Likewise.
	(find_omp_clause): Renamed to omp_find_clause and moved to
	omp-general.c.
	(is_combined_parallel): Moved to omp-expand.c.
	(is_reference): Renamed to omp_is_reference and and moved to
	omp-general.c.
	(adjust_for_condition): Renamed to omp_adjust_for_condition and moved
	to omp-general.c.
	(get_omp_for_step_from_incr): Renamed to omp_get_for_step_from_incr
	and moved to omp-general.c.
	(extract_omp_for_data): Renamed to omp_extract_for_data and moved to
	omp-general.c.
	(workshare_safe_to_combine_p): Moved to omp-expand.c.
	(omp_adjust_chunk_size): Likewise.
	(get_ws_args_for): Likewise.
	(get_base_type): Removed.
	(dump_omp_region): Moved to omp-expand.c.
	(debug_omp_region): Likewise.
	(debug_all_omp_regions): Likewise.
	(new_omp_region): Likewise.
	(free_omp_region_1): Likewise.
	(free_omp_regions): Renamed to omp_free_regions and moved to
	omp-expand.c.
	(find_combined_for): Renamed to omp_find_combined_for, made global.
	(build_omp_barrier): Renamed to omp_build_barrier and moved to
	omp-general.c.
	(omp_max_vf): Moved to omp-general.c.
	(omp_max_simt_vf): Likewise.
	(gimple_build_cond_empty): Moved to omp-expand.c.
	(parallel_needs_hsa_kernel_p): Likewise.
	(expand_omp_build_assign): Moved declaration to omp-expand.c.
	(expand_parallel_call): Moved to omp-expand.c.
	(expand_cilk_for_call): Likewise.
	(expand_task_call): Likewise.
	(vec2chain): Likewise.
	(remove_exit_barrier): Likewise.
	(remove_exit_barriers): Likewise.
	(optimize_omp_library_calls): Likewise.
	(expand_omp_regimplify_p): Likewise.
	(expand_omp_build_assign): Likewise.
	(expand_omp_taskreg): Likewise.
	(oacc_collapse): Likewise.
	(expand_oacc_collapse_init): Likewise.
	(expand_oacc_collapse_vars): Likewise.
	(expand_omp_for_init_counts): Likewise.
	(expand_omp_for_init_vars): Likewise.
	(extract_omp_for_update_vars): Likewise.
	(expand_omp_ordered_source): Likewise.
	(expand_omp_ordered_sink): Likewise.
	(expand_omp_ordered_source_sink): Likewise.
	(expand_omp_for_ordered_loops): Likewise.
	(expand_omp_for_generic): Likewise.
	(expand_omp_for_static_nochunk): Likewise.
	(find_phi_with_arg_on_edge): Likewise.
	(expand_omp_for_static_chunk): Likewise.
	(expand_cilk_for): Likewise.
	(expand_omp_simd): Likewise.
	(expand_omp_taskloop_for_outer): Likewise.
	(expand_omp_taskloop_for_inner): Likewise.
	(expand_oacc_for): Likewise.
	(expand_omp_for): Likewise.
	(expand_omp_sections): Likewise.
	(expand_omp_single): Likewise.
	(expand_omp_synch): Likewise.
	(expand_omp_atomic_load): Likewise.
	(expand_omp_atomic_store): Likewise.
	(expand_omp_atomic_fetch_op): Likewise.
	(expand_omp_atomic_pipeline): Likewise.
	(expand_omp_atomic_mutex): Likewise.
	(expand_omp_atomic): Likewise.
	(oacc_launch_pack): and moved to omp-general.c, made public.
	(OACC_FN_ATTRIB): Likewise.
	(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
	to omp-general.c.
	(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
	omp-general.c.
	(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
	moved to omp-general.c.
	(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
	omp-general.c.
	(oacc_fn_attrib_kernels_p): Moved to omp-general.c.
	(oacc_fn_attrib_level): Moved to omp-offload.c.
	(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
	omp-general.c.
	(get_oacc_ifn_dim_arg): Renamed to oacc_get_ifn_dim_arg and moved to
	omp-general.c.
	(mark_loops_in_oacc_kernels_region): Moved to omp-expand.c.
	(grid_launch_attributes_trees): Likewise.
	(grid_attr_trees): Likewise.
	(grid_create_kernel_launch_attr_types): Likewise.
	(grid_insert_store_range_dim): Likewise.
	(grid_get_kernel_launch_attributes): Likewise.
	(get_target_argument_identifier_1): Likewise.
	(get_target_argument_identifier): Likewise.
	(get_target_argument_value): Likewise.
	(push_target_argument_according_to_value): Likewise.
	(get_target_arguments): Likewise.
	(expand_omp_target): Likewise.
	(grid_expand_omp_for_loop): Moved to omp-grid.c.
	(grid_arg_decl_map): Likewise.
	(grid_remap_kernel_arg_accesses): Likewise.
	(grid_expand_target_grid_body): Likewise.
	(expand_omp): Renamed to omp_expand and moved to omp-expand.c.
	(build_omp_regions_1): Moved to omp-expand.c.
	(build_omp_regions_root): Likewise.
	(omp_expand_local): Likewise.
	(build_omp_regions): Likewise.
	(execute_expand_omp): Likewise.
	(pass_data_expand_omp): Likewise.
	(pass_expand_omp): Likewise.
	(make_pass_expand_omp): Likewise.
	(pass_data_expand_omp_ssa): Likewise.
	(pass_expand_omp_ssa): Likewise.
	(make_pass_expand_omp_ssa): Likewise.
	(grid_lastprivate_predicate): Renamed to
	omp_grid_lastprivate_predicate and moved to omp-grid.c, made public.
	(grid_prop): Moved to omp-grid.c.
	(GRID_MISSED_MSG_PREFIX): Likewise.
	(grid_safe_assignment_p): Likewise.
	(grid_seq_only_contains_local_assignments): Likewise.
	(grid_find_single_omp_among_assignments_1): Likewise.
	(grid_find_single_omp_among_assignments): Likewise.
	(grid_find_ungridifiable_statement): Likewise.
	(grid_parallel_clauses_gridifiable): Likewise.
	(grid_inner_loop_gridifiable_p): Likewise.
	(grid_dist_follows_simple_pattern): Likewise.
	(grid_gfor_follows_tiling_pattern): Likewise.
	(grid_call_permissible_in_distribute_p): Likewise.
	(grid_handle_call_in_distribute): Likewise.
	(grid_dist_follows_tiling_pattern): Likewise.
	(grid_target_follows_gridifiable_pattern): Likewise.
	(grid_remap_prebody_decls): Likewise.
	(grid_var_segment): Likewise.
	(grid_mark_variable_segment): Likewise.
	(grid_copy_leading_local_assignments): Likewise.
	(grid_process_grid_body): Likewise.
	(grid_eliminate_combined_simd_part): Likewise.
	(grid_mark_tiling_loops): Likewise.
	(grid_mark_tiling_parallels_and_loops): Likewise.
	(grid_process_kernel_body_copy): Likewise.
	(grid_attempt_target_gridification): Likewise.
	(grid_gridify_all_targets_stmt): Likewise.
	(grid_gridify_all_targets): Renamed to omp_grid_gridify_all_targets
	and moved to omp-grid.c, made public.
	(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
	omp-expand.c.
	(add_decls_addresses_to_decl_constructor): Moved to omp-offload.c.
	(omp_finish_file): Likewise.
	(oacc_thread_numbers): Likewise.
	(oacc_xform_loop): Likewise.
	(oacc_default_dims, oacc_min_dims): Likewise.
	(oacc_parse_default_dims): Likewise.
	(oacc_validate_dims): Likewise.
	(new_oacc_loop_raw): Likewise.
	(new_oacc_loop_outer): Likewise.
	(new_oacc_loop): Likewise.
	(new_oacc_loop_routine): Likewise.
	(finish_oacc_loop): Likewise.
	(free_oacc_loop): Likewise.
	(dump_oacc_loop_part): Likewise.
	(dump_oacc_loop): Likewise.
	(debug_oacc_loop): Likewise.
	(oacc_loop_discover_walk): Likewise.
	(oacc_loop_sibling_nreverse): Likewise.
	(oacc_loop_discovery): Likewise.
	(oacc_loop_xform_head_tail): Likewise.
	(oacc_loop_xform_loop): Likewise.
	(oacc_loop_process): Likewise.
	(oacc_loop_fixed_partitions): Likewise.
	(oacc_loop_auto_partitions): Likewise.
	(oacc_loop_partition): Likewise.
	(default_goacc_fork_join): Likewise.
	(default_goacc_reduction): Likewise.
	(execute_oacc_device_lower): Likewise.
	(default_goacc_validate_dims): Likewise.
	(default_goacc_dim_limit): Likewise.
	(pass_data_oacc_device_lower): Likewise.
	(pass_oacc_device_lower): Likewise.
	(make_pass_oacc_device_lower): Likewise.
	(execute_omp_device_lower): Likewise.
	(pass_data_omp_device_lower): Likewise.
	(pass_omp_device_lower): Likewise.
	(make_pass_omp_device_lower): Likewise.
	(pass_data_omp_target_link): Likewise.
	(pass_omp_target_link): Likewise.
	(find_link_var_op): Likewise.
	(pass_omp_target_link::execute): Likewise.
	(make_pass_omp_target_link): Likewise.

	* Makefile.in (OBJS): Added omp-offload.o, omp-expand.o, omp-general.o
	and omp-grid.o.
	(GTFILES): Added omp-offload.h, omp-offload.c and omp-expand.c, removed
	omp-low.h.
	* gimple-fold.c: Include omp-general.h instead of omp-low.h.
	(fold_internal_goacc_dim): Adjusted calls to
	get_oacc_ifn_dim_arg and get_oacc_fn_dim_size to use their new names.
	* gimplify.c: Include omp-low.h.
	(omp_notice_variable): Adjust the call to get_oacc_fn_attrib to use
	its new name.
	(gimplify_omp_task): Adjusted calls to find_omp_clause to use its new
	name.
	(gimplify_omp_for): Likewise.
	* lto-cgraph.c: Include omp-offload.h instead of omp-low.h.
	* toplev.c: Include omp-offload.h instead of omp-low.h.
	* tree-cfg.c: Include omp-general.h instead of omp-low.h.  Also
	include omp-expand.h.
	(make_edges_bb): Adjusted the call to make_gimple_omp_edges to use its
	new name.
	(make_edges): Adjust the call to free_omp_regions to use its new name.
	* tree-parloops.c: Include omp-general.h.
	(create_parallel_loop): Adjusted the call to set_oacc_fn_attrib to use
	its new name.
	(parallelize_loops): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	* tree-ssa-loop.c: Include omp-general.h instead of omp-low.h.
	(gate_oacc_kernels): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	* tree-vrp.c: Include omp-general.h instead of omp-low.h.
	(extract_range_basic): Adjusted calls to get_oacc_ifn_dim_arg and
	get_oacc_fn_dim_size to use their new names.
	* varpool.c: Include omp-offload.h instead of omp-low.h.
	* gengtype.c (open_base_files): Replace omp-low.h with omp-offload.h in
	ifiles.
	* config/nvptx/nvptx.c: Include omp-general.c.
	(nvptx_expand_call): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	(nvptx_reorg): Likewise.
	(nvptx_record_offload_symbol): Likewise.

gcc/c-family:
	* c-omp.c: Include omp-general.h instead of omp-low.h.
	(c_finish_oacc_wait): Adjusted call to find_omp_clause to use its new
	name.

gcc/c/
	* c-parser.c: Include omp-general.h and omp-offload.h instead of
	omp-low.h.
	(c_finish_oacc_routine): Adjusted call to
	get_oacc_fn_attrib, build_oacc_routine_dims and replace_oacc_fn_attrib
	to use their new names.
	(c_parser_oacc_enter_exit_data): Adjusted call to find_omp_clause to
	use its new name.
	(c_parser_oacc_update): Likewise.
	(c_parser_omp_simd): Likewise.
	(c_parser_omp_target_update): Likewise.
	* c-typeck.c: Include omp-general.h instead of omp-low.h.
	(c_finish_omp_cancel): Adjusted call to find_omp_clause to use its new
	name.
	(c_finish_omp_cancellation_point): Likewise.
	* gimple-parser.c: Do not include omp-low.h

gcc/cp/
	* parser.c: Include omp-general.h and omp-offload.h instead of
	omp-low.h.
	(cp_parser_omp_simd): Adjusted calls to find_omp_clause to use its new
	name.
	(cp_parser_omp_target_update): Likewise.
	(cp_parser_oacc_declare): Likewise.
	(cp_parser_oacc_enter_exit_data): Likewise.
	(cp_parser_oacc_update): Likewise.
	(cp_finalize_oacc_routine): Adjusted call to get_oacc_fn_attrib,
	build_oacc_routine_dims and replace_oacc_fn_attrib to use their new
	names.
	* semantics.c: Include omp-general insteda of omp-low.h.
	(finish_omp_for): Adjusted calls to find_omp_clause to use its new
	name.
	(finish_omp_cancel): Likewise.
	(finish_omp_cancellation_point): Likewise.

fortran/
	* trans-openmp.c: Include omp-general.h.

From-SVN: r243673
This commit is contained in:
Martin Jambor 2016-12-14 23:30:41 +01:00 committed by Martin Jambor
parent cfce1a4a42
commit 629b3d75c8
34 changed files with 12661 additions and 12079 deletions

View File

@ -1,3 +1,278 @@
2016-12-14 Martin Jambor <mjambor@suse.cz>
* omp-general.h: New file.
* omp-general.c: New file.
* omp-expand.h: Likewise.
* omp-expand.c: Likewise.
* omp-offload.h: Likewise.
* omp-offload.c: Likewise.
* omp-grid.c: Likewise.
* omp-grid.c: Likewise.
* omp-low.h: Include omp-general.h and omp-grid.h. Removed includes
of params.h, symbol-summary.h, lto-section-names.h, cilk.h, tree-eh.h,
ipa-prop.h, tree-cfgcleanup.h, cfgloop.h, except.h, expr.h, stmt.h,
varasm.h, calls.h, explow.h, dojump.h, flags.h, tree-into-ssa.h,
tree-cfg.h, cfganal.h, alias.h, emit-rtl.h, optabs.h, expmed.h,
alloc-pool.h, cfghooks.h, rtl.h and memmodel.h.
(omp_find_combined_for): Declare.
(find_omp_clause): Renamed to omp_find_clause and moved to
omp-general.h.
(free_omp_regions): Renamed to omp_free_regions and moved to
omp-expand.h.
(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
to omp-general.h.
(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
omp-general.h.
(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
moved to omp-general.h.
(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
omp-general.h.
(oacc_fn_attrib_kernels_p): Moved to omp-general.h.
(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
omp-general.c.
(omp_expand_local): Moved to omp-expand.h.
(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
omp-expand.h.
(omp_finish_file): Moved to omp-offload.h.
(default_goacc_validate_dims): Renamed to
oacc_default_goacc_validate_dims and moved to omp-offload.h.
(offload_funcs, offload_vars): Moved to omp-offload.h.
* omp-low.c: Include omp-general.h, omp-offload.h and omp-grid.h.
(omp_region): Moved to omp-expand.c.
(omp_for_data_loop): Moved to omp-general.h.
(omp_for_data): Likewise.
(oacc_loop): Moved to omp-offload.c.
(oacc_loop_flags): Moved to omp-general.h.
(offload_funcs, offload_vars): Moved to omp-offload.c.
(root_omp_region): Moved to omp-expand.c.
(omp_any_child_fn_dumped): Likewise.
(find_omp_clause): Renamed to omp_find_clause and moved to
omp-general.c.
(is_combined_parallel): Moved to omp-expand.c.
(is_reference): Renamed to omp_is_reference and and moved to
omp-general.c.
(adjust_for_condition): Renamed to omp_adjust_for_condition and moved
to omp-general.c.
(get_omp_for_step_from_incr): Renamed to omp_get_for_step_from_incr
and moved to omp-general.c.
(extract_omp_for_data): Renamed to omp_extract_for_data and moved to
omp-general.c.
(workshare_safe_to_combine_p): Moved to omp-expand.c.
(omp_adjust_chunk_size): Likewise.
(get_ws_args_for): Likewise.
(get_base_type): Removed.
(dump_omp_region): Moved to omp-expand.c.
(debug_omp_region): Likewise.
(debug_all_omp_regions): Likewise.
(new_omp_region): Likewise.
(free_omp_region_1): Likewise.
(free_omp_regions): Renamed to omp_free_regions and moved to
omp-expand.c.
(find_combined_for): Renamed to omp_find_combined_for, made global.
(build_omp_barrier): Renamed to omp_build_barrier and moved to
omp-general.c.
(omp_max_vf): Moved to omp-general.c.
(omp_max_simt_vf): Likewise.
(gimple_build_cond_empty): Moved to omp-expand.c.
(parallel_needs_hsa_kernel_p): Likewise.
(expand_omp_build_assign): Moved declaration to omp-expand.c.
(expand_parallel_call): Moved to omp-expand.c.
(expand_cilk_for_call): Likewise.
(expand_task_call): Likewise.
(vec2chain): Likewise.
(remove_exit_barrier): Likewise.
(remove_exit_barriers): Likewise.
(optimize_omp_library_calls): Likewise.
(expand_omp_regimplify_p): Likewise.
(expand_omp_build_assign): Likewise.
(expand_omp_taskreg): Likewise.
(oacc_collapse): Likewise.
(expand_oacc_collapse_init): Likewise.
(expand_oacc_collapse_vars): Likewise.
(expand_omp_for_init_counts): Likewise.
(expand_omp_for_init_vars): Likewise.
(extract_omp_for_update_vars): Likewise.
(expand_omp_ordered_source): Likewise.
(expand_omp_ordered_sink): Likewise.
(expand_omp_ordered_source_sink): Likewise.
(expand_omp_for_ordered_loops): Likewise.
(expand_omp_for_generic): Likewise.
(expand_omp_for_static_nochunk): Likewise.
(find_phi_with_arg_on_edge): Likewise.
(expand_omp_for_static_chunk): Likewise.
(expand_cilk_for): Likewise.
(expand_omp_simd): Likewise.
(expand_omp_taskloop_for_outer): Likewise.
(expand_omp_taskloop_for_inner): Likewise.
(expand_oacc_for): Likewise.
(expand_omp_for): Likewise.
(expand_omp_sections): Likewise.
(expand_omp_single): Likewise.
(expand_omp_synch): Likewise.
(expand_omp_atomic_load): Likewise.
(expand_omp_atomic_store): Likewise.
(expand_omp_atomic_fetch_op): Likewise.
(expand_omp_atomic_pipeline): Likewise.
(expand_omp_atomic_mutex): Likewise.
(expand_omp_atomic): Likewise.
(oacc_launch_pack): and moved to omp-general.c, made public.
(OACC_FN_ATTRIB): Likewise.
(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
to omp-general.c.
(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
omp-general.c.
(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
moved to omp-general.c.
(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
omp-general.c.
(oacc_fn_attrib_kernels_p): Moved to omp-general.c.
(oacc_fn_attrib_level): Moved to omp-offload.c.
(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
omp-general.c.
(get_oacc_ifn_dim_arg): Renamed to oacc_get_ifn_dim_arg and moved to
omp-general.c.
(mark_loops_in_oacc_kernels_region): Moved to omp-expand.c.
(grid_launch_attributes_trees): Likewise.
(grid_attr_trees): Likewise.
(grid_create_kernel_launch_attr_types): Likewise.
(grid_insert_store_range_dim): Likewise.
(grid_get_kernel_launch_attributes): Likewise.
(get_target_argument_identifier_1): Likewise.
(get_target_argument_identifier): Likewise.
(get_target_argument_value): Likewise.
(push_target_argument_according_to_value): Likewise.
(get_target_arguments): Likewise.
(expand_omp_target): Likewise.
(grid_expand_omp_for_loop): Moved to omp-grid.c.
(grid_arg_decl_map): Likewise.
(grid_remap_kernel_arg_accesses): Likewise.
(grid_expand_target_grid_body): Likewise.
(expand_omp): Renamed to omp_expand and moved to omp-expand.c.
(build_omp_regions_1): Moved to omp-expand.c.
(build_omp_regions_root): Likewise.
(omp_expand_local): Likewise.
(build_omp_regions): Likewise.
(execute_expand_omp): Likewise.
(pass_data_expand_omp): Likewise.
(pass_expand_omp): Likewise.
(make_pass_expand_omp): Likewise.
(pass_data_expand_omp_ssa): Likewise.
(pass_expand_omp_ssa): Likewise.
(make_pass_expand_omp_ssa): Likewise.
(grid_lastprivate_predicate): Renamed to
omp_grid_lastprivate_predicate and moved to omp-grid.c, made public.
(grid_prop): Moved to omp-grid.c.
(GRID_MISSED_MSG_PREFIX): Likewise.
(grid_safe_assignment_p): Likewise.
(grid_seq_only_contains_local_assignments): Likewise.
(grid_find_single_omp_among_assignments_1): Likewise.
(grid_find_single_omp_among_assignments): Likewise.
(grid_find_ungridifiable_statement): Likewise.
(grid_parallel_clauses_gridifiable): Likewise.
(grid_inner_loop_gridifiable_p): Likewise.
(grid_dist_follows_simple_pattern): Likewise.
(grid_gfor_follows_tiling_pattern): Likewise.
(grid_call_permissible_in_distribute_p): Likewise.
(grid_handle_call_in_distribute): Likewise.
(grid_dist_follows_tiling_pattern): Likewise.
(grid_target_follows_gridifiable_pattern): Likewise.
(grid_remap_prebody_decls): Likewise.
(grid_var_segment): Likewise.
(grid_mark_variable_segment): Likewise.
(grid_copy_leading_local_assignments): Likewise.
(grid_process_grid_body): Likewise.
(grid_eliminate_combined_simd_part): Likewise.
(grid_mark_tiling_loops): Likewise.
(grid_mark_tiling_parallels_and_loops): Likewise.
(grid_process_kernel_body_copy): Likewise.
(grid_attempt_target_gridification): Likewise.
(grid_gridify_all_targets_stmt): Likewise.
(grid_gridify_all_targets): Renamed to omp_grid_gridify_all_targets
and moved to omp-grid.c, made public.
(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
omp-expand.c.
(add_decls_addresses_to_decl_constructor): Moved to omp-offload.c.
(omp_finish_file): Likewise.
(oacc_thread_numbers): Likewise.
(oacc_xform_loop): Likewise.
(oacc_default_dims, oacc_min_dims): Likewise.
(oacc_parse_default_dims): Likewise.
(oacc_validate_dims): Likewise.
(new_oacc_loop_raw): Likewise.
(new_oacc_loop_outer): Likewise.
(new_oacc_loop): Likewise.
(new_oacc_loop_routine): Likewise.
(finish_oacc_loop): Likewise.
(free_oacc_loop): Likewise.
(dump_oacc_loop_part): Likewise.
(dump_oacc_loop): Likewise.
(debug_oacc_loop): Likewise.
(oacc_loop_discover_walk): Likewise.
(oacc_loop_sibling_nreverse): Likewise.
(oacc_loop_discovery): Likewise.
(oacc_loop_xform_head_tail): Likewise.
(oacc_loop_xform_loop): Likewise.
(oacc_loop_process): Likewise.
(oacc_loop_fixed_partitions): Likewise.
(oacc_loop_auto_partitions): Likewise.
(oacc_loop_partition): Likewise.
(default_goacc_fork_join): Likewise.
(default_goacc_reduction): Likewise.
(execute_oacc_device_lower): Likewise.
(default_goacc_validate_dims): Likewise.
(default_goacc_dim_limit): Likewise.
(pass_data_oacc_device_lower): Likewise.
(pass_oacc_device_lower): Likewise.
(make_pass_oacc_device_lower): Likewise.
(execute_omp_device_lower): Likewise.
(pass_data_omp_device_lower): Likewise.
(pass_omp_device_lower): Likewise.
(make_pass_omp_device_lower): Likewise.
(pass_data_omp_target_link): Likewise.
(pass_omp_target_link): Likewise.
(find_link_var_op): Likewise.
(pass_omp_target_link::execute): Likewise.
(make_pass_omp_target_link): Likewise.
* Makefile.in (OBJS): Added omp-offload.o, omp-expand.o, omp-general.o
and omp-grid.o.
(GTFILES): Added omp-offload.h, omp-offload.c and omp-expand.c, removed
omp-low.h.
* gimple-fold.c: Include omp-general.h instead of omp-low.h.
(fold_internal_goacc_dim): Adjusted calls to
get_oacc_ifn_dim_arg and get_oacc_fn_dim_size to use their new names.
* gimplify.c: Include omp-low.h.
(omp_notice_variable): Adjust the call to get_oacc_fn_attrib to use
its new name.
(gimplify_omp_task): Adjusted calls to find_omp_clause to use its new
name.
(gimplify_omp_for): Likewise.
* lto-cgraph.c: Include omp-offload.h instead of omp-low.h.
* toplev.c: Include omp-offload.h instead of omp-low.h.
* tree-cfg.c: Include omp-general.h instead of omp-low.h. Also
include omp-expand.h.
(make_edges_bb): Adjusted the call to make_gimple_omp_edges to use its
new name.
(make_edges): Adjust the call to free_omp_regions to use its new name.
* tree-parloops.c: Include omp-general.h.
(create_parallel_loop): Adjusted the call to set_oacc_fn_attrib to use
its new name.
(parallelize_loops): Adjusted the call to get_oacc_fn_attrib to use
its new name.
* tree-ssa-loop.c: Include omp-general.h instead of omp-low.h.
(gate_oacc_kernels): Adjusted the call to get_oacc_fn_attrib to use
its new name.
* tree-vrp.c: Include omp-general.h instead of omp-low.h.
(extract_range_basic): Adjusted calls to get_oacc_ifn_dim_arg and
get_oacc_fn_dim_size to use their new names.
* varpool.c: Include omp-offload.h instead of omp-low.h.
* gengtype.c (open_base_files): Replace omp-low.h with omp-offload.h in
ifiles.
* config/nvptx/nvptx.c: Include omp-general.c.
(nvptx_expand_call): Adjusted the call to get_oacc_fn_attrib to use
its new name.
(nvptx_reorg): Likewise.
(nvptx_record_offload_symbol): Likewise.
2016-12-14 Martin Sebor <msebor@redhat.com>
PR middle-end/78786

View File

@ -1399,6 +1399,10 @@ OBJS = \
mode-switching.o \
modulo-sched.o \
multiple_target.o \
omp-offload.o \
omp-expand.o \
omp-general.o \
omp-grid.o \
omp-low.o \
omp-simd-clone.o \
optabs.o \
@ -2479,8 +2483,10 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/tree-scalar-evolution.c \
$(srcdir)/tree-ssa-operands.h \
$(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
$(srcdir)/omp-offload.h \
$(srcdir)/omp-offload.c \
$(srcdir)/omp-expand.c \
$(srcdir)/omp-low.c \
$(srcdir)/omp-low.h \
$(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \
$(srcdir)/cgraphclones.c \
$(srcdir)/tree-phinodes.c \

View File

@ -1,3 +1,9 @@
2016-12-14 Martin Jambor <mjambor@suse.cz>
* c-omp.c: Include omp-general.h instead of omp-low.h.
(c_finish_oacc_wait): Adjusted call to find_omp_clause to use its new
name.
2016-12-14 Martin Sebor <msebor@redhat.com>
PR c/17308

View File

@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "c-common.h"
#include "gimple-expr.h"
#include "c-pragma.h"
#include "omp-low.h"
#include "omp-general.h"
#include "gomp-constants.h"
@ -45,7 +45,7 @@ c_finish_oacc_wait (location_t loc, tree parms, tree clauses)
vec_alloc (args, nparms + 2);
stmt = builtin_decl_explicit (BUILT_IN_GOACC_WAIT);
if (find_omp_clause (clauses, OMP_CLAUSE_ASYNC))
if (omp_find_clause (clauses, OMP_CLAUSE_ASYNC))
t = OMP_CLAUSE_ASYNC_EXPR (clauses);
else
t = build_int_cst (integer_type_node, GOMP_ASYNC_SYNC);

View File

@ -1,3 +1,21 @@
2016-12-14 Martin Jambor <mjambor@suse.cz>
* c-parser.c: Include omp-general.h and omp-offload.h instead of
omp-low.h.
(c_finish_oacc_routine): Adjusted call to
get_oacc_fn_attrib, build_oacc_routine_dims and replace_oacc_fn_attrib
to use their new names.
(c_parser_oacc_enter_exit_data): Adjusted call to find_omp_clause to
use its new name.
(c_parser_oacc_update): Likewise.
(c_parser_omp_simd): Likewise.
(c_parser_omp_target_update): Likewise.
* c-typeck.c: Include omp-general.h instead of omp-low.h.
(c_finish_omp_cancel): Adjusted call to find_omp_clause to use its new
name.
(c_finish_omp_cancellation_point): Likewise.
* gimple-parser.c: Do not include omp-low.h
2016-12-02 Cesar Philippidis <cesar@codesourcery.com>
James Norris <jnorris@codesourcery.com>

View File

@ -52,7 +52,8 @@ along with GCC; see the file COPYING3. If not see
#include "c-lang.h"
#include "c-family/c-objc.h"
#include "plugin.h"
#include "omp-low.h"
#include "omp-general.h"
#include "omp-offload.h"
#include "builtins.h"
#include "gomp-constants.h"
#include "c-family/c-indentation.h"
@ -13922,7 +13923,7 @@ c_parser_oacc_enter_exit_data (c_parser *parser, bool enter)
clauses = c_parser_oacc_all_clauses (parser, OACC_EXIT_DATA_CLAUSE_MASK,
"#pragma acc exit data");
if (find_omp_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
if (omp_find_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
{
error_at (loc, enter
? "%<#pragma acc enter data%> has no data movement clause"
@ -14241,7 +14242,7 @@ c_finish_oacc_routine (struct oacc_routine_data *data, tree fndecl,
return;
}
if (get_oacc_fn_attrib (fndecl))
if (oacc_get_fn_attrib (fndecl))
{
error_at (data->loc,
"%<#pragma acc routine%> already applied to %qD", fndecl);
@ -14259,8 +14260,8 @@ c_finish_oacc_routine (struct oacc_routine_data *data, tree fndecl,
}
/* Process the routine's dimension clauses. */
tree dims = build_oacc_routine_dims (data->clauses);
replace_oacc_fn_attrib (fndecl, dims);
tree dims = oacc_build_routine_dims (data->clauses);
oacc_replace_fn_attrib (fndecl, dims);
/* Add an "omp declare target" attribute. */
DECL_ATTRIBUTES (fndecl)
@ -14292,7 +14293,7 @@ c_parser_oacc_update (c_parser *parser)
tree clauses = c_parser_oacc_all_clauses (parser, OACC_UPDATE_CLAUSE_MASK,
"#pragma acc update");
if (find_omp_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
if (omp_find_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
{
error_at (loc,
"%<#pragma acc update%> must contain at least one "
@ -15263,7 +15264,7 @@ c_parser_omp_simd (location_t loc, c_parser *parser,
{
omp_split_clauses (loc, OMP_SIMD, mask, clauses, cclauses);
clauses = cclauses[C_OMP_CLAUSE_SPLIT_SIMD];
tree c = find_omp_clause (cclauses[C_OMP_CLAUSE_SPLIT_FOR],
tree c = omp_find_clause (cclauses[C_OMP_CLAUSE_SPLIT_FOR],
OMP_CLAUSE_ORDERED);
if (c && OMP_CLAUSE_ORDERED_EXPR (c))
{
@ -16107,8 +16108,8 @@ c_parser_omp_target_update (location_t loc, c_parser *parser,
tree clauses
= c_parser_omp_all_clauses (parser, OMP_TARGET_UPDATE_CLAUSE_MASK,
"#pragma omp target update");
if (find_omp_clause (clauses, OMP_CLAUSE_TO) == NULL_TREE
&& find_omp_clause (clauses, OMP_CLAUSE_FROM) == NULL_TREE)
if (omp_find_clause (clauses, OMP_CLAUSE_TO) == NULL_TREE
&& omp_find_clause (clauses, OMP_CLAUSE_FROM) == NULL_TREE)
{
error_at (loc,
"%<#pragma omp target update%> must contain at least one "

View File

@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-iterator.h"
#include "gimplify.h"
#include "tree-inline.h"
#include "omp-low.h"
#include "omp-general.h"
#include "c-family/c-objc.h"
#include "c-family/c-ubsan.h"
#include "cilk.h"
@ -12012,13 +12012,13 @@ c_finish_omp_cancel (location_t loc, tree clauses)
{
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_CANCEL);
int mask = 0;
if (find_omp_clause (clauses, OMP_CLAUSE_PARALLEL))
if (omp_find_clause (clauses, OMP_CLAUSE_PARALLEL))
mask = 1;
else if (find_omp_clause (clauses, OMP_CLAUSE_FOR))
else if (omp_find_clause (clauses, OMP_CLAUSE_FOR))
mask = 2;
else if (find_omp_clause (clauses, OMP_CLAUSE_SECTIONS))
else if (omp_find_clause (clauses, OMP_CLAUSE_SECTIONS))
mask = 4;
else if (find_omp_clause (clauses, OMP_CLAUSE_TASKGROUP))
else if (omp_find_clause (clauses, OMP_CLAUSE_TASKGROUP))
mask = 8;
else
{
@ -12027,7 +12027,7 @@ c_finish_omp_cancel (location_t loc, tree clauses)
"clauses");
return;
}
tree ifc = find_omp_clause (clauses, OMP_CLAUSE_IF);
tree ifc = omp_find_clause (clauses, OMP_CLAUSE_IF);
if (ifc != NULL_TREE)
{
tree type = TREE_TYPE (OMP_CLAUSE_IF_EXPR (ifc));
@ -12051,13 +12051,13 @@ c_finish_omp_cancellation_point (location_t loc, tree clauses)
{
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_CANCELLATION_POINT);
int mask = 0;
if (find_omp_clause (clauses, OMP_CLAUSE_PARALLEL))
if (omp_find_clause (clauses, OMP_CLAUSE_PARALLEL))
mask = 1;
else if (find_omp_clause (clauses, OMP_CLAUSE_FOR))
else if (omp_find_clause (clauses, OMP_CLAUSE_FOR))
mask = 2;
else if (find_omp_clause (clauses, OMP_CLAUSE_SECTIONS))
else if (omp_find_clause (clauses, OMP_CLAUSE_SECTIONS))
mask = 4;
else if (find_omp_clause (clauses, OMP_CLAUSE_TASKGROUP))
else if (omp_find_clause (clauses, OMP_CLAUSE_TASKGROUP))
mask = 8;
else
{

View File

@ -34,7 +34,6 @@ along with GCC; see the file COPYING3. If not see
#include "c-lang.h"
#include "c-family/c-objc.h"
#include "plugin.h"
#include "omp-low.h"
#include "builtins.h"
#include "gomp-constants.h"
#include "c-family/c-indentation.h"

View File

@ -55,6 +55,7 @@
#include "gimple.h"
#include "stor-layout.h"
#include "builtins.h"
#include "omp-general.h"
#include "omp-low.h"
#include "gomp-constants.h"
#include "dumpfile.h"
@ -1389,7 +1390,7 @@ nvptx_expand_call (rtx retval, rtx address)
if (DECL_STATIC_CHAIN (decl))
cfun->machine->has_chain = true;
tree attr = get_oacc_fn_attrib (decl);
tree attr = oacc_get_fn_attrib (decl);
if (attr)
{
tree dims = TREE_VALUE (attr);
@ -4090,7 +4091,7 @@ nvptx_reorg (void)
/* Determine launch dimensions of the function. If it is not an
offloaded function (i.e. this is a regular compiler), the
function has no neutering. */
tree attr = get_oacc_fn_attrib (current_function_decl);
tree attr = oacc_get_fn_attrib (current_function_decl);
if (attr)
{
/* If we determined this mask before RTL expansion, we could
@ -4243,7 +4244,7 @@ nvptx_record_offload_symbol (tree decl)
case FUNCTION_DECL:
{
tree attr = get_oacc_fn_attrib (decl);
tree attr = oacc_get_fn_attrib (decl);
/* OpenMP offloading does not set this attribute. */
tree dims = attr ? TREE_VALUE (attr) : NULL_TREE;

View File

@ -1,3 +1,22 @@
2016-12-14 Martin Jambor <mjambor@suse.cz>
* parser.c: Include omp-general.h and omp-offload.h instead of
omp-low.h.
(cp_parser_omp_simd): Adjusted calls to find_omp_clause to use its new
name.
(cp_parser_omp_target_update): Likewise.
(cp_parser_oacc_declare): Likewise.
(cp_parser_oacc_enter_exit_data): Likewise.
(cp_parser_oacc_update): Likewise.
(cp_finalize_oacc_routine): Adjusted call to get_oacc_fn_attrib,
build_oacc_routine_dims and replace_oacc_fn_attrib to use their new
names.
* semantics.c: Include omp-general insteda of omp-low.h.
(finish_omp_for): Adjusted calls to find_omp_clause to use its new
name.
(finish_omp_cancel): Likewise.
(finish_omp_cancellation_point): Likewise.
2016-12-14 Marek Polacek <polacek@redhat.com>
PR c++/72775

View File

@ -35,8 +35,9 @@ along with GCC; see the file COPYING3. If not see
#include "plugin.h"
#include "tree-pretty-print.h"
#include "parser.h"
#include "omp-low.h"
#include "gomp-constants.h"
#include "omp-general.h"
#include "omp-offload.h"
#include "c-family/c-indentation.h"
#include "context.h"
#include "cp-cilkplus.h"
@ -34675,7 +34676,7 @@ cp_parser_omp_simd (cp_parser *parser, cp_token *pragma_tok,
{
cp_omp_split_clauses (loc, OMP_SIMD, mask, clauses, cclauses);
clauses = cclauses[C_OMP_CLAUSE_SPLIT_SIMD];
tree c = find_omp_clause (cclauses[C_OMP_CLAUSE_SPLIT_FOR],
tree c = omp_find_clause (cclauses[C_OMP_CLAUSE_SPLIT_FOR],
OMP_CLAUSE_ORDERED);
if (c && OMP_CLAUSE_ORDERED_EXPR (c))
{
@ -35703,8 +35704,8 @@ cp_parser_omp_target_update (cp_parser *parser, cp_token *pragma_tok,
tree clauses
= cp_parser_omp_all_clauses (parser, OMP_TARGET_UPDATE_CLAUSE_MASK,
"#pragma omp target update", pragma_tok);
if (find_omp_clause (clauses, OMP_CLAUSE_TO) == NULL_TREE
&& find_omp_clause (clauses, OMP_CLAUSE_FROM) == NULL_TREE)
if (omp_find_clause (clauses, OMP_CLAUSE_TO) == NULL_TREE
&& omp_find_clause (clauses, OMP_CLAUSE_FROM) == NULL_TREE)
{
error_at (pragma_tok->location,
"%<#pragma omp target update%> must contain at least one "
@ -36038,7 +36039,7 @@ cp_parser_oacc_declare (cp_parser *parser, cp_token *pragma_tok)
"#pragma acc declare", pragma_tok, true);
if (find_omp_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
if (omp_find_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
{
error_at (pragma_tok->location,
"no valid clauses specified in %<#pragma acc declare%>");
@ -36211,7 +36212,7 @@ cp_parser_oacc_enter_exit_data (cp_parser *parser, cp_token *pragma_tok,
clauses = cp_parser_oacc_all_clauses (parser, OACC_EXIT_DATA_CLAUSE_MASK,
"#pragma acc exit data", pragma_tok);
if (find_omp_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
if (omp_find_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
{
error_at (loc, "%<#pragma acc %s data%> has no data movement clause",
enter ? "enter" : "exit");
@ -36385,7 +36386,7 @@ cp_parser_oacc_update (cp_parser *parser, cp_token *pragma_tok)
clauses = cp_parser_oacc_all_clauses (parser, OACC_UPDATE_CLAUSE_MASK,
"#pragma acc update", pragma_tok);
if (find_omp_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
if (omp_find_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
{
error_at (pragma_tok->location,
"%<#pragma acc update%> must contain at least one "
@ -37461,7 +37462,7 @@ cp_finalize_oacc_routine (cp_parser *parser, tree fndecl, bool is_defn)
return;
}
if (get_oacc_fn_attrib (fndecl))
if (oacc_get_fn_attrib (fndecl))
{
error_at (parser->oacc_routine->loc,
"%<#pragma acc routine%> already applied to %qD", fndecl);
@ -37479,9 +37480,9 @@ cp_finalize_oacc_routine (cp_parser *parser, tree fndecl, bool is_defn)
}
/* Process the routine's dimension clauses. */
tree dims = build_oacc_routine_dims (parser->oacc_routine->clauses);
replace_oacc_fn_attrib (fndecl, dims);
tree dims = oacc_build_routine_dims (parser->oacc_routine->clauses);
oacc_replace_fn_attrib (fndecl, dims);
/* Add an "omp declare target" attribute. */
DECL_ATTRIBUTES (fndecl)
= tree_cons (get_identifier ("omp declare target"),

View File

@ -38,7 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "intl.h"
#include "tree-iterator.h"
#include "omp-low.h"
#include "omp-general.h"
#include "convert.h"
#include "gomp-constants.h"
@ -8001,7 +8001,7 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv,
gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (incrv));
if (TREE_VEC_LENGTH (declv) > 1)
{
tree c = find_omp_clause (clauses, OMP_CLAUSE_COLLAPSE);
tree c = omp_find_clause (clauses, OMP_CLAUSE_COLLAPSE);
if (c)
collapse = tree_to_shwi (OMP_CLAUSE_COLLAPSE_EXPR (c));
if (collapse != TREE_VEC_LENGTH (declv))
@ -8264,8 +8264,8 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv,
step at this point, fill it in. */
if (code == OMP_SIMD && !processing_template_decl
&& TREE_VEC_LENGTH (OMP_FOR_INCR (omp_for)) == 1)
for (tree c = find_omp_clause (clauses, OMP_CLAUSE_LINEAR); c;
c = find_omp_clause (OMP_CLAUSE_CHAIN (c), OMP_CLAUSE_LINEAR))
for (tree c = omp_find_clause (clauses, OMP_CLAUSE_LINEAR); c;
c = omp_find_clause (OMP_CLAUSE_CHAIN (c), OMP_CLAUSE_LINEAR))
if (OMP_CLAUSE_LINEAR_STEP (c) == NULL_TREE)
{
decl = TREE_OPERAND (TREE_VEC_ELT (OMP_FOR_INIT (omp_for), 0), 0);
@ -8586,13 +8586,13 @@ finish_omp_cancel (tree clauses)
{
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_CANCEL);
int mask = 0;
if (find_omp_clause (clauses, OMP_CLAUSE_PARALLEL))
if (omp_find_clause (clauses, OMP_CLAUSE_PARALLEL))
mask = 1;
else if (find_omp_clause (clauses, OMP_CLAUSE_FOR))
else if (omp_find_clause (clauses, OMP_CLAUSE_FOR))
mask = 2;
else if (find_omp_clause (clauses, OMP_CLAUSE_SECTIONS))
else if (omp_find_clause (clauses, OMP_CLAUSE_SECTIONS))
mask = 4;
else if (find_omp_clause (clauses, OMP_CLAUSE_TASKGROUP))
else if (omp_find_clause (clauses, OMP_CLAUSE_TASKGROUP))
mask = 8;
else
{
@ -8601,7 +8601,7 @@ finish_omp_cancel (tree clauses)
return;
}
vec<tree, va_gc> *vec = make_tree_vector ();
tree ifc = find_omp_clause (clauses, OMP_CLAUSE_IF);
tree ifc = omp_find_clause (clauses, OMP_CLAUSE_IF);
if (ifc != NULL_TREE)
{
tree type = TREE_TYPE (OMP_CLAUSE_IF_EXPR (ifc));
@ -8623,13 +8623,13 @@ finish_omp_cancellation_point (tree clauses)
{
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_CANCELLATION_POINT);
int mask = 0;
if (find_omp_clause (clauses, OMP_CLAUSE_PARALLEL))
if (omp_find_clause (clauses, OMP_CLAUSE_PARALLEL))
mask = 1;
else if (find_omp_clause (clauses, OMP_CLAUSE_FOR))
else if (omp_find_clause (clauses, OMP_CLAUSE_FOR))
mask = 2;
else if (find_omp_clause (clauses, OMP_CLAUSE_SECTIONS))
else if (omp_find_clause (clauses, OMP_CLAUSE_SECTIONS))
mask = 4;
else if (find_omp_clause (clauses, OMP_CLAUSE_TASKGROUP))
else if (omp_find_clause (clauses, OMP_CLAUSE_TASKGROUP))
mask = 8;
else
{

View File

@ -1,3 +1,7 @@
2016-12-14 Martin Jambor <mjambor@suse.cz>
* trans-openmp.c: Include omp-general.h.
2016-12-14 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/78780

View File

@ -35,8 +35,9 @@ along with GCC; see the file COPYING3. If not see
#include "trans-array.h"
#include "trans-const.h"
#include "arith.h"
#include "omp-low.h"
#include "gomp-constants.h"
#include "omp-general.h"
#include "omp-low.h"
int ompws_flags;

View File

@ -1719,7 +1719,7 @@ open_base_files (void)
"tree-dfa.h", "tree-ssa.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
"except.h", "output.h", "cfgloop.h", "target.h", "lto-streamer.h",
"target-globals.h", "ipa-ref.h", "cgraph.h", "symbol-summary.h",
"ipa-prop.h", "ipa-inline.h", "dwarf2out.h", "omp-low.h", NULL
"ipa-prop.h", "ipa-inline.h", "dwarf2out.h", "omp-offload.h", NULL
};
const char *const *ifp;
outf_p gtype_desc_c;

View File

@ -52,7 +52,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-match.h"
#include "gomp-constants.h"
#include "optabs-query.h"
#include "omp-low.h"
#include "omp-general.h"
#include "ipa-chkp.h"
#include "tree-cfg.h"
#include "fold-const-call.h"
@ -3416,8 +3416,8 @@ gimple_fold_builtin (gimple_stmt_iterator *gsi)
static tree
fold_internal_goacc_dim (const gimple *call)
{
int axis = get_oacc_ifn_dim_arg (call);
int size = get_oacc_fn_dim_size (current_function_decl, axis);
int axis = oacc_get_ifn_dim_arg (call);
int size = oacc_get_fn_dim_size (current_function_decl, axis);
bool is_pos = gimple_call_internal_fn (call) == IFN_GOACC_DIM_POS;
tree result = NULL_TREE;

View File

@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "tree-cfg.h"
#include "tree-ssa.h"
#include "omp-general.h"
#include "omp-low.h"
#include "gimple-low.h"
#include "cilk.h"
@ -6959,7 +6960,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
if (gimplify_omp_ctxp->outer_context == NULL
&& VAR_P (decl)
&& get_oacc_fn_attrib (current_function_decl))
&& oacc_get_fn_attrib (current_function_decl))
{
location_t loc = DECL_SOURCE_LOCATION (decl);
@ -9314,7 +9315,7 @@ gimplify_omp_task (tree *expr_p, gimple_seq *pre_p)
gimple_seq body = NULL;
gimplify_scan_omp_clauses (&OMP_TASK_CLAUSES (expr), pre_p,
find_omp_clause (OMP_TASK_CLAUSES (expr),
omp_find_clause (OMP_TASK_CLAUSES (expr),
OMP_CLAUSE_UNTIED)
? ORT_UNTIED_TASK : ORT_TASK, OMP_TASK);
@ -9390,7 +9391,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
ort = ORT_ACC;
break;
case OMP_TASKLOOP:
if (find_omp_clause (OMP_FOR_CLAUSES (for_stmt), OMP_CLAUSE_UNTIED))
if (omp_find_clause (OMP_FOR_CLAUSES (for_stmt), OMP_CLAUSE_UNTIED))
ort = ORT_UNTIED_TASK;
else
ort = ORT_TASK;
@ -9555,7 +9556,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
gcc_assert (TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt))
== TREE_VEC_LENGTH (OMP_FOR_INCR (for_stmt)));
tree c = find_omp_clause (OMP_FOR_CLAUSES (for_stmt), OMP_CLAUSE_ORDERED);
tree c = omp_find_clause (OMP_FOR_CLAUSES (for_stmt), OMP_CLAUSE_ORDERED);
bool is_doacross = false;
if (c && OMP_CLAUSE_ORDERED_EXPR (c))
{
@ -9565,7 +9566,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
* 2);
}
int collapse = 1;
c = find_omp_clause (OMP_FOR_CLAUSES (for_stmt), OMP_CLAUSE_COLLAPSE);
c = omp_find_clause (OMP_FOR_CLAUSES (for_stmt), OMP_CLAUSE_COLLAPSE);
if (c)
collapse = tree_to_shwi (OMP_CLAUSE_COLLAPSE_EXPR (c));
for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++)

View File

@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "context.h"
#include "pass_manager.h"
#include "ipa-utils.h"
#include "omp-low.h"
#include "omp-offload.h"
#include "ipa-chkp.h"
/* True when asm nodes has been output. */

8195
gcc/omp-expand.c Normal file

File diff suppressed because it is too large Load Diff

32
gcc/omp-expand.h Normal file
View File

@ -0,0 +1,32 @@
/* Expansion pass for OMP directives. Outlines regions of certain OMP
directives to separate functions, converts others into explicit calls to the
runtime library (libgomp) and so forth
Copyright (C) 2005-2016 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_OMP_EXPAND_H
#define GCC_OMP_EXPAND_H
struct omp_region;
extern void omp_expand_local (basic_block head);
extern void omp_free_regions (void);
extern bool omp_make_gimple_edges (basic_block bb, struct omp_region **region,
int *region_idx);
#endif /* GCC_OMP_EXPAND_H */

650
gcc/omp-general.c Normal file
View File

@ -0,0 +1,650 @@
/* General types and functions that are uselful for processing of OpenMP,
OpenACC and similar directivers at various stages of compilation.
Copyright (C) 2005-2016 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Find an OMP clause of type KIND within CLAUSES. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "tree.h"
#include "gimple.h"
#include "ssa.h"
#include "diagnostic-core.h"
#include "fold-const.h"
#include "langhooks.h"
#include "omp-general.h"
tree
omp_find_clause (tree clauses, enum omp_clause_code kind)
{
for (; clauses ; clauses = OMP_CLAUSE_CHAIN (clauses))
if (OMP_CLAUSE_CODE (clauses) == kind)
return clauses;
return NULL_TREE;
}
/* Return true if DECL is a reference type. */
bool
omp_is_reference (tree decl)
{
return lang_hooks.decls.omp_privatize_by_reference (decl);
}
/* Adjust *COND_CODE and *N2 so that the former is either LT_EXPR or
GT_EXPR. */
void
omp_adjust_for_condition (location_t loc, enum tree_code *cond_code, tree *n2)
{
switch (*cond_code)
{
case LT_EXPR:
case GT_EXPR:
case NE_EXPR:
break;
case LE_EXPR:
if (POINTER_TYPE_P (TREE_TYPE (*n2)))
*n2 = fold_build_pointer_plus_hwi_loc (loc, *n2, 1);
else
*n2 = fold_build2_loc (loc, PLUS_EXPR, TREE_TYPE (*n2), *n2,
build_int_cst (TREE_TYPE (*n2), 1));
*cond_code = LT_EXPR;
break;
case GE_EXPR:
if (POINTER_TYPE_P (TREE_TYPE (*n2)))
*n2 = fold_build_pointer_plus_hwi_loc (loc, *n2, -1);
else
*n2 = fold_build2_loc (loc, MINUS_EXPR, TREE_TYPE (*n2), *n2,
build_int_cst (TREE_TYPE (*n2), 1));
*cond_code = GT_EXPR;
break;
default:
gcc_unreachable ();
}
}
/* Return the looping step from INCR, extracted from the step of a gimple omp
for statement. */
tree
omp_get_for_step_from_incr (location_t loc, tree incr)
{
tree step;
switch (TREE_CODE (incr))
{
case PLUS_EXPR:
step = TREE_OPERAND (incr, 1);
break;
case POINTER_PLUS_EXPR:
step = fold_convert (ssizetype, TREE_OPERAND (incr, 1));
break;
case MINUS_EXPR:
step = TREE_OPERAND (incr, 1);
step = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (step), step);
break;
default:
gcc_unreachable ();
}
return step;
}
/* Extract the header elements of parallel loop FOR_STMT and store
them into *FD. */
void
omp_extract_for_data (gomp_for *for_stmt, struct omp_for_data *fd,
struct omp_for_data_loop *loops)
{
tree t, var, *collapse_iter, *collapse_count;
tree count = NULL_TREE, iter_type = long_integer_type_node;
struct omp_for_data_loop *loop;
int i;
struct omp_for_data_loop dummy_loop;
location_t loc = gimple_location (for_stmt);
bool simd = gimple_omp_for_kind (for_stmt) & GF_OMP_FOR_SIMD;
bool distribute = gimple_omp_for_kind (for_stmt)
== GF_OMP_FOR_KIND_DISTRIBUTE;
bool taskloop = gimple_omp_for_kind (for_stmt)
== GF_OMP_FOR_KIND_TASKLOOP;
tree iterv, countv;
fd->for_stmt = for_stmt;
fd->pre = NULL;
if (gimple_omp_for_collapse (for_stmt) > 1)
fd->loops = loops;
else
fd->loops = &fd->loop;
fd->have_nowait = distribute || simd;
fd->have_ordered = false;
fd->collapse = 1;
fd->ordered = 0;
fd->sched_kind = OMP_CLAUSE_SCHEDULE_STATIC;
fd->sched_modifiers = 0;
fd->chunk_size = NULL_TREE;
fd->simd_schedule = false;
if (gimple_omp_for_kind (fd->for_stmt) == GF_OMP_FOR_KIND_CILKFOR)
fd->sched_kind = OMP_CLAUSE_SCHEDULE_CILKFOR;
collapse_iter = NULL;
collapse_count = NULL;
for (t = gimple_omp_for_clauses (for_stmt); t ; t = OMP_CLAUSE_CHAIN (t))
switch (OMP_CLAUSE_CODE (t))
{
case OMP_CLAUSE_NOWAIT:
fd->have_nowait = true;
break;
case OMP_CLAUSE_ORDERED:
fd->have_ordered = true;
if (OMP_CLAUSE_ORDERED_EXPR (t))
fd->ordered = tree_to_shwi (OMP_CLAUSE_ORDERED_EXPR (t));
break;
case OMP_CLAUSE_SCHEDULE:
gcc_assert (!distribute && !taskloop);
fd->sched_kind
= (enum omp_clause_schedule_kind)
(OMP_CLAUSE_SCHEDULE_KIND (t) & OMP_CLAUSE_SCHEDULE_MASK);
fd->sched_modifiers = (OMP_CLAUSE_SCHEDULE_KIND (t)
& ~OMP_CLAUSE_SCHEDULE_MASK);
fd->chunk_size = OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (t);
fd->simd_schedule = OMP_CLAUSE_SCHEDULE_SIMD (t);
break;
case OMP_CLAUSE_DIST_SCHEDULE:
gcc_assert (distribute);
fd->chunk_size = OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (t);
break;
case OMP_CLAUSE_COLLAPSE:
fd->collapse = tree_to_shwi (OMP_CLAUSE_COLLAPSE_EXPR (t));
if (fd->collapse > 1)
{
collapse_iter = &OMP_CLAUSE_COLLAPSE_ITERVAR (t);
collapse_count = &OMP_CLAUSE_COLLAPSE_COUNT (t);
}
break;
default:
break;
}
if (fd->ordered && fd->collapse == 1 && loops != NULL)
{
fd->loops = loops;
iterv = NULL_TREE;
countv = NULL_TREE;
collapse_iter = &iterv;
collapse_count = &countv;
}
/* FIXME: for now map schedule(auto) to schedule(static).
There should be analysis to determine whether all iterations
are approximately the same amount of work (then schedule(static)
is best) or if it varies (then schedule(dynamic,N) is better). */
if (fd->sched_kind == OMP_CLAUSE_SCHEDULE_AUTO)
{
fd->sched_kind = OMP_CLAUSE_SCHEDULE_STATIC;
gcc_assert (fd->chunk_size == NULL);
}
gcc_assert (fd->collapse == 1 || collapse_iter != NULL);
if (taskloop)
fd->sched_kind = OMP_CLAUSE_SCHEDULE_RUNTIME;
if (fd->sched_kind == OMP_CLAUSE_SCHEDULE_RUNTIME)
gcc_assert (fd->chunk_size == NULL);
else if (fd->chunk_size == NULL)
{
/* We only need to compute a default chunk size for ordered
static loops and dynamic loops. */
if (fd->sched_kind != OMP_CLAUSE_SCHEDULE_STATIC
|| fd->have_ordered)
fd->chunk_size = (fd->sched_kind == OMP_CLAUSE_SCHEDULE_STATIC)
? integer_zero_node : integer_one_node;
}
int cnt = fd->ordered ? fd->ordered : fd->collapse;
for (i = 0; i < cnt; i++)
{
if (i == 0 && fd->collapse == 1 && (fd->ordered == 0 || loops == NULL))
loop = &fd->loop;
else if (loops != NULL)
loop = loops + i;
else
loop = &dummy_loop;
loop->v = gimple_omp_for_index (for_stmt, i);
gcc_assert (SSA_VAR_P (loop->v));
gcc_assert (TREE_CODE (TREE_TYPE (loop->v)) == INTEGER_TYPE
|| TREE_CODE (TREE_TYPE (loop->v)) == POINTER_TYPE);
var = TREE_CODE (loop->v) == SSA_NAME ? SSA_NAME_VAR (loop->v) : loop->v;
loop->n1 = gimple_omp_for_initial (for_stmt, i);
loop->cond_code = gimple_omp_for_cond (for_stmt, i);
loop->n2 = gimple_omp_for_final (for_stmt, i);
gcc_assert (loop->cond_code != NE_EXPR
|| gimple_omp_for_kind (for_stmt) == GF_OMP_FOR_KIND_CILKSIMD
|| gimple_omp_for_kind (for_stmt) == GF_OMP_FOR_KIND_CILKFOR);
omp_adjust_for_condition (loc, &loop->cond_code, &loop->n2);
t = gimple_omp_for_incr (for_stmt, i);
gcc_assert (TREE_OPERAND (t, 0) == var);
loop->step = omp_get_for_step_from_incr (loc, t);
if (simd
|| (fd->sched_kind == OMP_CLAUSE_SCHEDULE_STATIC
&& !fd->have_ordered))
{
if (fd->collapse == 1)
iter_type = TREE_TYPE (loop->v);
else if (i == 0
|| TYPE_PRECISION (iter_type)
< TYPE_PRECISION (TREE_TYPE (loop->v)))
iter_type
= build_nonstandard_integer_type
(TYPE_PRECISION (TREE_TYPE (loop->v)), 1);
}
else if (iter_type != long_long_unsigned_type_node)
{
if (POINTER_TYPE_P (TREE_TYPE (loop->v)))
iter_type = long_long_unsigned_type_node;
else if (TYPE_UNSIGNED (TREE_TYPE (loop->v))
&& TYPE_PRECISION (TREE_TYPE (loop->v))
>= TYPE_PRECISION (iter_type))
{
tree n;
if (loop->cond_code == LT_EXPR)
n = fold_build2_loc (loc,
PLUS_EXPR, TREE_TYPE (loop->v),
loop->n2, loop->step);
else
n = loop->n1;
if (TREE_CODE (n) != INTEGER_CST
|| tree_int_cst_lt (TYPE_MAX_VALUE (iter_type), n))
iter_type = long_long_unsigned_type_node;
}
else if (TYPE_PRECISION (TREE_TYPE (loop->v))
> TYPE_PRECISION (iter_type))
{
tree n1, n2;
if (loop->cond_code == LT_EXPR)
{
n1 = loop->n1;
n2 = fold_build2_loc (loc,
PLUS_EXPR, TREE_TYPE (loop->v),
loop->n2, loop->step);
}
else
{
n1 = fold_build2_loc (loc,
MINUS_EXPR, TREE_TYPE (loop->v),
loop->n2, loop->step);
n2 = loop->n1;
}
if (TREE_CODE (n1) != INTEGER_CST
|| TREE_CODE (n2) != INTEGER_CST
|| !tree_int_cst_lt (TYPE_MIN_VALUE (iter_type), n1)
|| !tree_int_cst_lt (n2, TYPE_MAX_VALUE (iter_type)))
iter_type = long_long_unsigned_type_node;
}
}
if (i >= fd->collapse)
continue;
if (collapse_count && *collapse_count == NULL)
{
t = fold_binary (loop->cond_code, boolean_type_node,
fold_convert (TREE_TYPE (loop->v), loop->n1),
fold_convert (TREE_TYPE (loop->v), loop->n2));
if (t && integer_zerop (t))
count = build_zero_cst (long_long_unsigned_type_node);
else if ((i == 0 || count != NULL_TREE)
&& TREE_CODE (TREE_TYPE (loop->v)) == INTEGER_TYPE
&& TREE_CONSTANT (loop->n1)
&& TREE_CONSTANT (loop->n2)
&& TREE_CODE (loop->step) == INTEGER_CST)
{
tree itype = TREE_TYPE (loop->v);
if (POINTER_TYPE_P (itype))
itype = signed_type_for (itype);
t = build_int_cst (itype, (loop->cond_code == LT_EXPR ? -1 : 1));
t = fold_build2_loc (loc,
PLUS_EXPR, itype,
fold_convert_loc (loc, itype, loop->step), t);
t = fold_build2_loc (loc, PLUS_EXPR, itype, t,
fold_convert_loc (loc, itype, loop->n2));
t = fold_build2_loc (loc, MINUS_EXPR, itype, t,
fold_convert_loc (loc, itype, loop->n1));
if (TYPE_UNSIGNED (itype) && loop->cond_code == GT_EXPR)
t = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype,
fold_build1_loc (loc, NEGATE_EXPR, itype, t),
fold_build1_loc (loc, NEGATE_EXPR, itype,
fold_convert_loc (loc, itype,
loop->step)));
else
t = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype, t,
fold_convert_loc (loc, itype, loop->step));
t = fold_convert_loc (loc, long_long_unsigned_type_node, t);
if (count != NULL_TREE)
count = fold_build2_loc (loc,
MULT_EXPR, long_long_unsigned_type_node,
count, t);
else
count = t;
if (TREE_CODE (count) != INTEGER_CST)
count = NULL_TREE;
}
else if (count && !integer_zerop (count))
count = NULL_TREE;
}
}
if (count
&& !simd
&& (fd->sched_kind != OMP_CLAUSE_SCHEDULE_STATIC
|| fd->have_ordered))
{
if (!tree_int_cst_lt (count, TYPE_MAX_VALUE (long_integer_type_node)))
iter_type = long_long_unsigned_type_node;
else
iter_type = long_integer_type_node;
}
else if (collapse_iter && *collapse_iter != NULL)
iter_type = TREE_TYPE (*collapse_iter);
fd->iter_type = iter_type;
if (collapse_iter && *collapse_iter == NULL)
*collapse_iter = create_tmp_var (iter_type, ".iter");
if (collapse_count && *collapse_count == NULL)
{
if (count)
*collapse_count = fold_convert_loc (loc, iter_type, count);
else
*collapse_count = create_tmp_var (iter_type, ".count");
}
if (fd->collapse > 1 || (fd->ordered && loops))
{
fd->loop.v = *collapse_iter;
fd->loop.n1 = build_int_cst (TREE_TYPE (fd->loop.v), 0);
fd->loop.n2 = *collapse_count;
fd->loop.step = build_int_cst (TREE_TYPE (fd->loop.v), 1);
fd->loop.cond_code = LT_EXPR;
}
else if (loops)
loops[0] = fd->loop;
}
/* Build a call to GOMP_barrier. */
gimple *
omp_build_barrier (tree lhs)
{
tree fndecl = builtin_decl_explicit (lhs ? BUILT_IN_GOMP_BARRIER_CANCEL
: BUILT_IN_GOMP_BARRIER);
gcall *g = gimple_build_call (fndecl, 0);
if (lhs)
gimple_call_set_lhs (g, lhs);
return g;
}
/* Return maximum possible vectorization factor for the target. */
int
omp_max_vf (void)
{
if (!optimize
|| optimize_debug
|| !flag_tree_loop_optimize
|| (!flag_tree_loop_vectorize
&& (global_options_set.x_flag_tree_loop_vectorize
|| global_options_set.x_flag_tree_vectorize)))
return 1;
int vf = 1;
int vs = targetm.vectorize.autovectorize_vector_sizes ();
if (vs)
vf = 1 << floor_log2 (vs);
else
{
machine_mode vqimode = targetm.vectorize.preferred_simd_mode (QImode);
if (GET_MODE_CLASS (vqimode) == MODE_VECTOR_INT)
vf = GET_MODE_NUNITS (vqimode);
}
return vf;
}
/* Return maximum SIMT width if offloading may target SIMT hardware. */
int
omp_max_simt_vf (void)
{
if (!optimize)
return 0;
if (ENABLE_OFFLOADING)
for (const char *c = getenv ("OFFLOAD_TARGET_NAMES"); c; )
{
if (!strncmp (c, "nvptx", strlen ("nvptx")))
return 32;
else if ((c = strchr (c, ',')))
c++;
}
return 0;
}
/* Encode an oacc launch argument. This matches the GOMP_LAUNCH_PACK
macro on gomp-constants.h. We do not check for overflow. */
tree
oacc_launch_pack (unsigned code, tree device, unsigned op)
{
tree res;
res = build_int_cst (unsigned_type_node, GOMP_LAUNCH_PACK (code, 0, op));
if (device)
{
device = fold_build2 (LSHIFT_EXPR, unsigned_type_node,
device, build_int_cst (unsigned_type_node,
GOMP_LAUNCH_DEVICE_SHIFT));
res = fold_build2 (BIT_IOR_EXPR, unsigned_type_node, res, device);
}
return res;
}
/* FIXME: What is the following comment for? */
/* Look for compute grid dimension clauses and convert to an attribute
attached to FN. This permits the target-side code to (a) massage
the dimensions, (b) emit that data and (c) optimize. Non-constant
dimensions are pushed onto ARGS.
The attribute value is a TREE_LIST. A set of dimensions is
represented as a list of INTEGER_CST. Those that are runtime
exprs are represented as an INTEGER_CST of zero.
TOOO. Normally the attribute will just contain a single such list. If
however it contains a list of lists, this will represent the use of
device_type. Each member of the outer list is an assoc list of
dimensions, keyed by the device type. The first entry will be the
default. Well, that's the plan. */
/* Replace any existing oacc fn attribute with updated dimensions. */
void
oacc_replace_fn_attrib (tree fn, tree dims)
{
tree ident = get_identifier (OACC_FN_ATTRIB);
tree attribs = DECL_ATTRIBUTES (fn);
/* If we happen to be present as the first attrib, drop it. */
if (attribs && TREE_PURPOSE (attribs) == ident)
attribs = TREE_CHAIN (attribs);
DECL_ATTRIBUTES (fn) = tree_cons (ident, dims, attribs);
}
/* Scan CLAUSES for launch dimensions and attach them to the oacc
function attribute. Push any that are non-constant onto the ARGS
list, along with an appropriate GOMP_LAUNCH_DIM tag. IS_KERNEL is
true, if these are for a kernels region offload function. */
void
oacc_set_fn_attrib (tree fn, tree clauses, bool is_kernel, vec<tree> *args)
{
/* Must match GOMP_DIM ordering. */
static const omp_clause_code ids[]
= { OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH };
unsigned ix;
tree dims[GOMP_DIM_MAX];
tree attr = NULL_TREE;
unsigned non_const = 0;
for (ix = GOMP_DIM_MAX; ix--;)
{
tree clause = omp_find_clause (clauses, ids[ix]);
tree dim = NULL_TREE;
if (clause)
dim = OMP_CLAUSE_EXPR (clause, ids[ix]);
dims[ix] = dim;
if (dim && TREE_CODE (dim) != INTEGER_CST)
{
dim = integer_zero_node;
non_const |= GOMP_DIM_MASK (ix);
}
attr = tree_cons (NULL_TREE, dim, attr);
/* Note kernelness with TREE_PUBLIC. */
if (is_kernel)
TREE_PUBLIC (attr) = 1;
}
oacc_replace_fn_attrib (fn, attr);
if (non_const)
{
/* Push a dynamic argument set. */
args->safe_push (oacc_launch_pack (GOMP_LAUNCH_DIM,
NULL_TREE, non_const));
for (unsigned ix = 0; ix != GOMP_DIM_MAX; ix++)
if (non_const & GOMP_DIM_MASK (ix))
args->safe_push (dims[ix]);
}
}
/* Process the routine's dimension clauess to generate an attribute
value. Issue diagnostics as appropriate. We default to SEQ
(OpenACC 2.5 clarifies this). All dimensions have a size of zero
(dynamic). TREE_PURPOSE is set to indicate whether that dimension
can have a loop partitioned on it. non-zero indicates
yes, zero indicates no. By construction once a non-zero has been
reached, further inner dimensions must also be non-zero. We set
TREE_VALUE to zero for the dimensions that may be partitioned and
1 for the other ones -- if a loop is (erroneously) spawned at
an outer level, we don't want to try and partition it. */
tree
oacc_build_routine_dims (tree clauses)
{
/* Must match GOMP_DIM ordering. */
static const omp_clause_code ids[] =
{OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ};
int ix;
int level = -1;
for (; clauses; clauses = OMP_CLAUSE_CHAIN (clauses))
for (ix = GOMP_DIM_MAX + 1; ix--;)
if (OMP_CLAUSE_CODE (clauses) == ids[ix])
{
if (level >= 0)
error_at (OMP_CLAUSE_LOCATION (clauses),
"multiple loop axes specified for routine");
level = ix;
break;
}
/* Default to SEQ. */
if (level < 0)
level = GOMP_DIM_MAX;
tree dims = NULL_TREE;
for (ix = GOMP_DIM_MAX; ix--;)
dims = tree_cons (build_int_cst (boolean_type_node, ix >= level),
build_int_cst (integer_type_node, ix < level), dims);
return dims;
}
/* Retrieve the oacc function attrib and return it. Non-oacc
functions will return NULL. */
tree
oacc_get_fn_attrib (tree fn)
{
return lookup_attribute (OACC_FN_ATTRIB, DECL_ATTRIBUTES (fn));
}
/* Return true if this oacc fn attrib is for a kernels offload
region. We use the TREE_PUBLIC flag of each dimension -- only
need to check the first one. */
bool
oacc_fn_attrib_kernels_p (tree attr)
{
return TREE_PUBLIC (TREE_VALUE (attr));
}
/* Extract an oacc execution dimension from FN. FN must be an
offloaded function or routine that has already had its execution
dimensions lowered to the target-specific values. */
int
oacc_get_fn_dim_size (tree fn, int axis)
{
tree attrs = oacc_get_fn_attrib (fn);
gcc_assert (axis < GOMP_DIM_MAX);
tree dims = TREE_VALUE (attrs);
while (axis--)
dims = TREE_CHAIN (dims);
int size = TREE_INT_CST_LOW (TREE_VALUE (dims));
return size;
}
/* Extract the dimension axis from an IFN_GOACC_DIM_POS or
IFN_GOACC_DIM_SIZE call. */
int
oacc_get_ifn_dim_arg (const gimple *stmt)
{
gcc_checking_assert (gimple_call_internal_fn (stmt) == IFN_GOACC_DIM_SIZE
|| gimple_call_internal_fn (stmt) == IFN_GOACC_DIM_POS);
tree arg = gimple_call_arg (stmt, 0);
HOST_WIDE_INT axis = TREE_INT_CST_LOW (arg);
gcc_checking_assert (axis >= 0 && axis < GOMP_DIM_MAX);
return (int) axis;
}

91
gcc/omp-general.h Normal file
View File

@ -0,0 +1,91 @@
/* General types and functions that are uselful for processing of OpenMP,
OpenACC and similar directivers at various stages of compilation.
Copyright (C) 2005-2016 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_OMP_GENERAL_H
#define GCC_OMP_GENERAL_H
#include "gomp-constants.h"
/* Flags for an OpenACC loop. */
enum oacc_loop_flags {
OLF_SEQ = 1u << 0, /* Explicitly sequential */
OLF_AUTO = 1u << 1, /* Compiler chooses axes. */
OLF_INDEPENDENT = 1u << 2, /* Iterations are known independent. */
OLF_GANG_STATIC = 1u << 3, /* Gang partitioning is static (has op). */
/* Explicitly specified loop axes. */
OLF_DIM_BASE = 4,
OLF_DIM_GANG = 1u << (OLF_DIM_BASE + GOMP_DIM_GANG),
OLF_DIM_WORKER = 1u << (OLF_DIM_BASE + GOMP_DIM_WORKER),
OLF_DIM_VECTOR = 1u << (OLF_DIM_BASE + GOMP_DIM_VECTOR),
OLF_MAX = OLF_DIM_BASE + GOMP_DIM_MAX
};
/* A structure holding the elements of:
for (V = N1; V cond N2; V += STEP) [...] */
struct omp_for_data_loop
{
tree v, n1, n2, step;
enum tree_code cond_code;
};
/* A structure describing the main elements of a parallel loop. */
struct omp_for_data
{
struct omp_for_data_loop loop;
tree chunk_size;
gomp_for *for_stmt;
tree pre, iter_type;
int collapse;
int ordered;
bool have_nowait, have_ordered, simd_schedule;
unsigned char sched_modifiers;
enum omp_clause_schedule_kind sched_kind;
struct omp_for_data_loop *loops;
};
#define OACC_FN_ATTRIB "oacc function"
extern tree omp_find_clause (tree clauses, enum omp_clause_code kind);
extern bool omp_is_reference (tree decl);
extern void omp_adjust_for_condition (location_t loc, enum tree_code *cond_code,
tree *n2);
extern tree omp_get_for_step_from_incr (location_t loc, tree incr);
extern void omp_extract_for_data (gomp_for *for_stmt, struct omp_for_data *fd,
struct omp_for_data_loop *loops);
extern gimple *omp_build_barrier (tree lhs);
extern int omp_max_vf (void);
extern int omp_max_simt_vf (void);
extern tree oacc_launch_pack (unsigned code, tree device, unsigned op);
extern void oacc_replace_fn_attrib (tree fn, tree dims);
extern void oacc_set_fn_attrib (tree fn, tree clauses, bool is_kernel,
vec<tree> *args);
extern tree oacc_build_routine_dims (tree clauses);
extern tree oacc_get_fn_attrib (tree fn);
extern bool oacc_fn_attrib_kernels_p (tree attr);
extern int oacc_get_fn_dim_size (tree fn, int axis);
extern int oacc_get_ifn_dim_arg (const gimple *stmt);
#endif /* GCC_OMP_GENERAL_H */

1407
gcc/omp-grid.c Normal file

File diff suppressed because it is too large Load Diff

27
gcc/omp-grid.h Normal file
View File

@ -0,0 +1,27 @@
/* Lowering and expansion of OpenMP directives for HSA GPU agents.
Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_OMP_GRID_H
#define GCC_OMP_GRID_H
extern tree omp_grid_lastprivate_predicate (struct omp_for_data *fd);
extern void omp_grid_gridify_all_targets (gimple_seq *body_p);
#endif /* GCC_OMP_GRID_H */

File diff suppressed because it is too large Load Diff

View File

@ -20,25 +20,12 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_OMP_LOW_H
#define GCC_OMP_LOW_H
struct omp_region;
extern tree find_omp_clause (tree, enum omp_clause_code);
extern void omp_expand_local (basic_block);
extern void free_omp_regions (void);
extern tree omp_reduction_init_op (location_t, enum tree_code, tree);
extern tree omp_reduction_init (tree, tree);
extern bool make_gimple_omp_edges (basic_block, struct omp_region **, int *);
extern void omp_finish_file (void);
extern tree omp_member_access_dummy_var (tree);
extern void replace_oacc_fn_attrib (tree, tree);
extern tree build_oacc_routine_dims (tree);
extern tree get_oacc_fn_attrib (tree);
extern void set_oacc_fn_attrib (tree, tree, bool, vec<tree> *);
extern bool oacc_fn_attrib_kernels_p (tree);
extern int get_oacc_ifn_dim_arg (const gimple *);
extern int get_oacc_fn_dim_size (tree, int);
extern tree omp_find_combined_for (gimple_stmt_iterator *gsi_p,
bool *handled_ops_p,
struct walk_stmt_info *wi);
extern GTY(()) vec<tree, va_gc> *offload_funcs;
extern GTY(()) vec<tree, va_gc> *offload_vars;
#endif /* GCC_OMP_LOW_H */

1718
gcc/omp-offload.c Normal file

File diff suppressed because it is too large Load Diff

30
gcc/omp-offload.h Normal file
View File

@ -0,0 +1,30 @@
/* Bits of OpenMP and OpenACC handling that is specific to device offloading
and a lowering pass for OpenACC device directives.
Copyright (C) 2005-2016 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_OMP_DEVICE_H
#define GCC_OMP_DEVICE_H
extern GTY(()) vec<tree, va_gc> *offload_funcs;
extern GTY(()) vec<tree, va_gc> *offload_vars;
extern void omp_finish_file (void);
#endif /* GCC_OMP_DEVICE_H */

View File

@ -76,7 +76,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-prop.h"
#include "gcse.h"
#include "tree-chkp.h"
#include "omp-low.h"
#include "omp-offload.h"
#include "hsa.h"
#include "edit-context.h"

View File

@ -54,7 +54,8 @@ along with GCC; see the file COPYING3. If not see
#include "value-prof.h"
#include "tree-inline.h"
#include "tree-ssa-live.h"
#include "omp-low.h"
#include "omp-general.h"
#include "omp-expand.h"
#include "tree-cfgcleanup.h"
#include "gimplify.h"
#include "attribs.h"
@ -863,7 +864,7 @@ make_edges_bb (basic_block bb, struct omp_region **pcur_region, int *pomp_index)
break;
CASE_GIMPLE_OMP:
fallthru = make_gimple_omp_edges (bb, pcur_region, pomp_index);
fallthru = omp_make_gimple_edges (bb, pcur_region, pomp_index);
break;
case GIMPLE_TRANSACTION:
@ -1006,7 +1007,7 @@ make_edges (void)
XDELETE (bb_to_omp_idx);
free_omp_regions ();
omp_free_regions ();
}
/* Add SEQ after GSI. Start new bb after GSI, and created further bbs as

View File

@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-vectorizer.h"
#include "tree-hasher.h"
#include "tree-parloops.h"
#include "omp-general.h"
#include "omp-low.h"
#include "tree-ssa.h"
#include "params.h"
@ -2045,7 +2046,7 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
tree clause = build_omp_clause (loc, OMP_CLAUSE_NUM_GANGS);
OMP_CLAUSE_NUM_GANGS_EXPR (clause)
= build_int_cst (integer_type_node, n_threads);
set_oacc_fn_attrib (cfun->decl, clause, true, NULL);
oacc_set_fn_attrib (cfun->decl, clause, true, NULL);
}
else
{
@ -3199,7 +3200,7 @@ parallelize_loops (bool oacc_kernels_p)
/* Do not parallelize loops in offloaded functions. */
if (!oacc_kernels_p
&& get_oacc_fn_attrib (cfun->decl) != NULL)
&& oacc_get_fn_attrib (cfun->decl) != NULL)
return false;
if (cfun->has_nonlocal_label)

View File

@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "tree-scalar-evolution.h"
#include "tree-vectorizer.h"
#include "omp-low.h"
#include "omp-general.h"
#include "diagnostic-core.h"
@ -152,7 +152,7 @@ gate_oacc_kernels (function *fn)
if (!flag_openacc)
return false;
tree oacc_function_attr = get_oacc_fn_attrib (fn->decl);
tree oacc_function_attr = oacc_get_fn_attrib (fn->decl);
if (oacc_function_attr == NULL_TREE)
return false;
if (!oacc_fn_attrib_kernels_p (oacc_function_attr))

View File

@ -55,7 +55,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-threadupdate.h"
#include "tree-ssa-scopedtables.h"
#include "tree-ssa-threadedge.h"
#include "omp-low.h"
#include "omp-general.h"
#include "target.h"
#include "case-cfn-macros.h"
#include "params.h"
@ -4003,8 +4003,8 @@ extract_range_basic (value_range *vr, gimple *stmt)
and pos is [0,N-1]. */
{
bool is_pos = cfn == CFN_GOACC_DIM_POS;
int axis = get_oacc_ifn_dim_arg (stmt);
int size = get_oacc_fn_dim_size (current_function_decl, axis);
int axis = oacc_get_ifn_dim_arg (stmt);
int size = oacc_get_fn_dim_size (current_function_decl, axis);
if (!size)
/* If it's dynamic, the backend might know a hardware

View File

@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "varasm.h"
#include "debug.h"
#include "output.h"
#include "omp-low.h"
#include "omp-offload.h"
#include "context.h"
const char * const tls_model_names[]={"none", "emulated",