From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 2CA6E385841C for ; Wed, 11 Aug 2021 16:11:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2CA6E385841C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: X9JCcaVG6qTlbNYQ8dfdUH7StMzmj3Ag+vFa57+ia/y2NJc3Sq9RgFWZg2fk/kQp7KHL//atTF cfM6L+gGbxDyGhyuhNw7UuOrqkj7ijHo4unVHjrkF6YQTPdZIpPc9rK6tIOfb3VN6PTDA1ZDKw HqlW2Ujz7SDW7SULh0ySMO31lkTr1N6HuSIdGRGmGJjnTXn4eXXdNGaxQg46iIqfikDZv0TYEc oDUyfox6X3YoIJ1/eWCh2kjUWI2pRWTmYtvEUu5tHbhYXxNs0oH8PSw55CvTE0XZD3ydQmgSAC wvQt+7rsTJWW95wb+hEir7Bf X-IronPort-AV: E=Sophos;i="5.84,313,1620720000"; d="scan'208";a="64739627" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 11 Aug 2021 08:11:45 -0800 IronPort-SDR: msuKAqtysKlm/iCiqfhxuBy701aR1Je0Mg9MgAWdvrvZ9GARx3vS9/PtWSUYNem2//sE0w/FGX NzltoHUlhnFhbQR80h/huneDCYApJif7FmPgLMkDJZjKqUWwnObBoWipd/TGfW1rM+gyl636g/ hDU4B+q8S7p1FFwvH7iI8S81ckC7wmV6gdYWKoH6h8PnWWOzh/X2Lf+aLht5MOF8eEbWfPKdtw Fffj3I1MUir5EFkgo7XrhdBXqrXPLJ5d+FwN7a1BDz0iP25z9brNUm3qN90F7psz+NRNGFfdR7 TCI= Date: Wed, 11 Aug 2021 16:11:39 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Sebastian Huber CC: Subject: Re: [PATCH v3] gcov: Add TARGET_GCOV_TYPE_SIZE target macro In-Reply-To: <20210811065837.114010-1-sebastian.huber@embedded-brains.de> Message-ID: References: <20210811065837.114010-1-sebastian.huber@embedded-brains.de> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3125.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2021 16:11:49 -0000 On Wed, 11 Aug 2021, Sebastian Huber wrote: > 64-bit atomic operations. Allow targets to override the default type > size with the new TARGET_GCOV_TYPE_SIZE target macro. Hook, not macro. > diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c > index f79f939bd10f..e85b60c79f49 100644 > --- a/gcc/c-family/c-cppbuiltin.c > +++ b/gcc/c-family/c-cppbuiltin.c > @@ -1450,6 +1450,8 @@ c_cpp_builtins (cpp_reader *pfile) > /* For libgcov. */ > builtin_define_with_int_value ("__LIBGCC_VTABLE_USES_DESCRIPTORS__", > TARGET_VTABLE_USES_DESCRIPTORS); > + builtin_define_with_int_value ("__LIBGCC_GCOV_TYPE_SIZE", > + TARGET_GCOV_TYPE_SIZE); The TARGET_* macros used to initialize targetm may only be defined to their final values in the architecture-specific .c file that actually defines targetm. All other files should access the hook via targetm, not the TARGET_* macros. (TARGET_VTABLE_USES_DESCRIPTORS in the diff context is a target macro, not a hook at all.) > +DEFHOOKPOD > +(gcov_type_size, > + "The gcov type size in bits. This type is used for example for counters\n\ > +incremented by profiling and code-coverage events. The default value is 64,\n\ > +if the type size of long long is greater than 32, otherwise the default\n\ > +value is 32. A 64-bit type is recommended to avoid overflows of the\n\ > +counters. If the @option{-fprofile-update=atomic} is used, then the\n\ > +counters are incremented using atomic operations. Targets not supporting\n\ > +64-bit atomic operations may override the default value and request a 32-bit\n\ > +type.", > + HOST_WIDE_INT, (LONG_LONG_TYPE_SIZE > 32 ? 64 : 32)) LONG_LONG_TYPE_SIZE may depend on command-line options passed to the compiler (it does for AVR). The hook thus needs to be a function returning the desired size. -- Joseph S. Myers joseph@codesourcery.com