aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2016-05-13 08:49:20 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-05-13 08:49:20 +0000
commitee516de9b3b1aab35e4b21e9058c6176ee30901b (patch)
tree4b89253c5567cb98e1c4a7e0dbbf1e5628ac0cc2 /gcc/tree.c
parentfff9b5ddb7f5a165518c7c634c16d127749225ed (diff)
downloadgcc-ee516de9b3b1aab35e4b21e9058c6176ee30901b.zip
gcc-ee516de9b3b1aab35e4b21e9058c6176ee30901b.tar.gz
gcc-ee516de9b3b1aab35e4b21e9058c6176ee30901b.tar.bz2
builtins.c (expand_builtin_memcmp): Do not emit the call here.
* builtins.c (expand_builtin_memcmp): Do not emit the call here. (expand_builtin_trap): Emit a regular call. (set_builtin_user_assembler_name): Remove obsolete cases. * dse.c (scan_insn): Adjust. * except.c: Include calls.h. (sjlj_emit_function_enter): If DONT_USE_BUILTIN_SETJMP is defined, emit a regular call to setjmp. * expr.c (emit_block_move_hints): Call emit_block_copy_via_libcall. (block_move_libcall_safe_for_call_parm): Use memcpy builtin. (emit_block_move_via_libcall): Delete. (block_move_fn): Delete. (init_block_move_fn): Likewise. (emit_block_move_libcall_fn): Likewise. (emit_block_op_via_libcall): New function. (set_storage_via_libcall): Tidy up and use memset builtin. (block_clear_fn): Delete. (init_block_clear_fn): Likewise. (clear_storage_libcall_fn): Likewise. (expand_assignment): Call emit_block_move_via_libcall. Do not include gt-expr.h. * expr.h (emit_block_op_via_libcall): Declare. (emit_block_copy_via_libcall): New inline function. (emit_block_move_via_libcall): Likewise. (emit_block_comp_via_libcall): Likewise. (block_clear_fn): Delete. (init_block_move_fn): Likewise. (init_block_clear_fn): Likewise. (emit_block_move_via_libcall): Likewise. (set_storage_via_libcall): Add default parameter value. * libfuncs.h (enum libfunc_index): Remove obsolete values. (abort_libfunc): Delete. (memcpy_libfunc): Likewise. (memmove_libfunc): Likewise. (memcmp_libfunc): Likewise. (memset_libfunc): Likewise. (setbits_libfunc): Likewise. (setjmp_libfunc): Likewise. (longjmp_libfunc): Likewise. (profile_function_entry_libfunc): Likewise. (profile_function_exit_libfunc): Likewise. (gcov_flush_libfunc): Likewise. * optabs-libfuncs.c (build_libfunc_function): Set DECL_ARTIFICIAL and DECL_VISIBILITY on the declaration. (init_optabs): Do not initialize obsolete libfuncs. * optabs.c (prepare_cmp_insn): Call emit_block_comp_via_libcall. * tree-core.h (ECF_RET1): Define. (ECF_TM_PURE): Adjust. (ECF_TM_BUILTIN): Likewise. * tree.c (set_call_expr_flags): Deal with ECF_RET1. (build_common_builtin_nodes): Initialize abort builtin. Add ECF_RET1 on memcpy, memmove and memset builtins. Pass final flags for alloca and alloca_with_align builtins. * config/alpha/alpha.c (alpha_init_libfuncs): Do not initialize obsolete builtins. * config/ia64/ia64.c (ia64_vms_init_libfuncs): Likewise. * config/i386/i386.c (ix86_expand_set_or_movmem): Adjust call to set_storage_via_libcall and call emit_block_copy_via_libcall. From-SVN: r236195
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index b63f64c..4e00004 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10451,6 +10451,11 @@ set_call_expr_flags (tree decl, int flags)
if (flags & ECF_LEAF)
DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("leaf"),
NULL, DECL_ATTRIBUTES (decl));
+ if (flags & ECF_RET1)
+ DECL_ATTRIBUTES (decl)
+ = tree_cons (get_identifier ("fn spec"),
+ build_tree_list (NULL_TREE, build_string (1, "1")),
+ DECL_ATTRIBUTES (decl));
if ((flags & ECF_TM_PURE) && flag_tm)
apply_tm_attr (decl, get_identifier ("transaction_pure"));
/* Looping const or pure is implied by noreturn.
@@ -10486,13 +10491,20 @@ build_common_builtin_nodes (void)
tree tmp, ftype;
int ecf_flags;
- if (!builtin_decl_explicit_p (BUILT_IN_UNREACHABLE))
+ if (!builtin_decl_explicit_p (BUILT_IN_UNREACHABLE)
+ || !builtin_decl_explicit_p (BUILT_IN_ABORT))
{
ftype = build_function_type (void_type_node, void_list_node);
- local_define_builtin ("__builtin_unreachable", ftype, BUILT_IN_UNREACHABLE,
- "__builtin_unreachable",
- ECF_NOTHROW | ECF_LEAF | ECF_NORETURN
- | ECF_CONST);
+ if (!builtin_decl_explicit_p (BUILT_IN_UNREACHABLE))
+ local_define_builtin ("__builtin_unreachable", ftype,
+ BUILT_IN_UNREACHABLE,
+ "__builtin_unreachable",
+ ECF_NOTHROW | ECF_LEAF | ECF_NORETURN
+ | ECF_CONST);
+ if (!builtin_decl_explicit_p (BUILT_IN_ABORT))
+ local_define_builtin ("__builtin_abort", ftype, BUILT_IN_ABORT,
+ "abort",
+ ECF_LEAF | ECF_NORETURN | ECF_CONST);
}
if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY)
@@ -10504,10 +10516,10 @@ build_common_builtin_nodes (void)
if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY))
local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
- "memcpy", ECF_NOTHROW | ECF_LEAF);
+ "memcpy", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
if (!builtin_decl_explicit_p (BUILT_IN_MEMMOVE))
local_define_builtin ("__builtin_memmove", ftype, BUILT_IN_MEMMOVE,
- "memmove", ECF_NOTHROW | ECF_LEAF);
+ "memmove", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
}
if (!builtin_decl_explicit_p (BUILT_IN_MEMCMP))
@@ -10525,15 +10537,19 @@ build_common_builtin_nodes (void)
ptr_type_node, integer_type_node,
size_type_node, NULL_TREE);
local_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET,
- "memset", ECF_NOTHROW | ECF_LEAF);
+ "memset", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
}
+ /* If we're checking the stack, `alloca' can throw. */
+ const int alloca_flags
+ = ECF_MALLOC | ECF_LEAF | (flag_stack_check ? 0 : ECF_NOTHROW);
+
if (!builtin_decl_explicit_p (BUILT_IN_ALLOCA))
{
ftype = build_function_type_list (ptr_type_node,
size_type_node, NULL_TREE);
local_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA,
- "alloca", ECF_MALLOC | ECF_NOTHROW | ECF_LEAF);
+ "alloca", alloca_flags);
}
ftype = build_function_type_list (ptr_type_node, size_type_node,
@@ -10541,14 +10557,7 @@ build_common_builtin_nodes (void)
local_define_builtin ("__builtin_alloca_with_align", ftype,
BUILT_IN_ALLOCA_WITH_ALIGN,
"__builtin_alloca_with_align",
- ECF_MALLOC | ECF_NOTHROW | ECF_LEAF);
-
- /* If we're checking the stack, `alloca' can throw. */
- if (flag_stack_check)
- {
- TREE_NOTHROW (builtin_decl_explicit (BUILT_IN_ALLOCA)) = 0;
- TREE_NOTHROW (builtin_decl_explicit (BUILT_IN_ALLOCA_WITH_ALIGN)) = 0;
- }
+ alloca_flags);
ftype = build_function_type_list (void_type_node,
ptr_type_node, ptr_type_node,