From 892a653cc93da08467301e5cc18ddec7c85462f2 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 17 Aug 2016 08:55:35 +0200 Subject: [PATCH] Do not use LONG_LONG_TYPE_SIZE in #if macro condition * 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 | 9 +++++++++ gcc/coverage.c | 3 ++- gcc/gcov-io.h | 10 ---------- gcc/tree-profile.c | 11 ++++++----- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9667b7ce268..edbac57728b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-08-17 Martin Liska + + * 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 * config/i386/i386.c (enum ix86_builtins): Reorder enumerators, so diff --git a/gcc/coverage.c b/gcc/coverage.c index d4d371ecd6d..30cdc69e187 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -142,7 +142,8 @@ static void coverage_obj_finish (vec *); 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); } diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h index afd00acb866..a6da2bfcd42 100644 --- a/gcc/gcov-io.h +++ b/gcc/gcov-io.h @@ -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 #endif -#else /*!IN_GCOV */ -#define GCOV_TYPE_SIZE (LONG_LONG_TYPE_SIZE > 32 ? 64 : 32) #endif #if defined (HOST_HAS_F_SETLKW) diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index fdf0201f2e4..622869ebb27 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -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 -- 2.30.2