public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Frederik Harwath <frederik@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-11] openacc: Add "can_be_parallel" flag info to "graph" dumps
Date: Wed, 17 Nov 2021 08:18:00 +0000 (GMT)	[thread overview]
Message-ID: <20211117081800.64CCE3857C66@sourceware.org> (raw)

https://gcc.gnu.org/g:dce1c32758dbdba9b09ba4f9aae10b85cb0e8a55

commit dce1c32758dbdba9b09ba4f9aae10b85cb0e8a55
Author: Frederik Harwath <frederik@codesourcery.com>
Date:   Tue Nov 16 16:16:47 2021 +0100

    openacc: Add "can_be_parallel" flag info to "graph" dumps
    
    gcc/ChangeLog:
    
            * graph.c (oacc_get_fn_attrib): New declaration.
            (find_loop_location): New declaration.
            (draw_cfg_nodes_for_loop): Print value of the
            can_be_parallel flag at the top of loops in OpenACC
            functions.

Diff:
---
 gcc/graph.c | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/gcc/graph.c b/gcc/graph.c
index ce8de33ffe1..3ad07be3b30 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -191,6 +191,10 @@ draw_cfg_nodes_no_loops (pretty_printer *pp, struct function *fun)
     }
 }
 
+
+extern tree oacc_get_fn_attrib (tree);
+extern dump_user_location_t find_loop_location (class loop *);
+
 /* Draw all the basic blocks in LOOP.  Print the blocks in breath-first
    order to get a good ranking of the nodes.  This function is recursive:
    It first prints inner loops, then the body of LOOP itself.  */
@@ -205,17 +209,26 @@ draw_cfg_nodes_for_loop (pretty_printer *pp, int funcdef_no,
 
   if (loop->header != NULL
       && loop->latch != EXIT_BLOCK_PTR_FOR_FN (cfun))
-    pp_printf (pp,
-	       "\tsubgraph cluster_%d_%d {\n"
-	       "\tstyle=\"filled\";\n"
-	       "\tcolor=\"darkgreen\";\n"
-	       "\tfillcolor=\"%s\";\n"
-	       "\tlabel=\"loop %d\";\n"
-	       "\tlabeljust=l;\n"
-	       "\tpenwidth=2;\n",
-	       funcdef_no, loop->num,
-	       fillcolors[(loop_depth (loop) - 1) % 3],
-	       loop->num);
+    {
+      pp_printf (pp,
+                 "\tsubgraph cluster_%d_%d {\n"
+                 "\tstyle=\"filled\";\n"
+                 "\tcolor=\"darkgreen\";\n"
+                 "\tfillcolor=\"%s\";\n"
+                 "\tlabel=\"loop %d %s\";\n"
+                 "\tlabeljust=l;\n"
+                 "\tpenwidth=2;\n",
+                 funcdef_no, loop->num,
+                 fillcolors[(loop_depth (loop) - 1) % 3], loop->num,
+                 /* This is only meaningful for loops that have been processed
+                    by Graphite.
+
+                    TODO Use can_be_parallel_valid_p? */
+                 !oacc_get_fn_attrib (cfun->decl)
+                     ? ""
+                     : loop->can_be_parallel ? "(can_be_parallel = true)"
+                                             : "(can_be_parallel = false)");
+    }
 
   for (class loop *inner = loop->inner; inner; inner = inner->next)
     draw_cfg_nodes_for_loop (pp, funcdef_no, inner);


                 reply	other threads:[~2021-11-17  8:18 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=20211117081800.64CCE3857C66@sourceware.org \
    --to=frederik@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).