]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add __gcov_indirect_call_profiler_v4_atomic.
authorMartin Liska <mliska@suse.cz>
Mon, 27 Jan 2020 15:20:10 +0000 (16:20 +0100)
committerMartin Liska <mliska@suse.cz>
Mon, 27 Jan 2020 15:20:10 +0000 (16:20 +0100)
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.

gcc/ChangeLog
gcc/tree-profile.c
libgcc/ChangeLog
libgcc/libgcov-profiler.c
libgcc/libgcov.h

index c1ef611047787b2e4ce4dcbd763cf696a743ce07..b3624b15195dda5082e0f0e711da166b291c8f42 100644 (file)
@@ -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
index 4c1d296d9ea3ef9b6d568e5a34ebe9fe637d5f66..6c0838261a19829d4e1239254c6748cdfe644b80 100644 (file)
@@ -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)
index 22bef220665ead40a2d3616cfe587c53c22dcda6..20cb222d0799e41cfa539d4eaa25f6674f4c2094 100644 (file)
@@ -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.
index 58784d18477b84e5b709eb2b42de3f4b669ec921..6043ac4c7a116aa3e451f60ff9499fc8f4fe1183 100644 (file)
@@ -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
index bc7e308a4f9b1d38de259d585da44c747af8cc16..023293e05ec5e79f51cfa4fd4a1c9defe1e574fc 100644 (file)
@@ -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);