public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)
       [not found]     ` <CAFiYyc1ENcX=qHjnsxod_AE-zwghvU=RsWQy3yoKiW7RyCt1_A@mail.gmail.com>
@ 2013-09-04  8:46       ` Dodji Seketeli
  2013-09-04 10:07         ` Richard Biener
  2013-09-04 13:52         ` Ian Lance Taylor
  0 siblings, 2 replies; 4+ messages in thread
From: Dodji Seketeli @ 2013-09-04  8:46 UTC (permalink / raw)
  To: Richard Biener; +Cc: Paulo Matos, GCC Patches

Hello,

Richard Biener <richard.guenther@gmail.com> a écrit:

[...]

> DECL_IS_BUILTIN is true if the decl was created by the frontend / backend
> rather than by user code (indicated by source location).  DECL_BUILT_IN
> is true if the decl represents a function of the standard library, a
> builtin that is
> recognized by optimization / expansion.  User declared prototypes of
> C library functions are not DECL_IS_BUILTIN but may be DECL_BUILT_IN.

Every time I see these macros I have a hard time telling which is which
:-) So I felt I'd stand on your shoulders (if you don't mind) and add
these comments right in tree.h so that they are easier to find next
time.

OK to commit this comment-only patchlet to trunk then?

Thanks.

From 1ad29143764a72d27b1ecf3c06b4ba72bfaf4fe8 Mon Sep 17 00:00:00 2001
From: Dodji Seketeli <dodji@seketeli.org>
Date: Wed, 4 Sep 2013 10:32:36 +0200
Subject: [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN

gcc/ChangeLog

	* tree.h (DECL_BUILT_IN, DECL_IS_BUILTIN): Add more comments
	explaining their differences.
---
 gcc/tree.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/tree.h b/gcc/tree.h
index 718d8f4..88d527a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1838,6 +1838,9 @@ extern enum machine_mode vector_type_mode (const_tree);
 #define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
 #define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
 #define DECL_SOURCE_COLUMN(NODE) LOCATION_COLUMN (DECL_SOURCE_LOCATION (NODE))
+/* This accessor returns TRUE if the decl it operates on was created
+   by a front-end or back-end rather than by user code.  In this case
+   builtin-ness is indicated by source location.  */
 #define DECL_IS_BUILTIN(DECL) \
   (LOCATION_LOCUS (DECL_SOURCE_LOCATION (DECL)) <= BUILTINS_LOCATION)
 
@@ -2486,7 +2489,13 @@ extern vec<tree, va_gc> **decl_debug_args_insert (tree);
 #define DECL_STRUCT_FUNCTION(NODE) \
   (FUNCTION_DECL_CHECK (NODE)->function_decl.f)
 
-/* In a FUNCTION_DECL, nonzero means a built in function.  */
+/* In a FUNCTION_DECL, nonzero means a built in function of a
+   standard library or more generally a built in function that is
+   recognized by optimizers and expanders.
+
+   Note that it is different from the DECL_IS_BUILTIN accessor.  For
+   instance, user declarated prototypes of C library functions are not
+   DECL_IS_BUILTIN but may be DECL_BUILT_IN.  */
 #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN)
 
 /* For a builtin function, identify which part of the compiler defined it.  */
-- 

		Dodji

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)
  2013-09-04  8:46       ` [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?) Dodji Seketeli
@ 2013-09-04 10:07         ` Richard Biener
  2013-09-05  7:58           ` Dodji Seketeli
  2013-09-04 13:52         ` Ian Lance Taylor
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Biener @ 2013-09-04 10:07 UTC (permalink / raw)
  To: Dodji Seketeli; +Cc: Paulo Matos, GCC Patches

On Wed, Sep 4, 2013 at 10:46 AM, Dodji Seketeli <dodji@seketeli.org> wrote:
> Hello,
>
> Richard Biener <richard.guenther@gmail.com> a écrit:
>
> [...]
>
>> DECL_IS_BUILTIN is true if the decl was created by the frontend / backend
>> rather than by user code (indicated by source location).  DECL_BUILT_IN
>> is true if the decl represents a function of the standard library, a
>> builtin that is
>> recognized by optimization / expansion.  User declared prototypes of
>> C library functions are not DECL_IS_BUILTIN but may be DECL_BUILT_IN.
>
> Every time I see these macros I have a hard time telling which is which
> :-) So I felt I'd stand on your shoulders (if you don't mind) and add
> these comments right in tree.h so that they are easier to find next
> time.
>
> OK to commit this comment-only patchlet to trunk then?

Ok.

Thanks,
Richard.

