From: Cesar Philippidis Date: Fri, 17 Jun 2016 20:32:03 +0000 (-0700) Subject: openmp.c (match_acc): New generic function to parse OpenACC directives. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8559b90fc164ff07436971c520db20cb475c9944;p=gcc.git openmp.c (match_acc): New generic function to parse OpenACC directives. gcc/fortran/ * openmp.c (match_acc): New generic function to parse OpenACC directives. (gfc_match_oacc_parallel_loop): Use it. (gfc_match_oacc_parallel): Likewise. (gfc_match_oacc_kernels_loop): Likewise. (gfc_match_oacc_kernels): Likewise. (gfc_match_oacc_data): Likewise. (gfc_match_oacc_host_data): Likewise. (gfc_match_oacc_loop): Likewise. (gfc_match_oacc_enter_data): Likewise. (gfc_match_oacc_exit_data): Likewise. From-SVN: r237565 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7150f84841e..0bb604c51ed 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,17 @@ +2016-06-17 Cesar Philippidis + + * openmp.c (match_acc): New generic function to parse OpenACC + directives. + (gfc_match_oacc_parallel_loop): Use it. + (gfc_match_oacc_parallel): Likewise. + (gfc_match_oacc_kernels_loop): Likewise. + (gfc_match_oacc_kernels): Likewise. + (gfc_match_oacc_data): Likewise. + (gfc_match_oacc_host_data): Likewise. + (gfc_match_oacc_loop): Likewise. + (gfc_match_oacc_enter_data): Likewise. + (gfc_match_oacc_exit_data): Likewise. + 2016-06-16 Martin Liska * trans-stmt.c (gfc_trans_simple_do): Predict the edge. diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 2c9279401a2..f5148667f5c 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1411,101 +1411,63 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask, (OMP_CLAUSE_GANG | OMP_CLAUSE_WORKER | OMP_CLAUSE_VECTOR | OMP_CLAUSE_SEQ) -match -gfc_match_oacc_parallel_loop (void) +static match +match_acc (gfc_exec_op op, uint64_t mask) { gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_PARALLEL_LOOP_CLAUSES, false, false, - true) != MATCH_YES) + if (gfc_match_omp_clauses (&c, mask, false, false, true) != MATCH_YES) return MATCH_ERROR; - - new_st.op = EXEC_OACC_PARALLEL_LOOP; + new_st.op = op; new_st.ext.omp_clauses = c; return MATCH_YES; } +match +gfc_match_oacc_parallel_loop (void) +{ + return match_acc (EXEC_OACC_PARALLEL_LOOP, OACC_PARALLEL_LOOP_CLAUSES); +} + match gfc_match_oacc_parallel (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_PARALLEL_CLAUSES, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_PARALLEL; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_PARALLEL, OACC_PARALLEL_CLAUSES); } match gfc_match_oacc_kernels_loop (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_KERNELS_LOOP_CLAUSES, false, false, - true) != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_KERNELS_LOOP; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_KERNELS_LOOP, OACC_KERNELS_LOOP_CLAUSES); } match gfc_match_oacc_kernels (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_KERNELS_CLAUSES, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_KERNELS; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_KERNELS, OACC_KERNELS_CLAUSES); } match gfc_match_oacc_data (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_DATA_CLAUSES, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_DATA; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_DATA, OACC_DATA_CLAUSES); } match gfc_match_oacc_host_data (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_HOST_DATA_CLAUSES, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_HOST_DATA; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_HOST_DATA, OACC_HOST_DATA_CLAUSES); } match gfc_match_oacc_loop (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_LOOP_CLAUSES, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_LOOP; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_LOOP, OACC_LOOP_CLAUSES); } @@ -1617,28 +1579,14 @@ gfc_match_oacc_update (void) match gfc_match_oacc_enter_data (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_ENTER_DATA_CLAUSES, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_ENTER_DATA; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_ENTER_DATA, OACC_ENTER_DATA_CLAUSES); } match gfc_match_oacc_exit_data (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_EXIT_DATA_CLAUSES, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_EXIT_DATA; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_EXIT_DATA, OACC_EXIT_DATA_CLAUSES); }