From patchwork Sat May 13 23:23:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 93633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6017367vqo; Sat, 13 May 2023 16:32:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4M8KArodSpVm3TT7LgeL972g+NNwv7ov7w96G6D2S9G5sMP69owem2xZN0ZYUnAgfmyVCp X-Received: by 2002:a17:907:3606:b0:961:800b:3f57 with SMTP id bk6-20020a170907360600b00961800b3f57mr26180360ejc.77.1684020760608; Sat, 13 May 2023 16:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684020760; cv=none; d=google.com; s=arc-20160816; b=Trj00YeqLKE4k1xFWVTn4QI4lxMrwBU5hW/ejMBqtkSz7DERoVD1h1yWubT5W5K+iW hxGYORTgwlumDLjngmZ37+AiuJTivNrMDzanINqIrk3q0D2OQTQWNhUdlnGWjSQD4DN5 +kzn3lajJT8sZHsNeMTC+2jfvO66dLqdOPbNpxiq02NhpwkdwvcpfTIECLjn5FuYi6ay qviWRkEiGP1WNM8yyHeFNZd5sKSRLRErP15JPSE+ZIZ7YhqiWxrggfi/4wpb6M0kHaKe h7KaEaEmddR3hDLE8lmo/feExyCaNugdgjZUXp4OOcA18xxzkZhH8iUvPi1FvdbboB0m NjeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=rJSaDourxG+L6aDVXAf2XAH/CfCZJSnGwC1u9jWUJFQ=; b=IPDIRibUzOnVe4dRXNNZkhwynfjUmzFo9R1jewdzOiqP1pkxJonOIsbVyM/6roOtH/ KXu4OWGRnjqvCxZuLfjQt6gMCAnvxB4a7lYjbny6snBGoiTk0BUFZeG6g6xdR1JEVARS 7+tCBgmd2vSluL6XHJoq85P+C+WcwzE7w3lWiAKTGdf0cWmttO41pzji+aPIFEDgu87w Sh9hrgu51+HZjaiec2pGXk3AJxCD2vH33Nufl6pTTCIP1bIYS4n+jBDQy/H/vR7Zzo3e QdIUYevslLewQfrrx4/3Kjs8a7GvEPlpmQz9sORM54xoB+hybx4nqOOQp5glKP+X8WAb XhxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xZX8iswE; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z25-20020a170906075900b0094f297e08c2si10191468ejb.964.2023.05.13.16.32.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:32:40 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xZX8iswE; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 827CE3870904 for ; Sat, 13 May 2023 23:29:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 827CE3870904 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020598; bh=rJSaDourxG+L6aDVXAf2XAH/CfCZJSnGwC1u9jWUJFQ=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=xZX8iswEmPJv8Lt1bYuWdUCRzZU9LsxIFUu5k2h27aktbvoCJnqsRy2TPIxXuet2U hf6ReYNMhZb5MN2vLggbto4D2ic5Y8bDDtO3mGX9S5riZXq4islg3KYqHNRmiS49sN 5hk5BvEInQnNXhUNZyw+gWlgto0fQQR6EQIZpnEQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 8EB78385735C; Sat, 13 May 2023 23:23:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8EB78385735C Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-50bc040c7b8so17131858a12.2; Sat, 13 May 2023 16:23:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020237; x=1686612237; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rJSaDourxG+L6aDVXAf2XAH/CfCZJSnGwC1u9jWUJFQ=; b=RCLy2SPwLNC4RGLmBbX3qeYxBbkuGIiaubCtV0X4axkbJSGpLmpp/m7pXDaBIuIAiT HAsCLQx4XiM9WENIHldjOqJY/HzykTuGIq/4sVzAjuR1d2AKWH4YgxnmidJi4X+ka3x2 +w2isqjKglMdLik1knU/Cm8k9oT8HESh67dSlXQXjJOIzQ3ew7+ixP/VeXns6D+WtoRP rRqDB8zQ7nTr5rWUc8JjeKzSzaW49EkVE7r4Qy/ASG6WrAgcKSTb1cPBLmiVbeSpoJd1 rq/KSPDBUt9tJC5P+dP87ZqzxoLfGAjngKHRYIcDF08+IB/h9RG8KzwJEYefl0m6mu5Q EUZA== X-Gm-Message-State: AC+VfDz37zTKXDabShUgBrJT0qeQhgFHKu/oSDfRzAnQGA4IFMvF/gMg +pZ6OLZ/q7mHgdyHqKV0UJuIYc4uUf4= X-Received: by 2002:a17:907:2d91:b0:969:f3b4:83 with SMTP id gt17-20020a1709072d9100b00969f3b40083mr15608670ejc.71.1684020235959; Sat, 13 May 2023 16:23:55 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id de39-20020a1709069be700b00969e9fef151sm6923315ejc.97.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:51 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001An7-0n; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 14/14] gcc: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:21 +0200 Message-Id: <20230513232321.279733-15-rep.dot.nop@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230513232321.279733-1-rep.dot.nop@gmail.com> References: <20230513232321.279733-1-rep.dot.nop@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bernhard Reutner-Fischer via Gcc-patches From: Bernhard Reutner-Fischer Reply-To: Bernhard Reutner-Fischer Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765823753184641764?= X-GMAIL-MSGID: =?utf-8?q?1765823753184641764?= From: Bernhard Reutner-Fischer gcc/ChangeLog: * alias.cc (ref_all_alias_ptr_type_p): Use _P() defines from tree.h. * attribs.cc (diag_attr_exclusions): Ditto. (decl_attributes): Ditto. (build_type_attribute_qual_variant): Ditto. * builtins.cc (fold_builtin_carg): Ditto. (fold_builtin_next_arg): Ditto. (do_mpc_arg2): Ditto. * cfgexpand.cc (expand_return): Ditto. * cgraph.h (decl_in_symtab_p): Ditto. (symtab_node::get_create): Ditto. * dwarf2out.cc (base_type_die): Ditto. (implicit_ptr_descriptor): Ditto. (gen_array_type_die): Ditto. (gen_type_die_with_usage): Ditto. (optimize_location_into_implicit_ptr): Ditto. * expr.cc (do_store_flag): Ditto. * fold-const.cc (negate_expr_p): Ditto. (fold_negate_expr_1): Ditto. (fold_convert_const): Ditto. (fold_convert_loc): Ditto. (constant_boolean_node): Ditto. (fold_binary_op_with_conditional_arg): Ditto. (build_fold_addr_expr_with_type_loc): Ditto. (fold_comparison): Ditto. (fold_checksum_tree): Ditto. (tree_unary_nonnegative_warnv_p): Ditto. (integer_valued_real_unary_p): Ditto. (fold_read_from_constant_string): Ditto. * gcc-rich-location.cc (maybe_range_label_for_tree_type_mismatch::get_text): Ditto. * gimple-expr.cc (useless_type_conversion_p): Ditto. (is_gimple_reg): Ditto. (is_gimple_asm_val): Ditto. (mark_addressable): Ditto. * gimple-expr.h (is_gimple_variable): Ditto. (virtual_operand_p): Ditto. * gimple-ssa-warn-access.cc (pass_waccess::check_dangling_stores): Ditto. * gimplify.cc (gimplify_bind_expr): Ditto. (gimplify_return_expr): Ditto. (gimple_add_padding_init_for_auto_var): Ditto. (gimplify_addr_expr): Ditto. (omp_add_variable): Ditto. (omp_notice_variable): Ditto. (omp_get_base_pointer): Ditto. (omp_strip_components_and_deref): Ditto. (omp_strip_indirections): Ditto. (omp_accumulate_sibling_list): Ditto. (omp_build_struct_sibling_lists): Ditto. (gimplify_adjust_omp_clauses_1): Ditto. (gimplify_adjust_omp_clauses): Ditto. (gimplify_omp_for): Ditto. (goa_lhs_expr_p): Ditto. (gimplify_one_sizepos): Ditto. * graphite-scop-detection.cc (scop_detection::graphite_can_represent_scev): Ditto. * ipa-devirt.cc (odr_types_equivalent_p): Ditto. * ipa-prop.cc (ipa_set_jf_constant): Ditto. (propagate_controlled_uses): Ditto. * ipa-sra.cc (type_prevails_p): Ditto. (scan_expr_access): Ditto. * optabs-tree.cc (optab_for_tree_code): Ditto. * toplev.cc (wrapup_global_declaration_1): Ditto. * trans-mem.cc (transaction_invariant_address_p): Ditto. * tree-cfg.cc (verify_types_in_gimple_reference): Ditto. (verify_gimple_comparison): Ditto. (verify_gimple_assign_binary): Ditto. (verify_gimple_assign_single): Ditto. * tree-complex.cc (get_component_ssa_name): Ditto. * tree-emutls.cc (lower_emutls_2): Ditto. * tree-inline.cc (copy_tree_body_r): Ditto. (estimate_move_cost): Ditto. (copy_decl_for_dup_finish): Ditto. * tree-nested.cc (convert_nonlocal_omp_clauses): Ditto. (note_nonlocal_vla_type): Ditto. (convert_local_omp_clauses): Ditto. (remap_vla_decls): Ditto. (fixup_vla_decls): Ditto. * tree-parloops.cc (loop_has_vector_phi_nodes): Ditto. * tree-pretty-print.cc (print_declaration): Ditto. (print_call_name): Ditto. * tree-sra.cc (compare_access_positions): Ditto. * tree-ssa-alias.cc (compare_type_sizes): Ditto. * tree-ssa-ccp.cc (get_default_value): Ditto. * tree-ssa-coalesce.cc (populate_coalesce_list_for_outofssa): Ditto. * tree-ssa-dom.cc (reduce_vector_comparison_to_scalar_comparison): Ditto. * tree-ssa-forwprop.cc (can_propagate_from): Ditto. * tree-ssa-propagate.cc (may_propagate_copy): Ditto. * tree-ssa-sccvn.cc (fully_constant_vn_reference_p): Ditto. * tree-ssa-sink.cc (statement_sink_location): Ditto. * tree-ssa-structalias.cc (type_must_have_pointers): Ditto. * tree-ssa-ter.cc (find_replaceable_in_bb): Ditto. * tree-ssa-uninit.cc (warn_uninit): Ditto. * tree-ssa.cc (maybe_rewrite_mem_ref_base): Ditto. (non_rewritable_mem_ref_base): Ditto. * tree-streamer-in.cc (lto_input_ts_type_non_common_tree_pointers): Ditto. * tree-streamer-out.cc (write_ts_type_non_common_tree_pointers): Ditto. * tree-vect-generic.cc (do_binop): Ditto. (do_cond): Ditto. * tree-vect-stmts.cc (vect_init_vector): Ditto. * tree-vector-builder.h (tree_vector_builder::note_representative): Ditto. * tree.cc (sign_mask_for): Ditto. (verify_type_variant): Ditto. (gimple_canonical_types_compatible_p): Ditto. (verify_type): Ditto. * ubsan.cc (get_ubsan_type_info_for_type): Ditto. * var-tracking.cc (prepare_call_arguments): Ditto. (vt_add_function_parameters): Ditto. * varasm.cc (decode_addr_const): Ditto. --- gcc/alias.cc | 2 +- gcc/attribs.cc | 11 +++----- gcc/builtins.cc | 8 +++--- gcc/cfgexpand.cc | 2 +- gcc/cgraph.h | 4 +-- gcc/dwarf2out.cc | 15 +++++------ gcc/expr.cc | 2 +- gcc/fold-const.cc | 46 ++++++++++++++++---------------- gcc/gcc-rich-location.cc | 2 +- gcc/gimple-expr.cc | 19 ++++++-------- gcc/gimple-expr.h | 4 +-- gcc/gimple-ssa-warn-access.cc | 2 +- gcc/gimplify.cc | 48 ++++++++++++++++------------------ gcc/graphite-scop-detection.cc | 4 +-- gcc/ipa-devirt.cc | 4 +-- gcc/ipa-prop.cc | 7 +++-- gcc/ipa-sra.cc | 8 +++--- gcc/optabs-tree.cc | 12 ++++----- gcc/toplev.cc | 2 +- gcc/trans-mem.cc | 2 +- gcc/tree-cfg.cc | 22 ++++++++-------- gcc/tree-complex.cc | 2 +- gcc/tree-emutls.cc | 2 +- gcc/tree-inline.cc | 8 +++--- gcc/tree-nested.cc | 16 ++++++------ gcc/tree-parloops.cc | 2 +- gcc/tree-pretty-print.cc | 4 +-- gcc/tree-sra.cc | 4 +-- gcc/tree-ssa-alias.cc | 4 +-- gcc/tree-ssa-ccp.cc | 2 +- gcc/tree-ssa-coalesce.cc | 2 +- gcc/tree-ssa-dom.cc | 4 +-- gcc/tree-ssa-forwprop.cc | 3 +-- gcc/tree-ssa-propagate.cc | 2 +- gcc/tree-ssa-sccvn.cc | 2 +- gcc/tree-ssa-sink.cc | 2 +- gcc/tree-ssa-structalias.cc | 3 +-- gcc/tree-ssa-ter.cc | 2 +- gcc/tree-ssa-uninit.cc | 2 +- gcc/tree-ssa.cc | 4 +-- gcc/tree-streamer-in.cc | 3 +-- gcc/tree-streamer-out.cc | 3 +-- gcc/tree-vect-generic.cc | 8 +++--- gcc/tree-vect-stmts.cc | 2 +- gcc/tree-vector-builder.h | 2 +- gcc/tree.cc | 28 ++++++++++---------- gcc/ubsan.cc | 2 +- gcc/var-tracking.cc | 4 +-- gcc/varasm.cc | 2 +- 49 files changed, 167 insertions(+), 183 deletions(-) diff --git a/gcc/alias.cc b/gcc/alias.cc index 3672bf277b9..7dc7e06de07 100644 --- a/gcc/alias.cc +++ b/gcc/alias.cc @@ -699,7 +699,7 @@ component_uses_parent_alias_set_from (const_tree t) static bool ref_all_alias_ptr_type_p (const_tree t) { - return (TREE_CODE (TREE_TYPE (t)) == VOID_TYPE + return (VOID_TYPE_P (TREE_TYPE (t)) || TYPE_REF_CAN_ALIAS_ALL (t)); } diff --git a/gcc/attribs.cc b/gcc/attribs.cc index b1300018d1e..b8cb55b97df 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -526,7 +526,7 @@ diag_attr_exclusions (tree last_decl, tree node, tree attrname, continue; if ((TREE_CODE (node) == FIELD_DECL - || TREE_CODE (node) == VAR_DECL) + || VAR_P (node)) && !excl->variable) continue; @@ -783,8 +783,7 @@ decl_attributes (tree *node, tree attributes, int flags, && TREE_CODE (*anode) != METHOD_TYPE) { if (TREE_CODE (*anode) == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (*anode)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (*anode)) == METHOD_TYPE)) + && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (*anode))) { /* OK, this is a bit convoluted. We can't just make a copy of the pointer type and modify its TREE_TYPE, because if @@ -820,7 +819,7 @@ decl_attributes (tree *node, tree attributes, int flags, if (TYPE_P (*anode) && (flags & (int) ATTR_FLAG_TYPE_IN_PLACE) - && TYPE_SIZE (*anode) != NULL_TREE) + && COMPLETE_TYPE_P (*anode)) { warning (OPT_Wattributes, "type attributes ignored after type is already defined"); continue; @@ -1278,9 +1277,7 @@ build_type_attribute_qual_variant (tree otype, tree attribute, int quals) build_duplicate_type is another solution (as used in handle_transparent_union_attribute), but that doesn't play well with the stronger C++ type identity model. */ - if (TREE_CODE (ttype) == RECORD_TYPE - || TREE_CODE (ttype) == UNION_TYPE - || TREE_CODE (ttype) == QUAL_UNION_TYPE + if (RECORD_OR_UNION_TYPE_P (ttype) || TREE_CODE (ttype) == ENUMERAL_TYPE) { warning (OPT_Wattributes, diff --git a/gcc/builtins.cc b/gcc/builtins.cc index c21c4688c58..8400adaf5b4 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -8937,7 +8937,7 @@ static tree fold_builtin_carg (location_t loc, tree arg, tree type) { if (validate_arg (arg, COMPLEX_TYPE) - && TREE_CODE (TREE_TYPE (TREE_TYPE (arg))) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (TREE_TYPE (arg)))) { tree atan2_fn = mathfn_built_in (type, BUILT_IN_ATAN2); @@ -10445,7 +10445,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p) We must also strip off INDIRECT_EXPR for C++ reference parameters. */ while (CONVERT_EXPR_P (arg) - || TREE_CODE (arg) == INDIRECT_REF) + || INDIRECT_REF_P (arg)) arg = TREE_OPERAND (arg, 0); if (arg != last_parm) { @@ -11133,9 +11133,9 @@ do_mpc_arg2 (tree arg0, tree arg1, tree type, int do_nonfinite, /* To proceed, MPFR must exactly represent the target floating point format, which only happens when the target base equals two. */ if (TREE_CODE (arg0) == COMPLEX_CST && !TREE_OVERFLOW (arg0) - && TREE_CODE (TREE_TYPE (TREE_TYPE (arg0))) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (TREE_TYPE (arg0))) && TREE_CODE (arg1) == COMPLEX_CST && !TREE_OVERFLOW (arg1) - && TREE_CODE (TREE_TYPE (TREE_TYPE (arg1))) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (TREE_TYPE (arg1))) && REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0))))->b == 2) { const REAL_VALUE_TYPE *const re0 = TREE_REAL_CST_PTR (TREE_REALPART (arg0)); diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index 1a1b26b1c6c..85a93a547c0 100644 --- a/gcc/cfgexpand.cc +++ b/gcc/cfgexpand.cc @@ -3753,7 +3753,7 @@ expand_return (tree retval) tree retval_rhs; /* If function wants no value, give it none. */ - if (TREE_CODE (TREE_TYPE (TREE_TYPE (current_function_decl))) == VOID_TYPE) + if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))) { expand_normal (retval); expand_null_return (); diff --git a/gcc/cgraph.h b/gcc/cgraph.h index f5f54769eda..cedaaac3a45 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -2650,7 +2650,7 @@ inline bool decl_in_symtab_p (const_tree decl) { return (TREE_CODE (decl) == FUNCTION_DECL - || (TREE_CODE (decl) == VAR_DECL + || (VAR_P (decl) && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))); } @@ -3359,7 +3359,7 @@ cgraph_node::optimize_for_size_p (void) inline symtab_node * symtab_node::get_create (tree node) { - if (TREE_CODE (node) == VAR_DECL) + if (VAR_P (node)) return varpool_node::get_create (node); else return cgraph_node::get_create (node); diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 1a0015ce00f..d89ffa66847 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -13287,7 +13287,7 @@ base_type_die (tree type, bool reverse) /* Dwarf2 doesn't know anything about complex ints, so use a user defined type for it. */ case COMPLEX_TYPE: - if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (type))) encoding = DW_ATE_complex_float; else encoding = DW_ATE_lo_user; @@ -17079,7 +17079,7 @@ implicit_ptr_descriptor (rtx rtl, HOST_WIDE_INT offset) if (dwarf_strict && dwarf_version < 5) return NULL; - gcc_assert (TREE_CODE (DEBUG_IMPLICIT_PTR_DECL (rtl)) == VAR_DECL + gcc_assert (VAR_P (DEBUG_IMPLICIT_PTR_DECL (rtl)) || TREE_CODE (DEBUG_IMPLICIT_PTR_DECL (rtl)) == PARM_DECL || TREE_CODE (DEBUG_IMPLICIT_PTR_DECL (rtl)) == RESULT_DECL); ref = lookup_decl_die (DEBUG_IMPLICIT_PTR_DECL (rtl)); @@ -22499,7 +22499,7 @@ gen_array_type_die (tree type, dw_die_ref context_die) size = int_size_in_bytes (TREE_TYPE (szdecl)); if (!DECL_P (szdecl)) { - if (TREE_CODE (szdecl) == INDIRECT_REF + if (INDIRECT_REF_P (szdecl) && DECL_P (TREE_OPERAND (szdecl, 0))) { rszdecl = TREE_OPERAND (szdecl, 0); @@ -22533,7 +22533,7 @@ gen_array_type_die (tree type, dw_die_ref context_die) add_name_attribute (array_die, type_tag (type)); equate_type_number_to_die (type, array_die); - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) add_AT_flag (array_die, DW_AT_GNU_vector, 1); /* For Fortran multidimensional arrays use DW_ORD_col_major ordering. */ @@ -22554,7 +22554,7 @@ gen_array_type_die (tree type, dw_die_ref context_die) add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_row_major); #endif - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) { /* For VECTOR_TYPEs we use an array DIE with appropriate bounds. */ dw_die_ref subrange_die = new_die (DW_TAG_subrange_type, array_die, NULL); @@ -26238,8 +26238,7 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die, now. (Vectors and arrays are special because the debugging info is in the cloned type itself. Similarly function/method types can contain extra ref-qualification). */ - if (TREE_CODE (type) == FUNCTION_TYPE - || TREE_CODE (type) == METHOD_TYPE) + if (FUNC_OR_METHOD_TYPE_P (type)) { /* For function/method types, can't use type_main_variant here, because that can have different ref-qualifiers for C++, @@ -30976,7 +30975,7 @@ optimize_location_into_implicit_ptr (dw_die_ref die, tree decl) return; if ((TREE_CODE (TREE_OPERAND (init, 0)) == STRING_CST && !TREE_ASM_WRITTEN (TREE_OPERAND (init, 0))) - || (TREE_CODE (TREE_OPERAND (init, 0)) == VAR_DECL + || (VAR_P (TREE_OPERAND (init, 0)) && !DECL_EXTERNAL (TREE_OPERAND (init, 0)) && TREE_OPERAND (init, 0) != decl)) { diff --git a/gcc/expr.cc b/gcc/expr.cc index 758dda9ec68..5ede094e705 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -12956,7 +12956,7 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) /* For vector typed comparisons emit code to generate the desired all-ones or all-zeros mask. */ - if (TREE_CODE (ops->type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (ops->type)) { tree ifexp = build2 (ops->code, ops->type, arg0, arg1); if (VECTOR_BOOLEAN_TYPE_P (ops->type) diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index db54bfc5662..a73b972ab9a 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -573,7 +573,7 @@ negate_expr_p (tree t) case NOP_EXPR: /* Negate -((double)float) as (double)(-float). */ - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { tree tem = strip_float_extensions (t); if (tem != t) @@ -759,7 +759,7 @@ fold_negate_expr_1 (location_t loc, tree t) case NOP_EXPR: /* Convert -((double)float) into (double)(-float). */ - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { tem = strip_float_extensions (t); if (tem != t && negate_expr_p (tem)) @@ -2385,7 +2385,7 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) else if (TREE_CODE (arg1) == FIXED_CST) return fold_convert_const_int_from_fixed (type, arg1); } - else if (TREE_CODE (type) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type)) { if (TREE_CODE (arg1) == INTEGER_CST) { @@ -2407,7 +2407,7 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) else if (TREE_CODE (arg1) == FIXED_CST) return fold_convert_const_real_from_fixed (type, arg1); } - else if (TREE_CODE (type) == FIXED_POINT_TYPE) + else if (FIXED_POINT_TYPE_P (type)) { if (TREE_CODE (arg1) == FIXED_CST) return fold_convert_const_fixed_from_fixed (type, arg1); @@ -2416,7 +2416,7 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) else if (TREE_CODE (arg1) == REAL_CST) return fold_convert_const_fixed_from_real (type, arg1); } - else if (TREE_CODE (type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (type)) { if (TREE_CODE (arg1) == VECTOR_CST && known_eq (TYPE_VECTOR_SUBPARTS (type), VECTOR_CST_NELTS (arg1))) @@ -2545,7 +2545,7 @@ fold_convert_loc (location_t loc, tree type, tree arg) return fold_convert_loc (loc, type, fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig), arg)); - gcc_assert (TREE_CODE (orig) == VECTOR_TYPE + gcc_assert (VECTOR_TYPE_P (orig) && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig))); return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg); @@ -2658,7 +2658,7 @@ fold_convert_loc (location_t loc, tree type, tree arg) return build_zero_vector (type); gcc_assert (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig))); gcc_assert (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig) - || TREE_CODE (orig) == VECTOR_TYPE); + || VECTOR_TYPE_P (orig)); return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg); case VOID_TYPE: @@ -7184,7 +7184,7 @@ constant_boolean_node (bool value, tree type) return value ? integer_one_node : integer_zero_node; else if (type == boolean_type_node) return value ? boolean_true_node : boolean_false_node; - else if (TREE_CODE (type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (type)) return build_vector_from_val (type, build_int_cst (TREE_TYPE (type), value ? -1 : 0)); @@ -7237,7 +7237,7 @@ fold_binary_op_with_conditional_arg (location_t loc, rhs = false_value; } else if (!(TREE_CODE (type) != VECTOR_TYPE - && TREE_CODE (TREE_TYPE (cond)) == VECTOR_TYPE)) + && VECTOR_TYPE_P (TREE_TYPE (cond)))) { tree testtype = TREE_TYPE (cond); test = cond; @@ -7248,7 +7248,7 @@ fold_binary_op_with_conditional_arg (location_t loc, /* Detect the case of mixing vector and scalar types - bail out. */ return NULL_TREE; - if (TREE_CODE (TREE_TYPE (test)) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (test))) cond_code = VEC_COND_EXPR; /* This transformation is only worthwhile if we don't have to wrap ARG @@ -9289,7 +9289,7 @@ build_fold_addr_expr_with_type_loc (location_t loc, tree t, tree ptrtype) if (TREE_CODE (t) == WITH_SIZE_EXPR) t = TREE_OPERAND (t, 0); - if (TREE_CODE (t) == INDIRECT_REF) + if (INDIRECT_REF_P (t)) { t = TREE_OPERAND (t, 0); @@ -10137,7 +10137,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, = get_inner_reference (TREE_OPERAND (arg0, 0), &bitsize, &bitpos0, &offset0, &mode, &unsignedp, &reversep, &volatilep); - if (TREE_CODE (base0) == INDIRECT_REF) + if (INDIRECT_REF_P (base0)) base0 = TREE_OPERAND (base0, 0); else indirect_base0 = true; @@ -10152,7 +10152,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, = get_inner_reference (TREE_OPERAND (base0, 0), &bitsize, &bitpos0, &offset0, &mode, &unsignedp, &reversep, &volatilep); - if (TREE_CODE (base0) == INDIRECT_REF) + if (INDIRECT_REF_P (base0)) base0 = TREE_OPERAND (base0, 0); else indirect_base0 = true; @@ -10180,7 +10180,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, = get_inner_reference (TREE_OPERAND (arg1, 0), &bitsize, &bitpos1, &offset1, &mode, &unsignedp, &reversep, &volatilep); - if (TREE_CODE (base1) == INDIRECT_REF) + if (INDIRECT_REF_P (base1)) base1 = TREE_OPERAND (base1, 0); else indirect_base1 = true; @@ -10195,7 +10195,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, = get_inner_reference (TREE_OPERAND (base1, 0), &bitsize, &bitpos1, &offset1, &mode, &unsignedp, &reversep, &volatilep); - if (TREE_CODE (base1) == INDIRECT_REF) + if (INDIRECT_REF_P (base1)) base1 = TREE_OPERAND (base1, 0); else indirect_base1 = true; @@ -13763,9 +13763,7 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, fold_checksum_tree (TYPE_MAX_VALUE (expr), ctx, ht); } fold_checksum_tree (TYPE_MAIN_VARIANT (expr), ctx, ht); - if (TREE_CODE (expr) == RECORD_TYPE - || TREE_CODE (expr) == UNION_TYPE - || TREE_CODE (expr) == QUAL_UNION_TYPE) + if (RECORD_OR_UNION_TYPE_P (expr)) fold_checksum_tree (TYPE_BINFO (expr), ctx, ht); fold_checksum_tree (TYPE_CONTEXT (expr), ctx, ht); break; @@ -14665,9 +14663,9 @@ tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0, tree inner_type = TREE_TYPE (op0); tree outer_type = type; - if (TREE_CODE (outer_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (outer_type)) { - if (TREE_CODE (inner_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (inner_type)) return RECURSE (op0); if (INTEGRAL_TYPE_P (inner_type)) { @@ -14678,7 +14676,7 @@ tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0, } else if (INTEGRAL_TYPE_P (outer_type)) { - if (TREE_CODE (inner_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (inner_type)) return RECURSE (op0); if (INTEGRAL_TYPE_P (inner_type)) return TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type) @@ -15442,7 +15440,7 @@ integer_valued_real_unary_p (tree_code code, tree op0, int depth) tree type = TREE_TYPE (op0); if (TREE_CODE (type) == INTEGER_TYPE) return true; - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) return RECURSE (op0); break; } @@ -15673,7 +15671,7 @@ fold_unary_to_constant (enum tree_code code, tree type, tree op0) tree fold_read_from_constant_string (tree exp) { - if ((TREE_CODE (exp) == INDIRECT_REF + if ((INDIRECT_REF_P (exp) || TREE_CODE (exp) == ARRAY_REF) && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE) { @@ -15682,7 +15680,7 @@ fold_read_from_constant_string (tree exp) tree string; location_t loc = EXPR_LOCATION (exp); - if (TREE_CODE (exp) == INDIRECT_REF) + if (INDIRECT_REF_P (exp)) string = string_constant (exp1, &index, NULL, NULL); else { diff --git a/gcc/gcc-rich-location.cc b/gcc/gcc-rich-location.cc index d02a5144cc6..edecf07f81e 100644 --- a/gcc/gcc-rich-location.cc +++ b/gcc/gcc-rich-location.cc @@ -200,7 +200,7 @@ maybe_range_label_for_tree_type_mismatch::get_text (unsigned range_idx) const tree expr_type = TREE_TYPE (m_expr); tree other_type = NULL_TREE; - if (m_other_expr && EXPR_P (m_other_expr)) + if (CAN_HAVE_LOCATION_P (m_other_expr)) other_type = TREE_TYPE (m_other_expr); range_label_for_type_mismatch inner (expr_type, other_type); diff --git a/gcc/gimple-expr.cc b/gcc/gimple-expr.cc index 83dc340a35d..f15cc0ba715 100644 --- a/gcc/gimple-expr.cc +++ b/gcc/gimple-expr.cc @@ -76,10 +76,8 @@ useless_type_conversion_p (tree outer_type, tree inner_type) != TYPE_ADDR_SPACE (TREE_TYPE (inner_type))) return false; /* Do not lose casts to function pointer types. */ - if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE) - && !(TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (inner_type)) == METHOD_TYPE)) + if (FUNC_OR_METHOD_TYPE_P (TREE_TYPE (outer_type)) + && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (inner_type))) return false; } @@ -147,8 +145,8 @@ useless_type_conversion_p (tree outer_type, tree inner_type) TREE_TYPE (inner_type)); /* Recurse for vector types with the same number of subparts. */ - else if (TREE_CODE (inner_type) == VECTOR_TYPE - && TREE_CODE (outer_type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (inner_type) + && VECTOR_TYPE_P (outer_type)) return (known_eq (TYPE_VECTOR_SUBPARTS (inner_type), TYPE_VECTOR_SUBPARTS (outer_type)) && useless_type_conversion_p (TREE_TYPE (outer_type), @@ -223,8 +221,7 @@ useless_type_conversion_p (tree outer_type, tree inner_type) TREE_TYPE (inner_type)); } - else if ((TREE_CODE (inner_type) == FUNCTION_TYPE - || TREE_CODE (inner_type) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (inner_type) && TREE_CODE (inner_type) == TREE_CODE (outer_type)) { tree outer_parm, inner_parm; @@ -819,7 +816,7 @@ is_gimple_reg (tree t) it seems safest to not do too much optimization with these at the tree level at all. We'll have to rely on the rtl optimizers to clean this up, as there we've got all the appropriate bits exposed. */ - if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)) + if (VAR_P (t) && DECL_HARD_REGISTER (t)) return false; /* Variables can be marked as having partial definitions, avoid @@ -847,7 +844,7 @@ is_gimple_val (tree t) bool is_gimple_asm_val (tree t) { - if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)) + if (VAR_P (t) && DECL_HARD_REGISTER (t)) return true; return is_gimple_val (t); @@ -955,7 +952,7 @@ mark_addressable (tree x) mark_addressable_1 (x); /* Also mark the artificial SSA_NAME that points to the partition of X. */ - if (TREE_CODE (x) == VAR_DECL + if (VAR_P (x) && !DECL_EXTERNAL (x) && !TREE_STATIC (x) && cfun->gimple_df != NULL diff --git a/gcc/gimple-expr.h b/gcc/gimple-expr.h index e89f7e20fc8..39f4b2ff4e8 100644 --- a/gcc/gimple-expr.h +++ b/gcc/gimple-expr.h @@ -81,7 +81,7 @@ is_gimple_reg_type (tree type) inline bool is_gimple_variable (tree t) { - return (TREE_CODE (t) == VAR_DECL + return (VAR_P (t) || TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL || TREE_CODE (t) == SSA_NAME); @@ -108,7 +108,7 @@ virtual_operand_p (tree op) if (TREE_CODE (op) == SSA_NAME) return SSA_NAME_IS_VIRTUAL_OPERAND (op); - if (TREE_CODE (op) == VAR_DECL) + if (VAR_P (op)) return VAR_DECL_IS_VIRTUAL_OPERAND (op); return false; diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc index 33bc4a84a7e..ac07a6f9b95 100644 --- a/gcc/gimple-ssa-warn-access.cc +++ b/gcc/gimple-ssa-warn-access.cc @@ -4584,7 +4584,7 @@ pass_waccess::check_dangling_stores (basic_block bb, if (TREE_CODE (lhs_ref.ref) == PARM_DECL && (lhs_ref.deref - DECL_BY_REFERENCE (lhs_ref.ref)) > 0) /* Assignment through a (real) pointer/reference parameter. */; - else if (TREE_CODE (lhs_ref.ref) == VAR_DECL + else if (VAR_P (lhs_ref.ref) && !auto_var_p (lhs_ref.ref)) /* Assignment to/through a non-local variable. */; else diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 3740a8979af..8bfd1372f81 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -1491,7 +1491,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p) if (DECL_HAS_VALUE_EXPR_P (key)) { key = DECL_VALUE_EXPR (key); - if (TREE_CODE (key) == INDIRECT_REF) + if (INDIRECT_REF_P (key)) key = TREE_OPERAND (key, 0); } tree *c = oacc_declare_returns->get (key); @@ -1625,7 +1625,7 @@ gimplify_return_expr (tree stmt, gimple_seq *pre_p) result_decl = TREE_OPERAND (ret_expr, 0); /* See through a return by reference. */ - if (TREE_CODE (result_decl) == INDIRECT_REF) + if (INDIRECT_REF_P (result_decl)) result_decl = TREE_OPERAND (result_decl, 0); gcc_assert ((TREE_CODE (ret_expr) == MODIFY_EXPR @@ -1812,7 +1812,7 @@ gimple_add_padding_init_for_auto_var (tree decl, bool is_vla, /* The temporary address variable for this vla should be created in gimplify_vla_decl. */ gcc_assert (DECL_HAS_VALUE_EXPR_P (decl)); - gcc_assert (TREE_CODE (DECL_VALUE_EXPR (decl)) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (DECL_VALUE_EXPR (decl))); addr_of_decl = TREE_OPERAND (DECL_VALUE_EXPR (decl), 0); } else @@ -6590,7 +6590,7 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) /* For various reasons, the gimplification of the expression may have made a new INDIRECT_REF. */ - if (TREE_CODE (op0) == INDIRECT_REF + if (INDIRECT_REF_P (op0) || (TREE_CODE (op0) == MEM_REF && integer_zerop (TREE_OPERAND (op0, 1)))) goto do_indirect_ref; @@ -7400,7 +7400,7 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags) nflags = GOVD_FIRSTPRIVATE; nflags |= flags & GOVD_SEEN; t = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (t) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (t)); t = TREE_OPERAND (t, 0); gcc_assert (DECL_P (t)); omp_add_variable (ctx, t, nflags); @@ -8033,7 +8033,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) { splay_tree_node n2; tree t = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (t) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (t)); t = TREE_OPERAND (t, 0); gcc_assert (DECL_P (t)); n2 = splay_tree_lookup (ctx->variables, (splay_tree_key) t); @@ -9026,7 +9026,7 @@ omp_get_base_pointer (tree expr) || TREE_CODE (expr) == COMPONENT_REF) expr = TREE_OPERAND (expr, 0); - if (TREE_CODE (expr) == INDIRECT_REF + if (INDIRECT_REF_P (expr) || (TREE_CODE (expr) == MEM_REF && integer_zerop (TREE_OPERAND (expr, 1)))) { @@ -9050,7 +9050,7 @@ static tree omp_strip_components_and_deref (tree expr) { while (TREE_CODE (expr) == COMPONENT_REF - || TREE_CODE (expr) == INDIRECT_REF + || INDIRECT_REF_P (expr) || (TREE_CODE (expr) == MEM_REF && integer_zerop (TREE_OPERAND (expr, 1))) || TREE_CODE (expr) == POINTER_PLUS_EXPR @@ -9068,7 +9068,7 @@ omp_strip_components_and_deref (tree expr) static tree omp_strip_indirections (tree expr) { - while (TREE_CODE (expr) == INDIRECT_REF + while (INDIRECT_REF_P (expr) || (TREE_CODE (expr) == MEM_REF && integer_zerop (TREE_OPERAND (expr, 1)))) expr = TREE_OPERAND (expr, 0); @@ -10283,7 +10283,7 @@ omp_accumulate_sibling_list (enum omp_region_type region_type, while (TREE_CODE (ocd) == ARRAY_REF) ocd = TREE_OPERAND (ocd, 0); - if (TREE_CODE (ocd) == INDIRECT_REF) + if (INDIRECT_REF_P (ocd)) ocd = TREE_OPERAND (ocd, 0); tree base = extract_base_bit_offset (ocd, &cbitpos, &coffset); @@ -10375,11 +10375,10 @@ omp_accumulate_sibling_list (enum omp_region_type region_type, tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (grp_end), OMP_CLAUSE_MAP); bool base_ref - = (TREE_CODE (base) == INDIRECT_REF + = (INDIRECT_REF_P (base) && ((TREE_CODE (TREE_TYPE (TREE_OPERAND (base, 0))) == REFERENCE_TYPE) - || ((TREE_CODE (TREE_OPERAND (base, 0)) - == INDIRECT_REF) + || (INDIRECT_REF_P (TREE_OPERAND (base, 0)) && (TREE_CODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (base, 0), 0))) == REFERENCE_TYPE)))); @@ -10441,7 +10440,7 @@ omp_accumulate_sibling_list (enum omp_region_type region_type, || TREE_CODE (TREE_TYPE (sc_decl)) != ARRAY_TYPE) break; } - else if (TREE_CODE (sc_decl) == INDIRECT_REF + else if (INDIRECT_REF_P (sc_decl) && TREE_CODE (TREE_OPERAND (sc_decl, 0)) == COMPONENT_REF && (TREE_CODE (TREE_TYPE (TREE_OPERAND (sc_decl, 0))) == REFERENCE_TYPE)) @@ -10611,7 +10610,7 @@ omp_build_struct_sibling_lists (enum tree_code code, decl = d; } if (d == decl - && TREE_CODE (decl) == INDIRECT_REF + && INDIRECT_REF_P (decl) && TREE_CODE (TREE_OPERAND (decl, 0)) == COMPONENT_REF && (TREE_CODE (TREE_TYPE (TREE_OPERAND (decl, 0))) == REFERENCE_TYPE) @@ -12462,7 +12461,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) { tree decl2 = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (decl2) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (decl2)); decl2 = TREE_OPERAND (decl2, 0); gcc_assert (DECL_P (decl2)); tree mem = build_simple_mem_ref (decl2); @@ -12751,7 +12750,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, case OMP_CLAUSE_HAS_DEVICE_ADDR: decl = OMP_CLAUSE_DECL (c); - while (TREE_CODE (decl) == INDIRECT_REF + while (INDIRECT_REF_P (decl) || TREE_CODE (decl) == ARRAY_REF) decl = TREE_OPERAND (decl, 0); n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); @@ -12826,7 +12825,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, if ((ctx->region_type & ORT_TARGET) != 0 && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER) { - if (TREE_CODE (decl) == INDIRECT_REF + if (INDIRECT_REF_P (decl) && TREE_CODE (TREE_OPERAND (decl, 0)) == COMPONENT_REF && (TREE_CODE (TREE_TYPE (TREE_OPERAND (decl, 0))) == REFERENCE_TYPE)) @@ -12880,7 +12879,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, gcc_assert (OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FORCE_DEVICEPTR); tree decl2 = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (decl2) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (decl2)); decl2 = TREE_OPERAND (decl2, 0); gcc_assert (DECL_P (decl2)); tree mem = build_simple_mem_ref (decl2); @@ -12931,7 +12930,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) { tree decl2 = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (decl2) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (decl2)); decl2 = TREE_OPERAND (decl2, 0); gcc_assert (DECL_P (decl2)); tree mem = build_simple_mem_ref (decl2); @@ -13852,8 +13851,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) { has_decl_expr = BITMAP_ALLOC (NULL); if (TREE_CODE (OMP_FOR_PRE_BODY (for_stmt)) == DECL_EXPR - && TREE_CODE (DECL_EXPR_DECL (OMP_FOR_PRE_BODY (for_stmt))) - == VAR_DECL) + && VAR_P (DECL_EXPR_DECL (OMP_FOR_PRE_BODY (for_stmt)))) { t = OMP_FOR_PRE_BODY (for_stmt); bitmap_set_bit (has_decl_expr, DECL_UID (DECL_EXPR_DECL (t))); @@ -13866,7 +13864,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) { t = tsi_stmt (si); if (TREE_CODE (t) == DECL_EXPR - && TREE_CODE (DECL_EXPR_DECL (t)) == VAR_DECL) + && VAR_P (DECL_EXPR_DECL (t))) bitmap_set_bit (has_decl_expr, DECL_UID (DECL_EXPR_DECL (t))); } } @@ -15663,7 +15661,7 @@ goa_lhs_expr_p (tree expr, tree addr) STRIP_TYPE_NOPS but includes the main variant lookup. */ STRIP_USELESS_TYPE_CONVERSION (expr); - if (TREE_CODE (expr) == INDIRECT_REF) + if (INDIRECT_REF_P (expr)) { expr = TREE_OPERAND (expr, 0); while (expr != addr @@ -17591,7 +17589,7 @@ gimplify_one_sizepos (tree *expr_p, gimple_seq *stmt_p) if this type is from outside the function. It's OK to have that here. */ if (expr == NULL_TREE || is_gimple_constant (expr) - || TREE_CODE (expr) == VAR_DECL + || VAR_P (expr) || CONTAINS_PLACEHOLDER_P (expr)) return; diff --git a/gcc/graphite-scop-detection.cc b/gcc/graphite-scop-detection.cc index 48b3d62c2cf..e111203523d 100644 --- a/gcc/graphite-scop-detection.cc +++ b/gcc/graphite-scop-detection.cc @@ -980,8 +980,8 @@ scop_detection::graphite_can_represent_scev (sese_l scop, tree scev) && graphite_can_represent_scev (scop, TREE_OPERAND (scev, 1)); case MULT_EXPR: - return !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev, 0))) - && !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev, 1))) + return !CONVERT_EXPR_P (TREE_OPERAND (scev, 0)) + && !CONVERT_EXPR_P (TREE_OPERAND (scev, 1)) && !(chrec_contains_symbols (TREE_OPERAND (scev, 0)) && chrec_contains_symbols (TREE_OPERAND (scev, 1))) && graphite_can_represent_init (scev) diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc index 819860258d1..2c61a497cee 100644 --- a/gcc/ipa-devirt.cc +++ b/gcc/ipa-devirt.cc @@ -1252,7 +1252,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, if (INTEGRAL_TYPE_P (t1) || SCALAR_FLOAT_TYPE_P (t1) || FIXED_POINT_TYPE_P (t1) - || TREE_CODE (t1) == VECTOR_TYPE + || VECTOR_TYPE_P (t1) || TREE_CODE (t1) == COMPLEX_TYPE || TREE_CODE (t1) == OFFSET_TYPE || POINTER_TYPE_P (t1)) @@ -1310,7 +1310,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, } } - if ((TREE_CODE (t1) == VECTOR_TYPE || TREE_CODE (t1) == COMPLEX_TYPE) + if ((VECTOR_TYPE_P (t1) || TREE_CODE (t1) == COMPLEX_TYPE) && !odr_subtypes_equivalent_p (TREE_TYPE (t1), TREE_TYPE (t2), visited, loc1, loc2)) { diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc index 0f3cb3dd9f9..77a91da5a5a 100644 --- a/gcc/ipa-prop.cc +++ b/gcc/ipa-prop.cc @@ -546,7 +546,7 @@ ipa_set_jf_constant (struct ipa_jump_func *jfunc, tree constant, if (TREE_CODE (constant) == ADDR_EXPR && (TREE_CODE (TREE_OPERAND (constant, 0)) == FUNCTION_DECL - || (TREE_CODE (TREE_OPERAND (constant, 0)) == VAR_DECL + || (VAR_P (TREE_OPERAND (constant, 0)) && TREE_STATIC (TREE_OPERAND (constant, 0))))) { struct ipa_cst_ref_desc *rdesc; @@ -4188,7 +4188,7 @@ propagate_controlled_uses (struct cgraph_edge *cs) if (rdesc->refcount != IPA_UNDESCRIBED_USE && ipa_get_param_load_dereferenced (old_root_info, i) && TREE_CODE (cst) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (cst, 0)) == VAR_DECL) + && VAR_P (TREE_OPERAND (cst, 0))) { symtab_node *n = symtab_node::get (TREE_OPERAND (cst, 0)); new_root->create_reference (n, IPA_REF_LOAD, NULL); @@ -4202,8 +4202,7 @@ propagate_controlled_uses (struct cgraph_edge *cs) gcc_checking_assert (TREE_CODE (cst) == ADDR_EXPR && ((TREE_CODE (TREE_OPERAND (cst, 0)) == FUNCTION_DECL) - || (TREE_CODE (TREE_OPERAND (cst, 0)) - == VAR_DECL))); + || VAR_P (TREE_OPERAND (cst, 0)))); symtab_node *n = symtab_node::get (TREE_OPERAND (cst, 0)); if (n) diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc index 7b8260bc9e1..7230522526f 100644 --- a/gcc/ipa-sra.cc +++ b/gcc/ipa-sra.cc @@ -1664,10 +1664,10 @@ type_prevails_p (tree old_type, tree new_type) if (TREE_CODE (old_type) != COMPLEX_TYPE && TREE_CODE (old_type) != VECTOR_TYPE && (TREE_CODE (new_type) == COMPLEX_TYPE - || TREE_CODE (new_type) == VECTOR_TYPE)) + || VECTOR_TYPE_P (new_type))) return true; if ((TREE_CODE (old_type) == COMPLEX_TYPE - || TREE_CODE (old_type) == VECTOR_TYPE) + || VECTOR_TYPE_P (old_type)) && TREE_CODE (new_type) != COMPLEX_TYPE && TREE_CODE (new_type) != VECTOR_TYPE) return false; @@ -1754,7 +1754,7 @@ scan_expr_access (tree expr, gimple *stmt, isra_scan_context ctx, if (ctx == ISRA_CTX_ARG) return; tree t = get_base_address (TREE_OPERAND (expr, 0)); - if (TREE_CODE (t) == VAR_DECL && !TREE_STATIC (t)) + if (VAR_P (t) && !TREE_STATIC (t)) loaded_decls->add (t); return; } @@ -1780,7 +1780,7 @@ scan_expr_access (tree expr, gimple *stmt, isra_scan_context ctx, return; deref = true; } - else if (TREE_CODE (base) == VAR_DECL + else if (VAR_P (base) && !TREE_STATIC (base) && (ctx == ISRA_CTX_ARG || ctx == ISRA_CTX_LOAD)) diff --git a/gcc/optabs-tree.cc b/gcc/optabs-tree.cc index 8010046c6a8..cd7b45fd455 100644 --- a/gcc/optabs-tree.cc +++ b/gcc/optabs-tree.cc @@ -63,7 +63,7 @@ optab_for_tree_code (enum tree_code code, const_tree type, expansion has code to adjust TRUNC_MOD_EXPR into the desired other modes, but for vector modes it does not. The adjustment code should be instead emitted in tree-vect-patterns.cc. */ - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) return unknown_optab; /* FALLTHRU */ case TRUNC_MOD_EXPR: @@ -77,7 +77,7 @@ optab_for_tree_code (enum tree_code code, const_tree type, into the desired other modes, but for vector modes it does not. The adjustment code should be instead emitted in tree-vect-patterns.cc. */ - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) return unknown_optab; /* FALLTHRU */ case RDIV_EXPR: @@ -88,7 +88,7 @@ optab_for_tree_code (enum tree_code code, const_tree type, return TYPE_UNSIGNED (type) ? udiv_optab : sdiv_optab; case LSHIFT_EXPR: - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) { if (subtype == optab_vector) return TYPE_SATURATING (type) ? unknown_optab : vashl_optab; @@ -100,7 +100,7 @@ optab_for_tree_code (enum tree_code code, const_tree type, return ashl_optab; case RSHIFT_EXPR: - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) { if (subtype == optab_vector) return TYPE_UNSIGNED (type) ? vlshr_optab : vashr_optab; @@ -110,7 +110,7 @@ optab_for_tree_code (enum tree_code code, const_tree type, return TYPE_UNSIGNED (type) ? lshr_optab : ashr_optab; case LROTATE_EXPR: - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) { if (subtype == optab_vector) return vrotl_optab; @@ -120,7 +120,7 @@ optab_for_tree_code (enum tree_code code, const_tree type, return rotl_optab; case RROTATE_EXPR: - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) { if (subtype == optab_vector) return vrotr_optab; diff --git a/gcc/toplev.cc b/gcc/toplev.cc index d53b5e78ae3..8aec9a2de10 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -323,7 +323,7 @@ wrapup_global_declaration_1 (tree decl) { /* We're not deferring this any longer. Assignment is conditional to avoid needlessly dirtying PCH pages. */ - if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS) + if (HAS_DECL_ASSEMBLER_NAME_P (decl) && DECL_DEFER_OUTPUT (decl) != 0) DECL_DEFER_OUTPUT (decl) = 0; diff --git a/gcc/trans-mem.cc b/gcc/trans-mem.cc index 4b129663e0d..d036e4333db 100644 --- a/gcc/trans-mem.cc +++ b/gcc/trans-mem.cc @@ -1062,7 +1062,7 @@ tm_log_delete (void) static bool transaction_invariant_address_p (const_tree mem, basic_block region_entry_block) { - if ((TREE_CODE (mem) == INDIRECT_REF || TREE_CODE (mem) == MEM_REF) + if ((INDIRECT_REF_P (mem) || TREE_CODE (mem) == MEM_REF) && TREE_CODE (TREE_OPERAND (mem, 0)) == SSA_NAME) { basic_block def_bb; diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index 0aeebb67fac..a1a607666dc 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -3328,7 +3328,7 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) return true; } } - else if (TREE_CODE (expr) == INDIRECT_REF) + else if (INDIRECT_REF_P (expr)) { error ("%qs in gimple IL", code_name); debug_generic_stmt (expr); @@ -3615,8 +3615,8 @@ verify_gimple_comparison (tree type, tree op0, tree op1, enum tree_code code) && (TREE_CODE (type) == BOOLEAN_TYPE || TYPE_PRECISION (type) == 1)) { - if ((TREE_CODE (op0_type) == VECTOR_TYPE - || TREE_CODE (op1_type) == VECTOR_TYPE) + if ((VECTOR_TYPE_P (op0_type) + || VECTOR_TYPE_P (op1_type)) && code != EQ_EXPR && code != NE_EXPR && !VECTOR_BOOLEAN_TYPE_P (op0_type) && !VECTOR_INTEGER_TYPE_P (op0_type)) @@ -3630,7 +3630,7 @@ verify_gimple_comparison (tree type, tree op0, tree op1, enum tree_code code) } /* Or a boolean vector type with the same element count as the comparison operand types. */ - else if (TREE_CODE (type) == VECTOR_TYPE + else if (VECTOR_TYPE_P (type) && TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE) { if (TREE_CODE (op0_type) != VECTOR_TYPE @@ -3963,13 +3963,13 @@ verify_gimple_assign_binary (gassign *stmt) types and integer vector types. */ if ((!INTEGRAL_TYPE_P (rhs1_type) && !FIXED_POINT_TYPE_P (rhs1_type) - && !(TREE_CODE (rhs1_type) == VECTOR_TYPE + && ! (VECTOR_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type)))) || (!INTEGRAL_TYPE_P (rhs2_type) /* Vector shifts of vectors are also ok. */ - && !(TREE_CODE (rhs1_type) == VECTOR_TYPE + && ! (VECTOR_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type)) - && TREE_CODE (rhs2_type) == VECTOR_TYPE + && VECTOR_TYPE_P (rhs2_type) && INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type)))) || !useless_type_conversion_p (lhs_type, rhs1_type)) { @@ -4029,7 +4029,7 @@ verify_gimple_assign_binary (gassign *stmt) tree lhs_etype = lhs_type; tree rhs1_etype = rhs1_type; tree rhs2_etype = rhs2_type; - if (TREE_CODE (lhs_type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (lhs_type)) { if (TREE_CODE (rhs1_type) != VECTOR_TYPE || TREE_CODE (rhs2_type) != VECTOR_TYPE) @@ -4709,7 +4709,7 @@ verify_gimple_assign_single (gassign *stmt) return res; case CONSTRUCTOR: - if (TREE_CODE (rhs1_type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (rhs1_type)) { unsigned int i; tree elt_i, elt_v, elt_t = NULL_TREE; @@ -4729,7 +4729,7 @@ verify_gimple_assign_single (gassign *stmt) if (elt_t == NULL_TREE) { elt_t = TREE_TYPE (elt_v); - if (TREE_CODE (elt_t) == VECTOR_TYPE) + if (VECTOR_TYPE_P (elt_t)) { tree elt_t = TREE_TYPE (elt_v); if (!useless_type_conversion_p (TREE_TYPE (rhs1_type), @@ -4774,7 +4774,7 @@ verify_gimple_assign_single (gassign *stmt) return true; } if (elt_i != NULL_TREE - && (TREE_CODE (elt_t) == VECTOR_TYPE + && (VECTOR_TYPE_P (elt_t) || TREE_CODE (elt_i) != INTEGER_CST || compare_tree_int (elt_i, i) != 0)) { diff --git a/gcc/tree-complex.cc b/gcc/tree-complex.cc index ef40511f67d..688fe13989c 100644 --- a/gcc/tree-complex.cc +++ b/gcc/tree-complex.cc @@ -526,7 +526,7 @@ get_component_ssa_name (tree ssa_name, bool imag_p) SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ret) = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name); if (SSA_NAME_IS_DEFAULT_DEF (ssa_name) - && TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL) + && VAR_P (SSA_NAME_VAR (ssa_name))) { SSA_NAME_DEF_STMT (ret) = SSA_NAME_DEF_STMT (ssa_name); set_ssa_default_def (cfun, SSA_NAME_VAR (ret), ret); diff --git a/gcc/tree-emutls.cc b/gcc/tree-emutls.cc index eb3ac9bd2da..5dca5a82913 100644 --- a/gcc/tree-emutls.cc +++ b/gcc/tree-emutls.cc @@ -439,7 +439,7 @@ static tree lower_emutls_2 (tree *ptr, int *walk_subtrees, void *) { tree t = *ptr; - if (TREE_CODE (t) == VAR_DECL) + if (VAR_P (t)) return DECL_THREAD_LOCAL_P (t) ? t : NULL_TREE; else if (!EXPR_P (t)) *walk_subtrees = 0; diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc index 63a19f8d1d8..47e2f58ba6c 100644 --- a/gcc/tree-inline.cc +++ b/gcc/tree-inline.cc @@ -1307,7 +1307,7 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data) } } } - else if (TREE_CODE (*tp) == INDIRECT_REF) + else if (INDIRECT_REF_P (*tp)) { /* Get rid of *& from inline substitutions that can happen when a pointer argument is an ADDR_EXPR. */ @@ -1429,7 +1429,7 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data) /* Handle the case where we substituted an INDIRECT_REF into the operand of the ADDR_EXPR. */ - if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF + if (INDIRECT_REF_P (TREE_OPERAND (*tp, 0)) && !id->do_not_fold) { tree t = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0); @@ -4170,7 +4170,7 @@ estimate_move_cost (tree type, bool ARG_UNUSED (speed_p)) gcc_assert (!VOID_TYPE_P (type)); - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) { scalar_mode inner = SCALAR_TYPE_MODE (TREE_TYPE (type)); machine_mode simd = targetm.vectorize.preferred_simd_mode (inner); @@ -5918,7 +5918,7 @@ copy_decl_for_dup_finish (copy_body_data *id, tree decl, tree copy) DECL_ABSTRACT_ORIGIN (copy) = DECL_ORIGIN (decl); /* The new variable/label has no RTL, yet. */ - if (CODE_CONTAINS_STRUCT (TREE_CODE (copy), TS_DECL_WRTL) + if (HAS_RTL_P (copy) && !TREE_STATIC (copy) && !DECL_EXTERNAL (copy)) SET_DECL_RTL (copy, 0); /* For vector typed decls make sure to update DECL_MODE according diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc index 1418e1f7f56..ae7d1f1f6a8 100644 --- a/gcc/tree-nested.cc +++ b/gcc/tree-nested.cc @@ -1311,7 +1311,7 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) pdecl = &TREE_OPERAND (OMP_CLAUSE_DECL (clause), 0); if (TREE_CODE (*pdecl) == POINTER_PLUS_EXPR) pdecl = &TREE_OPERAND (*pdecl, 0); - if (TREE_CODE (*pdecl) == INDIRECT_REF + if (INDIRECT_REF_P (*pdecl) || TREE_CODE (*pdecl) == ADDR_EXPR) pdecl = &TREE_OPERAND (*pdecl, 0); } @@ -1614,7 +1614,7 @@ note_nonlocal_vla_type (struct nesting_info *info, tree type) type = DECL_ORIGINAL_TYPE (TYPE_NAME (type)); while (POINTER_TYPE_P (type) - || TREE_CODE (type) == VECTOR_TYPE + || VECTOR_TYPE_P (type) || TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE) type = TREE_TYPE (type); @@ -2097,7 +2097,7 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) pdecl = &TREE_OPERAND (OMP_CLAUSE_DECL (clause), 0); if (TREE_CODE (*pdecl) == POINTER_PLUS_EXPR) pdecl = &TREE_OPERAND (*pdecl, 0); - if (TREE_CODE (*pdecl) == INDIRECT_REF + if (INDIRECT_REF_P (*pdecl) || TREE_CODE (*pdecl) == ADDR_EXPR) pdecl = &TREE_OPERAND (*pdecl, 0); } @@ -3234,8 +3234,8 @@ remap_vla_decls (tree block, struct nesting_info *root) val = DECL_VALUE_EXPR (var); type = TREE_TYPE (var); - if (!(TREE_CODE (val) == INDIRECT_REF - && TREE_CODE (TREE_OPERAND (val, 0)) == VAR_DECL + if (! (INDIRECT_REF_P (val) + && VAR_P (TREE_OPERAND (val, 0)) && variably_modified_type_p (type, NULL))) continue; @@ -3261,8 +3261,8 @@ remap_vla_decls (tree block, struct nesting_info *root) val = DECL_VALUE_EXPR (var); type = TREE_TYPE (var); - if (!(TREE_CODE (val) == INDIRECT_REF - && TREE_CODE (TREE_OPERAND (val, 0)) == VAR_DECL + if (! (INDIRECT_REF_P (val) + && VAR_P (TREE_OPERAND (val, 0)) && variably_modified_type_p (type, NULL))) continue; @@ -3323,7 +3323,7 @@ fixup_vla_decls (tree block) { tree val = DECL_VALUE_EXPR (var); - if (!(TREE_CODE (val) == INDIRECT_REF + if (! (INDIRECT_REF_P (val) && VAR_P (TREE_OPERAND (val, 0)) && DECL_HAS_VALUE_EXPR_P (TREE_OPERAND (val, 0)))) continue; diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc index 0abec54905d..e495bbd6527 100644 --- a/gcc/tree-parloops.cc +++ b/gcc/tree-parloops.cc @@ -3195,7 +3195,7 @@ loop_has_vector_phi_nodes (class loop *loop ATTRIBUTE_UNUSED) for (i = 0; i < loop->num_nodes; i++) for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi)) - if (TREE_CODE (TREE_TYPE (PHI_RESULT (gsi.phi ()))) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (PHI_RESULT (gsi.phi ())))) goto end; res = false; diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc index 7947f9647a1..3d1c983154f 100644 --- a/gcc/tree-pretty-print.cc +++ b/gcc/tree-pretty-print.cc @@ -3962,7 +3962,7 @@ print_declaration (pretty_printer *pp, tree t, int spc, dump_flags_t flags) if (TREE_CODE (t) == TYPE_DECL) pp_string (pp, "typedef "); - if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t)) + if (HAS_RTL_P (t) && DECL_REGISTER (t)) pp_string (pp, "register "); if (TREE_PUBLIC (t) && DECL_EXTERNAL (t)) @@ -4484,7 +4484,7 @@ print_call_name (pretty_printer *pp, tree node, dump_flags_t flags) break; case ARRAY_REF: - if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL) + if (VAR_P (TREE_OPERAND (op0, 0))) dump_function_name (pp, TREE_OPERAND (op0, 0), flags); else dump_generic_node (pp, op0, 0, flags, false); diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc index ad0c738645d..56a8ba26135 100644 --- a/gcc/tree-sra.cc +++ b/gcc/tree-sra.cc @@ -1465,10 +1465,10 @@ compare_access_positions (const void *a, const void *b) else if (TREE_CODE (f1->type) != COMPLEX_TYPE && TREE_CODE (f1->type) != VECTOR_TYPE && (TREE_CODE (f2->type) == COMPLEX_TYPE - || TREE_CODE (f2->type) == VECTOR_TYPE)) + || VECTOR_TYPE_P (f2->type))) return 1; else if ((TREE_CODE (f1->type) == COMPLEX_TYPE - || TREE_CODE (f1->type) == VECTOR_TYPE) + || VECTOR_TYPE_P (f1->type)) && TREE_CODE (f2->type) != COMPLEX_TYPE && TREE_CODE (f2->type) != VECTOR_TYPE) return -1; diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc index e0693e146bf..79ed956e300 100644 --- a/gcc/tree-ssa-alias.cc +++ b/gcc/tree-ssa-alias.cc @@ -945,10 +945,10 @@ compare_type_sizes (tree type1, tree type2) /* Be conservative for arrays and vectors. We want to support partial overlap on int[3] and int[3] as tested in gcc.dg/torture/alias-2.c. */ while (TREE_CODE (type1) == ARRAY_TYPE - || TREE_CODE (type1) == VECTOR_TYPE) + || VECTOR_TYPE_P (type1)) type1 = TREE_TYPE (type1); while (TREE_CODE (type2) == ARRAY_TYPE - || TREE_CODE (type2) == VECTOR_TYPE) + || VECTOR_TYPE_P (type2)) type2 = TREE_TYPE (type2); return compare_sizes (TYPE_SIZE (type1), TYPE_SIZE (type2)); } diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc index 2e552b330b7..6fb371c2629 100644 --- a/gcc/tree-ssa-ccp.cc +++ b/gcc/tree-ssa-ccp.cc @@ -289,7 +289,7 @@ get_default_value (tree var) consider it VARYING. */ if (!virtual_operand_p (var) && SSA_NAME_VAR (var) - && TREE_CODE (SSA_NAME_VAR (var)) == VAR_DECL) + && VAR_P (SSA_NAME_VAR (var))) val.lattice_val = UNDEFINED; else { diff --git a/gcc/tree-ssa-coalesce.cc b/gcc/tree-ssa-coalesce.cc index 6e8c39076ca..e9de9d4d14a 100644 --- a/gcc/tree-ssa-coalesce.cc +++ b/gcc/tree-ssa-coalesce.cc @@ -1298,7 +1298,7 @@ populate_coalesce_list_for_outofssa (coalesce_list *cl, bitmap used_in_copy) originally with optimizations and only the link performed at -O0, so we can't actually require it. */ const int cost - = (TREE_CODE (SSA_NAME_VAR (a)) == VAR_DECL || in_lto_p) + = (VAR_P (SSA_NAME_VAR (a)) || in_lto_p) ? MUST_COALESCE_COST - 1 : MUST_COALESCE_COST; add_coalesce (cl, SSA_NAME_VERSION (a), SSA_NAME_VERSION (*slot), cost); diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc index ab31d2e7ee9..9f534b5a190 100644 --- a/gcc/tree-ssa-dom.cc +++ b/gcc/tree-ssa-dom.cc @@ -2162,8 +2162,8 @@ reduce_vector_comparison_to_scalar_comparison (gimple *stmt) /* We may have a vector comparison where both arms are uniform vectors. If so, we can simplify the vector comparison down to a scalar comparison. */ - if (TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE - && TREE_CODE (TREE_TYPE (rhs)) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (lhs)) + && VECTOR_TYPE_P (TREE_TYPE (rhs))) { /* If either operand is an SSA_NAME, then look back to its defining statement to try and get at a suitable source. */ diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 9dc67b5309c..80601236bc2 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -291,8 +291,7 @@ can_propagate_from (gimple *def_stmt) if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))) { tree rhs = gimple_assign_rhs1 (def_stmt); - if (POINTER_TYPE_P (TREE_TYPE (rhs)) - && TREE_CODE (TREE_TYPE (TREE_TYPE (rhs))) == FUNCTION_TYPE) + if (FUNCTION_POINTER_TYPE_P (TREE_TYPE (rhs))) return false; } diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc index 5573d360699..174d19890f9 100644 --- a/gcc/tree-ssa-propagate.cc +++ b/gcc/tree-ssa-propagate.cc @@ -1020,7 +1020,7 @@ may_propagate_copy (tree dest, tree orig, bool dest_not_phi_arg_p) && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig) && SSA_NAME_IS_DEFAULT_DEF (orig) && (SSA_NAME_VAR (orig) == NULL_TREE - || TREE_CODE (SSA_NAME_VAR (orig)) == VAR_DECL)) + || VAR_P (SSA_NAME_VAR (orig)))) ; /* Otherwise if ORIG just flows in from an abnormal edge then the copy cannot be propagated. */ diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 94d6163e6ae..27c84e78fcf 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -1575,7 +1575,7 @@ fully_constant_vn_reference_p (vn_reference_t ref) ctor = base->op0; else if (base->opcode == MEM_REF && base[1].opcode == ADDR_EXPR - && (TREE_CODE (TREE_OPERAND (base[1].op0, 0)) == VAR_DECL + && (VAR_P (TREE_OPERAND (base[1].op0, 0)) || TREE_CODE (TREE_OPERAND (base[1].op0, 0)) == CONST_DECL || TREE_CODE (TREE_OPERAND (base[1].op0, 0)) == STRING_CST)) { diff --git a/gcc/tree-ssa-sink.cc b/gcc/tree-ssa-sink.cc index 87b1d40c174..b1ba7a2ad6c 100644 --- a/gcc/tree-ssa-sink.cc +++ b/gcc/tree-ssa-sink.cc @@ -382,7 +382,7 @@ statement_sink_location (gimple *stmt, basic_block frombb, { /* Do not sink loads from hard registers. */ if (gimple_assign_single_p (stmt) - && TREE_CODE (gimple_assign_rhs1 (stmt)) == VAR_DECL + && VAR_P (gimple_assign_rhs1 (stmt)) && DECL_HARD_REGISTER (gimple_assign_rhs1 (stmt))) return false; diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc index 56021c59cb9..546dab5035e 100644 --- a/gcc/tree-ssa-structalias.cc +++ b/gcc/tree-ssa-structalias.cc @@ -5831,8 +5831,7 @@ type_must_have_pointers (tree type) /* A function or method can have pointers as arguments, so track those separately. */ - if (TREE_CODE (type) == FUNCTION_TYPE - || TREE_CODE (type) == METHOD_TYPE) + if (FUNC_OR_METHOD_TYPE_P (type)) return true; return false; diff --git a/gcc/tree-ssa-ter.cc b/gcc/tree-ssa-ter.cc index cab54a37663..68e9e1a936a 100644 --- a/gcc/tree-ssa-ter.cc +++ b/gcc/tree-ssa-ter.cc @@ -693,7 +693,7 @@ find_replaceable_in_bb (temp_expr_table *tab, basic_block bb) /* Increment counter if this statement sets a local register variable. */ if (gimple_assign_single_p (stmt) - && (TREE_CODE (gimple_assign_lhs (stmt)) == VAR_DECL + && (VAR_P (gimple_assign_lhs (stmt)) && DECL_HARD_REGISTER (gimple_assign_lhs (stmt)))) cur_reg_vars_cnt++; diff --git a/gcc/tree-ssa-uninit.cc b/gcc/tree-ssa-uninit.cc index 9f720ae1f4f..f42f76cd5c6 100644 --- a/gcc/tree-ssa-uninit.cc +++ b/gcc/tree-ssa-uninit.cc @@ -232,7 +232,7 @@ warn_uninit (opt_code opt, tree t, tree var, gimple *context, if (is_gimple_assign (context)) { - if (TREE_CODE (gimple_assign_lhs (context)) == VAR_DECL) + if (VAR_P (gimple_assign_lhs (context))) lhs_var = gimple_assign_lhs (context); else if (TREE_CODE (gimple_assign_lhs (context)) == SSA_NAME) lhs_var = SSA_NAME_VAR (gimple_assign_lhs (context)); diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc index 70828355c2b..607b37e7cf9 100644 --- a/gcc/tree-ssa.cc +++ b/gcc/tree-ssa.cc @@ -1507,7 +1507,7 @@ maybe_rewrite_mem_ref_base (tree *tp, bitmap suitable_for_renaming) && is_gimple_reg_type (TREE_TYPE (*tp)) && ! VOID_TYPE_P (TREE_TYPE (*tp))) { - if (TREE_CODE (TREE_TYPE (sym)) == VECTOR_TYPE + if (VECTOR_TYPE_P (TREE_TYPE (sym)) && useless_type_conversion_p (TREE_TYPE (*tp), TREE_TYPE (TREE_TYPE (sym))) && multiple_p (mem_ref_offset (*tp), @@ -1608,7 +1608,7 @@ non_rewritable_mem_ref_base (tree ref) || VOID_TYPE_P (TREE_TYPE (base)) || TREE_THIS_VOLATILE (decl) != TREE_THIS_VOLATILE (base)) return decl; - if ((TREE_CODE (TREE_TYPE (decl)) == VECTOR_TYPE + if ((VECTOR_TYPE_P (TREE_TYPE (decl)) || TREE_CODE (TREE_TYPE (decl)) == COMPLEX_TYPE) && useless_type_conversion_p (TREE_TYPE (base), TREE_TYPE (TREE_TYPE (decl))) diff --git a/gcc/tree-streamer-in.cc b/gcc/tree-streamer-in.cc index bf4bd5c3dd3..c803800862c 100644 --- a/gcc/tree-streamer-in.cc +++ b/gcc/tree-streamer-in.cc @@ -848,8 +848,7 @@ lto_input_ts_type_non_common_tree_pointers (class lto_input_block *ib, TYPE_DOMAIN (expr) = stream_read_tree_ref (ib, data_in); else if (RECORD_OR_UNION_TYPE_P (expr)) TYPE_FIELDS (expr) = streamer_read_chain (ib, data_in); - else if (TREE_CODE (expr) == FUNCTION_TYPE - || TREE_CODE (expr) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (expr)) TYPE_ARG_TYPES (expr) = stream_read_tree_ref (ib, data_in); if (!POINTER_TYPE_P (expr)) diff --git a/gcc/tree-streamer-out.cc b/gcc/tree-streamer-out.cc index 81e6fcb5af0..5751f77273b 100644 --- a/gcc/tree-streamer-out.cc +++ b/gcc/tree-streamer-out.cc @@ -739,8 +739,7 @@ write_ts_type_non_common_tree_pointers (struct output_block *ob, tree expr) stream_write_tree_ref (ob, TYPE_DOMAIN (expr)); else if (RECORD_OR_UNION_TYPE_P (expr)) streamer_write_chain (ob, TYPE_FIELDS (expr)); - else if (TREE_CODE (expr) == FUNCTION_TYPE - || TREE_CODE (expr) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (expr)) stream_write_tree_ref (ob, TYPE_ARG_TYPES (expr)); if (!POINTER_TYPE_P (expr)) diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index 59115b2e162..fa3809f0d24 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -173,9 +173,9 @@ do_binop (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b, tree bitpos, tree bitsize, enum tree_code code, tree type ATTRIBUTE_UNUSED) { - if (TREE_CODE (TREE_TYPE (a)) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (a))) a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos); - if (TREE_CODE (TREE_TYPE (b)) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (b))) b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos); return gimplify_build2 (gsi, code, inner_type, a, b); } @@ -1733,9 +1733,9 @@ do_cond (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b, tree bitpos, tree bitsize, enum tree_code code, tree type ATTRIBUTE_UNUSED) { - if (TREE_CODE (TREE_TYPE (a)) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (a))) a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos); - if (TREE_CODE (TREE_TYPE (b)) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (b))) b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos); tree cond = gimple_assign_rhs1 (gsi_stmt (*gsi)); return gimplify_build3 (gsi, code, inner_type, unshare_expr (cond), a, b); diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 61a2da4ecee..e7c94741f71 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -1412,7 +1412,7 @@ vect_init_vector (vec_info *vinfo, stmt_vec_info stmt_info, tree val, tree type, /* We abuse this function to push sth to a SSA name with initial 'val'. */ if (! useless_type_conversion_p (type, TREE_TYPE (val))) { - gcc_assert (TREE_CODE (type) == VECTOR_TYPE); + gcc_assert (VECTOR_TYPE_P (type)); if (! types_compatible_p (TREE_TYPE (type), TREE_TYPE (val))) { /* Scalar boolean value should be transformed into diff --git a/gcc/tree-vector-builder.h b/gcc/tree-vector-builder.h index 2af6d75dc94..b9167678424 100644 --- a/gcc/tree-vector-builder.h +++ b/gcc/tree-vector-builder.h @@ -134,7 +134,7 @@ tree_vector_builder::can_elide_p (const_tree elt) const inline void tree_vector_builder::note_representative (tree *elt1_ptr, tree elt2) { - if (CONSTANT_CLASS_P (elt2) && TREE_OVERFLOW (elt2)) + if (TREE_OVERFLOW_P (elt2)) { gcc_assert (operand_equal_p (*elt1_ptr, elt2, 0)); if (!TREE_OVERFLOW (elt2)) diff --git a/gcc/tree.cc b/gcc/tree.cc index 7e6de288886..8e144bc090e 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -2719,7 +2719,7 @@ sign_mask_for (tree type) return NULL_TREE; auto mask = wi::set_bit_in_zero (bits - 1, bits); - if (TREE_CODE (inttype) == VECTOR_TYPE) + if (VECTOR_TYPE_P (inttype)) { tree elt = wide_int_to_tree (TREE_TYPE (inttype), mask); return build_vector_from_val (inttype, elt); @@ -4959,7 +4959,7 @@ do { tree _node = (NODE); \ address is constant too. If it's a decl, its address is constant if the decl is static. Everything else is not constant and, furthermore, taking the address of a volatile variable is not volatile. */ - if (TREE_CODE (node) == INDIRECT_REF + if (INDIRECT_REF_P (node) || TREE_CODE (node) == MEM_REF) UPDATE_FLAGS (TREE_OPERAND (node, 0)); else if (CONSTANT_CLASS_P (node)) @@ -13462,8 +13462,8 @@ verify_type_variant (const_tree t, tree tv) if ((TREE_CODE (t) == ENUMERAL_TYPE && COMPLETE_TYPE_P (t)) || TREE_CODE (t) == INTEGER_TYPE || TREE_CODE (t) == BOOLEAN_TYPE - || TREE_CODE (t) == REAL_TYPE - || TREE_CODE (t) == FIXED_POINT_TYPE) + || SCALAR_FLOAT_TYPE_P (t) + || FIXED_POINT_TYPE_P (t)) { verify_variant_match (TYPE_MAX_VALUE); verify_variant_match (TYPE_MIN_VALUE); @@ -13543,7 +13543,7 @@ verify_type_variant (const_tree t, tree tv) return false; } } - else if ((TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE)) + else if (FUNC_OR_METHOD_TYPE_P (t)) verify_variant_match (TYPE_ARG_TYPES); /* For C++ the qualified variant of array type is really an array type of qualified TREE_TYPE. @@ -13684,7 +13684,7 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, /* Qualifiers do not matter for canonical type comparison purposes. */ /* Void types and nullptr types are always the same. */ - if (TREE_CODE (t1) == VOID_TYPE + if (VOID_TYPE_P (t1) || TREE_CODE (t1) == NULLPTR_TYPE) return true; @@ -13696,7 +13696,7 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, if (INTEGRAL_TYPE_P (t1) || SCALAR_FLOAT_TYPE_P (t1) || FIXED_POINT_TYPE_P (t1) - || TREE_CODE (t1) == VECTOR_TYPE + || VECTOR_TYPE_P (t1) || TREE_CODE (t1) == COMPLEX_TYPE || TREE_CODE (t1) == OFFSET_TYPE || POINTER_TYPE_P (t1)) @@ -13726,7 +13726,7 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, } /* Tail-recurse to components. */ - if (TREE_CODE (t1) == VECTOR_TYPE + if (VECTOR_TYPE_P (t1) || TREE_CODE (t1) == COMPLEX_TYPE) return gimple_canonical_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2), @@ -14043,8 +14043,8 @@ verify_type (const_tree t) error_found = true; } } - else if (INTEGRAL_TYPE_P (t) || TREE_CODE (t) == REAL_TYPE - || TREE_CODE (t) == FIXED_POINT_TYPE) + else if (INTEGRAL_TYPE_P (t) || SCALAR_FLOAT_TYPE_P (t) + || FIXED_POINT_TYPE_P (t)) { /* FIXME: The following check should pass: useless_type_conversion_p (const_cast (t), @@ -14070,7 +14070,7 @@ verify_type (const_tree t) error_found = true; } } - else if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (t)) { if (TYPE_METHOD_BASETYPE (t) && TREE_CODE (TYPE_METHOD_BASETYPE (t)) != RECORD_TYPE @@ -14092,8 +14092,8 @@ verify_type (const_tree t) error_found = true; } } - else if (INTEGRAL_TYPE_P (t) || TREE_CODE (t) == REAL_TYPE - || TREE_CODE (t) == FIXED_POINT_TYPE) + else if (INTEGRAL_TYPE_P (t) || SCALAR_FLOAT_TYPE_P (t) + || FIXED_POINT_TYPE_P (t)) { /* FIXME: The following check should pass: useless_type_conversion_p (const_cast (t), @@ -14235,7 +14235,7 @@ verify_type (const_tree t) } } } - else if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (t)) for (tree l = TYPE_ARG_TYPES (t); l; l = TREE_CHAIN (l)) { /* C++ FE uses TREE_PURPOSE to store initial values. */ diff --git a/gcc/ubsan.cc b/gcc/ubsan.cc index e6ffea3ff8b..cfae13d7cde 100644 --- a/gcc/ubsan.cc +++ b/gcc/ubsan.cc @@ -328,7 +328,7 @@ ubsan_source_location (location_t loc) static unsigned short get_ubsan_type_info_for_type (tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) return tree_to_uhwi (TYPE_SIZE (type)); else if (INTEGRAL_TYPE_P (type)) { diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc index fae0c73e02f..b0c3714a808 100644 --- a/gcc/var-tracking.cc +++ b/gcc/var-tracking.cc @@ -6290,7 +6290,7 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn) type = TREE_TYPE (fndecl); if (fndecl && TREE_CODE (fndecl) != FUNCTION_DECL) { - if (TREE_CODE (fndecl) == INDIRECT_REF + if (INDIRECT_REF_P (fndecl) && TREE_CODE (TREE_OPERAND (fndecl, 0)) == OBJ_TYPE_REF) obj_type_ref = TREE_OPERAND (fndecl, 0); fndecl = NULL_TREE; @@ -9968,7 +9968,7 @@ vt_add_function_parameters (void) { tree vexpr = DECL_VALUE_EXPR (DECL_RESULT (current_function_decl)); - if (TREE_CODE (vexpr) == INDIRECT_REF) + if (INDIRECT_REF_P (vexpr)) vexpr = TREE_OPERAND (vexpr, 0); if (TREE_CODE (vexpr) == PARM_DECL diff --git a/gcc/varasm.cc b/gcc/varasm.cc index cd0cd88321c..2e1dee46c9f 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -3014,7 +3014,7 @@ decode_addr_const (tree exp, class addr_const *value) offset += mem_ref_offset (target).force_shwi (); target = TREE_OPERAND (TREE_OPERAND (target, 0), 0); } - else if (TREE_CODE (target) == INDIRECT_REF + else if (INDIRECT_REF_P (target) && TREE_CODE (TREE_OPERAND (target, 0)) == NOP_EXPR && TREE_CODE (TREE_OPERAND (TREE_OPERAND (target, 0), 0)) == ADDR_EXPR)