This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)
- From: Dodji Seketeli <dodji at seketeli dot org>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Paulo Matos <pmatos at broadcom dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 04 Sep 2013 10:46:41 +0200
- Subject: [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)
- Authentication-results: sourceware.org; auth=none
- References: <19EB96622A777C4AB91610E763265F462B2BC8 at SJEXCHMB14 dot corp dot ad dot broadcom dot com> <CAFiYyc2sSXOZP1DZgL3KwkMKApB7QEuSKCR352m3KeB=HDL0Ug at mail dot gmail dot com> <19EB96622A777C4AB91610E763265F462B2C29 at SJEXCHMB14 dot corp dot ad dot broadcom dot com> <CAFiYyc1ENcX=qHjnsxod_AE-zwghvU=RsWQy3yoKiW7RyCt1_A at mail dot gmail dot com>
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