Hi! This patch series completes the implementation of the OpenACC declare directive.
Patches applied to gomp-4_0-branch Thanks! Jim
===== gcc/ChangeLog.gomp * builtin-types.def (BT_FN_VOID_PTR_INT_UINT): New type. * gimple-pretty-print.c (dump_gimple_omp_target): Handle declare directive. * gimple.h (gf_mask): Add enum. (is_gimple_omp_oacc): Add declare directive. * gimplify.c (omp_notice_variable): Handle device_resident. (gimplify_omp_target_update): Handle declare directive. (gimplify_expr): Handle declare directive. * omp-builtins.def (BUILT_IN_GOACC_STATIC, BUILT_IN_GOACC_DECLARE): New types. * omp-low.c (expand_omp_target): Handle declare directive. (build_omp_regions_1): Likewise. (lower_omp_target): Likewise. (make_gimple_omp_edges): Likewise. * varpool.c (gomp-constants.h): Add inclusion. (make_offloadable_1, make_offloadable): New functions. (get_create): Add calls to make_offloadable. ====== gcc/c/ChangeLog.gomp * c-parser.c (tree-iterator.h): Add inclusion. (check_oacc_vars1, check_oacc_vars, find_oacc_return, finish_oacc_declare): New functions. (oacc_return): New structure. (oacc_returns): New variable. (c_parser_declaration_or_fndef): Add call to finish_oacc_declare. (oacc_dcl_idx): New variable. (c_parser_oacc_declare): Rewrite. ===== gcc/cp/ChangeLog.gomp * decl.c (gomp-constants.h): Add inclusion. (check_oacc_vars1, check_oacc_vsars, find_oacc_return, finish_oacc_declare): New functions. (finish_function): Add call to finish_oacc_declare. * parser.c (tree-iterator.h): Add inclusion. (oacc_dcl_idx): New variable. (OACC_DECLARE_CLAUSE_MASK): New macro. (cp_parser_oacc_declare): New function. (cp_parser_pragma): Handle parsing of declare directive. * pt.c (tsubr_expr): Add handling of declare directive. ===== gcc/fortran/ChangeLog.gomp * f95-lang.c (gfc_attribute_table): New entry. * gfortran.h (symbol_attribute): New attributes. (gfc_omp_map_op): New enums. (OMP_LIST_LINK): New enum. (gfc_oacc_declare): Add member: module_var. (finish_oacc_declare): Add calling parm. * module.c (ab_attribute): Add enums. (attr_bits): Add initialization of new attribute bits. (mio_symbol_attribute): Add handling of new attribute bits. * openmp.c (OMP_CLAUSE_LINK): New defintion. (gfc_match_omp_clauses): Add handling of link clause. (OACC_DECLARE_CLAUSES): Update declare directive clauses. (gfc_match_oacc_declare): Add handling of device_resident and link clauses. (gfc_resolve_oacc_declare): Add handling of link clause. * symbol.c (check_conflict): Add checks for declare clauses in modules. (gfc_add_oacc_declare_create, gfc_add_declare_copyin, gfc_add_oacc_declare_deviceptr, gfc_add_oacc_declare_device_resident): New functions. (gfc_add_target): Add checks for declare attrs. * trans-decl.c (add_attributes_to_decl): Add creation of attribute. (oacc_return): New structure. (oacc_returns, module_oacc_clauses): New variables. (find_oacc_return, add_clause, find_module_oacc_declare_clauses): New functions. (finish_oacc_declare): Rename from insert_oacc_declare and rewrite. (gfc_generate_function_code): Change calling of finish_oacc_declare. * trans-openmp.c (gfc_trans_omp_clauses): Add handling of link and device_resident clauses. (gfc_trans_oacc_declare): Rewrite. * trans-stmt.c (gfc_trans_block_construct): Change calling of finish_oacc_declare. * types.def (BT_FN_VOID_PTR_INT_UINT): New type. ===== gcc/testsuite/ChangeLog.gomp * c-c++-common/goacc/declare-1.c: Update tests. * c-c++-common/goacc/declare-2.c: Likewise. * gfortran.dg/goacc/declare-1.f95: Update tests. ===== libgomp/ChangeLog.gomp * libgomp.map: Add GOACC_declare and GOACC_register_static. * oacc-init.c (acc_shutdown_1): Add call to acc_deallocate_static. (acc_init): Add call to acc_allocate_static. * oacc-int.h (goacc_allocate_static, goacc_deallocate_static): New declarations. * oacc-parallel.c (oacc_static): New structure. (oacc_statics): New variable. (goacc_allocate_static, goacc_deallocate_static, GOACC_register_static, GOACC_declare): New functions. * testsuite/libgomp.oacc-c++/declare-1.C: New file. * testsuite/libgomp.oacc-c-c++-common/declare-1.c: New file. * testsuite/libgomp.oacc-c-c++-common/declare-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/declare-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/declare-4.c: Likewise. * testsuite/libgomp.oacc-fortran/declare-1.f90: Update test. * testsuite/libgomp.oacc-fortran/declare-2.f90: New file. * testsuite/libgomp.oacc-fortran/declare-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/declare-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/declare-5.f90: Likewise.