aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2011-10-11 19:55:09 +0000
committerMichael Meissner <meissner@gcc.gnu.org>2011-10-11 19:55:09 +0000
commite79983f458034c3061645a4c4ff83c9c4d9019b9 (patch)
tree304b794b6f6f0af1f79b00f4166b897337141fac /gcc/tree.c
parentf0286f957326b588ba6f49d1fed0c14c19033830 (diff)
downloadgcc-e79983f458034c3061645a4c4ff83c9c4d9019b9.zip
gcc-e79983f458034c3061645a4c4ff83c9c4d9019b9.tar.gz
gcc-e79983f458034c3061645a4c4ff83c9c4d9019b9.tar.bz2
Convert standard builtin functions from being arrays to using a functional interface
From-SVN: r179820
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 03edb9c..64c4968 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4656,10 +4656,9 @@ free_lang_data_in_decl (tree decl)
&& DECL_INITIAL (decl)
&& TREE_CODE (DECL_INITIAL (decl)) == BLOCK)
{
- /* Strip builtins from the translation-unit BLOCK. We still have
- targets without builtin_decl support and also builtins are
- shared nodes and thus we can't use TREE_CHAIN in multiple
- lists. */
+ /* Strip builtins from the translation-unit BLOCK. We still have targets
+ without builtin_decl_explicit support and also builtins are shared
+ nodes and thus we can't use TREE_CHAIN in multiple lists. */
tree *nextp = &BLOCK_VARS (DECL_INITIAL (decl));
while (*nextp)
{
@@ -6942,9 +6941,9 @@ iterative_hash_expr (const_tree t, hashval_t val)
or front end builtins, since the function code is overloaded in those
cases. */
if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL
- && built_in_decls[DECL_FUNCTION_CODE (t)])
+ && builtin_decl_explicit_p (DECL_FUNCTION_CODE (t)))
{
- t = built_in_decls[DECL_FUNCTION_CODE (t)];
+ t = builtin_decl_explicit (DECL_FUNCTION_CODE (t));
code = TREE_CODE (t);
}
/* FALL THROUGH */
@@ -9429,8 +9428,7 @@ local_define_builtin (const char *name, tree type, enum built_in_function code,
DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("leaf"),
NULL, DECL_ATTRIBUTES (decl));
- built_in_decls[code] = decl;
- implicit_built_in_decls[code] = decl;
+ set_builtin_decl (code, decl, true);
}
/* Call this function after instantiating all builtins that the language
@@ -9442,22 +9440,22 @@ build_common_builtin_nodes (void)
{
tree tmp, ftype;
- if (built_in_decls[BUILT_IN_MEMCPY] == NULL
- || built_in_decls[BUILT_IN_MEMMOVE] == NULL)
+ if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY)
+ || !builtin_decl_explicit_p (BUILT_IN_MEMMOVE))
{
ftype = build_function_type_list (ptr_type_node,
ptr_type_node, const_ptr_type_node,
size_type_node, NULL_TREE);
- if (built_in_decls[BUILT_IN_MEMCPY] == NULL)
+ if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY))
local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
"memcpy", ECF_NOTHROW | ECF_LEAF);
- if (built_in_decls[BUILT_IN_MEMMOVE] == NULL)
+ if (!builtin_decl_explicit_p (BUILT_IN_MEMMOVE))
local_define_builtin ("__builtin_memmove", ftype, BUILT_IN_MEMMOVE,
"memmove", ECF_NOTHROW | ECF_LEAF);
}
- if (built_in_decls[BUILT_IN_MEMCMP] == NULL)
+ if (!builtin_decl_explicit_p (BUILT_IN_MEMCMP))
{
ftype = build_function_type_list (integer_type_node, const_ptr_type_node,
const_ptr_type_node, size_type_node,
@@ -9466,7 +9464,7 @@ build_common_builtin_nodes (void)
"memcmp", ECF_PURE | ECF_NOTHROW | ECF_LEAF);
}
- if (built_in_decls[BUILT_IN_MEMSET] == NULL)
+ if (!builtin_decl_explicit_p (BUILT_IN_MEMSET))
{
ftype = build_function_type_list (ptr_type_node,
ptr_type_node, integer_type_node,
@@ -9475,7 +9473,7 @@ build_common_builtin_nodes (void)
"memset", ECF_NOTHROW | ECF_LEAF);
}
- if (built_in_decls[BUILT_IN_ALLOCA] == NULL)
+ if (!builtin_decl_explicit_p (BUILT_IN_ALLOCA))
{
ftype = build_function_type_list (ptr_type_node,
size_type_node, NULL_TREE);
@@ -9492,8 +9490,8 @@ build_common_builtin_nodes (void)
/* If we're checking the stack, `alloca' can throw. */
if (flag_stack_check)
{
- TREE_NOTHROW (built_in_decls[BUILT_IN_ALLOCA]) = 0;
- TREE_NOTHROW (built_in_decls[BUILT_IN_ALLOCA_WITH_ALIGN]) = 0;
+ TREE_NOTHROW (builtin_decl_explicit (BUILT_IN_ALLOCA)) = 0;
+ TREE_NOTHROW (builtin_decl_explicit (BUILT_IN_ALLOCA_WITH_ALIGN)) = 0;
}
ftype = build_function_type_list (void_type_node,
@@ -9560,7 +9558,7 @@ build_common_builtin_nodes (void)
? "_Unwind_SjLj_Resume" : "_Unwind_Resume"),
ECF_NORETURN);
- if (built_in_decls[BUILT_IN_RETURN_ADDRESS] == NULL_TREE)
+ if (builtin_decl_explicit (BUILT_IN_RETURN_ADDRESS) == NULL_TREE)
{
ftype = build_function_type_list (ptr_type_node, integer_type_node,
NULL_TREE);
@@ -9570,16 +9568,16 @@ build_common_builtin_nodes (void)
ECF_NOTHROW);
}
- if (built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER] == NULL_TREE
- || built_in_decls[BUILT_IN_PROFILE_FUNC_EXIT] == NULL_TREE)
+ if (!builtin_decl_explicit_p (BUILT_IN_PROFILE_FUNC_ENTER)
+ || !builtin_decl_explicit_p (BUILT_IN_PROFILE_FUNC_EXIT))
{
ftype = build_function_type_list (void_type_node, ptr_type_node,
ptr_type_node, NULL_TREE);
- if (built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER] == NULL_TREE)
+ if (!builtin_decl_explicit_p (BUILT_IN_PROFILE_FUNC_ENTER))
local_define_builtin ("__cyg_profile_func_enter", ftype,
BUILT_IN_PROFILE_FUNC_ENTER,
"__cyg_profile_func_enter", 0);
- if (built_in_decls[BUILT_IN_PROFILE_FUNC_EXIT] == NULL_TREE)
+ if (!builtin_decl_explicit_p (BUILT_IN_PROFILE_FUNC_EXIT))
local_define_builtin ("__cyg_profile_func_exit", ftype,
BUILT_IN_PROFILE_FUNC_EXIT,
"__cyg_profile_func_exit", 0);