Do not use LONG_LONG_TYPE_SIZE in #if macro condition
authorMartin Liska <mliska@suse.cz>
Wed, 17 Aug 2016 06:55:35 +0000 (08:55 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 17 Aug 2016 06:55:35 +0000 (06:55 +0000)
* coverage.c (get_gcov_type): Replace GCOV_TYPE_SIZE with
a LONG_LONG_TYPE_SIZE comparison.
* gcov-io.h: Remove macro definitions.
* tree-profile.c (gimple_gen_edge_profiler): Replace usage
of GCOV_TYPE_ATOMIC_FETCH_ADD with a LONG_LONG_TYPE_SIZE
comparison.

From-SVN: r239522

gcc/ChangeLog
gcc/coverage.c
gcc/gcov-io.h
gcc/tree-profile.c

index 9667b7ce268f4fd0a18ff98e7a13ec952e70d7bc..edbac57728b1a1d92cbebc022f499434202247d2 100644 (file)
@@ -1,3 +1,12 @@
+2016-08-17  Martin Liska  <mliska@suse.cz>
+
+       * coverage.c (get_gcov_type): Replace GCOV_TYPE_SIZE with
+       a LONG_LONG_TYPE_SIZE comparison.
+       * gcov-io.h: Remove macro definitions.
+       * tree-profile.c (gimple_gen_edge_profiler): Replace usage
+       of GCOV_TYPE_ATOMIC_FETCH_ADD with a LONG_LONG_TYPE_SIZE
+       comparison.
+
 2016-08-16  Jakub Jelinek  <jakub@redhat.com>
 
        * config/i386/i386.c (enum ix86_builtins): Reorder enumerators, so
index d4d371ecd6d403b4407946619e61628a18024ad9..30cdc69e1873afcaba0d28da6ccf7d553a048c42 100644 (file)
@@ -142,7 +142,8 @@ static void coverage_obj_finish (vec<constructor_elt, va_gc> *);
 tree
 get_gcov_type (void)
 {
-  machine_mode mode = smallest_mode_for_size (GCOV_TYPE_SIZE, MODE_INT);
+  machine_mode mode
+    = smallest_mode_for_size (LONG_LONG_TYPE_SIZE > 32 ? 64 : 32, MODE_INT);
   return lang_hooks.types.type_for_mode (mode, false);
 }
 
index afd00acb866ee6efea6568d2e586da3f5de2dcf8..a6da2bfcd4231027af6e2c6bc09b019ade935e6c 100644 (file)
@@ -164,14 +164,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #ifndef GCC_GCOV_IO_H
 #define GCC_GCOV_IO_H
 
-#if LONG_LONG_TYPE_SIZE > 32
-#define GCOV_TYPE_ATOMIC_FETCH_ADD_FN __atomic_fetch_add_8
-#define GCOV_TYPE_ATOMIC_FETCH_ADD BUILT_IN_ATOMIC_FETCH_ADD_8
-#else
-#define GCOV_TYPE_ATOMIC_FETCH_ADD_FN __atomic_fetch_add_4
-#define GCOV_TYPE_ATOMIC_FETCH_ADD BUILT_IN_ATOMIC_FETCH_ADD_4
-#endif
-
 #ifndef IN_LIBGCOV
 /* About the host */
 
@@ -185,8 +177,6 @@ typedef uint64_t gcov_type_unsigned;
 #if IN_GCOV > 0
 #include <sys/types.h>
 #endif
-#else /*!IN_GCOV */
-#define GCOV_TYPE_SIZE (LONG_LONG_TYPE_SIZE > 32 ? 64 : 32)
 #endif
 
 #if defined (HOST_HAS_F_SETLKW)
index fdf0201f2e405ccc39c13b97da8a610511b94679..622869ebb27f00f881be60ec57fd9fb56898f8f4 100644 (file)
@@ -259,11 +259,12 @@ gimple_gen_edge_profiler (int edgeno, edge e)
     {
       /* __atomic_fetch_add (&counter, 1, MEMMODEL_RELAXED); */
       tree addr = tree_coverage_counter_addr (GCOV_COUNTER_ARCS, edgeno);
-      gcall *stmt
-       = gimple_build_call (builtin_decl_explicit (GCOV_TYPE_ATOMIC_FETCH_ADD),
-                            3, addr, one,
-                            build_int_cst (integer_type_node,
-                                           MEMMODEL_RELAXED));
+      tree f = builtin_decl_explicit (LONG_LONG_TYPE_SIZE > 32
+                                     ? BUILT_IN_ATOMIC_FETCH_ADD_8:
+                                     BUILT_IN_ATOMIC_FETCH_ADD_4);
+      gcall *stmt = gimple_build_call (f, 3, addr, one,
+                                      build_int_cst (integer_type_node,
+                                                     MEMMODEL_RELAXED));
       gsi_insert_on_edge (e, stmt);
     }
   else