summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-08-27 14:34:52 +0200
committerMartin Liska <marxin@gcc.gnu.org>2018-08-27 12:34:52 +0000
commit3d78e00879b42574c9b0084c30f1361f0cfb9101 (patch)
treebc8f9a510c36fa862ab02298af03a506c99fdda5
parentbb79aba479cf228832b8d2c6bfb8bf420a1f6f4a (diff)
Come up with fndecl_built_in_p.
2018-08-27 Martin Liska <mliska@suse.cz> * builtins.h (is_builtin_fn): Remove and fndecl_built_in_p. * builtins.c (is_builtin_fn): Likewise. * attribs.c (diag_attr_exclusions): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (builtin_mathfn_code): Likewise. (fold_builtin_expect): Likewise. (fold_call_expr): Likewise. (fold_builtin_call_array): Likewise. (fold_call_stmt): Likewise. (set_builtin_user_assembler_name): Likewise. (is_simple_builtin): Likewise. * calls.c (gimple_alloca_call_p): Likewise. (maybe_warn_nonstring_arg): Likewise. * cfgexpand.c (expand_call_stmt): Likewise. * cgraph.c (cgraph_update_edges_for_call_stmt_node): Likewise. (cgraph_edge::verify_corresponds_to_fndecl): Likewise. (cgraph_node::verify_node): Likewise. * cgraphclones.c (build_function_decl_skip_args): Likewise. (cgraph_node::create_clone): Likewise. * config/arm/arm.c (arm_insert_attributes): Likewise. * config/i386/i386.c (ix86_gimple_fold_builtin): Likewise. * dse.c (scan_insn): Likewise. * expr.c (expand_expr_real_1): Likewise. * fold-const.c (operand_equal_p): Likewise. (fold_binary_loc): Likewise. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise. * gimple-low.c (lower_stmt): Likewise. * gimple-pretty-print.c (dump_gimple_call): Likewise. * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call): Likewise. * gimple.c (gimple_build_call_from_tree): Likewise. (gimple_call_builtin_p): Likewise. (gimple_call_combined_fn): Likewise. * gimplify.c (gimplify_call_expr): Likewise. (gimple_boolify): Likewise. (gimplify_modify_expr): Likewise. (gimplify_addr_expr): Likewise. * hsa-gen.c (gen_hsa_insns_for_call): Likewise. * ipa-cp.c (determine_versionability): Likewise. * ipa-fnsummary.c (compute_fn_summary): Likewise. * ipa-param-manipulation.c (ipa_modify_formal_parameters): Likewise. * ipa-split.c (visit_bb): Likewise. (split_function): Likewise. * ipa-visibility.c (cgraph_externally_visible_p): Likewise. * lto-cgraph.c (input_node): Likewise. * lto-streamer-out.c (write_symbol): Likewise. * omp-low.c (setjmp_or_longjmp_p): Likewise. (lower_omp_1): Likewise. * predict.c (strip_predict_hints): Likewise. * print-tree.c (print_node): Likewise. * symtab.c (symtab_node::output_to_lto_symbol_table_p): Likewise. * trans-mem.c (is_tm_irrevocable): Likewise. (is_tm_load): Likewise. (is_tm_simple_load): Likewise. (is_tm_store): Likewise. (is_tm_simple_store): Likewise. (is_tm_abort): Likewise. (tm_region_init_1): Likewise. * tree-call-cdce.c (gen_shrink_wrap_conditions): Likewise. * tree-cfg.c (verify_gimple_call): Likewise. (move_stmt_r): Likewise. (stmt_can_terminate_bb_p): Likewise. * tree-eh.c (lower_eh_constructs_2): Likewise. * tree-if-conv.c (if_convertible_stmt_p): Likewise. * tree-inline.c (remap_gimple_stmt): Likewise. (copy_bb): Likewise. (estimate_num_insns): Likewise. (fold_marked_statements): Likewise. * tree-sra.c (scan_function): Likewise. * tree-ssa-ccp.c (surely_varying_stmt_p): Likewise. (optimize_stack_restore): Likewise. (pass_fold_builtins::execute): Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. (mark_all_reaching_defs_necessary_1): Likewise. * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Likewise. * tree-ssa-forwprop.c (simplify_builtin_call): Likewise. (pass_forwprop::execute): Likewise. * tree-ssa-loop-im.c (stmt_cost): Likewise. * tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise. * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Likewise. * tree-ssa-strlen.c (get_string_length): Likewise. * tree-ssa-structalias.c (handle_lhs_call): Likewise. (find_func_aliases_for_call): Likewise. * tree-ssa-ter.c (find_replaceable_in_bb): Likewise. * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Likewise. * tree-tailcall.c (find_tail_calls): Likewise. * tree.c (need_assembler_name_p): Likewise. (free_lang_data_in_decl): Likewise. (get_call_combined_fn): Likewise. * ubsan.c (is_ubsan_builtin_p): Likewise. * varasm.c (incorporeal_function_p): Likewise. * tree.h (DECL_BUILT_IN): Remove and replace with fndecl_built_in_p. (DECL_BUILT_IN_P): Transfort to fndecl_built_in_p. (fndecl_built_in_p): New. 2018-08-27 Martin Liska <mliska@suse.cz> * gcc-interface/decl.c (update_profile): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. * gcc-interface/gigi.h (call_is_atomic_load): Likewise. * gcc-interface/utils.c (gnat_pushdecl): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * c-common.c (check_function_restrict): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (check_builtin_function_arguments): Likewise. (reject_gcc_builtin): Likewise. * c-warn.c (sizeof_pointer_memaccess_warning): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * c-decl.c (locate_old_decl): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (diagnose_mismatched_decls): Likewise. (merge_decls): Likewise. (warn_if_shadowing): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. * c-parser.c (c_parser_postfix_expression_after_primary): Likewise. * c-tree.h (C_DECL_ISNT_PROTOTYPE): Likewise. * c-typeck.c (build_function_call_vec): Likewise. (convert_arguments): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * call.c (build_call_a): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (build_cxx_call): Likewise. * constexpr.c (constexpr_fn_retval): Likewise. (cxx_eval_builtin_function_call): Likewise. (cxx_eval_call_expression): Likewise. (potential_constant_expression_1): Likewise. * cp-gimplify.c (cp_gimplify_expr): Likewise. (cp_fold): Likewise. * decl.c (decls_match): Likewise. (validate_constexpr_redeclaration): Likewise. (duplicate_decls): Likewise. (make_rtl_for_nonlocal_decl): Likewise. * name-lookup.c (consider_binding_level): Likewise. (cp_emit_debug_info_for_using): Likewise. * semantics.c (finish_call_expr): Likewise. * tree.c (builtin_valid_in_constant_expr_p): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * go-gcc.cc (Gcc_backend::call_expression): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. 2018-08-27 Martin Liska <mliska@suse.cz> * lto-lang.c (handle_const_attribute): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. * lto-symtab.c (lto_symtab_merge_p): Likewise. (lto_symtab_merge_decls_1): Likewise. (lto_symtab_merge_symbols): Likewise. * lto.c (lto_maybe_register_decl): Likewise. (read_cgraph_and_symbols): Likewise. From-SVN: r263880
-rw-r--r--gcc/ChangeLog98
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/gcc-interface/decl.c2
-rw-r--r--gcc/ada/gcc-interface/gigi.h2
-rw-r--r--gcc/ada/gcc-interface/utils.c2
-rw-r--r--gcc/attribs.c2
-rw-r--r--gcc/builtins.c46
-rw-r--r--gcc/builtins.h1
-rw-r--r--gcc/c-family/ChangeLog9
-rw-r--r--gcc/c-family/c-common.c8
-rw-r--r--gcc/c-family/c-warn.c2
-rw-r--r--gcc/c/ChangeLog15
-rw-r--r--gcc/c/c-decl.c25
-rw-r--r--gcc/c/c-parser.c6
-rw-r--r--gcc/c/c-tree.h2
-rw-r--r--gcc/c/c-typeck.c7
-rw-r--r--gcc/calls.c4
-rw-r--r--gcc/cfgexpand.c4
-rw-r--r--gcc/cgraph.c10
-rw-r--r--gcc/cgraphclones.c5
-rw-r--r--gcc/config/arm/arm.c2
-rw-r--r--gcc/config/i386/i386.c4
-rw-r--r--gcc/cp/ChangeLog21
-rw-r--r--gcc/cp/call.c5
-rw-r--r--gcc/cp/constexpr.c14
-rw-r--r--gcc/cp/cp-gimplify.c12
-rw-r--r--gcc/cp/decl.c20
-rw-r--r--gcc/cp/name-lookup.c4
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/cp/tree.c5
-rw-r--r--gcc/dse.c3
-rw-r--r--gcc/expr.c2
-rw-r--r--gcc/fold-const.c5
-rw-r--r--gcc/gimple-fold.c3
-rw-r--r--gcc/gimple-low.c2
-rw-r--r--gcc/gimple-pretty-print.c3
-rw-r--r--gcc/gimple-ssa-warn-restrict.c2
-rw-r--r--gcc/gimple.c7
-rw-r--r--gcc/gimplify.c17
-rw-r--r--gcc/go/ChangeLog6
-rw-r--r--gcc/go/go-gcc.cc4
-rw-r--r--gcc/hsa-gen.c3
-rw-r--r--gcc/ipa-cp.c3
-rw-r--r--gcc/ipa-fnsummary.c6
-rw-r--r--gcc/ipa-param-manipulation.c2
-rw-r--r--gcc/ipa-split.c5
-rw-r--r--gcc/ipa-visibility.c2
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/lto-streamer-out.c3
-rw-r--r--gcc/lto/ChangeLog11
-rw-r--r--gcc/lto/lto-lang.c3
-rw-r--r--gcc/lto/lto-symtab.c8
-rw-r--r--gcc/lto/lto.c5
-rw-r--r--gcc/omp-low.c7
-rw-r--r--gcc/predict.c8
-rw-r--r--gcc/print-tree.c6
-rw-r--r--gcc/symtab.c2
-rw-r--r--gcc/trans-mem.c20
-rw-r--r--gcc/tree-call-cdce.c2
-rw-r--r--gcc/tree-cfg.c9
-rw-r--r--gcc/tree-eh.c2
-rw-r--r--gcc/tree-if-conv.c2
-rw-r--r--gcc/tree-inline.c9
-rw-r--r--gcc/tree-sra.c3
-rw-r--r--gcc/tree-ssa-ccp.c13
-rw-r--r--gcc/tree-ssa-dce.c4
-rw-r--r--gcc/tree-ssa-dom.c3
-rw-r--r--gcc/tree-ssa-forwprop.c4
-rw-r--r--gcc/tree-ssa-loop-im.c4
-rw-r--r--gcc/tree-ssa-math-opts.c2
-rw-r--r--gcc/tree-ssa-sccvn.c2
-rw-r--r--gcc/tree-ssa-strlen.c2
-rw-r--r--gcc/tree-ssa-structalias.c4
-rw-r--r--gcc/tree-ssa-ter.c2
-rw-r--r--gcc/tree-stdarg.c7
-rw-r--r--gcc/tree-tailcall.c2
-rw-r--r--gcc/tree.c11
-rw-r--r--gcc/tree.h59
-rw-r--r--gcc/ubsan.c2
-rw-r--r--gcc/varasm.c2
80 files changed, 391 insertions, 257 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 47844ef4678..459bcaddc07 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,103 @@
2018-08-27 Martin Liska <mliska@suse.cz>
+ * builtins.h (is_builtin_fn): Remove and fndecl_built_in_p.
+ * builtins.c (is_builtin_fn): Likewise.
+ * attribs.c (diag_attr_exclusions): Use new function
+ fndecl_built_in_p and remove check for FUNCTION_DECL if
+ possible.
+ (builtin_mathfn_code): Likewise.
+ (fold_builtin_expect): Likewise.
+ (fold_call_expr): Likewise.
+ (fold_builtin_call_array): Likewise.
+ (fold_call_stmt): Likewise.
+ (set_builtin_user_assembler_name): Likewise.
+ (is_simple_builtin): Likewise.
+ * calls.c (gimple_alloca_call_p): Likewise.
+ (maybe_warn_nonstring_arg): Likewise.
+ * cfgexpand.c (expand_call_stmt): Likewise.
+ * cgraph.c (cgraph_update_edges_for_call_stmt_node): Likewise.
+ (cgraph_edge::verify_corresponds_to_fndecl): Likewise.
+ (cgraph_node::verify_node): Likewise.
+ * cgraphclones.c (build_function_decl_skip_args): Likewise.
+ (cgraph_node::create_clone): Likewise.
+ * config/arm/arm.c (arm_insert_attributes): Likewise.
+ * config/i386/i386.c (ix86_gimple_fold_builtin): Likewise.
+ * dse.c (scan_insn): Likewise.
+ * expr.c (expand_expr_real_1): Likewise.
+ * fold-const.c (operand_equal_p): Likewise.
+ (fold_binary_loc): Likewise.
+ * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise.
+ * gimple-low.c (lower_stmt): Likewise.
+ * gimple-pretty-print.c (dump_gimple_call): Likewise.
+ * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call): Likewise.
+ * gimple.c (gimple_build_call_from_tree): Likewise.
+ (gimple_call_builtin_p): Likewise.
+ (gimple_call_combined_fn): Likewise.
+ * gimplify.c (gimplify_call_expr): Likewise.
+ (gimple_boolify): Likewise.
+ (gimplify_modify_expr): Likewise.
+ (gimplify_addr_expr): Likewise.
+ * hsa-gen.c (gen_hsa_insns_for_call): Likewise.
+ * ipa-cp.c (determine_versionability): Likewise.
+ * ipa-fnsummary.c (compute_fn_summary): Likewise.
+ * ipa-param-manipulation.c (ipa_modify_formal_parameters): Likewise.
+ * ipa-split.c (visit_bb): Likewise.
+ (split_function): Likewise.
+ * ipa-visibility.c (cgraph_externally_visible_p): Likewise.
+ * lto-cgraph.c (input_node): Likewise.
+ * lto-streamer-out.c (write_symbol): Likewise.
+ * omp-low.c (setjmp_or_longjmp_p): Likewise.
+ (lower_omp_1): Likewise.
+ * predict.c (strip_predict_hints): Likewise.
+ * print-tree.c (print_node): Likewise.
+ * symtab.c (symtab_node::output_to_lto_symbol_table_p): Likewise.
+ * trans-mem.c (is_tm_irrevocable): Likewise.
+ (is_tm_load): Likewise.
+ (is_tm_simple_load): Likewise.
+ (is_tm_store): Likewise.
+ (is_tm_simple_store): Likewise.
+ (is_tm_abort): Likewise.
+ (tm_region_init_1): Likewise.
+ * tree-call-cdce.c (gen_shrink_wrap_conditions): Likewise.
+ * tree-cfg.c (verify_gimple_call): Likewise.
+ (move_stmt_r): Likewise.
+ (stmt_can_terminate_bb_p): Likewise.
+ * tree-eh.c (lower_eh_constructs_2): Likewise.
+ * tree-if-conv.c (if_convertible_stmt_p): Likewise.
+ * tree-inline.c (remap_gimple_stmt): Likewise.
+ (copy_bb): Likewise.
+ (estimate_num_insns): Likewise.
+ (fold_marked_statements): Likewise.
+ * tree-sra.c (scan_function): Likewise.
+ * tree-ssa-ccp.c (surely_varying_stmt_p): Likewise.
+ (optimize_stack_restore): Likewise.
+ (pass_fold_builtins::execute): Likewise.
+ * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise.
+ (mark_all_reaching_defs_necessary_1): Likewise.
+ * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Likewise.
+ * tree-ssa-forwprop.c (simplify_builtin_call): Likewise.
+ (pass_forwprop::execute): Likewise.
+ * tree-ssa-loop-im.c (stmt_cost): Likewise.
+ * tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise.
+ * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Likewise.
+ * tree-ssa-strlen.c (get_string_length): Likewise.
+ * tree-ssa-structalias.c (handle_lhs_call): Likewise.
+ (find_func_aliases_for_call): Likewise.
+ * tree-ssa-ter.c (find_replaceable_in_bb): Likewise.
+ * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Likewise.
+ * tree-tailcall.c (find_tail_calls): Likewise.
+ * tree.c (need_assembler_name_p): Likewise.
+ (free_lang_data_in_decl): Likewise.
+ (get_call_combined_fn): Likewise.
+ * ubsan.c (is_ubsan_builtin_p): Likewise.
+ * varasm.c (incorporeal_function_p): Likewise.
+ * tree.h (DECL_BUILT_IN): Remove and replace with
+ fndecl_built_in_p.
+ (DECL_BUILT_IN_P): Transfort to fndecl_built_in_p.
+ (fndecl_built_in_p): New.
+
+2018-08-27 Martin Liska <mliska@suse.cz>
+
PR tree-optimization/86847
* tree-switch-conversion.c (switch_decision_tree::dump_case_nodes):
Dump also subtree probability.
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 06b11066549..58f336b65f2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2018-08-27 Martin Liska <mliska@suse.cz>
+
+ * gcc-interface/decl.c (update_profile): Use new function
+ fndecl_built_in_p and remove check for FUNCTION_DECL if
+ possible.
+ * gcc-interface/gigi.h (call_is_atomic_load): Likewise.
+ * gcc-interface/utils.c (gnat_pushdecl): Likewise.
+
2018-08-23 Giuliano Belinassi <giuliano.belinassi@usp.br>
* exp_unst.ads: Fix typo 'exapnded' to 'expanded'.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index b1dc379c247..6f605bd64ec 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -5421,7 +5421,7 @@ update_profile (Entity_Id gnat_subprog)
if (DECL_P (gnu_type))
{
/* Builtins cannot have their address taken so we can reset them. */
- gcc_assert (DECL_BUILT_IN (gnu_type));
+ gcc_assert (fndecl_built_in_p (gnu_type));
save_gnu_tree (gnat_subprog, NULL_TREE, false);
save_gnu_tree (gnat_subprog, gnu_type, false);
return;
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index b890195cefc..eb64a8bbdbd 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -1081,7 +1081,7 @@ call_is_atomic_load (tree exp)
{
tree fndecl = get_callee_fndecl (exp);
- if (!(fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL))
+ if (!(fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)))
return false;
enum built_in_function code = DECL_FUNCTION_CODE (fndecl);
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index cc1fe770f2c..313d984b83d 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -773,7 +773,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
debugger at the proper time. */
if (DECL_EXTERNAL (decl)
&& TREE_CODE (decl) == FUNCTION_DECL
- && DECL_BUILT_IN (decl))
+ && fndecl_built_in_p (decl))
vec_safe_push (builtin_decls, decl);
else if (global_bindings_p ())
vec_safe_push (global_decls, decl);
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 64700b6c8ce..8b721274d3b 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -432,7 +432,7 @@ diag_attr_exclusions (tree last_decl, tree node, tree attrname,
bool note = last_decl != NULL_TREE;
auto_diagnostic_group d;
if (TREE_CODE (node) == FUNCTION_DECL
- && DECL_BUILT_IN (node))
+ && fndecl_built_in_p (node))
note &= warning (OPT_Wattributes,
"ignoring attribute %qE in declaration of "
"a built-in function %qD because it conflicts "
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 6a992bd939b..c4b52b9c627 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -208,15 +208,6 @@ is_builtin_name (const char *name)
return false;
}
-
-/* Return true if DECL is a function symbol representing a built-in. */
-
-bool
-is_builtin_fn (tree decl)
-{
- return TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl);
-}
-
/* Return true if NODE should be considered for inline expansion regardless
of the optimization level. This means whenever a function is invoked with
its "internal" name, which normally contains the prefix "__builtin". */
@@ -8154,11 +8145,8 @@ builtin_mathfn_code (const_tree t)
return END_BUILTINS;
fndecl = get_callee_fndecl (t);
- if (fndecl == NULL_TREE
- || TREE_CODE (fndecl) != FUNCTION_DECL
- || ! DECL_BUILT_IN (fndecl)
- || DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
- return END_BUILTINS;
+ if (fndecl == NULL_TREE || !fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
+ return END_BUILTINS;
parmlist = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
init_const_call_expr_arg_iterator (t, &iter);
@@ -8313,9 +8301,8 @@ fold_builtin_expect (location_t loc, tree arg0, tree arg1, tree arg2,
if (TREE_CODE (inner) == CALL_EXPR
&& (fndecl = get_callee_fndecl (inner))
- && (DECL_BUILT_IN_P (fndecl, BUILT_IN_NORMAL, BUILT_IN_EXPECT)
- || DECL_BUILT_IN_P (fndecl, BUILT_IN_NORMAL,
- BUILT_IN_EXPECT_WITH_PROBABILITY)))
+ && (fndecl_built_in_p (fndecl, BUILT_IN_EXPECT)
+ || fndecl_built_in_p (fndecl, BUILT_IN_EXPECT_WITH_PROBABILITY)))
return arg0;
inner = inner_arg0;
@@ -9628,9 +9615,7 @@ fold_call_expr (location_t loc, tree exp, bool ignore)
{
tree ret = NULL_TREE;
tree fndecl = get_callee_fndecl (exp);
- if (fndecl
- && TREE_CODE (fndecl) == FUNCTION_DECL
- && DECL_BUILT_IN (fndecl)
+ if (fndecl && fndecl_built_in_p (fndecl)
/* If CALL_EXPR_VA_ARG_PACK is set, the arguments aren't finalized
yet. Defer folding until we see all the arguments
(after inlining). */
@@ -9644,10 +9629,7 @@ fold_call_expr (location_t loc, tree exp, bool ignore)
if (nargs && TREE_CODE (CALL_EXPR_ARG (exp, nargs - 1)) == CALL_EXPR)
{
tree fndecl2 = get_callee_fndecl (CALL_EXPR_ARG (exp, nargs - 1));
- if (fndecl2
- && TREE_CODE (fndecl2) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (fndecl2) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl2) == BUILT_IN_VA_ARG_PACK)
+ if (fndecl2 && fndecl_built_in_p (fndecl2, BUILT_IN_VA_ARG_PACK))
return NULL_TREE;
}
@@ -9683,17 +9665,14 @@ fold_builtin_call_array (location_t loc, tree,
tree fndecl = TREE_OPERAND (fn, 0);
if (TREE_CODE (fndecl) == FUNCTION_DECL
- && DECL_BUILT_IN (fndecl))
+ && fndecl_built_in_p (fndecl))
{
/* If last argument is __builtin_va_arg_pack (), arguments to this
function are not finalized yet. Defer folding until they are. */
if (n && TREE_CODE (argarray[n - 1]) == CALL_EXPR)
{
tree fndecl2 = get_callee_fndecl (argarray[n - 1]);
- if (fndecl2
- && TREE_CODE (fndecl2) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (fndecl2) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl2) == BUILT_IN_VA_ARG_PACK)
+ if (fndecl2 && fndecl_built_in_p (fndecl2, BUILT_IN_VA_ARG_PACK))
return NULL_TREE;
}
if (avoid_folding_inline_builtin (fndecl))
@@ -10812,9 +10791,7 @@ fold_call_stmt (gcall *stmt, bool ignore)
tree ret = NULL_TREE;
tree fndecl = gimple_call_fndecl (stmt);
location_t loc = gimple_location (stmt);
- if (fndecl
- && TREE_CODE (fndecl) == FUNCTION_DECL
- && DECL_BUILT_IN (fndecl)
+ if (fndecl && fndecl_built_in_p (fndecl)
&& !gimple_call_va_arg_pack_p (stmt))
{
int nargs = gimple_call_num_args (stmt);
@@ -10861,8 +10838,7 @@ fold_call_stmt (gcall *stmt, bool ignore)
void
set_builtin_user_assembler_name (tree decl, const char *asmspec)
{
- gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
+ gcc_assert (fndecl_built_in_p (decl, BUILT_IN_NORMAL)
&& asmspec != 0);
tree builtin = builtin_decl_explicit (DECL_FUNCTION_CODE (decl));
@@ -10882,7 +10858,7 @@ set_builtin_user_assembler_name (tree decl, const char *asmspec)
bool
is_simple_builtin (tree decl)
{
- if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ if (decl && fndecl_built_in_p (decl, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (decl))
{
/* Builtins that expand to constants. */
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 805f1801604..c3d5ccbb6b6 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -49,7 +49,6 @@ extern struct target_builtins *this_target_builtins;
/* Non-zero if __builtin_constant_p should be folded right away. */
extern bool force_folding_builtin_constant_p;
-extern bool is_builtin_fn (tree);
extern bool called_as_built_in (tree);
extern bool get_object_alignment_1 (tree, unsigned int *,
unsigned HOST_WIDE_INT *);
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index f833d0a1722..2ca6662c3c5 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,12 @@
+2018-08-27 Martin Liska <mliska@suse.cz>
+
+ * c-common.c (check_function_restrict): Use new function
+ fndecl_built_in_p and remove check for FUNCTION_DECL if
+ possible.
+ (check_builtin_function_arguments): Likewise.
+ (reject_gcc_builtin): Likewise.
+ * c-warn.c (sizeof_pointer_memaccess_warning): Likewise.
+
2018-08-26 Marek Polacek <polacek@redhat.com>
PR c++/87029, Implement -Wredundant-move.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 95cff215d60..0b0969b5216 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5326,8 +5326,7 @@ check_function_restrict (const_tree fndecl, const_tree fntype,
{
/* Avoid diagnosing calls built-ins with a zero size/bound
here. They are checked in more detail elsewhere. */
- if (DECL_BUILT_IN (fndecl)
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+ if (fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
&& nargs == 3
&& TREE_CODE (argarray[2]) == INTEGER_CST
&& integer_zerop (argarray[2]))
@@ -5755,8 +5754,7 @@ bool
check_builtin_function_arguments (location_t loc, vec<location_t> arg_loc,
tree fndecl, int nargs, tree *args)
{
- if (!DECL_BUILT_IN (fndecl)
- || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL)
+ if (!fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
return true;
switch (DECL_FUNCTION_CODE (fndecl))
@@ -8011,7 +8009,7 @@ reject_gcc_builtin (const_tree expr, location_t loc /* = UNKNOWN_LOCATION */)
strlen, and for C++ operators new and delete.
The c_decl_implicit() test avoids false positives for implicitly
declared built-ins with library fallbacks (such as abs). */
- && DECL_BUILT_IN (expr)
+ && fndecl_built_in_p (expr)
&& DECL_IS_BUILTIN (expr)
&& !c_decl_implicit (expr)
&& !DECL_ASSEMBLER_NAME_SET_P (expr))
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index ca259aa7bd0..95b66c1eabb 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -702,7 +702,7 @@ sizeof_pointer_memaccess_warning (location_t *sizeof_arg_loc, tree callee,
location_t loc;
if (TREE_CODE (callee) != FUNCTION_DECL
- || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL
+ || !fndecl_built_in_p (callee, BUILT_IN_NORMAL)
|| vec_safe_length (params) <= 1)
return;
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index e943f0aac4a..b3e499e5899 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,18 @@
+2018-08-27 Martin Liska <mliska@suse.cz>
+
+ * c-decl.c (locate_old_decl): Use new function
+ fndecl_built_in_p and remove check for FUNCTION_DECL if
+ possible.
+ (diagnose_mismatched_decls): Likewise.
+ (merge_decls): Likewise.
+ (warn_if_shadowing): Likewise.
+ (pushdecl): Likewise.
+ (implicitly_declare): Likewise.
+ * c-parser.c (c_parser_postfix_expression_after_primary): Likewise.
+ * c-tree.h (C_DECL_ISNT_PROTOTYPE): Likewise.
+ * c-typeck.c (build_function_call_vec): Likewise.
+ (convert_arguments): Likewise.
+
2018-08-20 David Malcolm <dmalcolm@redhat.com>
PR other/84889
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 95249779e3c..80647ee0207 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -1800,7 +1800,7 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
static void
locate_old_decl (tree decl)
{
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl)
+ if (TREE_CODE (decl) == FUNCTION_DECL && fndecl_built_in_p (decl)
&& !C_DECL_DECLARED_BUILTIN (decl))
;
else if (DECL_INITIAL (decl))
@@ -1843,7 +1843,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (TREE_CODE (olddecl) != TREE_CODE (newdecl))
{
if (!(TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_BUILT_IN (olddecl)
+ && fndecl_built_in_p (olddecl)
&& !C_DECL_DECLARED_BUILTIN (olddecl)))
{
auto_diagnostic_group d;
@@ -1877,7 +1877,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (!comptypes (oldtype, newtype))
{
if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_BUILT_IN (olddecl) && !C_DECL_DECLARED_BUILTIN (olddecl))
+ && fndecl_built_in_p (olddecl) && !C_DECL_DECLARED_BUILTIN (olddecl))
{
/* Accept harmless mismatch in function types.
This is for the ffs and fprintf builtins. */
@@ -2025,7 +2025,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
define the built-in with an old-style definition (so we
can't validate the argument list) the built-in definition is
overridden, but optionally warn this was a bad choice of name. */
- if (DECL_BUILT_IN (olddecl)
+ if (fndecl_built_in_p (olddecl)
&& !C_DECL_DECLARED_BUILTIN (olddecl)
&& (!TREE_PUBLIC (newdecl)
|| (DECL_INITIAL (newdecl)
@@ -2297,8 +2297,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl))
/* Don't warn about redundant redeclarations of builtins. */
&& !(TREE_CODE (newdecl) == FUNCTION_DECL
- && !DECL_BUILT_IN (newdecl)
- && DECL_BUILT_IN (olddecl)
+ && !fndecl_built_in_p (newdecl)
+ && fndecl_built_in_p (olddecl)
&& !C_DECL_DECLARED_BUILTIN (olddecl))
/* Don't warn about an extern followed by a definition. */
&& !(DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl))
@@ -2576,7 +2576,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
|| DECL_DISREGARD_INLINE_LIMITS (olddecl));
}
- if (DECL_BUILT_IN (olddecl))
+ if (fndecl_built_in_p (olddecl))
{
/* If redeclaring a builtin function, it stays built in.
But it gets tagged as having been declared. */
@@ -2840,7 +2840,7 @@ warn_if_shadowing (tree new_decl)
new_decl);
}
else if (TREE_CODE (old_decl) == FUNCTION_DECL
- && DECL_BUILT_IN (old_decl))
+ && fndecl_built_in_p (old_decl))
{
warning (OPT_Wshadow, "declaration of %q+D shadows "
"a built-in function", new_decl);
@@ -2953,7 +2953,7 @@ pushdecl (tree x)
thistype = TREE_TYPE (b_use->decl);
b_use->u.type = TREE_TYPE (b_use->decl);
if (TREE_CODE (b_use->decl) == FUNCTION_DECL
- && DECL_BUILT_IN (b_use->decl))
+ && fndecl_built_in_p (b_use->decl))
thistype
= build_type_attribute_variant (thistype,
TYPE_ATTRIBUTES
@@ -3057,7 +3057,8 @@ pushdecl (tree x)
else
thistype = type;
b->u.type = TREE_TYPE (b->decl);
- if (TREE_CODE (b->decl) == FUNCTION_DECL && DECL_BUILT_IN (b->decl))
+ if (TREE_CODE (b->decl) == FUNCTION_DECL
+ && fndecl_built_in_p (b->decl))
thistype
= build_type_attribute_variant (thistype,
TYPE_ATTRIBUTES (b->u.type));
@@ -3408,7 +3409,7 @@ implicitly_declare (location_t loc, tree functionid)
in the external scope because they're pushed before the file
scope gets created. Catch this here and rebind them into the
file scope. */
- if (!DECL_BUILT_IN (decl) && DECL_IS_BUILTIN (decl))
+ if (!fndecl_built_in_p (decl) && DECL_IS_BUILTIN (decl))
{
bind (functionid, decl, file_scope,
/*invisible=*/false, /*nested=*/true,
@@ -3429,7 +3430,7 @@ implicitly_declare (location_t loc, tree functionid)
implicit_decl_warning (loc, functionid, decl);
C_DECL_IMPLICIT (decl) = 1;
}
- if (DECL_BUILT_IN (decl))
+ if (fndecl_built_in_p (decl))
{
newtype = build_type_attribute_variant (newtype,
TYPE_ATTRIBUTES
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 0d5dbea8f67..28384dfe913 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -9175,8 +9175,7 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
sizeof_arg,
sizeof_ptr_memacc_comptypes);
if (TREE_CODE (expr.value) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (expr.value) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (expr.value) == BUILT_IN_MEMSET
+ && fndecl_built_in_p (expr.value, BUILT_IN_MEMSET)
&& vec_safe_length (exprlist) == 3)
{
tree arg0 = (*exprlist)[0];
@@ -9194,8 +9193,7 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
expr.original_code = ERROR_MARK;
if (TREE_CODE (expr.value) == INTEGER_CST
&& TREE_CODE (orig_expr.value) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (orig_expr.value) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (orig_expr.value) == BUILT_IN_CONSTANT_P)
+ && fndecl_built_in_p (orig_expr.value, BUILT_IN_CONSTANT_P))
expr.original_code = C_MAYBE_CONST_EXPR;
expr.original_type = NULL;
if (exprlist)
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index ae1a1e60d4b..017c01c592c 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -102,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
#define C_DECL_ISNT_PROTOTYPE(EXP) \
(EXP == 0 \
|| (!prototype_p (TREE_TYPE (EXP)) \
- && !DECL_BUILT_IN (EXP)))
+ && !fndecl_built_in_p (EXP)))
/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
TYPE_ARG_TYPES for functions with prototypes, but created for functions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 54c7967a06b..5f8df12564d 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3108,9 +3108,7 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc,
argarray = vec_safe_address (params);
/* Check that arguments to builtin functions match the expectations. */
- if (fundecl
- && DECL_BUILT_IN (fundecl)
- && DECL_BUILT_IN_CLASS (fundecl) == BUILT_IN_NORMAL
+ if (fundecl && fndecl_built_in_p (fundecl, BUILT_IN_NORMAL)
&& !check_builtin_function_arguments (loc, arg_loc, fundecl, nargs,
argarray))
return error_mark_node;
@@ -3233,8 +3231,7 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
precision should be removed (classification) or not
(comparison). */
if (type_generic
- && DECL_BUILT_IN (fundecl)
- && DECL_BUILT_IN_CLASS (fundecl) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (fundecl, BUILT_IN_NORMAL))
{
switch (DECL_FUNCTION_CODE (fundecl))
{
diff --git a/gcc/calls.c b/gcc/calls.c
index 0fb10b182b1..f57ecf91636 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -715,7 +715,7 @@ gimple_alloca_call_p (const gimple *stmt)
return false;
fndecl = gimple_call_fndecl (stmt);
- if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (fndecl))
{
CASE_BUILT_IN_ALLOCA:
@@ -1542,7 +1542,7 @@ get_attr_nonstring_decl (tree expr, tree *ref)
void
maybe_warn_nonstring_arg (tree fndecl, tree exp)
{
- if (!fndecl || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL)
+ if (!fndecl || !fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
return;
if (TREE_NO_WARNING (exp))
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 647764b0e94..2d3111da25d 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2616,7 +2616,7 @@ expand_call_stmt (gcall *stmt)
exp = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3);
CALL_EXPR_FN (exp) = gimple_call_fn (stmt);
- builtin_p = decl && DECL_BUILT_IN (decl);
+ builtin_p = decl && fndecl_built_in_p (decl);
/* If this is not a builtin function, the function type through which the
call is made may be different from the type of the function. */
@@ -2655,7 +2655,7 @@ expand_call_stmt (gcall *stmt)
CALL_EXPR_MUST_TAIL_CALL (exp) = gimple_call_must_tail_p (stmt);
CALL_EXPR_RETURN_SLOT_OPT (exp) = gimple_call_return_slot_opt_p (stmt);
if (decl
- && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
+ && fndecl_built_in_p (decl, BUILT_IN_NORMAL)
&& ALLOCA_FUNCTION_CODE_P (DECL_FUNCTION_CODE (decl)))
CALL_ALLOCA_FOR_VAR_P (exp) = gimple_call_alloca_for_var_p (stmt);
else
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index d19f1aacab8..148f29ea749 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1559,8 +1559,7 @@ cgraph_update_edges_for_call_stmt_node (cgraph_node *node,
{
/* Keep calls marked as dead dead. */
if (new_stmt && is_gimple_call (new_stmt) && e->callee
- && DECL_BUILT_IN_CLASS (e->callee->decl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (e->callee->decl) == BUILT_IN_UNREACHABLE)
+ && fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE))
{
node->get_edge (old_stmt)->set_call_stmt
(as_a <gcall *> (new_stmt));
@@ -3060,8 +3059,8 @@ cgraph_edge::verify_corresponds_to_fndecl (tree decl)
/* Optimizers can redirect unreachable calls or calls triggering undefined
behavior to builtin_unreachable. */
- if (DECL_BUILT_IN_CLASS (callee->decl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (callee->decl) == BUILT_IN_UNREACHABLE)
+
+ if (fndecl_built_in_p (callee->decl, BUILT_IN_UNREACHABLE))
return false;
if (callee->former_clone_of != node->decl
@@ -3187,8 +3186,7 @@ cgraph_node::verify_node (void)
/* Optimized out calls are redirected to __builtin_unreachable. */
&& (e->count.nonzero_p ()
|| ! e->callee->decl
- || DECL_BUILT_IN_CLASS (e->callee->decl) != BUILT_IN_NORMAL
- || DECL_FUNCTION_CODE (e->callee->decl) != BUILT_IN_UNREACHABLE)
+ || !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE))
&& count
== ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->count
&& (!e->count.ipa_p ()
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index 6e84a31c1a5..0c0a94b04a3 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -222,7 +222,7 @@ build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip,
DECL_VINDEX (new_decl) = NULL_TREE;
/* When signature changes, we need to clear builtin info. */
- if (DECL_BUILT_IN (new_decl)
+ if (fndecl_built_in_p (new_decl)
&& args_to_skip
&& !bitmap_empty_p (args_to_skip))
{
@@ -482,8 +482,7 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count,
version. The only exception is when the edge was proved to
be unreachable during the clonning procedure. */
if (!e->callee
- || DECL_BUILT_IN_CLASS (e->callee->decl) != BUILT_IN_NORMAL
- || DECL_FUNCTION_CODE (e->callee->decl) != BUILT_IN_UNREACHABLE)
+ || !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE))
e->redirect_callee_duplicating_thunks (new_node);
}
new_node->expand_all_artificial_thunks ();
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index c081216decd..6332e68df05 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -30841,7 +30841,7 @@ arm_insert_attributes (tree fndecl, tree * attributes)
return;
if (TREE_CODE (fndecl) != FUNCTION_DECL || DECL_EXTERNAL(fndecl)
- || DECL_BUILT_IN (fndecl) || DECL_ARTIFICIAL (fndecl))
+ || fndecl_built_in_p (fndecl) || DECL_ARTIFICIAL (fndecl))
return;
/* Nested definitions must inherit mode. */
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 98677386a2b..eab482c4c84 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -33329,7 +33329,7 @@ ix86_gimple_fold_builtin (gimple_stmt_iterator *gsi)
{
gimple *stmt = gsi_stmt (*gsi);
tree fndecl = gimple_call_fndecl (stmt);
- gcc_checking_assert (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD);
+ gcc_checking_assert (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_MD));
int n_args = gimple_call_num_args (stmt);
enum ix86_builtins fn_code = (enum ix86_builtins) DECL_FUNCTION_CODE (fndecl);
tree decl = NULL_TREE;
@@ -37919,7 +37919,7 @@ rdseed_step:
{
tree fndecl = gimple_call_fndecl (def_stmt);
if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
+ && fndecl_built_in_p (fndecl, BUILT_IN_MD))
switch ((unsigned int) DECL_FUNCTION_CODE (fndecl))
{
case IX86_BUILTIN_CMPPD:
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f1ae08e6f7d..e6d62082bf9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,24 @@
+2018-08-27 Martin Liska <mliska@suse.cz>
+
+ * call.c (build_call_a): Use new function
+ fndecl_built_in_p and remove check for FUNCTION_DECL if
+ possible.
+ (build_cxx_call): Likewise.
+ * constexpr.c (constexpr_fn_retval): Likewise.
+ (cxx_eval_builtin_function_call): Likewise.
+ (cxx_eval_call_expression): Likewise.
+ (potential_constant_expression_1): Likewise.
+ * cp-gimplify.c (cp_gimplify_expr): Likewise.
+ (cp_fold): Likewise.
+ * decl.c (decls_match): Likewise.
+ (validate_constexpr_redeclaration): Likewise.
+ (duplicate_decls): Likewise.
+ (make_rtl_for_nonlocal_decl): Likewise.
+ * name-lookup.c (consider_binding_level): Likewise.
+ (cp_emit_debug_info_for_using): Likewise.
+ * semantics.c (finish_call_expr): Likewise.
+ * tree.c (builtin_valid_in_constant_expr_p): Likewise.
+
2018-08-26 Marek Polacek <polacek@redhat.com>
PR c++/87080
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 626830c0d9a..d74f2be7d7c 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -389,7 +389,7 @@ build_call_a (tree function, int n, tree *argarray)
/* Don't pass empty class objects by value. This is useful
for tags in STL, which are used to control overload resolution.
We don't need to handle other cases of copying empty classes. */
- if (! decl || ! DECL_BUILT_IN (decl))
+ if (!decl || !fndecl_built_in_p (decl))
for (i = 0; i < n; i++)
{
tree arg = CALL_EXPR_ARG (function, i);
@@ -8869,8 +8869,7 @@ build_cxx_call (tree fn, int nargs, tree *argarray,
/* Check that arguments to builtin functions match the expectations. */
if (fndecl
&& !processing_template_decl
- && DECL_BUILT_IN (fndecl)
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
{
int i;
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 54c8b5edf8d..f646519135f 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -721,8 +721,7 @@ constexpr_fn_retval (tree body)
{
tree fun = get_function_named_in_call (body);
if (fun != NULL_TREE
- && DECL_BUILT_IN_CLASS (fun) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE)
+ && fndecl_built_in_p (fun, BUILT_IN_UNREACHABLE))
return NULL_TREE;
}
/* Fallthru. */
@@ -1198,8 +1197,8 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
/* For __builtin_is_constant_evaluated, defer it if not
ctx->pretend_const_required, otherwise fold it to true. */
- if (DECL_BUILT_IN_CLASS (fun) == BUILT_IN_FRONTEND
- && (int) DECL_FUNCTION_CODE (fun) == CP_BUILT_IN_IS_CONSTANT_EVALUATED)
+ if (fndecl_built_in_p (fun, CP_BUILT_IN_IS_CONSTANT_EVALUATED,
+ BUILT_IN_FRONTEND))
{
if (!ctx->pretend_const_required)
{
@@ -1242,8 +1241,7 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
/* Do not allow__builtin_unreachable in constexpr function.
The __builtin_unreachable call with BUILTINS_LOCATION
comes from cp_maybe_instrument_return. */
- if (DECL_BUILT_IN_CLASS (fun) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
+ if (fndecl_built_in_p (fun, BUILT_IN_UNREACHABLE)
&& EXPR_LOCATION (t) == BUILTINS_LOCATION)
error ("%<constexpr%> call flows off the end of the function");
else
@@ -1528,7 +1526,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
if (is_ubsan_builtin_p (fun))
return void_node;
- if (is_builtin_fn (fun))
+ if (fndecl_built_in_p (fun))
return cxx_eval_builtin_function_call (ctx, t, fun,
lval, non_constant_p, overflow_p);
if (!DECL_DECLARED_CONSTEXPR_P (fun))
@@ -5522,7 +5520,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
if (!DECL_DECLARED_CONSTEXPR_P (fun)
/* Allow any built-in function; if the expansion
isn't constant, we'll deal with that then. */
- && !is_builtin_fn (fun))
+ && !fndecl_built_in_p (fun))
{
if (flags & tf_error)
{
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index f6109914102..90a8f9fef8f 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -797,9 +797,8 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
tree decl = cp_get_callee_fndecl_nofold (*expr_p);
if (decl
- && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_FRONTEND
- && ((int) DECL_FUNCTION_CODE (decl)
- == CP_BUILT_IN_IS_CONSTANT_EVALUATED))
+ && fndecl_built_in_p (decl, CP_BUILT_IN_IS_CONSTANT_EVALUATED,
+ BUILT_IN_FRONTEND))
*expr_p = boolean_false_node;
}
break;
@@ -2489,7 +2488,7 @@ cp_fold (tree x)
/* Some built-in function calls will be evaluated at compile-time in
fold (). Set optimize to 1 when folding __builtin_constant_p inside
a constexpr function so that fold_builtin_1 doesn't fold it to 0. */
- if (callee && DECL_BUILT_IN (callee) && !optimize
+ if (callee && fndecl_built_in_p (callee) && !optimize
&& DECL_IS_BUILTIN_CONSTANT_P (callee)
&& current_function_decl
&& DECL_DECLARED_CONSTEXPR_P (current_function_decl))
@@ -2497,9 +2496,8 @@ cp_fold (tree x)
/* Defer folding __builtin_is_constant_evaluated. */
if (callee
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_FRONTEND
- && ((int) DECL_FUNCTION_CODE (callee)
- == CP_BUILT_IN_IS_CONSTANT_EVALUATED))
+ && fndecl_built_in_p (callee, CP_BUILT_IN_IS_CONSTANT_EVALUATED,
+ BUILT_IN_FRONTEND))
break;
x = copy_node (x);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9056ad0dbce..c9c5fa6b4d5 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -968,7 +968,7 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */)
if (same_type_p (TREE_TYPE (f1), r2))
{
if (!prototype_p (f2) && DECL_EXTERN_C_P (olddecl)
- && (DECL_BUILT_IN (olddecl)
+ && (fndecl_built_in_p (olddecl)
#ifdef SYSTEM_IMPLICIT_EXTERN_C
|| (DECL_IN_SYSTEM_HEADER (newdecl) && !DECL_CLASS_SCOPE_P (newdecl))
|| (DECL_IN_SYSTEM_HEADER (olddecl) && !DECL_CLASS_SCOPE_P (olddecl))
@@ -1208,7 +1208,7 @@ validate_constexpr_redeclaration (tree old_decl, tree new_decl)
return true;
if (TREE_CODE (old_decl) == FUNCTION_DECL)
{
- if (DECL_BUILT_IN (old_decl))
+ if (fndecl_built_in_p (old_decl))
{
/* Hide a built-in declaration. */
DECL_DECLARED_CONSTEXPR_P (old_decl)
@@ -1442,7 +1442,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
{
warning_at (newdecl_loc,
OPT_Wshadow,
- DECL_BUILT_IN (olddecl)
+ fndecl_built_in_p (olddecl)
? G_("shadowing built-in function %q#D")
: G_("shadowing library function %q#D"), olddecl);
/* Discard the old built-in function. */
@@ -1450,7 +1450,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
}
/* If the built-in is not ansi, then programs can override
it even globally without an error. */
- else if (! DECL_BUILT_IN (olddecl))
+ else if (! fndecl_built_in_p (olddecl))
warning_at (newdecl_loc, 0,
"library function %q#D redeclared as non-function %q#D",
olddecl, newdecl);
@@ -1537,7 +1537,7 @@ next_arg:;
/* Don't really override olddecl for __* prefixed builtins
except for __[^b]*_chk, the compiler might be using those
explicitly. */
- if (DECL_BUILT_IN (olddecl))
+ if (fndecl_built_in_p (olddecl))
{
tree id = DECL_NAME (olddecl);
const char *name = IDENTIFIER_POINTER (id);
@@ -1578,9 +1578,9 @@ next_arg:;
"declaration %q#D", newdecl, olddecl);
else
warning (OPT_Wshadow,
- DECL_BUILT_IN (olddecl)
- ? G_("shadowing built-in function %q#D")
- : G_("shadowing library function %q#D"), olddecl);
+ fndecl_built_in_p (olddecl)
+ ? G_("shadowing built-in function %q#D")
+ : G_("shadowing library function %q#D"), olddecl);
}
else
/* Discard the old built-in function. */
@@ -2522,7 +2522,7 @@ next_arg:;
/* If redeclaring a builtin function, it stays built in
if newdecl is a gnu_inline definition, or if newdecl is just
a declaration. */
- if (DECL_BUILT_IN (olddecl)
+ if (fndecl_built_in_p (olddecl)
&& (new_defines_function ? GNU_INLINE_P (newdecl) : types_match))
{
DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
@@ -6611,7 +6611,7 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
else
{
if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (decl, BUILT_IN_NORMAL))
set_builtin_user_assembler_name (decl, asmspec);
set_user_assembler_name (decl, asmspec);
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 8c7f68522da..8e009b29d61 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5791,7 +5791,7 @@ consider_binding_level (tree name, best_match <tree, const char *> &bm,
/* Skip anticipated decls of builtin functions. */
if (TREE_CODE (d) == FUNCTION_DECL
- && DECL_BUILT_IN (d)
+ && fndecl_built_in_p (d)
&& DECL_ANTICIPATED (d))
continue;
@@ -7274,7 +7274,7 @@ cp_emit_debug_info_for_using (tree t, tree context)
of a builtin function. */
if (TREE_CODE (t) == FUNCTION_DECL
&& DECL_EXTERNAL (t)
- && DECL_BUILT_IN (t))
+ && fndecl_built_in_p (t))
return;
/* Do not supply context to imported_module_or_decl, if
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index bfdca5024d3..b24d09224a9 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2546,8 +2546,7 @@ finish_call_expr (tree fn, vec<tree, va_gc> **args, bool disallow_virtual,
if ((complain & tf_warning)
&& TREE_CODE (fn) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fn) == BUILT_IN_MEMSET
+ && fndecl_built_in_p (fn, BUILT_IN_MEMSET)
&& vec_safe_length (*args) == 3
&& !any_type_dependent_arguments_p (*args))
{
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 8a1d2993f94..c6f216dab4b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -420,9 +420,8 @@ builtin_valid_in_constant_expr_p (const_tree decl)
return false;
if (DECL_BUILT_IN_CLASS (decl) != BUILT_IN_NORMAL)
{
- if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_FRONTEND
- && ((int) DECL_FUNCTION_CODE (decl)
- == CP_BUILT_IN_IS_CONSTANT_EVALUATED))
+ if (fndecl_built_in_p (decl, CP_BUILT_IN_IS_CONSTANT_EVALUATED,
+ BUILT_IN_FRONTEND))
return true;
/* Not a built-in. */
return false;
diff --git a/gcc/dse.c b/gcc/dse.c
index 26c6007b9ed..cfebfa0e110 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2419,8 +2419,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn)
&& GET_CODE (sym) == SYMBOL_REF
&& SYMBOL_REF_DECL (sym)
&& TREE_CODE (SYMBOL_REF_DECL (sym)) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (SYMBOL_REF_DECL (sym)) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (SYMBOL_REF_DECL (sym)) == BUILT_IN_MEMSET)
+ && fndecl_built_in_p (SYMBOL_REF_DECL (sym), BUILT_IN_MEMSET))
memset_call = SYMBOL_REF_DECL (sym);
if (const_call || memset_call)
diff --git a/gcc/expr.c b/gcc/expr.c
index 58574bafbf3..2645c259af8 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10937,7 +10937,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
}
/* Check for a built-in function. */
- if (fndecl && DECL_BUILT_IN (fndecl))
+ if (fndecl && fndecl_built_in_p (fndecl))
{
gcc_assert (DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_FRONTEND);
return expand_builtin (exp, target, subtarget, tmode, ignore);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 1e44a2454ad..63e15f027fb 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3451,7 +3451,7 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
case tcc_declaration:
/* Consider __builtin_sqrt equal to sqrt. */
return (TREE_CODE (arg0) == FUNCTION_DECL
- && DECL_BUILT_IN (arg0) && DECL_BUILT_IN (arg1)
+ && fndecl_built_in_p (arg0) && fndecl_built_in_p (arg1)
&& DECL_BUILT_IN_CLASS (arg0) == DECL_BUILT_IN_CLASS (arg1)
&& DECL_FUNCTION_CODE (arg0) == DECL_FUNCTION_CODE (arg1));
@@ -10761,8 +10761,7 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type,
tree fndecl = get_callee_fndecl (arg0);
if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRLEN
+ && fndecl_built_in_p (fndecl, BUILT_IN_STRLEN)
&& call_expr_nargs (arg0) == 1
&& TREE_CODE (TREE_TYPE (CALL_EXPR_ARG (arg0, 0))) == POINTER_TYPE)
{
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 07341ebe66f..cbca6a95b76 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -6347,8 +6347,7 @@ gimple_fold_stmt_to_constant_1 (gimple *stmt, tree (*valueize) (tree),
fn = (*valueize) (gimple_call_fn (stmt));
if (TREE_CODE (fn) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
- && DECL_BUILT_IN (TREE_OPERAND (fn, 0))
+ && fndecl_built_in_p (TREE_OPERAND (fn, 0))
&& gimple_builtin_call_types_compatible_p (stmt,
TREE_OPERAND (fn, 0)))
{
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 9623fb86a04..c3777a1e761 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -355,7 +355,7 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
}
if (decl
- && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (decl, BUILT_IN_NORMAL))
{
if (DECL_FUNCTION_CODE (decl) == BUILT_IN_SETJMP)
{
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index dd63a28761b..83e22735571 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -911,8 +911,7 @@ dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc,
if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
pp_string (buffer, " [tm-clone]");
if (TREE_CODE (fn) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_START
+ && fndecl_built_in_p (fn, BUILT_IN_TM_START)
&& gimple_call_num_args (gs) > 0)
{
tree t = gimple_call_arg (gs, 0);
diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c
index 977dd860ef7..ea30b7108f8 100644
--- a/gcc/gimple-ssa-warn-restrict.c
+++ b/gcc/gimple-ssa-warn-restrict.c
@@ -1731,7 +1731,7 @@ wrestrict_dom_walker::check_call (gimple *call)
return;
tree func = gimple_call_fndecl (call);
- if (!func || DECL_BUILT_IN_CLASS (func) != BUILT_IN_NORMAL)
+ if (!func || !fndecl_built_in_p (func, BUILT_IN_NORMAL))
return;
/* Argument number to extract from the call (depends on the built-in
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 8d56a966cc1..e3e651b1e61 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -376,7 +376,7 @@ gimple_build_call_from_tree (tree t, tree fnptrtype)
gimple_call_set_must_tail (call, CALL_EXPR_MUST_TAIL_CALL (t));
gimple_call_set_return_slot_opt (call, CALL_EXPR_RETURN_SLOT_OPT (t));
if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+ && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
&& ALLOCA_FUNCTION_CODE_P (DECL_FUNCTION_CODE (fndecl)))
gimple_call_set_alloca_for_var (call, CALL_ALLOCA_FOR_VAR_P (t));
else
@@ -2681,8 +2681,7 @@ gimple_call_builtin_p (const gimple *stmt, enum built_in_function code)
tree fndecl;
if (is_gimple_call (stmt)
&& (fndecl = gimple_call_fndecl (stmt)) != NULL_TREE
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl) == code)
+ && fndecl_built_in_p (fndecl, code))
return gimple_builtin_call_types_compatible_p (stmt, fndecl);
return false;
}
@@ -2701,7 +2700,7 @@ gimple_call_combined_fn (const gimple *stmt)
tree fndecl = gimple_call_fndecl (stmt);
if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+ && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
&& gimple_builtin_call_types_compatible_p (stmt, fndecl))
return as_combined_fn (DECL_FUNCTION_CODE (fndecl));
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index e35137aec2c..dbd0f0ebd0c 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3209,8 +3209,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
transform all calls in the same manner as the expanders do, but
we do transform most of them. */
fndecl = get_callee_fndecl (*expr_p);
- if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (fndecl))
{
CASE_BUILT_IN_ALLOCA:
@@ -3245,7 +3244,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
default:
;
}
- if (fndecl && DECL_BUILT_IN (fndecl))
+ if (fndecl && fndecl_built_in_p (fndecl))
{
tree new_tree = fold_call_expr (input_location, *expr_p, !want_value);
if (new_tree && new_tree != *expr_p)
@@ -3297,9 +3296,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
tree last_arg_fndecl = get_callee_fndecl (last_arg);
if (last_arg_fndecl
- && TREE_CODE (last_arg_fndecl) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (last_arg_fndecl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (last_arg_fndecl) == BUILT_IN_VA_ARG_PACK)
+ && fndecl_built_in_p (last_arg_fndecl, BUILT_IN_VA_ARG_PACK))
{
tree call = *expr_p;
@@ -3773,8 +3770,7 @@ gimple_boolify (tree expr)
/* For __builtin_expect ((long) (x), y) recurse into x as well
if x is truth_value_p. */
if (fn
- && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fn) == BUILT_IN_EXPECT
+ && fndecl_built_in_p (fn, BUILT_IN_EXPECT)
&& call_expr_nargs (call) == 2)
{
tree arg = CALL_EXPR_ARG (call, 0);
@@ -5719,8 +5715,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
STRIP_USELESS_TYPE_CONVERSION (CALL_EXPR_FN (*from_p));
tree fndecl = get_callee_fndecl (*from_p);
if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
+ && fndecl_built_in_p (fndecl, BUILT_IN_EXPECT)
&& call_expr_nargs (*from_p) == 3)
call_stmt = gimple_build_call_internal (IFN_BUILTIN_EXPECT, 3,
CALL_EXPR_ARG (*from_p, 0),
@@ -5978,7 +5973,7 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
being taken (we can unify those cases here) then we can mark
the builtin for implicit generation by GCC. */
if (TREE_CODE (op0) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (op0) == BUILT_IN_NORMAL
+ && fndecl_built_in_p (op0, BUILT_IN_NORMAL)
&& builtin_decl_declared_p (DECL_FUNCTION_CODE (op0)))
set_builtin_decl_implicit_p (DECL_FUNCTION_CODE (op0), true);
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index a392ed89bad..09f2b7fced6 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-27 Martin Liska <mliska@suse.cz>
+
+ * go-gcc.cc (Gcc_backend::call_expression): Use new function
+ fndecl_built_in_p and remove check for FUNCTION_DECL if
+ possible.
+
2018-07-20 Martin Sebor <msebor@redhat.com>
PR middle-end/82063
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 76a2026f1e0..1a449b7cc47 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -1948,8 +1948,8 @@ Gcc_backend::call_expression(Bfunction*, // containing fcn for call
tree excess_type = NULL_TREE;
if (optimize
&& TREE_CODE(fndecl) == FUNCTION_DECL
- && DECL_IS_BUILTIN(fndecl)
- && DECL_BUILT_IN_CLASS(fndecl) == BUILT_IN_NORMAL
+ && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
+ && DECL_IS_BUILTIN (fndecl)
&& nargs > 0
&& ((SCALAR_FLOAT_TYPE_P(rettype)
&& SCALAR_FLOAT_TYPE_P(TREE_TYPE(args[0])))
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index 416de933a22..69e092ec4fa 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -5300,8 +5300,7 @@ gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb)
tree function_decl = gimple_call_fndecl (stmt);
/* Prefetch pass can create type-mismatching prefetch builtin calls which
fail the gimple_call_builtin_p test above. Handle them here. */
- if (DECL_BUILT_IN_CLASS (function_decl)
- && DECL_FUNCTION_CODE (function_decl) == BUILT_IN_PREFETCH)
+ if (fndecl_built_in_p (function_decl, BUILT_IN_PREFETCH))
return;
if (function_decl == NULL_TREE)
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 42dd4cc2904..4838194cd73 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -638,8 +638,7 @@ determine_versionability (struct cgraph_node *node,
if (DECL_EXTERNAL (node->decl))
for (cgraph_edge *edge = node->callees; !reason && edge;
edge = edge->next_callee)
- if (DECL_BUILT_IN (edge->callee->decl)
- && DECL_BUILT_IN_CLASS (edge->callee->decl) == BUILT_IN_NORMAL)
+ if (fndecl_built_in_p (edge->callee->decl, BUILT_IN_NORMAL))
{
if (DECL_FUNCTION_CODE (edge->callee->decl) == BUILT_IN_VA_ARG_PACK)
reason = "external function which calls va_arg_pack";
diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index d8311d25ab2..62095c6cf6f 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -2455,10 +2455,8 @@ compute_fn_summary (struct cgraph_node *node, bool early)
for (e = node->callees; e; e = e->next_callee)
{
tree cdecl = e->callee->decl;
- if (DECL_BUILT_IN (cdecl)
- && DECL_BUILT_IN_CLASS (cdecl) == BUILT_IN_NORMAL
- && (DECL_FUNCTION_CODE (cdecl) == BUILT_IN_APPLY_ARGS
- || DECL_FUNCTION_CODE (cdecl) == BUILT_IN_VA_START))
+ if (fndecl_built_in_p (cdecl, BUILT_IN_APPLY_ARGS)
+ || fndecl_built_in_p (cdecl, BUILT_IN_VA_START))
break;
}
node->local.can_change_signature = !e;
diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 1ab1fcccdae..1e3a92a125f 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -218,7 +218,7 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments)
}
/* When signature changes, we need to clear builtin info. */
- if (DECL_BUILT_IN (fndecl))
+ if (fndecl_built_in_p (fndecl))
{
DECL_BUILT_IN_CLASS (fndecl) = NOT_BUILT_IN;
DECL_FUNCTION_CODE (fndecl) = (enum built_in_function) 0;
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 0e6440f8997..38f5bcf00a6 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -899,8 +899,7 @@ visit_bb (basic_block bb, basic_block return_bb,
/* Check builtins that prevent splitting. */
if (gimple_code (stmt) == GIMPLE_CALL
&& (decl = gimple_call_fndecl (stmt)) != NULL_TREE
- && DECL_BUILT_IN (decl)
- && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (decl, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (decl))
{
/* FIXME: once we will allow passing non-parm values to split part,
@@ -1347,7 +1346,7 @@ split_function (basic_block return_bb, struct split_point *split_point,
/* For usual cloning it is enough to clear builtin only when signature
changes. For partial inlining we however can not expect the part
of builtin implementation to have same semantic as the whole. */
- if (DECL_BUILT_IN (node->decl))
+ if (fndecl_built_in_p (node->decl))
{
DECL_BUILT_IN_CLASS (node->decl) = NOT_BUILT_IN;
DECL_FUNCTION_CODE (node->decl) = (enum built_in_function) 0;
diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c
index 907dc9d0e2b..000207fa31b 100644
--- a/gcc/ipa-visibility.c
+++ b/gcc/ipa-visibility.c
@@ -203,7 +203,7 @@ cgraph_externally_visible_p (struct cgraph_node *node,
using the implicit built-in declarations anymore. Similarly this enables
us to remove them as unreachable before actual calls may appear during
expansion or folding. */
- if (DECL_BUILT_IN (node->decl))
+ if (fndecl_built_in_p (node->decl))
return true;
/* If linker counts on us, we must preserve the function. */
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index d5e390cb5f4..1e6a7adeaa2 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1266,7 +1266,7 @@ input_node (struct lto_file_decl_data *file_data,
have already been read will have their tag stored in the 'aux'
field. Since built-in functions can be referenced in multiple
functions, they are expected to be read more than once. */
- if (node->aux && !DECL_BUILT_IN (node->decl))
+ if (node->aux && !fndecl_built_in_p (node->decl))
internal_error ("bytecode stream: found multiple instances of cgraph "
"node with uid %d", node->get_uid ());
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 9e28d678342..f9d0f3e08ec 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2618,7 +2618,8 @@ write_symbol (struct streamer_tree_cache_d *cache,
unsigned char c;
gcc_checking_assert (TREE_PUBLIC (t)
- && !is_builtin_fn (t)
+ && (TREE_CODE (t) != FUNCTION_DECL
+ || !fndecl_built_in_p (t))
&& !DECL_ABSTRACT_P (t)
&& (!VAR_P (t) || !DECL_HARD_REGISTER (t)));
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index a92317cb774..c05f6fbe5dc 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,14 @@
+2018-08-27 Martin Liska <mliska@suse.cz>
+
+ * lto-lang.c (handle_const_attribute): Use new function
+ fndecl_built_in_p and remove check for FUNCTION_DECL if
+ possible.
+ * lto-symtab.c (lto_symtab_merge_p): Likewise.
+ (lto_symtab_merge_decls_1): Likewise.
+ (lto_symtab_merge_symbols): Likewise.
+ * lto.c (lto_maybe_register_decl): Likewise.
+ (read_cgraph_and_symbols): Likewise.
+
2018-08-21 Tom de Vries <tdevries@suse.de>
* lto.c (lto_main): Call debuginfo_early_start and
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index de6ec1c077a..8eb4a25a634 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -303,8 +303,7 @@ handle_const_attribute (tree *node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
- if (TREE_CODE (*node) != FUNCTION_DECL
- || !DECL_BUILT_IN (*node))
+ if (!fndecl_built_in_p (*node))
inform (UNKNOWN_LOCATION, "%s:%s: %E: %E", __FILE__, __func__, *node, name);
tree type = TREE_TYPE (*node);
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index 0d603c0281f..cf08d455d87 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -546,14 +546,14 @@ lto_symtab_merge_p (tree prevailing, tree decl)
if (TREE_CODE (prevailing) == FUNCTION_DECL)
{
- if (DECL_BUILT_IN (prevailing) != DECL_BUILT_IN (decl))
+ if (fndecl_built_in_p (prevailing) != fndecl_built_in_p (decl))
{
if (dump_file)
fprintf (dump_file, "Not merging decls; "
"DECL_BUILT_IN mismatch\n");
return false;
}
- if (DECL_BUILT_IN (prevailing)
+ if (fndecl_built_in_p (prevailing)
&& (DECL_BUILT_IN_CLASS (prevailing) != DECL_BUILT_IN_CLASS (decl)
|| DECL_FUNCTION_CODE (prevailing) != DECL_FUNCTION_CODE (decl)))
{
@@ -797,7 +797,7 @@ lto_symtab_merge_decls_1 (symtab_node *first)
{
for (e = first; e; e = e->next_sharing_asm_name)
if (TREE_CODE (e->decl) == FUNCTION_DECL
- && !DECL_BUILT_IN (e->decl)
+ && !fndecl_built_in_p (e->decl)
&& lto_symtab_symbol_p (e))
{
prevailing = e;
@@ -1030,7 +1030,7 @@ lto_symtab_merge_symbols (void)
/* Builtins are not merged via decl merging. It is however
possible that tree merging unified the declaration. We
do not want duplicate entries in symbol table. */
- if (cnode && DECL_BUILT_IN (node->decl)
+ if (cnode && fndecl_built_in_p (node->decl)
&& (cnode2 = cgraph_node::get (node->decl))
&& cnode2 != cnode)
lto_cgraph_replace_node (cnode2, cnode);
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 10618896022..5b92bee026e 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -894,7 +894,7 @@ lto_maybe_register_decl (struct data_in *data_in, tree t, unsigned ix)
if (TREE_CODE (t) == VAR_DECL)
lto_register_var_decl_in_symtab (data_in, t, ix);
else if (TREE_CODE (t) == FUNCTION_DECL
- && !DECL_BUILT_IN (t))
+ && !fndecl_built_in_p (t))
lto_register_function_decl_in_symtab (data_in, t, ix);
}
@@ -2923,7 +2923,8 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
FOR_EACH_SYMBOL (snode)
if (snode->externally_visible && snode->real_symbol_p ()
&& snode->lto_file_data && snode->lto_file_data->resolution_map
- && !is_builtin_fn (snode->decl)
+ && !(TREE_CODE (snode->decl) != FUNCTION_DECL
+ || fndecl_built_in_p (snode->decl))
&& !(VAR_P (snode->decl) && DECL_HARD_REGISTER (snode->decl)))
{
ld_plugin_symbol_resolution_t *res;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 843c66fd221..fdabf67249b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2975,9 +2975,8 @@ scan_omp_1_op (tree *tp, int *walk_subtrees, void *data)
static bool
setjmp_or_longjmp_p (const_tree fndecl)
{
- if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
- && (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SETJMP
- || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_LONGJMP))
+ if (fndecl_built_in_p (fndecl, BUILT_IN_SETJMP)
+ || fndecl_built_in_p (fndecl, BUILT_IN_LONGJMP))
return true;
tree declname = DECL_NAME (fndecl);
@@ -8832,7 +8831,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
call_stmt = as_a <gcall *> (stmt);
fndecl = gimple_call_fndecl (call_stmt);
if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (fndecl))
{
case BUILT_IN_GOMP_BARRIER:
diff --git a/gcc/predict.c b/gcc/predict.c
index 8c8e79153fc..ca6a901cd56 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3996,10 +3996,12 @@ strip_predict_hints (function *fun, bool early)
tree fndecl = gimple_call_fndecl (stmt);
if (!early
- && ((DECL_BUILT_IN_P (fndecl, BUILT_IN_NORMAL, BUILT_IN_EXPECT)
+ && ((fndecl != NULL_TREE
+ && fndecl_built_in_p (fndecl, BUILT_IN_EXPECT)
&& gimple_call_num_args (stmt) == 2)
- || (DECL_BUILT_IN_P (fndecl, BUILT_IN_NORMAL,
- BUILT_IN_EXPECT_WITH_PROBABILITY)
+ || (fndecl != NULL_TREE
+ && fndecl_built_in_p (fndecl,
+ BUILT_IN_EXPECT_WITH_PROBABILITY)
&& gimple_call_num_args (stmt) == 3)
|| (gimple_call_internal_p (stmt)
&& gimple_call_internal_fn (stmt) == IFN_BUILTIN_EXPECT)))
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 5347e064704..8caf9dd0dd0 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -427,7 +427,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
fputs (" autoinline", file);
if (code == FUNCTION_DECL && DECL_UNINLINABLE (node))
fputs (" uninlinable", file);
- if (code == FUNCTION_DECL && DECL_BUILT_IN (node))
+ if (code == FUNCTION_DECL && fndecl_built_in_p (node))
fputs (" built-in", file);
if (code == FUNCTION_DECL && DECL_STATIC_CHAIN (node))
fputs (" static-chain", file);
@@ -502,7 +502,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
print_node (file, "size", DECL_SIZE (node), indent + 4);
print_node (file, "unit-size", DECL_SIZE_UNIT (node), indent + 4);
- if (code != FUNCTION_DECL || DECL_BUILT_IN (node))
+ if (code != FUNCTION_DECL || fndecl_built_in_p (node))
indent_to (file, indent + 3);
if (DECL_USER_ALIGN (node))
@@ -514,7 +514,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
DECL_OFFSET_ALIGN (node));
- if (code == FUNCTION_DECL && DECL_BUILT_IN (node))
+ if (code == FUNCTION_DECL && fndecl_built_in_p (node))
{
if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
fprintf (file, " built-in: BUILT_IN_MD:%d", DECL_FUNCTION_CODE (node));
diff --git a/gcc/symtab.c b/gcc/symtab.c
index c5464cbe6d7..3cf1f629413 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -2323,7 +2323,7 @@ symtab_node::output_to_lto_symbol_table_p (void)
return false;
/* FIXME: Builtins corresponding to real functions probably should have
symbol table entries. */
- if (is_builtin_fn (decl))
+ if (TREE_CODE (decl) == FUNCTION_DECL && fndecl_built_in_p (decl))
return false;
/* We have real symbol that should be in symbol table. However try to trim
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index ca14915ef0d..1d4eb806202 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -235,8 +235,7 @@ is_tm_irrevocable (tree x)
if (TREE_CODE (x) == ADDR_EXPR)
x = TREE_OPERAND (x, 0);
if (TREE_CODE (x) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (x) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (x) == BUILT_IN_TM_IRREVOCABLE)
+ && fndecl_built_in_p (x, BUILT_IN_TM_IRREVOCABLE))
return true;
return false;
@@ -358,7 +357,8 @@ is_tm_load (gimple *stmt)
return false;
fndecl = gimple_call_fndecl (stmt);
- return (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+ return (fndecl
+ && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
&& BUILTIN_TM_LOAD_P (DECL_FUNCTION_CODE (fndecl)));
}
@@ -374,7 +374,7 @@ is_tm_simple_load (gimple *stmt)
return false;
fndecl = gimple_call_fndecl (stmt);
- if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
{
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
return (fcode == BUILT_IN_TM_LOAD_1
@@ -402,7 +402,8 @@ is_tm_store (gimple *stmt)
return false;
fndecl = gimple_call_fndecl (stmt);
- return (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+ return (fndecl
+ && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
&& BUILTIN_TM_STORE_P (DECL_FUNCTION_CODE (fndecl)));
}
@@ -418,7 +419,8 @@ is_tm_simple_store (gimple *stmt)
return false;
fndecl = gimple_call_fndecl (stmt);
- if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl
+ && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
{
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
return (fcode == BUILT_IN_TM_STORE_1
@@ -440,9 +442,7 @@ is_tm_simple_store (gimple *stmt)
static bool
is_tm_abort (tree fndecl)
{
- return (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_TM_ABORT);
+ return (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_TM_ABORT));
}
/* Build a GENERIC tree for a user abort. This is called by front ends
@@ -2007,7 +2007,7 @@ tm_region_init_1 (struct tm_region *region, basic_block bb)
if (gimple_code (g) == GIMPLE_CALL)
{
tree fn = gimple_call_fndecl (g);
- if (fn && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL)
+ if (fn && fndecl_built_in_p (fn, BUILT_IN_NORMAL))
{
if ((DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_COMMIT
|| DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_COMMIT_EH)
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index a47be1d0362..01401cad6e6 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -737,7 +737,7 @@ gen_shrink_wrap_conditions (gcall *bi_call, vec<gimple *> conds,
call = bi_call;
fn = gimple_call_fndecl (call);
- gcc_assert (fn && DECL_BUILT_IN (fn));
+ gcc_assert (fn && fndecl_built_in_p (fn));
fnc = DECL_FUNCTION_CODE (fn);
*nconds = 0;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index b021fb0f97b..cf12cb1f391 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3426,7 +3426,7 @@ verify_gimple_call (gcall *stmt)
return true;
}
- if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
{
switch (DECL_FUNCTION_CODE (fndecl))
{
@@ -6882,7 +6882,7 @@ move_stmt_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
/* Remap the region numbers for __builtin_eh_{pointer,filter}. */
{
tree r, fndecl = gimple_call_fndecl (stmt);
- if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (fndecl))
{
case BUILT_IN_EH_COPY_VALUES:
@@ -8303,15 +8303,14 @@ stmt_can_terminate_bb_p (gimple *t)
if (is_gimple_call (t)
&& fndecl
- && DECL_BUILT_IN (fndecl)
+ && fndecl_built_in_p (fndecl)
&& (call_flags & ECF_NOTHROW)
&& !(call_flags & ECF_RETURNS_TWICE)
/* fork() doesn't really return twice, but the effect of
wrapping it in __gcov_fork() which calls __gcov_flush()
and clears the counters before forking has the same
effect as returning twice. Force a fake edge. */
- && !(DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_FORK))
+ && !fndecl_built_in_p (fndecl, BUILT_IN_FORK))
return false;
if (is_gimple_call (t))
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 20e2db9e29a..fb931aa4389 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1984,7 +1984,7 @@ lower_eh_constructs_2 (struct leh_state *state, gimple_stmt_iterator *gsi)
tree fndecl = gimple_call_fndecl (stmt);
tree rhs, lhs;
- if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (fndecl))
{
case BUILT_IN_EH_POINTER:
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index e181468fba9..77eefac4e34 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1079,7 +1079,7 @@ if_convertible_stmt_p (gimple *stmt, vec<data_reference_p> refs)
&& !(flags & ECF_LOOPING_CONST_OR_PURE)
/* We can only vectorize some builtins at the moment,
so restrict if-conversion to those. */
- && DECL_BUILT_IN (fndecl))
+ && fndecl_built_in_p (fndecl))
return true;
}
return false;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index ef615cc347e..9352acc8af6 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1702,7 +1702,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id)
case GIMPLE_CALL:
{
tree r, fndecl = gimple_call_fndecl (copy);
- if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (fndecl))
{
case BUILT_IN_EH_COPY_VALUES:
@@ -1939,8 +1939,7 @@ copy_bb (copy_body_data *id, basic_block bb,
else if (call_stmt
&& id->call_stmt
&& (decl = gimple_call_fndecl (stmt))
- && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN)
+ && fndecl_built_in_p (decl, BUILT_IN_VA_ARG_PACK_LEN))
{
/* __builtin_va_arg_pack_len () should be replaced by
the number of anonymous arguments. */
@@ -4039,7 +4038,7 @@ estimate_num_insns (gimple *stmt, eni_weights *weights)
if (gimple_call_internal_p (stmt))
return 0;
else if ((decl = gimple_call_fndecl (stmt))
- && DECL_BUILT_IN (decl))
+ && fndecl_built_in_p (decl))
{
/* Do not special case builtins where we see the body.
This just confuse inliner. */
@@ -4903,7 +4902,7 @@ fold_marked_statements (int first, hash_set<gimple *> *statements)
gimple *old_stmt = gsi_stmt (gsi);
tree old_decl = is_gimple_call (old_stmt) ? gimple_call_fndecl (old_stmt) : 0;
- if (old_decl && DECL_BUILT_IN (old_decl))
+ if (old_decl && fndecl_built_in_p (old_decl))
{
/* Folding builtins can create multiple instructions,
we need to look at all of them. */
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 3e30f6bc3d4..a9681ece0ae 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1498,8 +1498,7 @@ scan_function (void)
if (dest)
{
- if (DECL_BUILT_IN_CLASS (dest) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (dest) == BUILT_IN_APPLY_ARGS)
+ if (fndecl_built_in_p (dest, BUILT_IN_APPLY_ARGS))
encountered_apply_args = true;
if (recursive_call_p (current_function_decl, dest))
{
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index d0f799eb39d..95368a5c79d 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -807,7 +807,7 @@ surely_varying_stmt_p (gimple *stmt)
tree fndecl, fntype = gimple_call_fntype (stmt);
if (!gimple_call_lhs (stmt)
|| ((fndecl = gimple_call_fndecl (stmt)) != NULL_TREE
- && !DECL_BUILT_IN (fndecl)
+ && !fndecl_built_in_p (fndecl)
&& !lookup_attribute ("assume_aligned",
TYPE_ATTRIBUTES (fntype))
&& !lookup_attribute ("alloc_align",
@@ -2560,7 +2560,7 @@ optimize_stack_restore (gimple_stmt_iterator i)
callee = gimple_call_fndecl (stmt);
if (!callee
- || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL
+ || !fndecl_built_in_p (callee, BUILT_IN_NORMAL)
/* All regular builtins are ok, just obviously not alloca. */
|| ALLOCA_FUNCTION_CODE_P (DECL_FUNCTION_CODE (callee)))
return NULL_TREE;
@@ -2596,9 +2596,7 @@ optimize_stack_restore (gimple_stmt_iterator i)
if (is_gimple_call (stack_save))
{
callee = gimple_call_fndecl (stack_save);
- if (callee
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (callee) == BUILT_IN_STACK_SAVE)
+ if (callee && fndecl_built_in_p (callee, BUILT_IN_STACK_SAVE))
{
gimple_stmt_iterator stack_save_gsi;
tree rhs;
@@ -3195,7 +3193,7 @@ pass_fold_builtins::execute (function *fun)
}
callee = gimple_call_fndecl (stmt);
- if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL)
+ if (!callee || !fndecl_built_in_p (callee, BUILT_IN_NORMAL))
{
gsi_next (&i);
continue;
@@ -3370,8 +3368,7 @@ pass_fold_builtins::execute (function *fun)
}
callee = gimple_call_fndecl (stmt);
if (!callee
- || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL
- || DECL_FUNCTION_CODE (callee) == fcode)
+ || !fndecl_built_in_p (callee, fcode))
gsi_next (&i);
}
}
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index d23148675c9..91ce2aa4fc5 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -224,7 +224,7 @@ mark_stmt_if_obviously_necessary (gimple *stmt, bool aggressive)
{
tree callee = gimple_call_fndecl (stmt);
if (callee != NULL_TREE
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (callee, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_MALLOC:
@@ -565,7 +565,7 @@ mark_all_reaching_defs_necessary_1 (ao_ref *ref ATTRIBUTE_UNUSED,
{
tree callee = gimple_call_fndecl (def_stmt);
if (callee != NULL_TREE
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (callee, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_MALLOC:
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 7430fd7e706..f7cc034b26e 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1987,8 +1987,7 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator si)
certain that the value simply isn't constant. */
tree callee = gimple_call_fndecl (stmt);
if (callee
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (callee) == BUILT_IN_CONSTANT_P)
+ && fndecl_built_in_p (callee, BUILT_IN_CONSTANT_P))
{
propagate_tree_value_into_stmt (&si, integer_zero_node);
stmt = gsi_stmt (si);
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 4ed61c37a5f..efdf2094c8b 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1278,7 +1278,7 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
constant length. */
callee1 = gimple_call_fndecl (stmt1);
if (callee1 == NULL_TREE
- || DECL_BUILT_IN_CLASS (callee1) != BUILT_IN_NORMAL
+ || !fndecl_built_in_p (callee1, BUILT_IN_NORMAL)
|| gimple_call_num_args (stmt1) != 3)
break;
if (DECL_FUNCTION_CODE (callee1) != BUILT_IN_MEMCPY
@@ -2538,7 +2538,7 @@ pass_forwprop::execute (function *fun)
{
tree callee = gimple_call_fndecl (stmt);
if (callee != NULL_TREE
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (callee, BUILT_IN_NORMAL))
changed = simplify_builtin_call (&gsi, callee);
break;
}
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 01a954eeb1e..9c62f20866c 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -471,9 +471,7 @@ stmt_cost (gimple *stmt)
/* Unless the call is a builtin_constant_p; this always folds to a
constant, so moving it is useless. */
fndecl = gimple_call_fndecl (stmt);
- if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CONSTANT_P)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_CONSTANT_P))
return 0;
return LIM_EXPENSIVE;
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index a90d9d28e4e..25378da6f4a 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -793,7 +793,7 @@ pass_cse_reciprocals::execute (function *fun)
{
fndecl = gimple_call_fndecl (call);
if (!fndecl
- || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_MD)
+ || !fndecl_built_in_p (fndecl, BUILT_IN_MD))
continue;
fndecl = targetm.builtin_reciprocal (fndecl);
if (!fndecl)
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index c927cb8078f..42676487c86 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1373,7 +1373,7 @@ fully_constant_vn_reference_p (vn_reference_t ref)
if (op->opcode == CALL_EXPR
&& TREE_CODE (op->op0) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (op->op0, 0)) == FUNCTION_DECL
- && DECL_BUILT_IN (TREE_OPERAND (op->op0, 0))
+ && fndecl_built_in_p (TREE_OPERAND (op->op0, 0))
&& operands.length () >= 2
&& operands.length () <= 3)
{
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index d0792aa38c8..b90d4a17985 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -581,7 +581,7 @@ get_string_length (strinfo *si)
gcc_assert (is_gimple_call (stmt));
callee = gimple_call_fndecl (stmt);
- gcc_assert (callee && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL);
+ gcc_assert (callee && fndecl_built_in_p (callee, BUILT_IN_NORMAL));
lhs = gimple_call_lhs (stmt);
/* unshare_strinfo is intentionally not called here. The (delayed)
transformation of strcpy or strcat into stpcpy is done at the place
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index fd24f84fb14..22558351138 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4075,7 +4075,7 @@ handle_lhs_call (gcall *stmt, tree lhs, int flags, vec<ce_s> rhsc,
initialized and thus may point to global memory. All
builtin functions with the malloc attribute behave in a sane way. */
if (!fndecl
- || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL)
+ || !fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
make_constraint_from (vi, nonlocal_id);
tmpc.var = vi->id;
tmpc.offset = 0;
@@ -4729,7 +4729,7 @@ find_func_aliases_for_call (struct function *fn, gcall *t)
varinfo_t fi;
if (fndecl != NULL_TREE
- && DECL_BUILT_IN (fndecl)
+ && fndecl_built_in_p (fndecl)
&& find_func_aliases_for_builtin_call (fn, t))
return;
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index 4339520039b..3396a5c28df 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -683,7 +683,7 @@ find_replaceable_in_bb (temp_expr_table *tab, basic_block bb)
insns instead of a true call. */
if (is_gimple_call (stmt)
&& !((fndecl = gimple_call_fndecl (stmt))
- && DECL_BUILT_IN (fndecl)))
+ && fndecl_built_in_p (fndecl)))
cur_call_cnt++;
/* Increment counter if this statement sets a local
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index c8594851957..f40dc5641cd 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -694,7 +694,7 @@ optimize_va_list_gpr_fpr_size (function *fun)
callee = gimple_call_fndecl (stmt);
if (!callee
- || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL)
+ || !fndecl_built_in_p (callee, BUILT_IN_NORMAL))
continue;
switch (DECL_FUNCTION_CODE (callee))
@@ -867,9 +867,8 @@ optimize_va_list_gpr_fpr_size (function *fun)
tree callee = gimple_call_fndecl (stmt);
if (callee
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL
- && (DECL_FUNCTION_CODE (callee) == BUILT_IN_VA_START
- || DECL_FUNCTION_CODE (callee) == BUILT_IN_VA_END))
+ && (fndecl_built_in_p (callee, BUILT_IN_VA_START)
+ || fndecl_built_in_p (callee, BUILT_IN_VA_END)))
continue;
}
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 9ebed9de524..8e9c2cbd289 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -476,7 +476,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
tail_recursion = false;
func = gimple_call_fndecl (call);
if (func
- && !DECL_BUILT_IN (func)
+ && !fndecl_built_in_p (func)
&& recursive_call_p (current_function_decl, func))
{
tree arg;
diff --git a/gcc/tree.c b/gcc/tree.c
index f00a519b302..5ae467437b5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5240,7 +5240,7 @@ need_assembler_name_p (tree decl)
{
/* Do not set assembler name on builtins. Allow RTL expansion to
decide whether to expand inline or via a regular call. */
- if (DECL_BUILT_IN (decl)
+ if (fndecl_built_in_p (decl)
&& DECL_BUILT_IN_CLASS (decl) != BUILT_IN_FRONTEND)
return false;
@@ -5371,10 +5371,9 @@ free_lang_data_in_decl (tree decl)
nodes and thus we can't use TREE_CHAIN in multiple lists. */
tree *nextp = &BLOCK_VARS (DECL_INITIAL (decl));
while (*nextp)
- {
- tree var = *nextp;
- if (TREE_CODE (var) == FUNCTION_DECL
- && DECL_BUILT_IN (var))
+ {
+ tree var = *nextp;
+ if (fndecl_built_in_p (var))
*nextp = TREE_CHAIN (var);
else
nextp = &TREE_CHAIN (var);
@@ -9100,7 +9099,7 @@ get_call_combined_fn (const_tree call)
return as_combined_fn (CALL_EXPR_IFN (call));
tree fndecl = get_callee_fndecl (call);
- if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
return as_combined_fn (DECL_FUNCTION_CODE (fndecl));
return CFN_LAST;
diff --git a/gcc/tree.h b/gcc/tree.h
index 5d4f034e008..db04eb7e58b 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2995,25 +2995,11 @@ 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 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 declared 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. */
#define DECL_BUILT_IN_CLASS(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.built_in_class)
-/* For a function declaration, return true if NODE is non-null and it is
- a builtin of a CLASS with requested NAME. */
-#define DECL_BUILT_IN_P(NODE, CLASS, NAME) \
- (NODE != NULL_TREE && DECL_BUILT_IN_CLASS (NODE) == CLASS \
- && DECL_FUNCTION_CODE (NODE) == NAME)
-
/* In FUNCTION_DECL, a chain of ..._DECL nodes. */
#define DECL_ARGUMENTS(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.arguments)
@@ -5848,4 +5834,49 @@ type_has_mode_precision_p (const_tree t)
return known_eq (TYPE_PRECISION (t), GET_MODE_PRECISION (TYPE_MODE (t)));
}
+/* For a FUNCTION_DECL NODE, 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 declared prototypes of C library functions are not
+ DECL_IS_BUILTIN but may be DECL_BUILT_IN.
+
+ When a NULL argument is pass or tree code of the NODE is not FUNCTION_DECL
+ false is returned. */
+
+inline bool
+fndecl_built_in_p (const_tree node)
+{
+ return (DECL_BUILT_IN_CLASS (node) != NOT_BUILT_IN);
+}
+
+/* For a FUNCTION_DECL NODE, return true when a function is
+ a built-in of class KLASS. */
+
+inline bool
+fndecl_built_in_p (const_tree node, built_in_class klass)
+{
+ return (fndecl_built_in_p (node) && DECL_BUILT_IN_CLASS (node) == klass);
+}
+
+/* For a FUNCTION_DECL NODE, return true when a function is
+ a built-in of class KLASS with name equal to NAME. */
+
+inline bool
+fndecl_built_in_p (const_tree node, int name, built_in_class klass)
+{
+ return (fndecl_built_in_p (node, klass) && DECL_FUNCTION_CODE (node) == name);
+}
+
+/* For a FUNCTION_DECL NODE, return true when a function is
+ a built-in of class BUILT_IN_NORMAL class with name equal to NAME. */
+
+inline bool
+fndecl_built_in_p (const_tree node, built_in_function name)
+{
+ return (fndecl_built_in_p (node, BUILT_IN_NORMAL)
+ && DECL_FUNCTION_CODE (node) == name);
+}
+
#endif /* GCC_TREE_H */
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 722f5702612..9bbcecc58af 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -663,7 +663,7 @@ bool
is_ubsan_builtin_p (tree t)
{
return TREE_CODE (t) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL
+ && fndecl_built_in_p (t, BUILT_IN_NORMAL)
&& strncmp (IDENTIFIER_POINTER (DECL_NAME (t)),
"__builtin___ubsan_", 18) == 0;
}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 99de27d9d3c..2180da48895 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2401,7 +2401,7 @@ static hash_set<tree> *pending_assemble_externals_set;
static bool
incorporeal_function_p (tree decl)
{
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
+ if (TREE_CODE (decl) == FUNCTION_DECL && fndecl_built_in_p (decl))
{
const char *name;