public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kwok Yeung <kcy@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] Fortran: Add location info to OpenMP tree nodes
Date: Wed, 29 Jun 2022 14:47:06 +0000 (GMT)	[thread overview]
Message-ID: <20220629144706.DD1D0384F017@sourceware.org> (raw)

https://gcc.gnu.org/g:28d79c9620aa4d968f6b3be2772b5515f9d784d9

commit 28d79c9620aa4d968f6b3be2772b5515f9d784d9
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Thu Mar 24 21:02:34 2022 -0700

    Fortran: Add location info to OpenMP tree nodes
    
    gcc/fortran/
            * trans-openmp.cc (gfc_trans_omp_critical): Set location on OMP
            tree node.
            (gfc_trans_omp_do): Likewise.
            (gfc_trans_omp_masked): Likewise.
            (gfc_trans_omp_do_simd): Likewise.
            (gfc_trans_omp_scope): Likewise.
            (gfc_trans_omp_taskgroup): Likewise.
            (gfc_trans_omp_taskwait): Likewise.
            (gfc_trans_omp_distribute): Likewise.
            (gfc_trans_omp_taskloop): Likewise.
            (gfc_trans_omp_master_masked_taskloop): Likewise.
    
    (cherry picked from commit 198bd0d599e0a91df1cfa6ab37545d05dff48e97)

Diff:
---
 gcc/fortran/ChangeLog.omp   | 18 ++++++++++++++++++
 gcc/fortran/trans-openmp.cc | 11 +++++++++++
 2 files changed, 29 insertions(+)

diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 5a6f3e59486..31a71943e96 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,21 @@
+2022-03-24  Sandra Loosemore  <sandra@codesourcery.com>
+
+	Backport from mainline:
+
+	2022-03-24  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* trans-openmp.cc (gfc_trans_omp_critical): Set location on OMP
+	tree node.
+	(gfc_trans_omp_do): Likewise.
+	(gfc_trans_omp_masked): Likewise.
+	(gfc_trans_omp_do_simd): Likewise.
+	(gfc_trans_omp_scope): Likewise.
+	(gfc_trans_omp_taskgroup): Likewise.
+	(gfc_trans_omp_taskwait): Likewise.
+	(gfc_trans_omp_distribute): Likewise.
+	(gfc_trans_omp_taskloop): Likewise.
+	(gfc_trans_omp_master_masked_taskloop): Likewise.
+
 2022-06-17  Chung-Lin Tang  <cltang@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 6be51f0e7fd..969f2a19f24 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -6584,6 +6584,7 @@ gfc_trans_omp_critical (gfc_code *code)
     name = get_identifier (code->ext.omp_clauses->critical_name);
   gfc_start_block (&block);
   stmt = make_node (OMP_CRITICAL);
+  SET_EXPR_LOCATION (stmt, gfc_get_location (&code->loc));
   TREE_TYPE (stmt) = void_type_node;
   OMP_CRITICAL_BODY (stmt) = gfc_trans_code (code->block->next);
   OMP_CRITICAL_NAME (stmt) = name;
@@ -6617,6 +6618,7 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock,
   unsigned ix;
   vec<tree, va_heap, vl_embed> *saved_doacross_steps = doacross_steps;
   gfc_expr_list *tile = do_clauses ? do_clauses->tile_list : clauses->tile_list;
