aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.cc
diff options
context:
space:
mode:
authorChung-Lin Tang <cltang@baylibre.com>2024-11-11 17:16:26 +0000
committerSandra Loosemore <sloosemore@baylibre.com>2025-05-15 20:25:51 +0000
commitef9bac1dbc7c600372100206995f4a4598475005 (patch)
tree63a3b9fe6689368bb056d262865235aff1836246 /gcc/c/c-parser.cc
parent2ab0f672c29b875f4c5cb73b3770598981d9dba5 (diff)
downloadgcc-ef9bac1dbc7c600372100206995f4a4598475005.zip
gcc-ef9bac1dbc7c600372100206995f4a4598475005.tar.gz
gcc-ef9bac1dbc7c600372100206995f4a4598475005.tar.bz2
OpenACC 2.7: Connect readonly modifier to points-to analysis
This patch links the readonly modifier to points-to analysis. In front-ends, firstprivate pointer clauses are marked with OMP_CLAUSE_MAP_POINTS_TO_READONLY set true, and later during lowering the receiver side read of pointer has VAR_POINTS_TO_READONLY set true, which later directs SSA_NAME_POINTS_TO_READONLY_MEMORY set to true during SSA conversion. SSA_NAME_POINTS_TO_READONLY_MEMORY is an already existing flag connected with alias oracle routines in tree-ssa-alias.cc, thus making the readonly-modifier effective in hinting points-to analysis. Currently have one testcase c-c++-common/goacc/readonly-2.c where we can demonstrate 'readonly' can avoid a clobber by function call. This patch is ported from upstream submission: https://gcc.gnu.org/pipermail/gcc-patches/2024-April/648728.html gcc/c-family/ChangeLog: * c-omp.cc (c_omp_address_inspector::expand_array_base): Set OMP_CLAUSE_MAP_POINTS_TO_READONLY on pointer clause. (c_omp_address_inspector::expand_component_selector): Likewise. gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_trans_omp_array_section): Set OMP_CLAUSE_MAP_POINTS_TO_READONLY on pointer clause. gcc/ChangeLog: * gimple-expr.cc (copy_var_decl): Copy VAR_POINTS_TO_READONLY for VAR_DECLs. * omp-low.cc (lower_omp_target): Set VAR_POINTS_TO_READONLY for variables of receiver refs. * tree-pretty-print.cc (dump_omp_clause): Print OMP_CLAUSE_MAP_POINTS_TO_READONLY. (dump_generic_node): Print SSA_NAME_POINTS_TO_READONLY_MEMORY. * tree-ssanames.cc (make_ssa_name_fn): Set SSA_NAME_POINTS_TO_READONLY_MEMORY if DECL_POINTS_TO_READONLY is set. * tree.h (OMP_CLAUSE_MAP_POINTS_TO_READONLY): New macro. (VAR_POINTS_TO_READONLY): New macro. gcc/testsuite/ChangeLog: * c-c++-common/goacc/readonly-1.c: Adjust testcase. * c-c++-common/goacc/readonly-2.c: New testcase. * gfortran.dg/goacc/readonly-1.f90: Adjust testcase. * gfortran.dg/pr67170.f90: Likewise.
Diffstat (limited to 'gcc/c/c-parser.cc')
0 files changed, 0 insertions, 0 deletions