diff options
author | Martin Liska <mliska@suse.cz> | 2018-08-27 14:34:52 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-08-27 12:34:52 +0000 |
commit | 3d78e00879b42574c9b0084c30f1361f0cfb9101 (patch) | |
tree | bc8f9a510c36fa862ab02298af03a506c99fdda5 /gcc/builtins.c | |
parent | bb79aba479cf228832b8d2c6bfb8bf420a1f6f4a (diff) | |
download | gcc-3d78e00879b42574c9b0084c30f1361f0cfb9101.zip gcc-3d78e00879b42574c9b0084c30f1361f0cfb9101.tar.gz gcc-3d78e00879b42574c9b0084c30f1361f0cfb9101.tar.bz2 |
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
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 6a992bd..c4b52b9 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. */ |