2025-04-17 Kwok Cheung Yeung * c-parser.cc (c_parser_omp_clause_map): Apply iterator to push and pop mapper clauses. 2025-04-17 Kwok Cheung Yeung * c-parser.cc (c_parser_omp_iterators): Use macros for accessing iterator elements. (c_parser_omp_clause_affinity): Likewise. (c_parser_omp_clause_depend): Likewise. (c_parser_omp_clause_map): Likewise. (c_parser_omp_clause_from_to): Likewise. * c-typeck.cc (c_omp_finish_iterators): Likewise. 2025-04-17 Kwok Cheung Yeung * c-typeck.cc (handle_omp_array_sections): Add extra argument. Set argument to true if array section has a stride that is not one. (c_finish_omp_clauses): Disable strided updates when iterators are used in the clause. Emit sorry if strided. 2025-04-17 Kwok Cheung Yeung * c-parser.cc (c_parser_omp_clause_from_to): Parse 'iterator' modifier. * c-typeck.cc (c_finish_omp_clauses): Finish iterators for to/from clauses. 2025-04-17 Kwok Cheung Yeung * c-parser.cc (c_parser_omp_clause_map): Parse 'iterator' modifier. * c-typeck.cc (c_finish_omp_clauses): Finish iterators. Apply iterators to generated clauses. 2025-04-17 Kwok Cheung Yeung * c-typeck.cc (handle_omp_array_sections): Use OMP_ITERATOR_DECL_P. (c_finish_omp_clauses): Likewise. 2025-03-21 Paul-Antoine Arras Backported from master: 2025-03-21 Paul-Antoine Arras Tobias Burnus * c-parser.cc (c_parser_omp_clause_destroy): Make addressable. (c_parser_omp_clause_init): Make addressable. 2025-03-18 Sandra Loosemore Backported from master: 2025-03-11 Sandra Loosemore PR c/118579 * c-parser.cc (c_parser_omp_variable_list): Capture location information when KIND is OMP_CLAUSE_ERROR. (c_parser_oacc_data_clause_deviceptr): Use the improved location for diagnostics, and remove the FIXME. (c_finish_omp_declare_variant): Likewise. (c_parser_omp_threadprivate): Likewise. 2025-01-30 Tobias Burnus Backported from master: 2025-01-30 Tobias Burnus * c-parser.cc (c_finish_omp_declare_variant): Modify how append_args is saved internally. 2025-01-28 Tobias Burnus Backported from master: 2024-12-18 Tobias Burnus * c-parser.cc (c_parser_omp_clause_init_modifiers): New; split of from ... (c_parser_omp_clause_init): ... here; call it. (c_finish_omp_declare_variant): Parse 'append_args' clause. (c_parser_omp_clause_interop): Set tree used/read. 2025-01-27 Tobias Burnus Backported from master: 2024-12-12 Tobias Burnus * c-parser.cc (OMP_DISPATCH_CLAUSE_MASK): Add has_device_addr clause. (c_finish_omp_declare_variant): Add an 'inform' telling the user that 'need_device_addr' is invalid for C. 2025-01-27 Tobias Burnus Backported from master: 2024-11-22 Tobias Burnus * c-parser.cc (c_parser_omp_clause_interop): New. (c_parser_omp_clause_name, c_parser_omp_all_clauses, c_parser_omp_dispatch_body): Handle 'interop' clause. * c-typeck.cc (c_finish_omp_clauses): Likewise. 2025-01-27 Tobias Burnus Backported from master: 2024-11-22 Tobias Burnus * c-parser.cc (INCLUDE_STRING): Define. (c_parser_pragma): Handle 'interop' directive. (c_parser_omp_clause_name): Handle init, use, and destroy clauses. (c_parser_omp_all_clauses): Likewise; use C_ORT_OMP_INTEROP, if 'use' is permitted, for c_finish_omp_clauses. (c_parser_omp_clause_destroy, c_parser_omp_modifier_prefer_type, c_parser_omp_clause_init, c_parser_omp_clause_use, OMP_INTEROP_CLAUSE_MASK, c_parser_omp_interop): New. * c-typeck.cc (c_finish_omp_clauses): Add missing OPT_Wopenmp to a warning; handle new clauses. 2025-01-27 Paul-Antoine Arras Backported from master: 2024-11-20 Paul-Antoine Arras * c-parser.cc (c_parser_omp_dispatch): New function. (c_parser_omp_clause_name): Handle nocontext and novariants clauses. (c_parser_omp_clause_novariants): New function. (c_parser_omp_clause_nocontext): Likewise. (c_parser_omp_all_clauses): Handle nocontext and novariants clauses. (c_parser_omp_dispatch_body): New function adapted from c_parser_expr_no_commas. (OMP_DISPATCH_CLAUSE_MASK): Define. (c_parser_omp_dispatch): New function. (c_finish_omp_declare_variant): Parse adjust_args. (c_parser_omp_construct): Handle PRAGMA_OMP_DISPATCH. * c-typeck.cc (c_finish_omp_clauses): Handle OMP_CLAUSE_NOVARIANTS and OMP_CLAUSE_NOCONTEXT. 2025-01-23 Tobias Burnus Backported from master: 2024-09-25 Tobias Burnus * c-parser.cc (c_parser_omp_declare_target): Set target-used bit in omp_requires_mask. 2024-05-15 Jakub Jelinek * c-typeck.cc (c_finish_omp_clauses): Diagnose grainsize used together with num_tasks. 2024-05-04 Sandra Loosemore * c-decl.cc (c_decl_attributes): Don't add "omp declare target block". 2024-05-04 Sandra Loosemore * c-parser.c (c_parser_omp_context_selector): Remove metadirective_p parameter and conditionalization. (c_parser_omp_context_selector_specification): Remove metadirective_p parameter and adjust call not to pass it on. (c_finish_omp_declare_variant): Adjust arguments on calls to c_parser_omp_context_selector_specification and omp_context_selector_matches. (c_parser_omp_metadirective): Likewise. 2024-05-04 Sandra Loosemore * c-parser.cc (struct c_parser): Add new fields for metadirectives. (c_parser_skip_to_end_of_block_or_statement): Add metadirective_p parameter; use it to control brace and parentheses behavior. (mangle_metadirective_region_label): New. (c_parser_label, c_parser_statement_after_labels): Use it. (c_parser_pragma): Handle metadirective. (c_parser_omp_context_selector): Add metadirective_p flag, use it to gate support for non-constant user condition. (c_parser_omp_context_selector_specification): Add metadirective_p argument. (c_parser_finish_omp_declare_variant): Adjust call to above. (analyze_metadirective_body): New. (c_parser_omp_metadirective): New. 2024-05-04 Sandra Loosemore * c-parser.cc (c_finish_omp_declare_variant): Update calls to omp_check_context_selector and omp_context_selector_matches. 2023-10-26 Tobias Burnus * c-parser.cc (c_parser_omp_allocate): Change error wording. 2023-08-10 Julian Brown * c-parser.cc (c_parser_omp_variable_list): Support array-shaping operator in 'declare mapper' definitions. (c_parser_omp_clause_map): Pass C_ORT_OMP_DECLARE_MAPPER to c_parser_omp_variable_list in mapper definitions. (c_parser_omp_clause_from_to): Add parsing for mapper modifier. (c_parser_omp_target_update): Instantiate mappers. 2023-09-05 Julian Brown * c-parser.cc (c_parser_braced_init): Disallow array-shaping operator in braced init. (c_parser_conditional_expression): Disallow array-shaping operator in conditional expression. (c_parser_cast_expression): Add array-shaping operator support. (c_parser_postfix_expression): Disallow array-shaping operator in statement expressions. (c_parser_postfix_expression_after_primary): Add OpenMP array section stride support. (c_parser_expr_list): Disallow array-shaping operator in expression lists. (c_array_type_nelts_top, c_array_type_nelts_total): New functions. (c_parser_omp_variable_list): Support array-shaping operator. (c_parser_omp_target_update): Recognize GOMP_MAP_TO_GRID and GOMP_MAP_FROM_GRID map kinds as well as OMP_CLAUSE_TO/OMP_CLAUSE_FROM. * c-tree.h (c_omp_array_shaping_op_p, c_omp_has_array_shape_p): New extern declarations. (create_omp_arrayshape_type): Add prototype. * c-typeck.cc (c_omp_array_shaping_op_p, c_omp_has_array_shape_p): New globals. (build_omp_array_section): Permit integral types, not just integer constants, when creating array types for array sections. (create_omp_arrayshape_type): New function. (handle_omp_array_sections_1): Add DISCONTIGUOUS parameter. Add strided/rectangular array section support. (omp_array_section_low_bound): New function. (handle_omp_array_sections): Add DISCONTIGUOUS parameter. Add strided/rectangular array section support. (c_finish_omp_clauses): Update calls to handle_omp_array_sections. Handle discontiguous updates. 2023-09-05 Julian Brown * c-parser.cc (c_parser_postfix_expression_after_primary): Dummy stride support (for now). (struct omp_dim): Add stride support. (c_parser_omp_variable_list): Likewise. * c-tree.h (build_omp_array_section): Update prototype. * c-typeck.cc (mark_exp_read): Add stride support for OMP_ARRAY_SECTION. (build_omp_array_section): Add stride support. (handle_omp_array_sections_1): Add minimal stride support. 2023-07-03 Julian Brown * c-typeck.cc (handle_omp_array_sections): Pass pointer to clause to process instead of clause. (c_finish_omp_clauses): Update calls to handle_omp_array_sections. Handle cases where initial clause might be replaced. 2023-07-06 Julian Brown * c-parser.cc (c_parser_omp_target_data): Instantiate mappers for 'omp target data'. (c_parser_omp_target_enter_data): Instantiate mappers for 'omp target enter data'. (c_parser_omp_target_exit_data): Instantiate mappers for 'omp target exit data'. (c_parser_omp_target): Add c_omp_region_type argument to c_omp_instantiate_mappers call. * c-tree.h (c_omp_instantiate_mappers): Remove spurious prototype. 2023-06-30 Julian Brown * c-decl.cc (c_omp_mapper_id, c_omp_mapper_decl, c_omp_mapper_lookup, c_omp_extract_mapper_directive, c_omp_map_array_section, c_omp_scan_mapper_bindings_r, c_omp_scan_mapper_bindings): New functions. * c-objc-common.h (LANG_HOOKS_OMP_FINISH_MAPPER_CLAUSES, LANG_HOOKS_OMP_MAPPER_LOOKUP, LANG_HOOKS_OMP_EXTRACT_MAPPER_DIRECTIVE, LANG_HOOKS_OMP_MAP_ARRAY_SECTION): Define langhooks for C. * c-parser.cc (c_parser_omp_clause_map): Add KIND parameter. Handle mapper modifier. (c_parser_omp_all_clauses): Update call to c_parser_omp_clause_map with new kind argument. (c_parser_omp_target): Instantiate explicit mappers and record bindings for implicit mappers. (c_parser_omp_declare_mapper): Parse "declare mapper" directives. (c_parser_omp_declare): Support "declare mapper". * c-tree.h (c_omp_finish_mapper_clauses, c_omp_mapper_lookup, c_omp_extract_mapper_directive, c_omp_map_array_section, c_omp_mapper_id, c_omp_mapper_decl, c_omp_scan_mapper_bindings, c_omp_instantiate_mappers): Add prototypes. * c-typeck.cc (c_finish_omp_clauses): Handle GOMP_MAP_PUSH_MAPPER_NAME and GOMP_MAP_POP_MAPPER_NAME. (c_omp_finish_mapper_clauses): New function (langhook). 2024-06-05 Jakub Jelinek Frederik Harwath Sandra Loosemore * c-parser.cc (c_parser_skip_std_attribute_spec_seq): New function. (check_omp_intervening_code): Reject imperfectly nested tile. (c_parser_compound_statement_nostart): If want_nested_loop, use c_parser_omp_next_tokens_can_be_canon_loop instead of just checking for RID_FOR keyword. (c_parser_omp_clause_name): Handle full and partial clause names. (c_parser_omp_clause_allocate): Remove spurious semicolon. (c_parser_omp_clause_full, c_parser_omp_clause_partial): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FULL and PRAGMA_OMP_CLAUSE_PARTIAL. (c_parser_omp_next_tokens_can_be_canon_loop): New function. (c_parser_omp_loop_nest): Parse C23 attributes. Handle tile/unroll constructs. Use c_parser_omp_next_tokens_can_be_canon_loop instead of just checking for RID_FOR keyword. Only add_stmt (body) if it is non-NULL. (c_parser_omp_for_loop): Rename tiling variable to oacc_tiling. For OMP_CLAUSE_SIZES set collapse to list length of OMP_CLAUSE_SIZES_LIST. Use c_parser_omp_next_tokens_can_be_canon_loop instead of just checking for RID_FOR keyword. Remove spurious semicolon. Don't call c_omp_check_loop_binding_exprs if stmt is NULL. Skip generated loops. (c_parser_omp_tile_sizes, c_parser_omp_tile): New functions. (OMP_UNROLL_CLAUSE_MASK): Define. (c_parser_omp_unroll): New function. (c_parser_omp_construct): Handle PRAGMA_OMP_TILE and PRAGMA_OMP_UNROLL. * c-typeck.cc (c_finish_omp_clauses): Adjust wording of some of the conflicting clause diagnostic messages to include word clause. Handle OMP_CLAUSE_{FULL,PARTIAL,SIZES} and diagnose full vs. partial conflict. 2023-11-19 Tobias Burnus Chung-Lin Tang * c-parser.cc (c_parser_omp_clause_uses_allocators): New. (c_parser_omp_clause_name, c_parser_omp_all_clauses, OMP_TARGET_CLAUSE_MASK): Handle uses_allocators. * c-typeck.cc (c_finish_omp_clauses): Likewise. 2022-03-17 Kwok Cheung Yeung * c-typeck.cc (handle_omp_array_sections_1): Add check to ensure that clause is a map. 2021-08-19 Chung-Lin Tang * c-typeck.cc (handle_omp_array_sections_1): Robustify non-contiguous array check and reject non-DECL base-pointer cases as unsupported. 2022-02-03 Kwok Cheung Yeung * c-parser.ccc (c_parser_omp_clause_map): Update call to c_parser_omp_variable_list. (c_parser_omp_clause_to): Update call to c_parser_omp_var_list_parens. (c_parser_omp_clause_from): Likewise. 2018-12-13 Cesar Philippidis Nathan Sidwell Julian Brown * c-parser.c (c_parser_omp_variable_list): New c_omp_region_type argument. Use it to specialize handling of OMP_CLAUSE_REDUCTION for OpenACC. (c_parser_oacc_data_clause): Add region-type argument. (c_parser_oacc_data_clause_deviceptr): Likewise. (c_parser_omp_clause_reduction): Change is_omp boolean parameter to c_omp_region_type. Update call to c_parser_omp_variable_list. (c_parser_oacc_all_clauses): Update calls to c_parser_omp_clause_reduction. (c_parser_omp_all_clauses): Likewise. (c_parser_oacc_cache): Update call to c_parser_omp_var_list_parens. * c-typeck.c (c_finish_omp_clauses): Emit an error on orphan OpenACC gang reductions. Suppress user-defined reduction error for OpenACC. 2020-04-19 Chung-Lin Tang PR other/76739 * c-typeck.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.