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

On Tue, Aug 10, 2021 at 8:07 AM Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:
>
> 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?

I suppose this is historic.

> 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

Or simply use stdint.h names, since this is for the target
GCC arranges for an appropriate stdint header.

blaming a bit yields

commit 9b514d25867f14eb1b430765ba6d5083e592fcd7
Author: Nathan Sidwell <nathan@codesourcery.com>
Date:   Sat May 10 19:02:21 2003 +0000

    defaults.h (GCOV_TYPE_SIZE): Remove.

            * defaults.h (GCOV_TYPE_SIZE): Remove.
...

so - as we're about to re-introduce that let's as Nathan if he remembers
why we removed it ;)  (well, no target overrided the macro)

Richard.

> --
> 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/

  reply	other threads:[~2021-08-10  7:59 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
2021-08-10  7:59             ` Richard Biener [this message]
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=CAFiYyc03+sxXZe4HH0qS0JCZLwfuVsfQhwDegst-yN7nWyYd5w@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=nathan@acm.org \
    --cc=sebastian.huber@embedded-brains.de \
    /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).