aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>2005-02-09 16:22:25 -0800
committerRichard Henderson <rth@gcc.gnu.org>2005-02-09 16:22:25 -0800
commitc6a912da40b0f909bdafcf6e2afb69068a20f503 (patch)
tree4ed79a7176ee65e1fb619e14384a1bc2dd57d091 /gcc
parentaf9777199237969ff0cb1d720436f6811f6a1fc8 (diff)
downloadgcc-c6a912da40b0f909bdafcf6e2afb69068a20f503.zip
gcc-c6a912da40b0f909bdafcf6e2afb69068a20f503.tar.gz
gcc-c6a912da40b0f909bdafcf6e2afb69068a20f503.tar.bz2
builtins.c (DEF_BUILTIN): Add COND argument.
* builtins.c (DEF_BUILTIN): Add COND argument. * tree.h (DEF_BUILTIN): Likewise. * builtins.def (DEF_GCC_BUILTIN, DEF_LIB_BUILTIN, DEF_EXT_LIB_BUILTIN, DEF_C94_BUILTIN, DEF_C99_BUILTIN, DEF_C99_C90RES_BUILTIN): Update to match. (DEF_BUILTIN_STUB): New. (BUILT_IN_STACK_SAVE, BUILT_IN_STACK_RESTORE, BUILT_IN_INIT_TRAMPOLINE, BUILT_IN_ADJUST_TRAMPOLINE, BUILT_IN_NONLOCAL_GOTO, BUILT_IN_PROFILE_FUNC_ENTER, BUILT_IN_PROFILE_FUNC_EXIT): Use it. * c-common.c (DEF_BUILTIN): Add COND argument. * tree.c (local_define_builtin): New. (build_common_builtin_nodes): New. ada/ * utils.c (gnat_define_builtin): Remove. (gnat_install_builtins): Use build_common_builtin_nodes. fortran/ * f95-lang.c (gfc_init_builtin_functions): Call build_common_builtin_nodes; do not define any functions handled by it. java/ * builtins.c (initialize_builtins): Call build_common_builtin_nodes. * decl.c (java_init_decl_processing): Initialize const_ptr_type_node. treelang/ * treetree.c (treelang_init_decl_processing): Call build_common_builtin_nodes. From-SVN: r94785
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/utils.c102
-rw-r--r--gcc/builtins.c2
-rw-r--r--gcc/builtins.def39
-rw-r--r--gcc/c-common.c8
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/f95-lang.c62
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/builtins.c2
-rw-r--r--gcc/java/decl.c4
-rw-r--r--gcc/tree.c118
-rw-r--r--gcc/tree.h3
-rw-r--r--gcc/treelang/ChangeLog7
-rw-r--r--gcc/treelang/treetree.c2
15 files changed, 210 insertions, 170 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f9d60df..785eae5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2005-02-09 Richard Henderson <rth@redhat.com>
+
+ * builtins.c (DEF_BUILTIN): Add COND argument.
+ * tree.h (DEF_BUILTIN): Likewise.
+ * builtins.def (DEF_GCC_BUILTIN, DEF_LIB_BUILTIN, DEF_EXT_LIB_BUILTIN,
+ DEF_C94_BUILTIN, DEF_C99_BUILTIN, DEF_C99_C90RES_BUILTIN): Update to
+ match.
+ (DEF_BUILTIN_STUB): New.
+ (BUILT_IN_STACK_SAVE, BUILT_IN_STACK_RESTORE, BUILT_IN_INIT_TRAMPOLINE,
+ BUILT_IN_ADJUST_TRAMPOLINE, BUILT_IN_NONLOCAL_GOTO,
+ BUILT_IN_PROFILE_FUNC_ENTER, BUILT_IN_PROFILE_FUNC_EXIT): Use it.
+ * c-common.c (DEF_BUILTIN): Add COND argument.
+ * tree.c (local_define_builtin): New.
+ (build_common_builtin_nodes): New.
+
2005-02-09 Roger Sayle <roger@eyesopen.com>
* fold-const.c (fold_strip_sign_ops): New function to simplify a
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a4adba5..f6b7f68 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-09 Richard Henderson <rth@redhat.com>
+
+ * utils.c (gnat_define_builtin): Remove.
+ (gnat_install_builtins): Use build_common_builtin_nodes.
+
2005-02-09 Arnaud Charlet <charlet@adacore.com>
* a-rbtgso.adb, a-crbtgo.ads, a-crbtgo.adb, a-crbtgk.ads,
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index b92fe4b..4d4fad4 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -118,7 +118,6 @@ struct language_function GTY(())
int unused;
};
-static void gnat_define_builtin (const char *, tree, int, const char *, bool);
static void gnat_install_builtins (void);
static tree merge_sizes (tree, tree, tree, bool, bool);
static tree compute_related_constant (tree, tree);
@@ -405,110 +404,13 @@ gnat_init_decl_processing (void)
gnat_install_builtins ();
}
-/* Define a builtin function. This is temporary and is just being done
- to initialize *_built_in_decls for the middle-end. We'll want
- to do full builtin processing soon. */
-
-static void
-gnat_define_builtin (const char *name, tree type,
- int function_code, const char *library_name, bool const_p)
-{
- tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
-
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- if (library_name)
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
- make_decl_rtl (decl);
- gnat_pushdecl (decl, Empty);
- DECL_BUILT_IN_CLASS (decl) = BUILT_IN_NORMAL;
- DECL_FUNCTION_CODE (decl) = function_code;
- TREE_READONLY (decl) = const_p;
-
- implicit_built_in_decls[function_code] = decl;
- built_in_decls[function_code] = decl;
-}
-
/* Install the builtin functions the middle-end needs. */
static void
gnat_install_builtins ()
{
- tree ftype;
- tree tmp;
-
- tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, long_integer_type_node, tmp);
- ftype = build_function_type (long_integer_type_node, tmp);
- gnat_define_builtin ("__builtin_expect", ftype, BUILT_IN_EXPECT,
- "__builtin_expect", true);
-
- tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, tmp);
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, tmp);
- ftype = build_function_type (ptr_void_type_node, tmp);
- gnat_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
- "memcpy", false);
-
- tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, tmp);
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, tmp);
- ftype = build_function_type (integer_type_node, tmp);
- gnat_define_builtin ("__builtin_memcmp", ftype, BUILT_IN_MEMCMP,
- "memcmp", false);
-
- tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, integer_type_node, tmp);
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, tmp);
- ftype = build_function_type (integer_type_node, tmp);
- gnat_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET,
- "memset", false);
-
- tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
- ftype = build_function_type (integer_type_node, tmp);
- gnat_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ, "clz", true);
-
- tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node);
- ftype = build_function_type (integer_type_node, tmp);
- gnat_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL, "clzl", true);
-
- tmp = tree_cons (NULL_TREE, long_long_integer_type_node, void_list_node);
- ftype = build_function_type (integer_type_node, tmp);
- gnat_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL, "clzll",
- true);
-
- /* The init_trampoline and adjust_trampoline builtins aren't used directly.
- They are inserted during lowering of nested functions. */
-
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, tmp);
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, tmp);
- ftype = build_function_type (void_type_node, tmp);
- gnat_define_builtin ("__builtin_init_trampoline", ftype,
- BUILT_IN_INIT_TRAMPOLINE, "init_trampoline", false);
-
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, void_list_node);
- ftype = build_function_type (ptr_void_type_node, tmp);
- gnat_define_builtin ("__builtin_adjust_trampoline", ftype,
- BUILT_IN_ADJUST_TRAMPOLINE, "adjust_trampoline", true);
-
- /* The stack_save, stack_restore, and alloca builtins aren't used directly.
- They are inserted during gimplification to implement variable sized stack
- allocation. */
-
- ftype = build_function_type (ptr_void_type_node, void_list_node);
- gnat_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE,
- "stack_save", false);
-
- tmp = tree_cons (NULL_TREE, ptr_void_type_node, void_list_node);
- ftype = build_function_type (void_type_node, tmp);
- gnat_define_builtin ("__builtin_stack_restore", ftype,
- BUILT_IN_STACK_RESTORE, "stack_restore", false);
-
- tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
- ftype = build_function_type (ptr_void_type_node, tmp);
- gnat_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA,
- "alloca", false);
+ /* Builtins used by generic optimizers. */
+ build_common_builtin_nodes ();
/* Target specific builtins, such as the AltiVec family on ppc. */
targetm.init_builtins ();
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 56e7eb0..432ecc6 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -59,7 +59,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
const char *const built_in_class_names[4]
= {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
-#define DEF_BUILTIN(X, N, C, T, LT, B, F, NA, AT, IM) #X,
+#define DEF_BUILTIN(X, N, C, T, LT, B, F, NA, AT, IM, COND) #X,
const char *const built_in_names[(int) END_BUILTINS] =
{
#include "builtins.def"
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 972b6a2..8857a93 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -69,7 +69,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#undef DEF_GCC_BUILTIN
#define DEF_GCC_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, BT_LAST, \
- false, false, false, ATTRS, true)
+ false, false, false, ATTRS, true, true)
/* A library builtin (like __builtin_strchr) is a builtin equivalent
of an ANSI/ISO standard library function. In addition to the
@@ -80,7 +80,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#undef DEF_LIB_BUILTIN
#define DEF_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, false, ATTRS, true)
+ true, true, false, ATTRS, true, true)
/* Like DEF_LIB_BUILTIN, except that the function is not one that is
specified by ANSI/ISO C. So, when we're being fully conformant we
@@ -89,21 +89,21 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#undef DEF_EXT_LIB_BUILTIN
#define DEF_EXT_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, true, ATTRS, false)
+ true, true, true, ATTRS, false, true)
/* Like DEF_LIB_BUILTIN, except that the function is only a part of
the standard in C94 or above. */
#undef DEF_C94_BUILTIN
#define DEF_C94_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc94, ATTRS, TARGET_C99_FUNCTIONS)
+ true, true, !flag_isoc94, ATTRS, TARGET_C99_FUNCTIONS, true)
/* Like DEF_LIB_BUILTIN, except that the function is only a part of
the standard in C99 or above. */
#undef DEF_C99_BUILTIN
#define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS)
+ true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS, true)
/* Builtin that is specified by C99 and C90 reserve the name for future use.
We can still recognize the builtin in C90 mode but we can't produce it
@@ -111,7 +111,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#undef DEF_C99_C90RES_BUILTIN
#define DEF_C99_C90RES_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS)
+ true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS, true)
+
+/* Allocate the enum and the name for a builtin, but do not actually
+ define it here at all. */
+#undef DEF_BUILTIN_STUB
+#define DEF_BUILTIN_STUB(ENUM, NAME) \
+ DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, 0, 0, false, false, \
+ false, 0, false, false)
/* Define an attribute list for math functions that are normally
"impure" because some of them may write into global memory for
@@ -610,8 +617,6 @@ DEF_GCC_BUILTIN (BUILT_IN_RETURN, "return", BT_FN_VOID_PTR, ATTR_NORETURN
DEF_GCC_BUILTIN (BUILT_IN_RETURN_ADDRESS, "return_address", BT_FN_PTR_UINT, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_SAVEREGS, "saveregs", BT_FN_PTR_VAR, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_SETJMP, "setjmp", BT_FN_INT_PTR, ATTR_NULL)
-DEF_GCC_BUILTIN (BUILT_IN_STACK_SAVE, "stack_save", BT_FN_PTR, ATTR_NULL)
-DEF_GCC_BUILTIN (BUILT_IN_STACK_RESTORE, "stack_restore", BT_FN_VOID_PTR, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_STDARG_START, "stdarg_start", BT_FN_VOID_VALIST_REF_VAR, ATTR_NULL)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRFMON, "strfmon", BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_STRFMON_3_4)
DEF_LIB_BUILTIN (BUILT_IN_STRFTIME, "strftime", BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR, ATTR_FORMAT_STRFTIME_3_0)
@@ -623,12 +628,16 @@ DEF_GCC_BUILTIN (BUILT_IN_VA_END, "va_end", BT_FN_VOID_VALIST_REF, ATTR_N
DEF_GCC_BUILTIN (BUILT_IN_VA_START, "va_start", BT_FN_VOID_VALIST_REF_VAR, ATTR_NULL)
DEF_EXT_LIB_BUILTIN (BUILT_IN__EXIT, "_exit", BT_FN_VOID_INT, ATTR_NORETURN_NOTHROW_LIST)
DEF_C99_BUILTIN (BUILT_IN__EXIT2, "_Exit", BT_FN_VOID_INT, ATTR_NORETURN_NOTHROW_LIST)
-DEF_GCC_BUILTIN (BUILT_IN_INIT_TRAMPOLINE, "init_trampoline", BT_FN_VOID_PTR_PTR_PTR, ATTR_NOTHROW_LIST)
-DEF_GCC_BUILTIN (BUILT_IN_ADJUST_TRAMPOLINE, "adjust_trampoline", BT_FN_PTR_PTR, ATTR_CONST_NOTHROW_LIST)
-DEF_GCC_BUILTIN (BUILT_IN_NONLOCAL_GOTO, "nonlocal_goto", BT_FN_PTR_PTR, ATTR_NORETURN_NOTHROW_LIST)
+
+/* Implementing nested functions. */
+DEF_BUILTIN_STUB (BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline")
+DEF_BUILTIN_STUB (BUILT_IN_ADJUST_TRAMPOLINE, "__builtin_adjust_trampoline")
+DEF_BUILTIN_STUB (BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto")
+
+/* Implementing variable sized local variables. */
+DEF_BUILTIN_STUB (BUILT_IN_STACK_SAVE, "__builtin_stack_save")
+DEF_BUILTIN_STUB (BUILT_IN_STACK_RESTORE, "__builtin_stack_restore")
/* Profiling hooks. */
-DEF_GCC_BUILTIN (BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter",
- BT_FN_VOID, ATTR_NULL)
-DEF_GCC_BUILTIN (BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit",
- BT_FN_VOID, ATTR_NULL)
+DEF_BUILTIN_STUB (BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter")
+DEF_BUILTIN_STUB (BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit")
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 72fd846..15f3648 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -3199,9 +3199,9 @@ c_common_nodes_and_builtins (void)
c_init_attributes ();
-#define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, \
- BOTH_P, FALLBACK_P, NONANSI_P, ATTRS, IMPLICIT) \
- if (NAME) \
+#define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P, \
+ NONANSI_P, ATTRS, IMPLICIT, COND) \
+ if (NAME && COND) \
{ \
tree decl; \
\
@@ -3234,6 +3234,8 @@ c_common_nodes_and_builtins (void)
#include "builtins.def"
#undef DEF_BUILTIN
+ build_common_builtin_nodes ();
+
targetm.init_builtins ();
if (flag_mudflap)
mudflap_init ();
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b1918a3..6db9cd9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-09 Richard Henderson <rth@redhat.com>
+
+ * f95-lang.c (gfc_init_builtin_functions): Call
+ build_common_builtin_nodes; do not define any functions handled
+ by it.
+
2005-02-08 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* expr.c (gfc_copy_expr): Don't copy 'op1' and 'op2' for
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index b406bf0..7f04b7c 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -794,8 +794,7 @@ gfc_init_builtin_functions (void)
BUILT_IN_CABS, "cabs", true);
gfc_define_builtin ("__builtin_cabsf", func_cfloat_float,
BUILT_IN_CABSF, "cabsf", true);
-
-
+
gfc_define_builtin ("__builtin_copysign", mfunc_double[1],
BUILT_IN_COPYSIGN, "copysign", true);
gfc_define_builtin ("__builtin_copysignf", mfunc_float[1],
@@ -809,61 +808,28 @@ gfc_init_builtin_functions (void)
/* Other builtin functions we use. */
- tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, long_integer_type_node, tmp);
- ftype = build_function_type (long_integer_type_node, tmp);
- gfc_define_builtin ("__builtin_expect", ftype, BUILT_IN_EXPECT,
- "__builtin_expect", true);
-
- tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, pvoid_type_node, tmp);
- tmp = tree_cons (NULL_TREE, pvoid_type_node, tmp);
- ftype = build_function_type (pvoid_type_node, tmp);
- gfc_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
- "memcpy", false);
-
tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
- gfc_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ, "clz", true);
+ gfc_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ,
+ "__builtin_clz", true);
tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
- gfc_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL, "clzl", true);
+ gfc_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL,
+ "__builtin_clzl", true);
tmp = tree_cons (NULL_TREE, long_long_integer_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
- gfc_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL, "clzll", true);
-
- tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
- tmp = tree_cons (NULL_TREE, pvoid_type_node, tmp);
- tmp = tree_cons (NULL_TREE, pvoid_type_node, tmp);
- ftype = build_function_type (void_type_node, tmp);
- gfc_define_builtin ("__builtin_init_trampoline", ftype,
- BUILT_IN_INIT_TRAMPOLINE, "init_trampoline", false);
-
- tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
- ftype = build_function_type (pvoid_type_node, tmp);
- gfc_define_builtin ("__builtin_adjust_trampoline", ftype,
- BUILT_IN_ADJUST_TRAMPOLINE, "adjust_trampoline", true);
-
- /* The stack_save, stack_restore, and alloca builtins aren't used directly.
- They are inserted during gimplification to implement variable sized
- stack allocation. */
-
- ftype = build_function_type (pvoid_type_node, void_list_node);
- gfc_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE,
- "stack_save", false);
-
- tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
- ftype = build_function_type (void_type_node, tmp);
- gfc_define_builtin ("__builtin_stack_restore", ftype, BUILT_IN_STACK_RESTORE,
- "stack_restore", false);
-
- tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
- ftype = build_function_type (pvoid_type_node, tmp);
- gfc_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA,
- "alloca", false);
+ gfc_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL,
+ "__builtin_clzll", true);
+
+ tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node);
+ tmp = tree_cons (NULL_TREE, long_integer_type_node, tmp);
+ ftype = build_function_type (long_integer_type_node, tmp);
+ gfc_define_builtin ("__builtin_expect", ftype, BUILT_IN_EXPECT,
+ "__builtin_expect", true);
+ build_common_builtin_nodes ();
targetm.init_builtins ();
}
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index e68ffe3..a24d4a4 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-09 Richard Henderson <rth@redhat.com>
+
+ * builtins.c (initialize_builtins): Call build_common_builtin_nodes.
+ * decl.c (java_init_decl_processing): Initialize const_ptr_type_node.
+
2005-02-08 Marcin Dalecki <martin@dalecki.de>
* expr.c (add_type_assertion): Use the proper enumeration type,
diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c
index 8230036..fd8aa5a 100644
--- a/gcc/java/builtins.c
+++ b/gcc/java/builtins.c
@@ -216,6 +216,8 @@ initialize_builtins (void)
double_ftype_double, "_ZN4java4lang4Math4sqrtEd");
define_builtin (BUILT_IN_TAN, "__builtin_tan",
double_ftype_double, "_ZN4java4lang4Math3tanEd");
+
+ build_common_builtin_nodes ();
}
/* If the call matches a builtin, return the
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 1343ebf..ad1b55e 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -692,7 +692,11 @@ java_init_decl_processing (void)
void_type_node = make_node (VOID_TYPE);
pushdecl (build_decl (TYPE_DECL, get_identifier ("void"), void_type_node));
layout_type (void_type_node); /* Uses size_zero_node */
+
ptr_type_node = build_pointer_type (void_type_node);
+ const_ptr_type_node
+ = build_pointer_type (build_type_variant (void_type_node, 1, 0));
+
t = make_node (VOID_TYPE);
layout_type (t); /* Uses size_zero_node */
return_address_type_node = build_pointer_type (t);
diff --git a/gcc/tree.c b/gcc/tree.c
index 6afc17f..4e7f7bf 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5782,6 +5782,124 @@ build_common_tree_nodes_2 (int short_double)
}
}
+/* A subroutine of build_common_builtin_nodes. Define a builtin function. */
+
+static void
+local_define_builtin (const char *name, tree type, enum built_in_function code,
+ const char *library_name, int ecf_flags)
+{
+ tree decl;
+
+ decl = lang_hooks.builtin_function (name, type, code, BUILT_IN_NORMAL,
+ library_name, NULL_TREE);
+ if (ecf_flags & ECF_CONST)
+ TREE_READONLY (decl) = 1;
+ if (ecf_flags & ECF_PURE)
+ DECL_IS_PURE (decl) = 1;
+ if (ecf_flags & ECF_NORETURN)
+ TREE_THIS_VOLATILE (decl) = 1;
+ if (ecf_flags & ECF_NOTHROW)
+ TREE_NOTHROW (decl) = 1;
+ if (ecf_flags & ECF_MALLOC)
+ DECL_IS_MALLOC (decl) = 1;
+
+ built_in_decls[code] = decl;
+ implicit_built_in_decls[code] = decl;
+}
+
+/* Call this function after instantiating all builtins that the language
+ front end cares about. This will build the rest of the builtins that
+ are relied upon by the tree optimizers and the middle-end. */
+
+void
+build_common_builtin_nodes (void)
+{
+ tree tmp, ftype;
+
+ if (built_in_decls[BUILT_IN_MEMCPY] == NULL
+ || built_in_decls[BUILT_IN_MEMMOVE] == NULL)
+ {
+ tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
+ tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp);
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ ftype = build_function_type (ptr_type_node, tmp);
+
+ if (built_in_decls[BUILT_IN_MEMCPY] == NULL)
+ local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
+ "memcpy", ECF_NOTHROW);
+ if (built_in_decls[BUILT_IN_MEMMOVE] == NULL)
+ local_define_builtin ("__builtin_memmove", ftype, BUILT_IN_MEMMOVE,
+ "memmove", ECF_NOTHROW);
+ }
+
+ if (built_in_decls[BUILT_IN_MEMCMP] == NULL)
+ {
+ tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
+ tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp);
+ tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp);
+ ftype = build_function_type (ptr_type_node, tmp);
+ local_define_builtin ("__builtin_memcmp", ftype, BUILT_IN_MEMCMP,
+ "memcmp", ECF_PURE | ECF_NOTHROW);
+ }
+
+ if (built_in_decls[BUILT_IN_MEMSET] == NULL)
+ {
+ tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
+ tmp = tree_cons (NULL_TREE, integer_type_node, tmp);
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ ftype = build_function_type (ptr_type_node, tmp);
+ local_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET,
+ "memset", ECF_NOTHROW);
+ }
+
+ if (built_in_decls[BUILT_IN_ALLOCA] == NULL)
+ {
+ tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
+ ftype = build_function_type (ptr_type_node, tmp);
+ local_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA,
+ "alloca", ECF_NOTHROW | ECF_MALLOC);
+ }
+
+ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ ftype = build_function_type (void_type_node, tmp);
+ local_define_builtin ("__builtin_init_trampoline", ftype,
+ BUILT_IN_INIT_TRAMPOLINE,
+ "__builtin_init_trampoline", ECF_NOTHROW);
+
+ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ ftype = build_function_type (ptr_type_node, tmp);
+ local_define_builtin ("__builtin_adjust_trampoline", ftype,
+ BUILT_IN_ADJUST_TRAMPOLINE,
+ "__builtin_adjust_trampoline",
+ ECF_CONST | ECF_NOTHROW);
+
+ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ ftype = build_function_type (void_type_node, tmp);
+ local_define_builtin ("__builtin_nonlocal_goto", ftype,
+ BUILT_IN_NONLOCAL_GOTO,
+ "__builtin_nonlocal_goto",
+ ECF_NORETURN | ECF_NOTHROW);
+
+ ftype = build_function_type (ptr_type_node, void_list_node);
+ local_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE,
+ "__builtin_stack_save", ECF_NOTHROW);
+
+ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ ftype = build_function_type (void_type_node, tmp);
+ local_define_builtin ("__builtin_stack_restore", ftype,
+ BUILT_IN_STACK_RESTORE,
+ "__builtin_stack_restore", ECF_NOTHROW);
+
+ ftype = build_function_type (void_type_node, void_list_node);
+ local_define_builtin ("__builtin_profile_func_enter", ftype,
+ BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter", 0);
+ local_define_builtin ("__builtin_profile_func_exit", ftype,
+ BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit", 0);
+}
+
/* HACK. GROSS. This is absolutely disgusting. I wish there was a
better way.
diff --git a/gcc/tree.h b/gcc/tree.h
index e64fb99..60ebc73 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -182,7 +182,7 @@ extern const char *const built_in_class_names[4];
/* Codes that identify the various built in functions
so that expand_call can identify them quickly. */
-#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM) ENUM,
+#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) ENUM,
enum built_in_function
{
#include "builtins.def"
@@ -3591,6 +3591,7 @@ extern int real_minus_onep (tree);
extern void init_ttree (void);
extern void build_common_tree_nodes (bool, bool);
extern void build_common_tree_nodes_2 (int);
+extern void build_common_builtin_nodes (void);
extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int);
extern tree build_range_type (tree, tree, tree);
extern HOST_WIDE_INT int_cst_value (tree);
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog
index 75d2082..35d4710 100644
--- a/gcc/treelang/ChangeLog
+++ b/gcc/treelang/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-09 Richard Henderson <rth@redhat.com>
+
+ * treetree.c (treelang_init_decl_processing): Call
+ build_common_builtin_nodes.
+
2005-02-06 Joseph S. Myers <joseph@codesourcery.com>
* treelang.texi: Don't use local treelang version number. Don't
@@ -5,7 +10,7 @@
2005-02-01 James A. Morrison <phython@gcc.gnu.org>
- * (lex.l): Undef LINEMAP_POSITION_FOR_COLUMN before defining it.
+ * lex.l: Undef LINEMAP_POSITION_FOR_COLUMN before defining it.
2005-02-01 James A. Morrison <phython@gcc.gnu.org>
diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c
index b621fad..54dcb46 100644
--- a/gcc/treelang/treetree.c
+++ b/gcc/treelang/treetree.c
@@ -1209,7 +1209,7 @@ treelang_init_decl_processing (void)
tree_push_type_decl (get_identifier ("long double"), long_double_type_node);
tree_push_type_decl (get_identifier ("void"), void_type_node);
- /* Add any target-specific builtin functions. */
+ build_common_builtin_nodes ();
(*targetm.init_builtins) ();
pedantic_lvalues = pedantic;