public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add debug msg to dump_file in add_new_function
@ 2015-06-04 13:35 Tom de Vries
  2015-06-04 15:02 ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2015-06-04 13:35 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

Hi,

[ posted earlier as part of "Don't dump low gimple functions in gimple 
dump", https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01586.html, 
currently discussed at: 
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02076.html ]

This patch adds a debug msg to dump_file in cgraph_node::add_new_function.

OK for trunk (after retesting)?

Thanks,
- Tom

[-- Attachment #2: 0001-Add-debug-msg-to-dump_file-in-add_new_function.patch --]
[-- Type: text/x-patch, Size: 2654 bytes --]

Add debug msg to dump_file in add_new_function

2014-06-04  Tom de Vries  <tom@codesourcery.com>

	* cgraphunit.c (cgraph_node::add_new_function): Dump message on new
	function.

	* gcc.dg/gomp/notify-new-function-2.c: New test.
	* gcc.dg/gomp/notify-new-function.c: Same.
---
 gcc/cgraphunit.c                                  | 14 ++++++++++++++
 gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c | 20 ++++++++++++++++++++
 gcc/testsuite/gcc.dg/gomp/notify-new-function.c   | 17 +++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/notify-new-function.c

diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 8d97163..388c032 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -503,6 +503,20 @@ cgraph_node::add_new_function (tree fndecl, bool lowered)
 {
   gcc::pass_manager *passes = g->get_passes ();
   cgraph_node *node;
+
+  if (dump_file)
+    {
+      const char *function_type = ((gimple_has_body_p (fndecl))
+				   ? (lowered
+				      ? "low gimple"
+				      : "high gimple")
+				   : "to-be-gimplified");
+      fprintf (dump_file,
+	       "Added new %s function %s to callgraph\n",
+	       function_type,
+	       fndecl_name (fndecl));
+    }
+
   switch (symtab->state)
     {
       case PARSING:
diff --git a/gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c b/gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c
new file mode 100644
index 0000000..b852261
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-omplower" } */
+
+void __attribute__((noinline))
+baz (int *p)
+{
+}
+
+void
+foo (void)
+{
+  int p[2];
+  p[0] = 1;
+  p[1] = 3;
+  #pragma omp task firstprivate (p)
+    baz (p);
+}
+
+/* Check for new function notification in omplower dump.  */
+/* { dg-final { scan-tree-dump-times "Added new high gimple function foo._omp_cpyfn.1 to callgraph" 1 "omplower" } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/notify-new-function.c b/gcc/testsuite/gcc.dg/gomp/notify-new-function.c
new file mode 100644
index 0000000..4cf4dd3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/notify-new-function.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-ompexp" } */
+
+int
+main (void)
+{
+#pragma omp parallel
+  {
+    extern void foo (void);
+    foo ();
+  }
+  return 0;
+}
+
+
+/* Check for new function notification in ompexp dump.  */
+/* { dg-final { scan-tree-dump-times "Added new low gimple function main._omp_fn.0 to callgraph" 1 "ompexp" } } */
-- 
1.9.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add debug msg to dump_file in add_new_function
  2015-06-04 13:35 [PATCH] Add debug msg to dump_file in add_new_function Tom de Vries
@ 2015-06-04 15:02 ` Tom de Vries
  2015-06-08  8:07   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2015-06-04 15:02 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

On 04/06/15 15:20, Tom de Vries wrote:
> Hi,
>
> [ posted earlier as part of "Don't dump low gimple functions in gimple
> dump", https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01586.html,
> currently discussed at:
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02076.html ]
>
> This patch adds a debug msg to dump_file in cgraph_node::add_new_function.
>

Added "ssa gimple" case for ompexpssa, and corresponding test-case.

 > OK for trunk (after retesting)?
 >

Thanks,
- Tom



[-- Attachment #2: 0001-Add-debug-msg-to-dump_file-in-add_new_function.patch --]
[-- Type: text/x-patch, Size: 3645 bytes --]

Add debug msg to dump_file in add_new_function

2014-06-04  Tom de Vries  <tom@codesourcery.com>

	* cgraphunit.c (cgraph_node::add_new_function): Dump message on new
	function.

	* gcc.dg/gomp/notify-new-function-2.c: New test.
	* gcc.dg/gomp/notify-new-function-3.c: Same.
	* gcc.dg/gomp/notify-new-function.c: Same.
---
 gcc/cgraphunit.c                                  | 17 +++++++++++++++++
 gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c | 20 ++++++++++++++++++++
 gcc/testsuite/gcc.dg/gomp/notify-new-function-3.c | 14 ++++++++++++++
 gcc/testsuite/gcc.dg/gomp/notify-new-function.c   | 17 +++++++++++++++++
 4 files changed, 68 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/notify-new-function-3.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/notify-new-function.c

diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 8d97163..5a62223 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -503,6 +503,23 @@ cgraph_node::add_new_function (tree fndecl, bool lowered)
 {
   gcc::pass_manager *passes = g->get_passes ();
   cgraph_node *node;
+
+  if (dump_file)
+    {
+      struct function *fn = DECL_STRUCT_FUNCTION (fndecl);
+      const char *function_type = ((gimple_has_body_p (fndecl))
+				   ? (lowered
+				      ? (gimple_in_ssa_p (fn)
+					 ? "ssa gimple"
+					 : "low gimple")
+				      : "high gimple")
+				   : "to-be-gimplified");
+      fprintf (dump_file,
+	       "Added new %s function %s to callgraph\n",
+	       function_type,
+	       fndecl_name (fndecl));
+    }
+
   switch (symtab->state)
     {
       case PARSING:
diff --git a/gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c b/gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c
new file mode 100644
index 0000000..e9c8939
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-omplower" } */
+
+void __attribute__((noinline))
+baz (int *p)
+{
+}
+
+void
+foo (void)
+{
+  int p[2];
+  p[0] = 1;
+  p[1] = 3;
+  #pragma omp task firstprivate (p)
+    baz (p);
+}
+
+/* Check for new function notification in omplower dump.  */
+/* { dg-final { scan-tree-dump-times "Added new high gimple function foo\\._omp_cpyfn\\.1 to callgraph" 1 "omplower" } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/notify-new-function-3.c b/gcc/testsuite/gcc.dg/gomp/notify-new-function-3.c
new file mode 100644
index 0000000..f173b8e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/notify-new-function-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-ompexpssa" } */
+
+void
+foo (int *__restrict a, int *__restrict b, int *__restrict c)
+{
+  int i;
+  for (i = 0; i < 1000; ++i)
+    c[i] = a[i] + b[i];
+}
+
+
+/* Check for new function notification in ompexpssa dump.  */
+/* { dg-final { scan-tree-dump-times "Added new ssa gimple function foo\\._loopfn\\.0 to callgraph" 1 "ompexpssa" } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/notify-new-function.c b/gcc/testsuite/gcc.dg/gomp/notify-new-function.c
new file mode 100644
index 0000000..4770a6b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/notify-new-function.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-ompexp" } */
+
+int
+main (void)
+{
+#pragma omp parallel
+  {
+    extern void foo (void);
+    foo ();
+  }
+  return 0;
+}
+
+
+/* Check for new function notification in ompexp dump.  */
+/* { dg-final { scan-tree-dump-times "Added new low gimple function main\\._omp_fn\\.0 to callgraph" 1 "ompexp" } } */
-- 
1.9.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add debug msg to dump_file in add_new_function
  2015-06-04 15:02 ` Tom de Vries
@ 2015-06-08  8:07   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2015-06-08  8:07 UTC (permalink / raw)
  To: Tom de Vries; +Cc: Richard Biener, gcc-patches

On Thu, Jun 4, 2015 at 4:42 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
> On 04/06/15 15:20, Tom de Vries wrote:
>>
>> Hi,
>>
>> [ posted earlier as part of "Don't dump low gimple functions in gimple
>> dump", https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01586.html,
>> currently discussed at:
>> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02076.html ]
>>
>> This patch adds a debug msg to dump_file in cgraph_node::add_new_function.
>>
>
> Added "ssa gimple" case for ompexpssa, and corresponding test-case.

Ok.

Thanks,
Richard.

>
>> OK for trunk (after retesting)?
>>
>
> Thanks,
> - Tom
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-08  8:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04 13:35 [PATCH] Add debug msg to dump_file in add_new_function Tom de Vries
2015-06-04 15:02 ` Tom de Vries
2015-06-08  8:07   ` Richard Biener

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).