public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r10-6260] Add __gcov_indirect_call_profiler_v4_atomic.
Date: Mon, 27 Jan 2020 15:20:00 -0000	[thread overview]
Message-ID: <20200127152057.43383.qmail@sourceware.org> (raw)

https://gcc.gnu.org/g:3ae37f9297fc97aefc6c6968315bd1ac6a1bc7ef

commit r10-6260-g3ae37f9297fc97aefc6c6968315bd1ac6a1bc7ef
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Jan 27 16:20:10 2020 +0100

    Add __gcov_indirect_call_profiler_v4_atomic.
    
    	PR gcov-profile/93403
    	* tree-profile.c (gimple_init_gcov_profiler): Generate
    	both __gcov_indirect_call_profiler_v4 and
    	__gcov_indirect_call_profiler_v4_atomic.
    	PR gcov-profile/93403
    	* libgcov-profiler.c (__gcov_indirect_call_profiler_v4):
    	Call __gcov_indirect_call_profiler_body.
    	(__gcov_indirect_call_profiler_body): New.
    	(__gcov_indirect_call_profiler_v4_atomic): New.
    	* libgcov.h (__gcov_indirect_call_profiler_v4_atomic):
    	New declaration.

Diff:
---
 gcc/ChangeLog             |  7 +++++++
 gcc/tree-profile.c        |  8 ++++----
 libgcc/ChangeLog          | 10 ++++++++++
 libgcc/libgcov-profiler.c | 23 ++++++++++++++++++++---
 libgcc/libgcov.h          |  1 +
 5 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c1ef611..b3624b1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-27  Martin Liska  <mliska@suse.cz>
+
+	PR gcov-profile/93403
+	* tree-profile.c (gimple_init_gcov_profiler): Generate
+	both __gcov_indirect_call_profiler_v4 and
+	__gcov_indirect_call_profiler_v4_atomic.
+
 2020-01-27  Richard Sandiford  <richard.sandiford@arm.com>
 
 	PR target/92822
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 4c1d296..6c08382 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -120,7 +120,6 @@ gimple_init_gcov_profiler (void)
   tree gcov_type_ptr;
   tree ic_profiler_fn_type;
   tree average_profiler_fn_type;
-  const char *profiler_fn_name;
   const char *fn_name;
 
   if (!gcov_type_node)
@@ -167,6 +166,7 @@ gimple_init_gcov_profiler (void)
       fn_name = concat ("__gcov_topn_values_profiler", fn_suffix, NULL);
       tree_topn_values_profiler_fn
 	= build_fn_decl (fn_name, topn_values_profiler_fn_type);
+      free (CONST_CAST (char *, fn_name));
 
       TREE_NOTHROW (tree_topn_values_profiler_fn) = 1;
       DECL_ATTRIBUTES (tree_topn_values_profiler_fn)
@@ -181,10 +181,10 @@ gimple_init_gcov_profiler (void)
 					  gcov_type_node,
 					  ptr_type_node,
 					  NULL_TREE);
-      profiler_fn_name = "__gcov_indirect_call_profiler_v4";
-
+      fn_name = concat ("__gcov_indirect_call_profiler_v4", fn_suffix, NULL);
       tree_indirect_call_profiler_fn
-	      = build_fn_decl (profiler_fn_name, ic_profiler_fn_type);
+	= build_fn_decl (fn_name, ic_profiler_fn_type);
+      free (CONST_CAST (char *, fn_name));
 
       TREE_NOTHROW (tree_indirect_call_profiler_fn) = 1;
       DECL_ATTRIBUTES (tree_indirect_call_profiler_fn)
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 22bef22..20cb222 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-27  Martin Liska  <mliska@suse.cz>
+
+	PR gcov-profile/93403
+	* libgcov-profiler.c (__gcov_indirect_call_profiler_v4):
+	Call __gcov_indirect_call_profiler_body.
+	(__gcov_indirect_call_profiler_body): New.
+	(__gcov_indirect_call_profiler_v4_atomic): New.
+	* libgcov.h (__gcov_indirect_call_profiler_v4_atomic):
+	New declaration.
+
 2020-01-27  Claudiu Zissulescu  <claziss@synopsys.com>
 
 	* config/arc/crti.S: Add RF16 object attribute.
diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c
index 58784d1..6043ac4 100644
--- a/libgcc/libgcov-profiler.c
+++ b/libgcc/libgcov-profiler.c
@@ -199,8 +199,9 @@ struct indirect_call_tuple __gcov_indirect_call;
    as a pointer to a function.  */
 
 /* Tries to determine the most common value among its inputs. */
-void
-__gcov_indirect_call_profiler_v4 (gcov_type value, void* cur_func)
+static inline void
+__gcov_indirect_call_profiler_body (gcov_type value, void *cur_func,
+				    int use_atomic)
 {
   /* If the C++ virtual tables contain function descriptors then one
      function may have multiple descriptors and we need to dereference
@@ -208,10 +209,26 @@ __gcov_indirect_call_profiler_v4 (gcov_type value, void* cur_func)
   if (cur_func == __gcov_indirect_call.callee
       || (__LIBGCC_VTABLE_USES_DESCRIPTORS__
 	  && *(void **) cur_func == *(void **) __gcov_indirect_call.callee))
-    __gcov_topn_values_profiler_body (__gcov_indirect_call.counters, value, 0);
+    __gcov_topn_values_profiler_body (__gcov_indirect_call.counters, value,
+				      use_atomic);
 
   __gcov_indirect_call.callee = NULL;
 }
+
+void
+__gcov_indirect_call_profiler_v4 (gcov_type value, void *cur_func)
+{
+  __gcov_indirect_call_profiler_body (value, cur_func, 0);
+}
+
+#if GCOV_SUPPORTS_ATOMIC
+void
+__gcov_indirect_call_profiler_v4_atomic (gcov_type value, void *cur_func)
+{
+  __gcov_indirect_call_profiler_body (value, cur_func, 1);
+}
+#endif
+
 #endif
 
 #ifdef L_gcov_time_profiler
diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h
index bc7e308..023293e 100644
--- a/libgcc/libgcov.h
+++ b/libgcc/libgcov.h
@@ -274,6 +274,7 @@ extern void __gcov_pow2_profiler_atomic (gcov_type *, gcov_type);
 extern void __gcov_topn_values_profiler (gcov_type *, gcov_type);
 extern void __gcov_topn_values_profiler_atomic (gcov_type *, gcov_type);
 extern void __gcov_indirect_call_profiler_v4 (gcov_type, void *);
+extern void __gcov_indirect_call_profiler_v4_atomic (gcov_type, void *);
 extern void __gcov_time_profiler (gcov_type *);
 extern void __gcov_time_profiler_atomic (gcov_type *);
 extern void __gcov_average_profiler (gcov_type *, gcov_type);


                 reply	other threads:[~2020-01-27 15:20 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=20200127152057.43383.qmail@sourceware.org \
    --to=marxin@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).