This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]