> Thanks.
>
> From 1ad29143764a72d27b1ecf3c06b4ba72bfaf4fe8 Mon Sep 17 00:00:00 2001
> From: Dodji Seketeli <dodji@seketeli.org>
> Date: Wed, 4 Sep 2013 10:32:36 +0200
> Subject: [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN
>
> gcc/ChangeLog
>
>         * tree.h (DECL_BUILT_IN, DECL_IS_BUILTIN): Add more comments
>         explaining their differences.
> ---
>  gcc/tree.h | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/tree.h b/gcc/tree.h
> index 718d8f4..88d527a 100644
> --- a/gcc/tree.h
> +++ b/gcc/tree.h
> @@ -1838,6 +1838,9 @@ extern enum machine_mode vector_type_mode (const_tree);
>  #define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
>  #define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
>  #define DECL_SOURCE_COLUMN(NODE) LOCATION_COLUMN (DECL_SOURCE_LOCATION (NODE))
> +/* This accessor returns TRUE if the decl it operates on was created
> +   by a front-end or back-end rather than by user code.  In this case
> +   builtin-ness is indicated by source location.  */
>  #define DECL_IS_BUILTIN(DECL) \
>    (LOCATION_LOCUS (DECL_SOURCE_LOCATION (DECL)) <= BUILTINS_LOCATION)
>
> @@ -2486,7 +2489,13 @@ extern vec<tree, va_gc> **decl_debug_args_insert (tree);
>  #define DECL_STRUCT_FUNCTION(NODE) \
>    (FUNCTION_DECL_CHECK (NODE)->function_decl.f)
>
> -/* In a FUNCTION_DECL, nonzero means a built in function.  */
> +/* In a FUNCTION_DECL, nonzero means a built in function of a
> +   standard library or more generally a built in function that is
> +   recognized by optimizers and expanders.
> +
> +   Note that it is different from the DECL_IS_BUILTIN accessor.  For
> +   instance, user declarated prototypes of C library functions are not
> +   DECL_IS_BUILTIN but may be DECL_BUILT_IN.  */
>  #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN)
>
>  /* For a builtin function, identify which part of the compiler defined it.  */
> --
>
>                 Dodji

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)
  2013-09-04  8:46       ` [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?) Dodji Seketeli
  2013-09-04 10:07         ` Richard Biener
@ 2013-09-04 13:52         ` Ian Lance Taylor
  1 sibling, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2013-09-04 13:52 UTC (permalink / raw)
  To: Dodji Seketeli; +Cc: Richard Biener, Paulo Matos, GCC Patches

On Wed, Sep 4, 2013 at 1:46 AM, Dodji Seketeli <dodji@seketeli.org> wrote:
>
> +/* In a FUNCTION_DECL, nonzero means a built in function of a
> +   standard library or more generally a built in function that is
> +   recognized by optimizers and expanders.
> +
> +   Note that it is different from the DECL_IS_BUILTIN accessor.  For
> +   instance, user declarated prototypes of C library functions are not
> +   DECL_IS_BUILTIN but may be DECL_BUILT_IN.  */
>  #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN)

s/declarated/declared/

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)
  2013-09-04 10:07         ` Richard Biener
@ 2013-09-05  7:58           ` Dodji Seketeli
  0 siblings, 0 replies; 4+ messages in thread
From: Dodji Seketeli @ 2013-09-05  7:58 UTC (permalink / raw)
  To: GCC Patches

Ian Lance Taylor <iant@google.com> a écrit:

> On Wed, Sep 4, 2013 at 1:46 AM, Dodji Seketeli <dodji@seketeli.org> wrote:
>>
>> +/* In a FUNCTION_DECL, nonzero means a built in function of a
>> +   standard library or more generally a built in function that is
>> +   recognized by optimizers and expanders.
>> +
>> +   Note that it is different from the DECL_IS_BUILTIN accessor.  For
>> +   instance, user declarated prototypes of C library functions are not
>> +   DECL_IS_BUILTIN but may be DECL_BUILT_IN.  */
>>  #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN)
>
> s/declarated/declared/

Thank for catching this, Ian.  I did the change.


Richard Biener <richard.guenther@gmail.com> a écrit:

[...]

> On Wed, Sep 4, 2013 at 10:46 AM, Dodji Seketeli <dodji@seketeli.org> wrote:
>> Hello,

[...]

>> OK to commit this comment-only patchlet to trunk then?
>
> Ok.

Thanks.  Applied to trunk.

Cheers.

-- 
		Dodji

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-05  7:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <19EB96622A777C4AB91610E763265F462B2BC8@SJEXCHMB14.corp.ad.broadcom.com>
     [not found] ` <CAFiYyc2sSXOZP1DZgL3KwkMKApB7QEuSKCR352m3KeB=HDL0Ug@mail.gmail.com>
     [not found]   ` <19EB96622A777C4AB91610E763265F462B2C29@SJEXCHMB14.corp.ad.broadcom.com>
     [not found]     ` <CAFiYyc1ENcX=qHjnsxod_AE-zwghvU=RsWQy3yoKiW7RyCt1_A@mail.gmail.com>
2013-09-04  8:46       ` [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?) Dodji Seketeli
2013-09-04 10:07         ` Richard Biener
2013-09-05  7:58           ` Dodji Seketeli
2013-09-04 13:52         ` Ian Lance Taylor

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).