2023-04-05 Julian Brown * decl2.cc (tree-inline.h): Include. (do_static_initialization_or_destruction): Change OMP_TARGET parameter to pass the host version of the SSDF function decl. Use copy_tree_body_r to clone init stmt. Update forward declaration. (c_parse_final_cleanups): Update calls to do_static_initialization_or_destruction. Use TREE_CHAIN instead of OMP_CLAUSE_CHAIN. 2023-04-02 Thomas Schwinge * decl2.cc (one_static_initialization_or_destruction): Remove 'omp_target' formal parameter. Adjust all users. 2023-03-27 Julian Brown * decl2.cc (priority_info): Add omp_tgt_initializations_p and omp_tgt_destructions_p. (start_objects, start_static_storage_duration_function, do_static_initialization_or_destruction, one_static_initialization_or_destruction, generate_ctor_or_dtor_function): Add 'omp_target' parameter. Support "declare target" decls. Update forward declarations. (OMP_SSDF_IDENTIFIER): New macro. (omp_tgt_ssdf_decls): New vec. (get_priority_info): Initialize omp_tgt_initializations_p and omp_tgt_destructions_p fields. (handle_tls_init): Update call to omp_static_initialization_or_destruction. (c_parse_final_cleanups): Support constructors/destructors on OpenMP offload targets. 2023-03-27 Frederik Harwath * parser.cc (cp_parser_is_pragma): New function. (cp_parser_omp_nested_loop_transform_clauses): Add argument for the level of loop-nest at which the clauses appear, ... (cp_parser_omp_tile): ... adjust use here, (cp_parser_omp_unroll): ... and here, (cp_parser_omp_for_loop): ... and here. Stop treating loop 2023-03-27 Frederik Harwath * parser.cc (cp_parser_omp_clause_unroll_full): Set new OMP_CLAUSE_TRANSFORM_LEVEL operand to default value. (cp_parser_omp_clause_unroll_partial): Likewise. (cp_parser_omp_tile_sizes): Likewise. (cp_parser_omp_loop_transform_clause): Likewise. (cp_parser_omp_nested_loop_transform_clauses): Likewise. (cp_parser_omp_unroll): Likewise. * pt.cc (tsubst_omp_clauses): Adjust OMP_CLAUSE_UNROLL_PARTIAL and OMP_CLAUSE_TILE handling to changed number of operands. 2023-03-27 Frederik Harwath * parser.cc (cp_parser_omp_clause_unroll_partial): Adjust. (cp_parser_nested_omp_unroll_clauses): Rename ... (cp_parser_omp_nested_loop_transform_clauses): ... to this. (cp_parser_omp_for_loop): Handle "omp tile" parsing in loop nests. (cp_parser_omp_tile_sizes): New function, parses single "sizes" clause (cp_parser_omp_tile): New function for parsing "omp tile". (cp_parser_omp_loop_transform_clause): New function. (cp_parser_omp_unroll): Adjust to renaming. (cp_parser_omp_construct): Handle PRAGMA_OMP_TILE. (cp_parser_pragma): Likewise. * pt.cc (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE. * semantics.cc (finish_omp_clauses): Likewise. 2023-03-27 Frederik Harwath * parser.cc (cp_parser_oacc_clause_tile): Adjust to renamings. (cp_parser_omp_clause_collapse): Likewise. (cp_parser_omp_for_loop): Likewise. * pt.cc (tsubst_omp_clauses): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_for): Likewise. 2023-03-27 Frederik Harwath * cp-gimplify.cc (cp_gimplify_expr): Handle OMP_UNROLL. (cp_fold_r): Likewise. (cp_genericize_r): Likewise. * parser.cc (cp_parser_omp_clause_name): Handle "full" clause. (check_no_duplicate_clause): Change return type to bool and return check result. (cp_parser_omp_clause_unroll_full): New function for parsing the "unroll clause". (cp_parser_omp_clause_unroll_partial): New function for parsing the "partial" clause. (cp_parser_omp_all_clauses): Handle OMP_CLAUSE_UNROLL and OMP_CLAUSE_FULL. (cp_parser_nested_omp_unroll_clauses): New function for parsing "omp unroll" directives following another directive. (cp_parser_omp_for_loop): Handle "omp unroll" directives between directive and loop. (OMP_UNROLL_CLAUSE_MASK): New definition. (cp_parser_omp_unroll): New function for parsing "omp unroll" loops that are not associated with another directive. (cp_parser_omp_construct): Handle PRAGMA_OMP_UNROLL. (cp_parser_pragma): Handle PRAGMA_OMP_UNROLL. * pt.cc (tsubst_omp_clauses): Handle OMP_CLAUSE_UNROLL_PARTIAL, OMP_CLAUSE_UNROLL_FULL, and OMP_CLAUSE_UNROLL_NONE. (tsubst_expr): Handle OMP_UNROLL. * semantics.cc (finish_omp_clauses): Handle OMP_CLAUSE_UNROLL_FULL, OMP_CLAUSE_UNROLL_PARTIAL, and OMP_CLAUSE_UNROLL_NONE. 2023-02-09 Kwok Cheung Yeung * parser.cc (cp_parser_omp_var_list_no_open): Add new parameter with default. Parse 'present' motion modifier and apply. (cp_parser_omp_clause_defaultmap): Parse 'present' in defaultmap. (cp_parser_omp_clause_map): Parse 'present' modifier in map clauses. (cp_parser_omp_all_clauses): Allow use of 'present' in 'to' and 'from' clauses. (cp_parser_omp_target_data): Allow map clauses with 'present' modifiers. (cp_parser_omp_target_enter_data): Likewise. (cp_parser_omp_target_exit_data): Likewise. * semantics.cc (finish_omp_target): Accept map clauses with 'present' modifiers. 2023-02-01 Tobias Burnus Backport from mainline: 2023-02-01 Jakub Jelinek PR c++/108607 * constexpr.cc (cxx_eval_constant_expression): Handle OMP_* and OACC_* constructs as non-constant. (potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE. 2023-01-09 Tobias Burnus Backport from mainline: 2023-01-05 Jakub Jelinek PR c++/108286 * semantics.cc (finish_omp_target_clauses): Ignore clauses other than OMP_CLAUSE_MAP. 2022-12-21 Tobias Burnus Backport from mainline: 2022-12-21 Jakub Jelinek PR c++/108180 * pt.cc (tsubst_expr): Don't call cp_finish_decl on DECL_OMP_PRIVATIZED_MEMBER vars. 2022-10-28 Tobias Burnus Backport from mainline: 2022-10-28 Jakub Jelinek * parser.cc (cp_parser_omp_all_clauses): Allow optional comma before the first clause even in pragma syntax. (cp_parser_omp_allocate, cp_parser_omp_atomic, cp_parser_omp_depobj, cp_parser_omp_flush, cp_parser_omp_scan_loop_body, cp_parser_omp_ordered, cp_parser_omp_assumption_clauses, cp_finish_omp_declare_variant, cp_parser_omp_declare_target, cp_parser_omp_declare_reduction_exprs, cp_parser_omp_requires, cp_parser_omp_error): Likewise. 2022-10-27 Marcel Vollweiler * semantics.cc (finish_omp_clauses): Remove "gang reduction on an orphan loop" checking. 2022-10-04 Tobias Burnus Backport from mainline: 2022-10-04 Jakub Jelinek * cp-tree.h (struct omp_declare_target_attr): Rename to ... (cp_omp_declare_target_attr): ... this. Add device_type member. (omp_begin_assumes_data): Rename to ... (cp_omp_begin_assumes_data): ... this. (struct saved_scope): Change types of omp_declare_target_attribute and omp_begin_assumes. * parser.cc (cp_parser_omp_clause_device_type): Uncomment check_no_duplicate_clause call. (cp_parser_omp_all_clauses): Fix up pasto, c_name for OMP_CLAUSE_LINK should be "link" rather than "to". (cp_parser_omp_declare_target): Adjust for omp_declare_target_attr to cp_omp_declare_target_attr changes, push -1 as device_type. Use error_at rather than warning_at for declare target with only device_type clauses. (OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Define. (cp_parser_omp_begin): Add begin declare target support. Adjust for omp_begin_assumes_data to cp_omp_begin_assumes_data change. (cp_parser_omp_end): Adjust for the omp_declare_target_attr to cp_omp_declare_target_attr and omp_begin_assumes_data to cp_omp_begin_assumes_data type changes, adjust diagnostics wording and simplify format strings for easier translations. * semantics.cc (finish_translation_unit): Likewise. * decl2.cc (cplus_decl_attributes): If device_type was present on begin declare target, add "omp declare target host" and/or "omp declare target nohost" attributes. 2022-09-27 Tobias Burnus Backport from mainline: 2022-09-27 Jakub Jelinek * cp-tree.h (struct omp_begin_assumes_data): New type. (struct saved_scope): Add omp_begin_assumes member. * parser.cc: Include bitmap.h. (cp_parser_omp_assumption_clauses, cp_parser_omp_assume, cp_parser_omp_assumes, cp_parser_omp_begin): New functions. (cp_parser_omp_end_declare_target): Rename to ... (cp_parser_omp_end): ... this. Handle also end assumes. (cp_parser_omp_construct): Handle PRAGMA_OMP_ASSUME. (cp_parser_pragma): Handle PRAGMA_OMP_ASSUME, PRAGMA_OMP_ASSUMES and PRAGMA_OMP_BEGIN. Handle PRAGMA_OMP_END rather than PRAGMA_OMP_END_DECLARE_TARGET and call cp_parser_omp_end for it rather than cp_parser_omp_end_declare_target. * pt.cc (apply_late_template_attributes): Also temporarily clear omp_begin_assumes. * semantics.cc (finish_translation_unit): Also diagnose #pragma omp begin assumes without corresponding #pragma omp end assumes. 2022-09-09 Paul-Antoine Arras Backport from mainline: 2022-09-07 Jakub Jelinek PR c++/106829 * semantics.cc (finish_omp_target_clauses): If current_function_decl isn't a nonstatic member function, don't set data.current_object to non-NULL. 2022-09-07 Tobias Burnus Backport from mainline: 2022-09-06 Jakub Jelinek * pt.cc (tsubst_expr) : If OMP_BODY was NULL, keep it NULL after instantiation too. 2022-09-06 Tobias Burnus Backport from mainline: 2022-09-06 Jakub Jelinek * parser.cc (cp_parser_omp_clause_doacross_sink): Don't verify val in omp_cur_iteration - 1 has integer_type_node type. 2022-09-05 Tobias Burnus Backport from mainline: 2022-09-03 Jakub Jelinek * parser.cc (cp_parser_omp_clause_name): Handle doacross. (cp_parser_omp_clause_depend_sink): Renamed to ... (cp_parser_omp_clause_doacross_sink): ... this. Add depend_p argument. Handle parsing of doacross(sink:omp_cur_iteration-1). Use OMP_CLAUSE_DOACROSS_SINK_NEGATIVE instead of OMP_CLAUSE_DEPEND_SINK_NEGATIVE, build OMP_CLAUSE_DOACROSS instead of OMP_CLAUSE_DEPEND and set OMP_CLAUSE_DOACROSS_DEPEND flag on it. (cp_parser_omp_clause_depend): Use OMP_CLAUSE_DOACROSS_SINK and OMP_CLAUSE_DOACROSS_SOURCE instead of OMP_CLAUSE_DEPEND_SINK and OMP_CLAUSE_DEPEND_SOURCE, build OMP_CLAUSE_DOACROSS for depend(source) and set OMP_CLAUSE_DOACROSS_DEPEND on it. (cp_parser_omp_clause_doacross): New function. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DOACROSS. (cp_parser_omp_depobj): Use OMP_CLAUSE_DEPEND_INVALID instead of OMP_CLAUSE_DEPEND_SOURCE. (cp_parser_omp_for_loop): Don't diagnose here linear clause together with ordered with argument. (cp_parser_omp_simd): Don't diagnose ordered clause with argument on for simd. (OMP_ORDERED_DEPEND_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DOACROSS. (cp_parser_omp_ordered): Handle also doacross and adjust for it diagnostic wording. * pt.cc (tsubst_omp_clause_decl): Use OMP_CLAUSE_DOACROSS_SINK_NEGATIVE instead of OMP_CLAUSE_DEPEND_SINK_NEGATIVE. (tsubst_omp_clauses): Handle OMP_CLAUSE_DOACROSS. (tsubst_expr): Use OMP_CLAUSE_DEPEND_INVALID instead of OMP_CLAUSE_DEPEND_SOURCE. * semantics.cc (cp_finish_omp_clause_depend_sink): Rename to ... (cp_finish_omp_clause_doacross_sink): ... this. (finish_omp_clauses): Handle OMP_CLAUSE_DOACROSS. Don't handle OMP_CLAUSE_DEPEND_SOURCE and OMP_CLAUSE_DEPEND_SINK. 2022-08-17 Tobias Burnus Backport from mainline: 2022-08-17 Tobias Burnus Chung-Lin Tang PR c++/104493 * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Remove. * cp-tree.h (cp_omp_mappable_type, cp_omp_emit_unmappable_type_notes): Remove. * decl2.cc (cp_omp_mappable_type_1, cp_omp_mappable_type, cp_omp_emit_unmappable_type_notes): Remove. (cplus_decl_attributes): Call omp_mappable_type instead of removed langhook. * decl.cc (cp_finish_decl): Likewise; call cxx_incomplete_type_inform in lieu of cp_omp_emit_unmappable_type_notes. * semantics.cc (finish_omp_clauses): Likewise. 2022-07-29 Tobias Burnus Backport from mainline: 2022-07-29 Jakub Jelinek PR c++/106448 * parser.cc (cp_parser_omp_atomic): For simple cast followed by CPP_QUERY token, don't try cp_parser_binary_operation if compare is true. 2022-07-05 Tobias Burnus Backport from mainline: 2022-07-04 Tobias Burnus Chung-Lin Tang Thomas Schwinge * parser.cc (cp_parser_omp_target_data, cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data, cp_parser_omp_target_update): Set OMP_REQUIRES_TARGET_USED. (cp_parser_omp_requires): Remove sorry. 2022-07-05 Tobias Burnus Reverted: 2021-02-02 Chung-Lin Tang * parser.cc (cp_parser_simple_declaration): Set OMP_REQUIRES_TARGET_USED in omp_requires_mask if function has "omp declare target" attribute. 2022-07-05 Tobias Burnus Backport from mainline: 2022-07-01 Tobias Burnus * parser.cc (cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): Accept tofrom map-type modifier but use 'to' / 'from' internally. 2022-07-05 Tobias Burnus Backport from mainline: 2022-06-07 Jakub Jelinek * parser.cc (cp_parser_omp_clause_linear): Parse OpenMP 5.2 style linear clause modifiers. Set OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER flag on the clauses when old style modifiers are used. * semantics.cc (finish_omp_clauses): Only reject linear clause with val modifier on simd or for if the old style modifiers are used. 2022-07-05 Tobias Burnus Backport from mainline: 2022-05-31 Jakub Jelinek * parser.cc (OMP_SCOPE_CLAUSE_MASK): Add firstprivate and allocate clauses. 2022-07-05 Tobias Burnus Backport from mainline: 2022-05-28 Jakub Jelinek * parser.cc (handle_omp_declare_target_clause): If OMP_CLAUSE_LINK was seen first, use "%" or "%" depending on OMP_CLAUSE_ENTER_TO of the current clause, otherwise use "% or %" wording. 2022-07-05 Tobias Burnus Backport from mainline: 2022-05-27 Jakub Jelinek * parser.cc (cp_parser_omp_clause_name): Parse enter clause. (cp_parser_omp_all_clauses): For to clause on declare target, use OMP_CLAUSE_ENTER clause with OMP_CLAUSE_ENTER_TO instead of OMP_CLAUSE_TO_DECLARE clause. Handle PRAGMA_OMP_CLAUSE_ENTER. (OMP_DECLARE_TARGET_CLAUSE_MASK): Add enter clause. (cp_parser_omp_declare_target): Use OMP_CLAUSE_ENTER instead of OMP_CLAUSE_TO_DECLARE. * semantics.cc (finish_omp_clauses): Handle OMP_CLAUSE_ENTER instead of OMP_CLAUSE_TO_DECLARE, to OMP_CLAUSE_ENTER_TO use "to" as clause name in diagnostics instead of omp_clause_code_name[OMP_CLAUSE_CODE (c)]. 2022-07-05 Tobias Burnus Backport from mainline: 2022-05-24 Jakub Jelinek PR c/105378 * parser.cc (OMP_TASKWAIT_CLAUSE_MASK): Add nowait clause. 2022-07-04 Tobias Burnus Backport from mainline: 2022-05-17 Jakub Jelinek * parser.cc (cp_parser_omp_clause_depend): Parse inoutset depend-kind. (cp_parser_omp_depobj): Likewise. * cxx-pretty-print.cc (cxx_pretty_printer::statement): Handle OMP_CLAUSE_DEPEND_INOUTSET. 2022-07-04 Tobias Burnus Backport from mainline: 2022-05-16 Marcel Vollweiler * pt.cc (tsubst_omp_clauses): Added OMP_CLAUSE_HAS_DEVICE_ADDR. * semantics.cc (finish_omp_clauses): Added template decl processing. 2022-06-30 Tobias Burnus * parser.cc (cp_parser_omp_requires): Add missing %<...%> in error. 2022-03-17 Kwok Cheung Yeung * semantics.cc (handle_omp_array_sections_1): Add check to ensure that clause is a map. 2022-05-12 Jakub Jelinek Backport from mainline: 2022-05-12 Jakub Jelinek * lex.cc (init_reswords): Register omp_all_memory as keyword if flag_openmp. * parser.cc (cp_parser_primary_expression): Diagnose uses of omp_all_memory in postfix expressions. (cp_parser_omp_var_list_no_open): Handle omp_all_memory in depend clause. * semantics.cc (finish_omp_clauses): Handle omp_all_memory keyword in depend clause as null_pointer_node, diagnose invalid uses. * pt.cc (tsubst_omp_clause_decl): Pass through omp_all_memory. 2022-06-17 Chung-Lin Tang Backport from mainline: 2022-06-17 Chung-Lin Tang * parser.cc (cp_parser_omp_clause_name): Add case for uses_allocators clause. (cp_parser_omp_clause_uses_allocators): New function. (cp_parser_omp_all_clauses): Add PRAGMA_OMP_CLAUSE_USES_ALLOCATORS case. (OMP_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USES_ALLOCATORS to mask. * semantics.cc (finish_omp_clauses): Add case handling for OMP_CLAUSE_USES_ALLOCATORS. 2022-04-20 Andrew Stubbs * parser.cc (cp_parser_omp_requires): Check requires unified_address for conflict with -foffload-memory=shared. 2022-03-10 Andrew Stubbs Backport of the patch posted at https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591351.html * parser.cc (cp_parser_omp_requires): Check compatibility of -foffload-memory option with requires directive. 2022-02-24 Chung-Lin Tang * semantics.cc (handle_omp_array_sections): Add handling for creating array-reference base-pointer attachment clause. 2022-02-18 Kwok Cheung Yeung * parser.cc (cp_parser_omp_construct): Move handling of PRAGMA_OMP_METADIRECTIVE from here... (cp_parser_pragma): ...to here. (analyze_metadirective_body): Check that the bracket nesting level is also zero before stopping the adding of tokens on encountering a close brace. (cp_parser_omp_metadirective): Modify function signature and update. Do not assert on remaining tokens if there has been a parse error. 2022-01-25 Kwok Cheung Yeung * parser.cc (omp_target_device_selectors): New. (cp_parser_omp_context_selector): Accept 'target_device' selector set. Treat 'device_num' selector as expression. (cp_parser_omp_context_selector_specification): Handle 'target_device' selector set. 2022-01-25 Kwok Cheung Yeung * parser.cc (cp_parser_skip_to_end_of_statement): Revert. (cp_parser_skip_to_end_of_block_or_statement): Track bracket depth separately from nesting depth. 2022-01-25 Kwok Cheung Yeung * parser.cc (cp_parser_skip_to_end_of_statement): Handle parentheses. (cp_parser_skip_to_end_of_block_or_statement): Likewise. (cp_parser_omp_context_selector): Add extra argument. Allow non-constant expressions. (cp_parser_omp_context_selector_specification): Add extra argument and propagate to cp_parser_omp_context_selector. (analyze_metadirective_body): New. (cp_parser_omp_metadirective): New. (cp_parser_omp_construct): Handle PRAGMA_OMP_METADIRECTIVE. (cp_parser_pragma): Handle PRAGMA_OMP_METADIRECTIVE. 2021-08-19 Chung-Lin Tang * semantics.cc (handle_omp_array_sections_1): Robustify non-contiguous array check and reject non-DECL base-pointer cases as unsupported. 2021-03-03 Chung-Lin Tang * decl2.cc (cp_omp_mappable_type_1): Allow fields with DECL_DECLARED_CONSTEXPR_P to be mapped. 2021-02-02 Chung-Lin Tang * parser.cc (cp_parser_simple_declaration): Set OMP_REQUIRES_TARGET_USED in omp_requires_mask if function has "omp declare target" attribute. (cp_parser_omp_target_data): Set OMP_REQUIRES_TARGET_USED in omp_requires_mask. (cp_parser_omp_target_enter_data): Likewise. (cp_parser_omp_target_exit_data): Likewise. (cp_parser_omp_requires): Adjust to only mention "not implemented yet" for OMP_REQUIRES_DYNAMIC_ALLOCATORS. 2021-02-01 Chung-Lin Tang * semantics.cc (finish_omp_clauses): Adjust to allow duplicate mapped variables for OpenMP. 2020-08-19 Sandra Loosemore Add a "combined" flag for "acc kernels loop" etc directives. * parser.cc (cp_parser_oacc_loop): Set OACC_LOOP_COMBINED. 2020-03-31 Sandra Loosemore * semantics.cc (handle_omp_array_sections_1): Call STRIP_NOPS on length and low_bound; (handle_omp_array_sections): Likewise. 2020-03-27 Sandra Loosemore * decl.cc (cp_unwrap_for_init): New. (finish_function): Call c_oacc_annotate_loops_in_kernels_regions. 2022-02-03 Kwok Cheung Yeung * parser.ccc (cp_parser_omp_clause_map): Update call to cp_parser_omp_var_list_no_open. (cp_parser_omp_all_clauses): Update calls to cp_parser_omp_var_list. 2018-12-13 Cesar Philippidis Nathan Sidwell Julian Brown * parser.c (cp_parser_omp_var_list_no_open): New c_omp_region_type argument. Use it to specialize handling of OMP_CLAUSE_REDUCTION for OpenACC. (cp_parser_omp_var_list): Add c_omp_region_type argument. Update call to cp_parser_omp_var_list_parens. (cp_parser_oacc_data_clause): Update call to cp_parser_omp_var_list. (cp_parser_omp_clause_reduction): Change is_omp boolean parameter to c_omp_region_type. Update call to cp_parser_omp_var_list_no_open. (cp_parser_oacc_all_clauses): Update call to cp_parser_omp_clause_reduction. (cp_parser_omp_all_clauses): Likewise. * semantics.c (finish_omp_reduction_clause): Add c_omp_region_type argument. Suppress user-defined reduction error for OpenACC. (finish_omp_clauses): Emit an error on orphan OpenACC gang reductions. 2020-04-19 Chung-Lin Tang PR other/76739 * semantics.cc (handle_omp_array_sections_1): Add 'bool &non_contiguous' parameter, adjust recursive call site, add cases for allowing pointer based multi-dimensional arrays for OpenACC. (handle_omp_array_sections): Adjust handle_omp_array_sections_1 call, handle non-contiguous case to create dynamic array map.