On 08/14/2018 03:06 AM, Martin Liška wrote:
Hi.

The patch adds more usages of the new macro. I hope it improves
readability of code.

I think it does :)  I see that most invocations of it in your
patch are with BUILT_IN_NORMAL as the second argument.  Is
the argument implied by the last argument?  E.g., in

  DECL_BUILT_IN_P (fndecl, BUILT_IN_NORMAL, BUILT_IN_VA_ARG_PACK)

is there a way to determine that BUILT_IN_VA_ARG_PACK implies
DECL_BUILT_IN_CLASS(fndecl), so that the second argument could
be eliminated?  (Both to make the invocation less verbose and
to avoid the mistake of using the macro with the wrong class.)

If not, adding DECL_NORMAL_BUILT_IN_P() would make it possible
to omit it.

Martin


Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

gcc/ChangeLog:

2018-08-10  Martin Liska  <mli...@suse.cz>

        * tree.h (DECL_BUILT_IN_P): Add also check
        for TREE_CODE (NODE) == FUNCTION_DECL.
        * builtins.c (fold_call_expr): Use DECL_BUILT_IN_P macro.
        (fold_builtin_call_array): 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 (cgraph_node::create_clone): Likewise.
        * dse.c (scan_insn): Likewise.
        * fold-const.c (fold_binary_loc): Likewise.
        * gimple-pretty-print.c (dump_gimple_call): Likewise.
        * gimple.c (gimple_call_builtin_p): Likewise.
        * gimplify.c (gimplify_call_expr): Likewise.
        (gimple_boolify): Likewise.
        (gimplify_modify_expr): Likewise.
        * ipa-fnsummary.c (compute_fn_summary): Likewise.
        * omp-low.c (setjmp_or_longjmp_p): Likewise.
        * trans-mem.c (is_tm_irrevocable): Likewise.
        (is_tm_abort): Likewise.
        * tree-cfg.c (stmt_can_terminate_bb_p): Likewise.
        * tree-inline.c (copy_bb): Likewise.
        * tree-sra.c (scan_function): Likewise.
        * tree-ssa-ccp.c (optimize_stack_restore): Likewise.
        (pass_fold_builtins::execute): Likewise.
        * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Likewise.
        * tree-ssa-loop-im.c (stmt_cost): Likewise.
        * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Likewise.

gcc/c/ChangeLog:

2018-08-10  Martin Liska  <mli...@suse.cz>

        * c-parser.c (c_parser_postfix_expression_after_primary):
        Use DECL_BUILT_IN_P macro.

gcc/cp/ChangeLog:

2018-08-10  Martin Liska  <mli...@suse.cz>

        * constexpr.c (constexpr_fn_retval): Use DECL_BUILT_IN_P macro.
        (cxx_eval_builtin_function_call): Likewise.
        * cp-gimplify.c (cp_gimplify_expr): Likewise.
        (cp_fold): Likewise.
        * semantics.c (finish_call_expr): Likewise.
        * tree.c (builtin_valid_in_constant_expr_p): Likewise.
---
 gcc/builtins.c            | 10 ++--------
 gcc/c/c-parser.c          |  9 +++------
 gcc/cgraph.c              | 13 ++++++-------
 gcc/cgraphclones.c        |  4 ++--
 gcc/cp/constexpr.c        | 12 +++++-------
 gcc/cp/cp-gimplify.c      | 12 ++++--------
 gcc/cp/semantics.c        |  4 +---
 gcc/cp/tree.c             |  5 ++---
 gcc/dse.c                 |  5 ++---
 gcc/fold-const.c          |  4 +---
 gcc/gimple-pretty-print.c |  4 +---
 gcc/gimple.c              |  3 +--
 gcc/gimplify.c            | 14 ++++----------
 gcc/ipa-fnsummary.c       |  8 ++++----
 gcc/omp-low.c             |  5 ++---
 gcc/trans-mem.c           |  8 ++------
 gcc/tree-cfg.c            |  3 +--
 gcc/tree-inline.c         |  4 ++--
 gcc/tree-sra.c            |  4 ++--
 gcc/tree-ssa-ccp.c        |  8 ++------
 gcc/tree-ssa-dom.c        |  4 +---
 gcc/tree-ssa-loop-im.c    |  4 +---
 gcc/tree-stdarg.c         |  6 ++----
 gcc/tree.h                |  4 +++-
 24 files changed, 56 insertions(+), 101 deletions(-)



Reply via email to