+  gfc_code *orig_code = code;
 
   /* Both collapsed and tiled loops are lowered the same way.  In
      OpenACC, those clauses are not compatible, so prioritize the tile
@@ -6974,6 +6976,7 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock,
     default: gcc_unreachable ();
     }
 
+  SET_EXPR_LOCATION (stmt, gfc_get_location (&orig_code->loc));
   TREE_TYPE (stmt) = void_type_node;
   OMP_FOR_BODY (stmt) = gfc_finish_block (&body);
   OMP_FOR_CLAUSES (stmt) = omp_clauses;
@@ -7247,6 +7250,7 @@ gfc_trans_omp_masked (gfc_code *code, gfc_omp_clauses *clauses)
   gfc_start_block (&block);
   tree omp_clauses = gfc_trans_omp_clauses (&block, clauses, code->loc);
   tree stmt = make_node (OMP_MASKED);
+  SET_EXPR_LOCATION (stmt, gfc_get_location (&code->loc));
   TREE_TYPE (stmt) = void_type_node;
   OMP_MASKED_BODY (stmt) = body;
   OMP_MASKED_CLAUSES (stmt) = omp_clauses;
@@ -8023,6 +8027,7 @@ gfc_trans_omp_do_simd (gfc_code *code, stmtblock_t *pblock,
   if (flag_openmp)
     {
       stmt = make_node (OMP_FOR);
+      SET_EXPR_LOCATION (stmt, gfc_get_location (&code->loc));
       TREE_TYPE (stmt) = void_type_node;
       OMP_FOR_BODY (stmt) = body;
       OMP_FOR_CLAUSES (stmt) = omp_do_clauses;
@@ -8195,6 +8200,7 @@ gfc_trans_omp_scope (gfc_code *code)
   tree omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses,
 					    code->loc);
   tree stmt = make_node (OMP_SCOPE);
+  SET_EXPR_LOCATION (stmt, gfc_get_location (&code->loc));
   TREE_TYPE (stmt) = void_type_node;
   OMP_SCOPE_BODY (stmt) = body;
   OMP_SCOPE_CLAUSES (stmt) = omp_clauses;
@@ -8270,6 +8276,7 @@ gfc_trans_omp_taskgroup (gfc_code *code)
   gfc_start_block (&block);
   tree body = gfc_trans_code (code->block->next);
   tree stmt = make_node (OMP_TASKGROUP);
+  SET_EXPR_LOCATION (stmt, gfc_get_location (&code->loc));
   TREE_TYPE (stmt) = void_type_node;
   OMP_TASKGROUP_BODY (stmt) = body;
   OMP_TASKGROUP_CLAUSES (stmt) = gfc_trans_omp_clauses (&block,
@@ -8290,6 +8297,7 @@ gfc_trans_omp_taskwait (gfc_code *code)
   stmtblock_t block;
   gfc_start_block (&block);
   tree stmt = make_node (OMP_TASK);
+  SET_EXPR_LOCATION (stmt, gfc_get_location (&code->loc));
   TREE_TYPE (stmt) = void_type_node;
   OMP_TASK_BODY (stmt) = NULL_TREE;
   OMP_TASK_CLAUSES (stmt) = gfc_trans_omp_clauses (&block,
@@ -8368,6 +8376,7 @@ gfc_trans_omp_distribute (gfc_code *code, gfc_omp_clauses *clausesa)
   if (flag_openmp)
     {
       tree distribute = make_node (OMP_DISTRIBUTE);
+      SET_EXPR_LOCATION (distribute, gfc_get_location (&code->loc));
       TREE_TYPE (distribute) = void_type_node;
       OMP_FOR_BODY (distribute) = stmt;
       OMP_FOR_CLAUSES (distribute) = omp_clauses;
@@ -8590,6 +8599,7 @@ gfc_trans_omp_taskloop (gfc_code *code, gfc_exec_op op)
   if (flag_openmp)
     {
       tree taskloop = make_node (OMP_TASKLOOP);
+      SET_EXPR_LOCATION (taskloop, gfc_get_location (&code->loc));
       TREE_TYPE (taskloop) = void_type_node;
       OMP_FOR_BODY (taskloop) = stmt;
       OMP_FOR_CLAUSES (taskloop) = omp_clauses;
@@ -8635,6 +8645,7 @@ gfc_trans_omp_master_masked_taskloop (gfc_code *code, gfc_exec_op op)
 					    &clausesa[GFC_OMP_SPLIT_MASKED],
 					    code->loc);
       tree msk = make_node (OMP_MASKED);
+      SET_EXPR_LOCATION (msk, gfc_get_location (&code->loc));
       TREE_TYPE (msk) = void_type_node;
       OMP_MASKED_BODY (msk) = stmt;
       OMP_MASKED_CLAUSES (msk) = clauses;


                 reply	other threads:[~2022-06-29 14:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220629144706.DD1D0384F017@sourceware.org \
    --to=kcy@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).