public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Development <gcc@gcc.gnu.org>
Subject: Re: get_gcov_type() vs. -fprofile-update=atomic
Date: Tue, 10 Aug 2021 08:07:08 +0200	[thread overview]
Message-ID: <982bf9f3-b3b8-f55a-d7a1-02b8acc518ce@embedded-brains.de> (raw)
In-Reply-To: <CAFiYyc2bfyBJCwZ48aMzUA1a0ziCBx2FkOiqH8HuRmL11KGH8g@mail.gmail.com>

On 09/08/2021 14:13, Richard Biener wrote:
>>> But I guess using 32bit counters on sparc-rtems might be the way to
>>> go ...
>> Yes, you somehow just have to make sure that your test programs don't
>> overflow the counters.
> Right - thus in principle it would be "nice" to allow to alter this with
> a command-line switch (even per TU in case 64bit is slow).

Setting the gcov type size per TU would require to store this 
information in the object so that libgcov is able to know which type 
size was used (probably somewhere in struct gcov_info). Currently, the 
gcov type size for libgcov is hard coded in "libgcc/libgcov.h":

#if __CHAR_BIT__ == 8
typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
#if GCOV_TYPE_SIZE > 32
typedef signed gcov_type __attribute__ ((mode (DI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (DI)));
#else
typedef signed gcov_type __attribute__ ((mode (SI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
#endif
#else
#if __CHAR_BIT__ == 16
typedef unsigned gcov_unsigned_t __attribute__ ((mode (HI)));
typedef unsigned gcov_position_t __attribute__ ((mode (HI)));
#if GCOV_TYPE_SIZE > 32
typedef signed gcov_type __attribute__ ((mode (SI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
#else
typedef signed gcov_type __attribute__ ((mode (HI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (HI)));
#endif
#else
typedef unsigned gcov_unsigned_t __attribute__ ((mode (QI)));
typedef unsigned gcov_position_t __attribute__ ((mode (QI)));
#if GCOV_TYPE_SIZE > 32
typedef signed gcov_type __attribute__ ((mode (HI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (HI)));
#else
typedef signed gcov_type __attribute__ ((mode (QI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (QI)));
#endif
#endif
#endif

Why is the mode attribute used here? Wouldn't this work also?

typedef gcov_unsigned_t __UINT32_TYPE__;
typedef gcov_position_t __UINT32_TYPE__;
#if GCOV_TYPE_SIZE > 32
typedef gcov_type __INT64_TYPE__;
typedef gcov_type_unsigned __UINT64_TYPE__;
#else
typedef gcov_type __INT32_TYPE__;
typedef gcov_type_unsigned __UINT32_TYPE__;
#endif

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

  parent reply	other threads:[~2021-08-10  6:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  6:51 Sebastian Huber
2021-08-09  8:02 ` Sebastian Huber
2021-08-09 10:22 ` Richard Biener
2021-08-09 10:55   ` Sebastian Huber
2021-08-09 11:27     ` Richard Biener
2021-08-09 12:03       ` Sebastian Huber
2021-08-09 12:13         ` Richard Biener
2021-08-09 13:36           ` Sebastian Huber
2021-08-10  6:07           ` Sebastian Huber [this message]
2021-08-10  7:59             ` Richard Biener
2021-08-10  8:10               ` Sebastian Huber

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=982bf9f3-b3b8-f55a-d7a1-02b8acc518ce@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).