From patchwork Sat May 13 23:23:08 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: 69309 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBBFA382A2FC for ; Sat, 13 May 2023 23:26:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBBFA382A2FC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020397; bh=RBY6jWlcf9eQWCe76s+eqIOlOL/GgZ0HBFaXBDdgUt0=; 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=OMHh3tHWOmTuB9V7k9YzWZ/8QI5vOXVqUoSjV96H9Vpo3vmmBsbvltNFSZydangG1 VgR3EDo11rDF45O3pP6vdd8jXZOqCd4eRIDzBlVdOTWLx7FamthxU8S3ZbI6A5u9Nk HwZ7Kqmrb2i8sH+4T5mYskgSJW/9iXm8xv9hI0zY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 7CA53385840E; Sat, 13 May 2023 23:23:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7CA53385840E Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-50bc0117683so20062990a12.1; Sat, 13 May 2023 16:23:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020230; x=1686612230; 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=RBY6jWlcf9eQWCe76s+eqIOlOL/GgZ0HBFaXBDdgUt0=; b=J5/r6a6a9R/y5DEFU8rpyNEYBbuf3NCL//QCiOxDa5GQQgMM2fX8IkiGtiHo/U8qaw 5LVkfIjGREbpi3B3KZSigOrvU7d98K1TI+/HtBrUNiafzPlioKa8EytwoH9RZ0L78OYE UBuT+J7sDSUJguigK8mOUzN1or6Sraev+M0lwH7LtBntSc7TKzw6i5pEC8vZ49G1BoDU UfhGMq3pV0Qfz+xEGw7ZhirFQrRE1FYEj3L/AokQRwP/4jD+WPVodtx+xIJconghwJtV WQtXDLTkqoDNR6pL/j6MIYNJfmLUnFCKyr4OO2I0eXP13xxP9o+/VFPyoW0miGJ4MRgg jArQ== X-Gm-Message-State: AC+VfDxmB4F5r3TtYF7QgNp4k2KiOSlqD17MRd8OKUVSglMr5vHGmVUZ cHNkhqFv10BH73YxH22KbJ78zjUFatc= X-Google-Smtp-Source: ACHHUZ41fGcDtXl4M9Gv0qfBobRcSe/NfKgNBnkDqfO3K+1eDMzohPPSADl93zSnXjBJ+YOXeqAsmg== X-Received: by 2002:a17:907:6d15:b0:96a:bfc:7335 with SMTP id sa21-20020a1709076d1500b0096a0bfc7335mr14535788ejc.53.1684020230375; Sat, 13 May 2023 16:23:50 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id fr30-20020a170906891e00b009663115c8f8sm7414049ejc.152.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaZ-001AmH-2z; Sun, 14 May 2023 01:23:47 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 01/14] ada: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:08 +0200 Message-Id: <20230513232321.279733-2-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.2 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Use _P defines from tree.h. (constructor_address_p): Ditto. (elaborate_expression_1): Ditto. * gcc-interface/trans.cc (Identifier_to_gnu): Ditto. (is_nrv_p): Ditto. (Subprogram_Body_to_gnu): Ditto. (gnat_to_gnu): Ditto. (gnat_to_gnu_external): Ditto. (add_decl_expr): Ditto. (gnat_gimplify_expr): Ditto. * gcc-interface/utils.cc (finish_record_type): Ditto. (create_var_decl): Ditto. * gcc-interface/utils2.cc (get_base_type): Ditto. (build_binary_op): Ditto. (build_unary_op): Ditto. (gnat_protect_expr): Ditto. (gnat_invariant_expr): Ditto. --- gcc/ada/gcc-interface/decl.cc | 17 ++++++++--------- gcc/ada/gcc-interface/trans.cc | 20 ++++++++++---------- gcc/ada/gcc-interface/utils.cc | 10 +++++----- gcc/ada/gcc-interface/utils2.cc | 16 ++++++++-------- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 20f43de9ea9..ec61593a65b 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -785,7 +785,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if ((TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE && No (gnat_renamed_obj)) || TYPE_IS_DUMMY_P (gnu_type) - || TREE_CODE (gnu_type) == VOID_TYPE) + || VOID_TYPE_P (gnu_type)) { gcc_assert (type_annotate_only); if (this_global) @@ -840,7 +840,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if (TREE_CODE (gnu_expr) == COMPONENT_REF && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0))) - && TREE_CODE (TREE_OPERAND (gnu_expr, 0)) == VAR_DECL + && VAR_P (TREE_OPERAND (gnu_expr, 0)) && (TREE_READONLY (TREE_OPERAND (gnu_expr, 0)) || DECL_READONLY_ONCE_ELAB (TREE_OPERAND (gnu_expr, 0)))) @@ -1077,7 +1077,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* We need to detect the case where a temporary is created to hold the return value, since we cannot safely rename it at top level as it lives only in the elaboration routine. */ - || (TREE_CODE (inner) == VAR_DECL + || (VAR_P (inner) && DECL_RETURN_VALUE_P (inner)) /* We also need to detect the case where the front-end creates a dangling 'reference to a function call at top level and @@ -1093,10 +1093,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) We cannot safely rename the rewritten expression since the underlying object lives only in the elaboration routine. */ - || (TREE_CODE (inner) == INDIRECT_REF + || (INDIRECT_REF_P (inner) && (inner = remove_conversions (TREE_OPERAND (inner, 0), true)) - && TREE_CODE (inner) == VAR_DECL + && VAR_P (inner) && DECL_RETURN_VALUE_P (inner))) ; @@ -1611,7 +1611,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) and optimization isn't enabled, then force it in memory so that a register won't be allocated to it with possible subparts left uninitialized and reaching the register allocator. */ - else if (TREE_CODE (gnu_decl) == VAR_DECL + else if (VAR_P (gnu_decl) && !DECL_EXTERNAL (gnu_decl) && !TREE_STATIC (gnu_decl) && DECL_MODE (gnu_decl) != BLKmode @@ -6717,8 +6717,7 @@ range_cannot_be_superflat (Node_Id gnat_range) static bool constructor_address_p (tree gnu_expr) { - while (TREE_CODE (gnu_expr) == NOP_EXPR - || TREE_CODE (gnu_expr) == CONVERT_EXPR + while (CONVERT_EXPR_P (gnu_expr) || TREE_CODE (gnu_expr) == NON_LVALUE_EXPR) gnu_expr = TREE_OPERAND (gnu_expr, 0); @@ -7061,7 +7060,7 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, const char *s, expr_variable_p = !(inner - && TREE_CODE (inner) == VAR_DECL + && VAR_P (inner) && (TREE_READONLY (inner) || DECL_READONLY_ONCE_ELAB (inner))); } diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 5fc1a26fede..c26f1b6e1ac 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -1241,7 +1241,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) /* Do the final dereference. */ gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); - if ((TREE_CODE (gnu_result) == INDIRECT_REF + if ((INDIRECT_REF_P (gnu_result) || TREE_CODE (gnu_result) == UNCONSTRAINED_ARRAY_REF) && No (Address_Clause (gnat_entity))) TREE_THIS_NOTRAP (gnu_result) = 1; @@ -3391,7 +3391,7 @@ struct nrv_data static inline bool is_nrv_p (bitmap nrv, tree t) { - return TREE_CODE (t) == VAR_DECL && bitmap_bit_p (nrv, DECL_UID (t)); + return VAR_P (t) && bitmap_bit_p (nrv, DECL_UID (t)); } /* Helper function for walk_tree, used by finalize_nrv below. */ @@ -4136,7 +4136,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) gnat_param = Next_Formal_With_Extras (gnat_param)) { tree gnu_param = get_gnu_tree (gnat_param); - bool is_var_decl = (TREE_CODE (gnu_param) == VAR_DECL); + bool is_var_decl = VAR_P (gnu_param); annotate_object (gnat_param, TREE_TYPE (gnu_param), NULL_TREE, DECL_BY_REF_P (gnu_param)); @@ -6908,7 +6908,7 @@ gnat_to_gnu (Node_Id gnat_node) && TYPE_CONTAINS_TEMPLATE_P (gnu_result_type)) gnu_aggr_type = TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_result_type))); - else if (TREE_CODE (gnu_result_type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (gnu_result_type)) gnu_aggr_type = TYPE_REPRESENTATIVE_ARRAY (gnu_result_type); else gnu_aggr_type = gnu_result_type; @@ -7740,7 +7740,7 @@ gnat_to_gnu (Node_Id gnat_node) gnu_result = build2 (INIT_EXPR, void_type_node, gnu_ret_deref, gnu_ret_val); /* Avoid a useless copy with __builtin_return_slot. */ - if (TREE_CODE (gnu_ret_val) == INDIRECT_REF) + if (INDIRECT_REF_P (gnu_ret_val)) gnu_result = build3 (COND_EXPR, void_type_node, fold_build2 (NE_EXPR, boolean_type_node, @@ -8415,7 +8415,7 @@ gnat_to_gnu (Node_Id gnat_node) /* If we're supposed to return something of void_type, it means we have something we're elaborating for effect, so just return. */ - if (TREE_CODE (gnu_result_type) == VOID_TYPE) + if (VOID_TYPE_P (gnu_result_type)) return gnu_result; /* If the result is a constant that overflowed, raise Constraint_Error. */ @@ -8588,7 +8588,7 @@ gnat_to_gnu_external (Node_Id gnat_node) current_function_decl = NULL_TREE; /* Do not import locations from external units. */ - if (gnu_result && EXPR_P (gnu_result)) + if (CAN_HAVE_LOCATION_P (gnu_result)) SET_EXPR_LOCATION (gnu_result, UNKNOWN_LOCATION); return gnu_result; @@ -8722,7 +8722,7 @@ add_decl_expr (tree gnu_decl, Node_Id gnat_node) Note that walk_tree knows how to deal with TYPE_DECL, but neither VAR_DECL nor CONST_DECL. This appears to be somewhat arbitrary. */ MARK_VISITED (gnu_stmt); - if (TREE_CODE (gnu_decl) == VAR_DECL + if (VAR_P (gnu_decl) || TREE_CODE (gnu_decl) == CONST_DECL) { MARK_VISITED (DECL_SIZE (gnu_decl)); @@ -8739,7 +8739,7 @@ add_decl_expr (tree gnu_decl, Node_Id gnat_node) && !TYPE_FAT_POINTER_P (type)) MARK_VISITED (TYPE_ADA_SIZE (type)); - if (TREE_CODE (gnu_decl) == VAR_DECL && (gnu_init = DECL_INITIAL (gnu_decl))) + if (VAR_P (gnu_decl) && (gnu_init = DECL_INITIAL (gnu_decl))) { /* If this is a variable and an initializer is attached to it, it must be valid for the context. Similar to init_const in create_var_decl. */ @@ -9000,7 +9000,7 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, /* The expressions for the RM bounds must be gimplified to ensure that they are properly elaborated. See gimplify_decl_expr. */ - if ((TREE_CODE (op) == TYPE_DECL || TREE_CODE (op) == VAR_DECL) + if ((TREE_CODE (op) == TYPE_DECL || VAR_P (op)) && !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (op)) && (INTEGRAL_TYPE_P (TREE_TYPE (op)) || SCALAR_FLOAT_TYPE_P (TREE_TYPE (op)))) diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index 0c4f8b90c8e..460ef6f1f01 100644 --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -1966,7 +1966,7 @@ finish_record_type (tree record_type, tree field_list, int rep_level, bool debug_info_p) { const enum tree_code orig_code = TREE_CODE (record_type); - const bool had_size = TYPE_SIZE (record_type) != NULL_TREE; + const bool had_size = COMPLETE_TYPE_P (record_type); const bool had_align = TYPE_ALIGN (record_type) > 0; /* For all-repped records with a size specified, lay the QUAL_UNION_TYPE out just like a UNION_TYPE, since the size will be fixed. */ @@ -2802,7 +2802,7 @@ create_var_decl (tree name, tree asm_name, tree type, tree init, if (TREE_CODE (inner) == ADDR_EXPR && ((TREE_CODE (TREE_OPERAND (inner, 0)) == CALL_EXPR && !call_is_atomic_load (TREE_OPERAND (inner, 0))) - || (TREE_CODE (TREE_OPERAND (inner, 0)) == VAR_DECL + || (VAR_P (TREE_OPERAND (inner, 0)) && DECL_RETURN_VALUE_P (TREE_OPERAND (inner, 0))))) DECL_RETURN_VALUE_P (var_decl) = 1; } @@ -2853,7 +2853,7 @@ create_var_decl (tree name, tree asm_name, tree type, tree init, support global BSS sections, uninitialized global variables would go in DATA instead, thus increasing the size of the executable. */ if (!flag_no_common - && TREE_CODE (var_decl) == VAR_DECL + && VAR_P (var_decl) && TREE_PUBLIC (var_decl) && !have_global_bss_p ()) DECL_COMMON (var_decl) = 1; @@ -2871,13 +2871,13 @@ create_var_decl (tree name, tree asm_name, tree type, tree init, DECL_IGNORED_P (var_decl) = 1; /* ??? Some attributes cannot be applied to CONST_DECLs. */ - if (TREE_CODE (var_decl) == VAR_DECL) + if (VAR_P (var_decl)) process_attributes (&var_decl, &attr_list, true, gnat_node); /* Add this decl to the current binding level. */ gnat_pushdecl (var_decl, gnat_node); - if (TREE_CODE (var_decl) == VAR_DECL && asm_name) + if (VAR_P (var_decl) && asm_name) { /* Let the target mangle the name if this isn't a verbatim asm. */ if (*IDENTIFIER_POINTER (asm_name) != '*') diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 6c17675f488..c56fccb4a98 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -68,7 +68,7 @@ get_base_type (tree type) while (TREE_TYPE (type) && (TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == REAL_TYPE)) + || SCALAR_FLOAT_TYPE_P (type))) type = TREE_TYPE (type); return type; @@ -986,7 +986,7 @@ build_binary_op (enum tree_code op_code, tree result_type, break; } - gcc_assert (TREE_CODE (result) == INDIRECT_REF + gcc_assert (INDIRECT_REF_P (result) || TREE_CODE (result) == NULL_EXPR || TREE_CODE (result) == SAVE_EXPR || DECL_P (result)); @@ -1423,7 +1423,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) the corresponding address, e.g. for an allocator. However do it for a return value to expose it for later recognition. */ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE - || (TREE_CODE (TREE_OPERAND (operand, 1)) == VAR_DECL + || (VAR_P (TREE_OPERAND (operand, 1)) && DECL_RETURN_VALUE_P (TREE_OPERAND (operand, 1)))) { result = build_unary_op (ADDR_EXPR, result_type, @@ -1597,11 +1597,11 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) if (!TYPE_IS_FAT_POINTER_P (type) && TYPE_VOLATILE (TREE_TYPE (type))) { TREE_SIDE_EFFECTS (result) = 1; - if (TREE_CODE (result) == INDIRECT_REF) + if (INDIRECT_REF_P (result)) TREE_THIS_VOLATILE (result) = TYPE_VOLATILE (TREE_TYPE (result)); } - if ((TREE_CODE (result) == INDIRECT_REF + if ((INDIRECT_REF_P (result) || TREE_CODE (result) == UNCONSTRAINED_ARRAY_REF) && can_never_be_null) TREE_THIS_NOTRAP (result) = 1; @@ -2926,7 +2926,7 @@ gnat_protect_expr (tree exp) /* Likewise if we're indirectly referencing part of something. */ if (code == COMPONENT_REF - && TREE_CODE (TREE_OPERAND (exp, 0)) == INDIRECT_REF) + && INDIRECT_REF_P (TREE_OPERAND (exp, 0))) return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)), TREE_OPERAND (exp, 1), NULL_TREE); @@ -3263,7 +3263,7 @@ gnat_invariant_expr (tree expr) /* Look through temporaries created to capture values. */ while ((TREE_CODE (expr) == CONST_DECL - || (TREE_CODE (expr) == VAR_DECL && TREE_READONLY (expr))) + || (VAR_P (expr) && TREE_READONLY (expr))) && decl_function_context (expr) == current_function_decl && DECL_INITIAL (expr)) { @@ -3362,7 +3362,7 @@ object: if (TREE_CODE (t) == PARM_DECL) return fold_convert (type, expr); - if (TREE_CODE (t) == VAR_DECL + if (VAR_P (t) && (DECL_EXTERNAL (t) || decl_function_context (t) != current_function_decl)) return fold_convert (type, expr); From patchwork Sat May 13 23:23:09 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: 69300 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 689883853545 for ; Sat, 13 May 2023 23:24:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 689883853545 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020263; bh=dre9x3IV/wtfaEtbToyVfLoniK6q7RxUOHq+sVkHQqA=; 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=nUVZJbta8/2X2KTzIZEExFLaASI24HgVzyEnmsrf9Dh2Hi1MVCRczy3U/bByQyYgO QdmUy58N9pdfoWsg/ZAtnAPHr7mxKUuLtxwCKj5NhUblhPOVpkPYGOWWCKoWsoUGvj DmByi3aycE7yGlAn3uSm4wpmAlQB+Ht+vi7aYu6w= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id A403F385840A; Sat, 13 May 2023 23:23:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A403F385840A Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-50bc570b4a3so20483286a12.1; Sat, 13 May 2023 16:23:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020230; x=1686612230; 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=dre9x3IV/wtfaEtbToyVfLoniK6q7RxUOHq+sVkHQqA=; b=gG8BKGD2whfLJSxAYK+fa0hZ9xQkAnnZ8eJ8dXLiOn4n+ARX1+kkXt/iXu3GeTrGJF VqVEcF4o7llLLp9+Eze0tq/Wor8IEWLX5ns5AQvmkCqGCPgKxVkej+se9tyqXYq3FhE1 DF+SvM4GaVE9XEtegkkRDQrsZl3Je48zSeok8agiX5J9P5yWZqfXFiGUq6rxxZrVvEjY YgSn2x9nMGQuMSKYqyTQc/pqFPe8im2Mo7MAfN53W9UVdHUmnKCvJSra/CG9NtXEBCc+ v9zFGT48i4gWugfCak+XNr3J1I6TNGXVH0gY5exMihuq9dOEbPdQy8gc0qJvDdRPaLUI jxDg== X-Gm-Message-State: AC+VfDyURTJJ1wH4q16N2abih0CxeDgpYOx0422rK+zadHuoeb6OZNgh +EeNiO6xzyIkqRTdhJe1oSSIOUmJTCU= X-Google-Smtp-Source: ACHHUZ6v7AxjZuLrhKCiuQHcOfrCkWwwxEwCUA6oAW3Z3ccjcuZLIOxFD2kE2xxmpBf/HzIZjEnoFQ== X-Received: by 2002:a17:907:9816:b0:96a:77a2:bba with SMTP id ji22-20020a170907981600b0096a77a20bbamr10435437ejc.60.1684020229440; Sat, 13 May 2023 16:23:49 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id og16-20020a1709071dd000b0096637a19dcasm7326211ejc.4.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaZ-001AmK-34; Sun, 14 May 2023 01:23:47 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 02/14] analyzer: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:09 +0200 Message-Id: <20230513232321.279733-3-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=-9.6 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/analyzer/ChangeLog: * region-model-manager.cc (get_code_for_cast): Use _P defines from tree.h. (region_model_manager::get_or_create_cast): Ditto. (region_model_manager::get_region_for_global): Ditto. * region-model.cc (region_model::get_lvalue_1): Ditto. * region.cc (decl_region::maybe_get_constant_value): Ditto. --- gcc/analyzer/region-model-manager.cc | 8 ++++---- gcc/analyzer/region-model.cc | 2 +- gcc/analyzer/region.cc | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc index fab5bba15d5..3b95e432aba 100644 --- a/gcc/analyzer/region-model-manager.cc +++ b/gcc/analyzer/region-model-manager.cc @@ -507,7 +507,7 @@ get_code_for_cast (tree dst_type, tree src_type) if (!src_type) return NOP_EXPR; - if (TREE_CODE (src_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (src_type)) { if (TREE_CODE (dst_type) == INTEGER_TYPE) return FIX_TRUNC_EXPR; @@ -531,9 +531,9 @@ region_model_manager::get_or_create_cast (tree type, const svalue *arg) return arg; /* Don't attempt to handle casts involving vector types for now. */ - if (TREE_CODE (type) == VECTOR_TYPE + if (VECTOR_TYPE_P (type) || (arg->get_type () - && TREE_CODE (arg->get_type ()) == VECTOR_TYPE)) + && VECTOR_TYPE_P (arg->get_type ()))) return get_or_create_unknown_svalue (type); enum tree_code op = get_code_for_cast (type, arg->get_type ()); @@ -1410,7 +1410,7 @@ region_model_manager::get_region_for_label (tree label) const decl_region * region_model_manager::get_region_for_global (tree expr) { - gcc_assert (TREE_CODE (expr) == VAR_DECL); + gcc_assert (VAR_P (expr)); decl_region **slot = m_globals_map.get (expr); if (slot) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index fb81d43f91b..3bb3df2f063 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -2092,7 +2092,7 @@ region_model::get_lvalue_1 (path_var pv, region_model_context *ctxt) const { gcc_assert (TREE_CODE (expr) == SSA_NAME || TREE_CODE (expr) == PARM_DECL - || TREE_CODE (expr) == VAR_DECL + || VAR_P (expr) || TREE_CODE (expr) == RESULT_DECL); int stack_index = pv.m_stack_depth; diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc index a18bfa50d09..8f0eb569b33 100644 --- a/gcc/analyzer/region.cc +++ b/gcc/analyzer/region.cc @@ -1162,7 +1162,7 @@ decl_region::get_stack_depth () const const svalue * decl_region::maybe_get_constant_value (region_model_manager *mgr) const { - if (TREE_CODE (m_decl) == VAR_DECL + if (VAR_P (m_decl) && DECL_IN_CONSTANT_POOL (m_decl) && DECL_INITIAL (m_decl) && TREE_CODE (DECL_INITIAL (m_decl)) == CONSTRUCTOR) From patchwork Sat May 13 23:23:10 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: 69307 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CAC6938708C3 for ; Sat, 13 May 2023 23:26:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAC6938708C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020388; bh=dnhltITTP1pkpb+TIJ4s/3JxBKpaLayURSD7DoidDVM=; 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=B5uK7Fhln+ZOqAaiQPY6nbA7uUti7b8q3ijuH2J9K8dPJewLYX5dNizd+wX/Ozni2 cnaj7av9AVFbzbaHdZe5Bm237j3RIqmEVJsfDAo0/BtZ4G/anIztFcch8nYIhCHcy4 u4e1OPzTDlcY/CssgLEYd3aMLQzqubwFpK2n3WM4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 0EFAF3858D3C; Sat, 13 May 2023 23:23:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0EFAF3858D3C Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9661a1ff1e9so1394910666b.1; Sat, 13 May 2023 16:23:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020229; x=1686612229; 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=dnhltITTP1pkpb+TIJ4s/3JxBKpaLayURSD7DoidDVM=; b=l94lcg2Kzuz/HT5p6ZQPpRLPcl/TGJhCWAWQYK7tNw0EjNqA2LiZHAKEvs7MPrOBzJ WRl3gJVVkwYkOleiPetKzrKNV/Xv9AEEcUGFzNR7MIYssslYpKk39gXmVWYCIV6AFtvx IWIevqeDQbseH+9LxGxwz1iHE2Ny7D2boU6f2BQpR416NOoCIQzwtw8N4l91020xJXbN vBtHpm97l8pZtsitRKJxtTkrSZF8eOfhqyrS+GL4d4rGnWNNlBi87QVbAVTuQOeixeib x8fIBXWfHL3vdNFQdeA1/CUXoixE4k0VG8IPFNqpOn3nDkjB3sDgn2Vb9aTOwIrNEUwL 159Q== X-Gm-Message-State: AC+VfDwPgKlCMnhFqJEi1124x0H/qqZArn7ch05+yndkMBH28f6kn3wH op0AzvJexiGCZaPj37B6x6/FXC4QoeA= X-Google-Smtp-Source: ACHHUZ7tng6rU8LoBTHY3D0fX848ax0p9FwTu4KnnDMcTZdDhr66RCA//+IFav4EvSOejrfnZsne9A== X-Received: by 2002:a17:906:7949:b0:969:ffcb:1eb4 with SMTP id l9-20020a170906794900b00969ffcb1eb4mr15598266ejo.2.1684020229093; Sat, 13 May 2023 16:23:49 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id hf27-20020a1709072c5b00b0096557203071sm7321509ejc.217.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaZ-001AmP-39; Sun, 14 May 2023 01:23:47 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 03/14] gcc/config/*: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:10 +0200 Message-Id: <20230513232321.279733-4-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=-9.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_STOCKGEN, 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_short_vector_p): Use _P defines from tree.h. (aarch64_mangle_type): Ditto. * config/alpha/alpha.cc (alpha_in_small_data_p): Ditto. (alpha_gimplify_va_arg_1): Ditto. * config/arc/arc.cc (arc_encode_section_info): Ditto. (arc_is_aux_reg_p): Ditto. (arc_is_uncached_mem_p): Ditto. (arc_handle_aux_attribute): Ditto. * config/arm/arm.cc (arm_handle_isr_attribute): Ditto. (arm_handle_cmse_nonsecure_call): Ditto. (arm_set_default_type_attributes): Ditto. (arm_is_segment_info_known): Ditto. (arm_mangle_type): Ditto. * config/arm/unknown-elf.h (IN_NAMED_SECTION_P): Ditto. * config/avr/avr.cc (avr_lookup_function_attribute1): Ditto. (avr_decl_absdata_p): Ditto. (avr_insert_attributes): Ditto. (avr_section_type_flags): Ditto. (avr_encode_section_info): Ditto. * config/bfin/bfin.cc (bfin_handle_l2_attribute): Ditto. * config/bpf/bpf.cc (bpf_core_compute): Ditto. * config/c6x/c6x.cc (c6x_in_small_data_p): Ditto. * config/csky/csky.cc (csky_handle_isr_attribute): Ditto. (csky_mangle_type): Ditto. * config/darwin-c.cc (darwin_pragma_unused): Ditto. * config/darwin.cc (is_objc_metadata): Ditto. * config/epiphany/epiphany.cc (epiphany_function_ok_for_sibcall): Ditto. * config/epiphany/epiphany.h (ROUND_TYPE_ALIGN): Ditto. * config/frv/frv.cc (frv_emit_movsi): Ditto. * config/gcn/gcn-tree.cc (gcn_lockless_update): Ditto. * config/gcn/gcn.cc (gcn_asm_output_symbol_ref): Ditto. * config/h8300/h8300.cc (h8300_encode_section_info): Ditto. * config/i386/i386-expand.cc: Ditto. * config/i386/i386.cc (type_natural_mode): Ditto. (ix86_function_arg): Ditto. (ix86_data_alignment): Ditto. (ix86_local_alignment): Ditto. (ix86_simd_clone_compute_vecsize_and_simdlen): Ditto. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Ditto. (i386_pe_type_dllexport_p): Ditto. (i386_pe_adjust_class_at_definition): Ditto. * config/i386/winnt.cc (i386_pe_determine_dllimport_p): Ditto. (i386_pe_binds_local_p): Ditto. (i386_pe_section_type_flags): Ditto. * config/ia64/ia64.cc (ia64_encode_section_info): Ditto. (ia64_gimplify_va_arg): Ditto. (ia64_in_small_data_p): Ditto. * config/iq2000/iq2000.cc (iq2000_function_arg): Ditto. * config/lm32/lm32.cc (lm32_in_small_data_p): Ditto. * config/loongarch/loongarch.cc (loongarch_handle_model_attribute): Ditto. * config/m32c/m32c.cc (m32c_insert_attributes): Ditto. * config/mcore/mcore.cc (mcore_mark_dllimport): Ditto. (mcore_encode_section_info): Ditto. * config/microblaze/microblaze.cc (microblaze_elf_in_small_data_p): Ditto. * config/mips/mips.cc (mips_output_aligned_decl_common): Ditto. * config/mmix/mmix.cc (mmix_encode_section_info): Ditto. * config/nvptx/nvptx.cc (nvptx_encode_section_info): Ditto. (pass_in_memory): Ditto. (nvptx_generate_vector_shuffle): Ditto. (nvptx_lockless_update): Ditto. * config/pa/pa.cc (pa_function_arg_padding): Ditto. (pa_function_value): Ditto. (pa_function_arg): Ditto. * config/pa/pa.h (IN_NAMED_SECTION_P): Ditto. (TEXT_SPACE_P): Ditto. * config/pa/som.h (MAKE_DECL_ONE_ONLY): Ditto. * config/pdp11/pdp11.cc (pdp11_return_in_memory): Ditto. * config/riscv/riscv.cc (riscv_in_small_data_p): Ditto. (riscv_mangle_type): Ditto. * config/rl78/rl78.cc (rl78_insert_attributes): Ditto. (rl78_addsi3_internal): Ditto. * config/rs6000/aix.h (ROUND_TYPE_ALIGN): Ditto. * config/rs6000/darwin.h (ROUND_TYPE_ALIGN): Ditto. * config/rs6000/freebsd64.h (ROUND_TYPE_ALIGN): Ditto. * config/rs6000/linux64.h (ROUND_TYPE_ALIGN): Ditto. * config/rs6000/rs6000-call.cc (rs6000_function_arg_boundary): Ditto. (rs6000_function_arg_advance_1): Ditto. (rs6000_function_arg): Ditto. (rs6000_pass_by_reference): Ditto. * config/rs6000/rs6000-logue.cc (rs6000_function_ok_for_sibcall): Ditto. * config/rs6000/rs6000.cc (rs6000_data_alignment): Ditto. (rs6000_set_default_type_attributes): Ditto. (rs6000_elf_in_small_data_p): Ditto. (IN_NAMED_SECTION): Ditto. (rs6000_xcoff_encode_section_info): Ditto. (rs6000_function_value): Ditto. (invalid_arg_for_unprototyped_fn): Ditto. * config/s390/s390-c.cc (s390_fn_types_compatible): Ditto. (s390_vec_n_elem): Ditto. * config/s390/s390.cc (s390_check_type_for_vector_abi): Ditto. (s390_function_arg_integer): Ditto. (s390_return_in_memory): Ditto. (s390_encode_section_info): Ditto. * config/sh/sh.cc (sh_gimplify_va_arg_expr): Ditto. (sh_function_value): Ditto. * config/sol2.cc (solaris_insert_attributes): Ditto. * config/sparc/sparc.cc (function_arg_slotno): Ditto. * config/sparc/sparc.h (ROUND_TYPE_ALIGN): Ditto. * config/stormy16/stormy16.cc (xstormy16_encode_section_info): Ditto. (xstormy16_handle_below100_attribute): Ditto. * config/v850/v850.cc (v850_encode_section_info): Ditto. (v850_insert_attributes): Ditto. * config/visium/visium.cc (visium_pass_by_reference): Ditto. (visium_return_in_memory): Ditto. * config/xtensa/xtensa.cc (xtensa_multibss_section_type_flags): Ditto. --- gcc/config/aarch64/aarch64.cc | 4 ++-- gcc/config/alpha/alpha.cc | 6 +++--- gcc/config/arc/arc.cc | 8 ++++---- gcc/config/arm/arm.cc | 16 +++++++--------- gcc/config/arm/unknown-elf.h | 2 +- gcc/config/avr/avr.cc | 11 +++++------ gcc/config/bfin/bfin.cc | 2 +- gcc/config/bpf/bpf.cc | 2 +- gcc/config/c6x/c6x.cc | 4 ++-- gcc/config/csky/csky.cc | 8 +++----- gcc/config/darwin-c.cc | 2 +- gcc/config/darwin.cc | 2 +- gcc/config/epiphany/epiphany.cc | 3 +-- gcc/config/epiphany/epiphany.h | 6 ++---- gcc/config/frv/frv.cc | 4 ++-- gcc/config/gcn/gcn-tree.cc | 2 +- gcc/config/gcn/gcn.cc | 4 ++-- gcc/config/h8300/h8300.cc | 2 +- gcc/config/i386/i386-expand.cc | 2 +- gcc/config/i386/i386.cc | 20 ++++++++------------ gcc/config/i386/winnt-cxx.cc | 12 ++++++------ gcc/config/i386/winnt.cc | 6 +++--- gcc/config/ia64/ia64.cc | 6 +++--- gcc/config/iq2000/iq2000.cc | 8 +++----- gcc/config/lm32/lm32.cc | 2 +- gcc/config/loongarch/loongarch.cc | 2 +- gcc/config/m32c/m32c.cc | 2 +- gcc/config/mcore/mcore.cc | 6 +++--- gcc/config/microblaze/microblaze.cc | 2 +- gcc/config/mips/mips.cc | 2 +- gcc/config/mmix/mmix.cc | 4 ++-- gcc/config/nvptx/nvptx.cc | 8 ++++---- gcc/config/pa/pa.cc | 10 +++++----- gcc/config/pa/pa.h | 4 ++-- gcc/config/pa/som.h | 2 +- gcc/config/pdp11/pdp11.cc | 2 +- gcc/config/riscv/riscv.cc | 4 ++-- gcc/config/rl78/rl78.cc | 4 ++-- gcc/config/rs6000/aix.h | 4 +--- gcc/config/rs6000/darwin.h | 6 ++---- gcc/config/rs6000/freebsd64.h | 4 +--- gcc/config/rs6000/linux64.h | 4 +--- gcc/config/rs6000/rs6000-call.cc | 10 +++++----- gcc/config/rs6000/rs6000-logue.cc | 4 ++-- gcc/config/rs6000/rs6000.cc | 15 +++++++-------- gcc/config/s390/s390-c.cc | 4 ++-- gcc/config/s390/s390.cc | 8 ++++---- gcc/config/sh/sh.cc | 12 ++++++------ gcc/config/sol2.cc | 2 +- gcc/config/sparc/sparc.cc | 2 +- gcc/config/sparc/sparc.h | 4 +--- gcc/config/stormy16/stormy16.cc | 4 ++-- gcc/config/v850/v850.cc | 6 +++--- gcc/config/visium/visium.cc | 4 ++-- gcc/config/xtensa/xtensa.cc | 2 +- 55 files changed, 133 insertions(+), 158 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 546cb121331..224e614266e 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -20453,7 +20453,7 @@ aarch64_short_vector_p (const_tree type, { poly_int64 size = -1; - if (type && TREE_CODE (type) == VECTOR_TYPE) + if (type && VECTOR_TYPE_P (type)) { if (aarch64_sve::builtin_type_p (type)) return false; @@ -20893,7 +20893,7 @@ aarch64_mangle_type (const_tree type) return "St9__va_list"; /* Half-precision floating point types. */ - if (TREE_CODE (type) == REAL_TYPE && TYPE_PRECISION (type) == 16) + if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16) { if (TYPE_MAIN_VARIANT (type) == float16_type_node) return NULL; diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc index 1d826085198..360b50e20d4 100644 --- a/gcc/config/alpha/alpha.cc +++ b/gcc/config/alpha/alpha.cc @@ -784,10 +784,10 @@ alpha_in_small_data_p (const_tree exp) return false; /* COMMON symbols are never small data. */ - if (TREE_CODE (exp) == VAR_DECL && DECL_COMMON (exp)) + if (VAR_P (exp) && DECL_COMMON (exp)) return false; - if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) + if (VAR_P (exp) && DECL_SECTION_NAME (exp)) { const char *section = DECL_SECTION_NAME (exp); if (strcmp (section, ".sdata") == 0 @@ -6253,7 +6253,7 @@ alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, return build2 (COMPLEX_EXPR, type, real_temp, imag_part); } - else if (TREE_CODE (type) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type)) { tree fpaddend, cond, fourtyeight; diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc index b47935a9214..dd012ffa975 100644 --- a/gcc/config/arc/arc.cc +++ b/gcc/config/arc/arc.cc @@ -5784,7 +5784,7 @@ arc_encode_section_info (tree decl, rtx rtl, int first) SYMBOL_REF_FLAGS (symbol) = flags; } - else if (TREE_CODE (decl) == VAR_DECL) + else if (VAR_P (decl)) { rtx symbol = XEXP (rtl, 0); @@ -8935,7 +8935,7 @@ arc_is_aux_reg_p (rtx pat) return false; /* Get the attributes. */ - if (TREE_CODE (addr) == VAR_DECL) + if (VAR_P (addr)) attrs = DECL_ATTRIBUTES (addr); else if (TREE_CODE (addr) == MEM_REF) attrs = TYPE_ATTRIBUTES (TREE_TYPE (TREE_OPERAND (addr, 0))); @@ -11247,7 +11247,7 @@ arc_is_uncached_mem_p (rtx pat) /* Get the attributes. */ if (TREE_CODE (addr) == MEM_REF - || TREE_CODE (addr) == VAR_DECL) + || VAR_P (addr)) { attrs = TYPE_ATTRIBUTES (TREE_TYPE (addr)); if (lookup_attribute ("uncached", attrs)) @@ -11315,7 +11315,7 @@ arc_handle_aux_attribute (tree *node, /* FIXME! add range check. TREE_INT_CST_LOW (arg) */ } - if (TREE_CODE (*node) == VAR_DECL) + if (VAR_P (*node)) { tree fntype = TREE_TYPE (*node); if (fntype && TREE_CODE (fntype) == POINTER_TYPE) diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 06e0756e4e8..6f218c96a2e 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -7463,8 +7463,7 @@ arm_handle_isr_attribute (tree *node, tree name, tree args, int flags, } else { - if (TREE_CODE (*node) == FUNCTION_TYPE - || TREE_CODE (*node) == METHOD_TYPE) + if (FUNC_OR_METHOD_TYPE_P (*node)) { if (arm_isr_value (args) == ARM_FT_UNKNOWN) { @@ -7474,8 +7473,7 @@ arm_handle_isr_attribute (tree *node, tree name, tree args, int flags, } } else if (TREE_CODE (*node) == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (*node)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE) + && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (*node)) && arm_isr_value (args) != ARM_FT_UNKNOWN) { *node = build_variant_type_copy (*node); @@ -7683,7 +7681,7 @@ arm_handle_cmse_nonsecure_call (tree *node, tree name, { fntype = TREE_TYPE (*node); - if (TREE_CODE (*node) == VAR_DECL || TREE_CODE (*node) == TYPE_DECL) + if (VAR_P (*node) || TREE_CODE (*node) == TYPE_DECL) decl = *node; } else @@ -7804,7 +7802,7 @@ arm_set_default_type_attributes (tree type) /* Add __attribute__ ((long_call)) to all functions, when inside #pragma long_calls or __attribute__ ((short_call)), when inside #pragma no_long_calls. */ - if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE) + if (FUNC_OR_METHOD_TYPE_P (type)) { tree type_attr_list, attr_name; type_attr_list = TYPE_ATTRIBUTES (type); @@ -8452,7 +8450,7 @@ arm_is_segment_info_known (rtx orig, bool *is_readonly) || !DECL_COMMON (SYMBOL_REF_DECL (orig)))) { tree decl = SYMBOL_REF_DECL (orig); - tree init = (TREE_CODE (decl) == VAR_DECL) + tree init = VAR_P (decl) ? DECL_INITIAL (decl) : (TREE_CODE (decl) == CONSTRUCTOR) ? decl : 0; int reloc = 0; @@ -8461,7 +8459,7 @@ arm_is_segment_info_known (rtx orig, bool *is_readonly) if (init && init != error_mark_node) reloc = compute_reloc_for_constant (init); - named_section = TREE_CODE (decl) == VAR_DECL + named_section = VAR_P (decl) && lookup_attribute ("section", DECL_ATTRIBUTES (decl)); readonly = decl_readonly_section (decl, reloc); @@ -30575,7 +30573,7 @@ arm_mangle_type (const_tree type) return "St9__va_list"; /* Half-precision floating point types. */ - if (TREE_CODE (type) == REAL_TYPE && TYPE_PRECISION (type) == 16) + if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16) { if (TYPE_MAIN_VARIANT (type) == float16_type_node) return NULL; diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h index 397ac3f68b9..42b97ce9458 100644 --- a/gcc/config/arm/unknown-elf.h +++ b/gcc/config/arm/unknown-elf.h @@ -51,7 +51,7 @@ /* Return a nonzero value if DECL has a section attribute. */ #define IN_NAMED_SECTION_P(DECL) \ - ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \ + ((TREE_CODE (DECL) == FUNCTION_DECL || VAR_P (DECL)) \ && DECL_SECTION_NAME (DECL) != NULL) #undef ASM_OUTPUT_ALIGNED_BSS diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index c193430cf07..d5af40f7091 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -961,8 +961,7 @@ avr_lookup_function_attribute1 (const_tree func, const char *name) func = TREE_TYPE (func); } - gcc_assert (TREE_CODE (func) == FUNCTION_TYPE - || TREE_CODE (func) == METHOD_TYPE); + gcc_assert (FUNC_OR_METHOD_TYPE_P (func)); return NULL_TREE != lookup_attribute (name, TYPE_ATTRIBUTES (func)); } @@ -9839,7 +9838,7 @@ avr_progmem_p (tree decl, tree attributes) static bool avr_decl_absdata_p (tree decl, tree attributes) { - return (TREE_CODE (decl) == VAR_DECL + return (VAR_P (decl) && NULL_TREE != lookup_attribute ("absdata", attributes)); } @@ -9976,7 +9975,7 @@ avr_insert_attributes (tree node, tree *attributes) /* Add the section attribute if the variable is in progmem. */ - if (TREE_CODE (node) == VAR_DECL + if (VAR_P (node) && (TREE_STATIC (node) || DECL_EXTERNAL (node)) && avr_progmem_p (node, *attributes)) { @@ -10190,7 +10189,7 @@ avr_section_type_flags (tree decl, const char *name, int reloc) if (startswith (name, ".noinit")) { - if (decl && TREE_CODE (decl) == VAR_DECL + if (decl && VAR_P (decl) && DECL_INITIAL (decl) == NULL_TREE) flags |= SECTION_BSS; /* @nobits */ else @@ -10338,7 +10337,7 @@ avr_encode_section_info (tree decl, rtx rtl, int new_decl_p) if (AVR_TINY && decl - && VAR_DECL == TREE_CODE (decl) + && VAR_P (decl) && MEM_P (rtl) && SYMBOL_REF_P (XEXP (rtl, 0))) { diff --git a/gcc/config/bfin/bfin.cc b/gcc/config/bfin/bfin.cc index c70d2281f06..4320ec26722 100644 --- a/gcc/config/bfin/bfin.cc +++ b/gcc/config/bfin/bfin.cc @@ -4877,7 +4877,7 @@ bfin_handle_l2_attribute (tree *node, tree ARG_UNUSED (name), else set_decl_section_name (decl, ".l2.text"); } - else if (TREE_CODE (decl) == VAR_DECL) + else if (VAR_P (decl)) { if (DECL_SECTION_NAME (decl) != NULL && strcmp (DECL_SECTION_NAME (decl), diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index d8693f8cfbe..e0324e1e0e0 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -1406,7 +1406,7 @@ bpf_core_compute (tree node, vec *accessors) if (TREE_CODE (node) == ADDR_EXPR) node = TREE_OPERAND (node, 0); - else if (TREE_CODE (node) == INDIRECT_REF + else if (INDIRECT_REF_P (node) || TREE_CODE (node) == POINTER_PLUS_EXPR) { accessors->safe_push (0); diff --git a/gcc/config/c6x/c6x.cc b/gcc/config/c6x/c6x.cc index 15be3b23716..0c9cb821f28 100644 --- a/gcc/config/c6x/c6x.cc +++ b/gcc/config/c6x/c6x.cc @@ -855,10 +855,10 @@ c6x_in_small_data_p (const_tree exp) if (TREE_CODE (exp) == FUNCTION_DECL) return false; - if (TREE_CODE (exp) == VAR_DECL && DECL_WEAK (exp)) + if (VAR_P (exp) && DECL_WEAK (exp)) return false; - if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) + if (VAR_P (exp) && DECL_SECTION_NAME (exp)) { const char *section = DECL_SECTION_NAME (exp); diff --git a/gcc/config/csky/csky.cc b/gcc/config/csky/csky.cc index ddc6954dad1..b4ee3b273a4 100644 --- a/gcc/config/csky/csky.cc +++ b/gcc/config/csky/csky.cc @@ -6490,8 +6490,7 @@ csky_handle_isr_attribute (tree *node, tree name, tree args, int flags, } else { - if (TREE_CODE (*node) == FUNCTION_TYPE - || TREE_CODE (*node) == METHOD_TYPE) + if (FUNC_OR_METHOD_TYPE_P (*node)) { if (csky_isr_value (args) == CSKY_FT_UNKNOWN) { @@ -6500,8 +6499,7 @@ csky_handle_isr_attribute (tree *node, tree name, tree args, int flags, } } else if (TREE_CODE (*node) == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (*node)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE) + && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (*node)) && csky_isr_value (args) != CSKY_FT_UNKNOWN) { *node = build_variant_type_copy (*node); @@ -7319,7 +7317,7 @@ csky_init_builtins (void) static const char * csky_mangle_type (const_tree type) { - if (TREE_CODE (type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16 && TYPE_MAIN_VARIANT (type) != float16_type_node) return "Dh"; diff --git a/gcc/config/darwin-c.cc b/gcc/config/darwin-c.cc index 579b9fa9317..ded0cd46c76 100644 --- a/gcc/config/darwin-c.cc +++ b/gcc/config/darwin-c.cc @@ -139,7 +139,7 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED) { tree local = lookup_name (decl); if (local && (TREE_CODE (local) == PARM_DECL - || TREE_CODE (local) == VAR_DECL)) + || VAR_P (local))) { TREE_USED (local) = 1; DECL_READ_P (local) = 1; diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc index ced2f7e40a6..efbcb3856ca 100644 --- a/gcc/config/darwin.cc +++ b/gcc/config/darwin.cc @@ -1415,7 +1415,7 @@ static tree is_objc_metadata (tree decl) { if (DECL_P (decl) - && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL) + && (VAR_P (decl) || TREE_CODE (decl) == CONST_DECL) && DECL_ATTRIBUTES (decl)) { tree meta = lookup_attribute ("OBJC2META", DECL_ATTRIBUTES (decl)); diff --git a/gcc/config/epiphany/epiphany.cc b/gcc/config/epiphany/epiphany.cc index 20c20e18ea0..60a2845d6d1 100644 --- a/gcc/config/epiphany/epiphany.cc +++ b/gcc/config/epiphany/epiphany.cc @@ -2159,8 +2159,7 @@ epiphany_function_ok_for_sibcall (tree decl, tree exp) gcc_assert (POINTER_TYPE_P (fn_type)); fn_type = TREE_TYPE (fn_type); - gcc_assert (TREE_CODE (fn_type) == FUNCTION_TYPE - || TREE_CODE (fn_type) == METHOD_TYPE); + gcc_assert (FUNC_OR_METHOD_TYPE_P (fn_type)); call_interrupt_p = lookup_attribute ("interrupt", TYPE_ATTRIBUTES (fn_type)) != NULL; } diff --git a/gcc/config/epiphany/epiphany.h b/gcc/config/epiphany/epiphany.h index c742709309e..0baeb298540 100644 --- a/gcc/config/epiphany/epiphany.h +++ b/gcc/config/epiphany/epiphany.h @@ -170,12 +170,10 @@ along with GCC; see the file COPYING3. If not see /* layout_type overrides our ADJUST_ALIGNMENT settings from epiphany-modes.def for vector modes, so we have to override it back. */ #define ROUND_TYPE_ALIGN(TYPE, MANGLED_ALIGN, SPECIFIED_ALIGN) \ - (TREE_CODE (TYPE) == VECTOR_TYPE && !TYPE_USER_ALIGN (TYPE) \ + (VECTOR_TYPE_P (TYPE) && !TYPE_USER_ALIGN (TYPE) \ && SPECIFIED_ALIGN <= GET_MODE_ALIGNMENT (TYPE_MODE (TYPE)) \ ? GET_MODE_ALIGNMENT (TYPE_MODE (TYPE)) \ - : ((TREE_CODE (TYPE) == RECORD_TYPE \ - || TREE_CODE (TYPE) == UNION_TYPE \ - || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \ + : (RECORD_OR_UNION_TYPE_P (TYPE) \ && !TYPE_PACKED (TYPE)) \ ? epiphany_special_round_type_align ((TYPE), (MANGLED_ALIGN), \ (SPECIFIED_ALIGN)) \ diff --git a/gcc/config/frv/frv.cc b/gcc/config/frv/frv.cc index 99f79325cd6..2dbaa75f3dc 100644 --- a/gcc/config/frv/frv.cc +++ b/gcc/config/frv/frv.cc @@ -4061,7 +4061,7 @@ frv_emit_movsi (rtx dest, rtx src) || !DECL_COMMON (SYMBOL_REF_DECL (sym)))) { tree decl = SYMBOL_REF_DECL (sym); - tree init = TREE_CODE (decl) == VAR_DECL + tree init = VAR_P (decl) ? DECL_INITIAL (decl) : TREE_CODE (decl) == CONSTRUCTOR ? decl : 0; @@ -4071,7 +4071,7 @@ frv_emit_movsi (rtx dest, rtx src) if (init && init != error_mark_node) reloc = compute_reloc_for_constant (init); - named_section = TREE_CODE (decl) == VAR_DECL + named_section = VAR_P (decl) && lookup_attribute ("section", DECL_ATTRIBUTES (decl)); readonly = decl_readonly_section (decl, reloc); diff --git a/gcc/config/gcn/gcn-tree.cc b/gcc/config/gcn/gcn-tree.cc index 3c3bf377dd6..c99c1767659 100644 --- a/gcc/config/gcn/gcn-tree.cc +++ b/gcc/config/gcn/gcn-tree.cc @@ -104,7 +104,7 @@ gcn_lockless_update (location_t loc, gimple_stmt_iterator *gsi, tree var_type = TREE_TYPE (var); if (TREE_CODE (var_type) == COMPLEX_TYPE - || TREE_CODE (var_type) == REAL_TYPE) + || SCALAR_FLOAT_TYPE_P (var_type)) code = VIEW_CONVERT_EXPR; if (TYPE_SIZE (var_type) == TYPE_SIZE (long_long_unsigned_type_node)) diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index 7bb71392c4c..007730da2f9 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -6523,7 +6523,7 @@ gcn_asm_output_symbol_ref (FILE *file, rtx x) tree decl; if (cfun && (decl = SYMBOL_REF_DECL (x)) != 0 - && TREE_CODE (decl) == VAR_DECL + && VAR_P (decl) && AS_LDS_P (TYPE_ADDR_SPACE (TREE_TYPE (decl)))) { /* LDS symbols (emitted using this hook) are only used at present @@ -6539,7 +6539,7 @@ gcn_asm_output_symbol_ref (FILE *file, rtx x) /* FIXME: See above -- this condition is unreachable. */ if (cfun && (decl = SYMBOL_REF_DECL (x)) != 0 - && TREE_CODE (decl) == VAR_DECL + && VAR_P (decl) && AS_LDS_P (TYPE_ADDR_SPACE (TREE_TYPE (decl)))) fputs ("@abs32", file); } diff --git a/gcc/config/h8300/h8300.cc b/gcc/config/h8300/h8300.cc index c3674933f90..7412c0535fc 100644 --- a/gcc/config/h8300/h8300.cc +++ b/gcc/config/h8300/h8300.cc @@ -5009,7 +5009,7 @@ h8300_encode_section_info (tree decl, rtx rtl, int first) if (TREE_CODE (decl) == FUNCTION_DECL && h8300_funcvec_function_p (decl)) extra_flags = SYMBOL_FLAG_FUNCVEC_FUNCTION; - else if (TREE_CODE (decl) == VAR_DECL + else if (VAR_P (decl) && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) { if (h8300_eightbit_data_p (decl)) diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 634fe61ba79..0e7966f9b3f 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -14571,7 +14571,7 @@ rdseed_step: op0 = pc_rtx; } else if (TREE_CODE (arg3) == SSA_NAME - && TREE_CODE (TREE_TYPE (arg3)) == VECTOR_TYPE) + && VECTOR_TYPE_P (TREE_TYPE (arg3))) { /* Recognize also when mask is like: __v2df src = _mm_setzero_pd (); diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index b1d08ecdb3d..52ce4d45154 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -1887,7 +1887,7 @@ type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum, { machine_mode mode = TYPE_MODE (type); - if (TREE_CODE (type) == VECTOR_TYPE && !VECTOR_MODE_P (mode)) + if (VECTOR_TYPE_P (type) && !VECTOR_MODE_P (mode)) { HOST_WIDE_INT size = int_size_in_bytes (type); if ((size == 8 || size == 16 || size == 32 || size == 64) @@ -1904,7 +1904,7 @@ type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum, if (DECIMAL_FLOAT_MODE_P (innermode)) return mode; - if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (type))) mode = MIN_MODE_VECTOR_FLOAT; else mode = MIN_MODE_VECTOR_INT; @@ -3412,7 +3412,7 @@ ix86_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) /* To simplify the code below, represent vector types with a vector mode even if MMX/SSE are not active. */ - if (arg.type && TREE_CODE (arg.type) == VECTOR_TYPE) + if (arg.type && VECTOR_TYPE_P (arg.type)) mode = type_natural_mode (arg.type, cum, false); if (TARGET_64BIT) @@ -17470,9 +17470,7 @@ ix86_data_alignment (tree type, unsigned int align, bool opt) || TYPE_MODE (type) == TCmode) && align < 128) return 128; } - else if ((TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE) + else if (RECORD_OR_UNION_TYPE_P (type) && TYPE_FIELDS (type)) { if (DECL_MODE (TYPE_FIELDS (type)) == DFmode && align < 64) @@ -17480,7 +17478,7 @@ ix86_data_alignment (tree type, unsigned int align, bool opt) if (ALIGN_MODE_128 (DECL_MODE (TYPE_FIELDS (type))) && align < 128) return 128; } - else if (TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == VECTOR_TYPE + else if (SCALAR_FLOAT_TYPE_P (type) || VECTOR_TYPE_P (type) || TREE_CODE (type) == INTEGER_TYPE) { if (TYPE_MODE (type) == DFmode && align < 64) @@ -17596,9 +17594,7 @@ ix86_local_alignment (tree exp, machine_mode mode, || TYPE_MODE (type) == TCmode) && align < 128) return 128; } - else if ((TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE) + else if (RECORD_OR_UNION_TYPE_P (type) && TYPE_FIELDS (type)) { if (DECL_MODE (TYPE_FIELDS (type)) == DFmode && align < 64) @@ -17606,7 +17602,7 @@ ix86_local_alignment (tree exp, machine_mode mode, if (ALIGN_MODE_128 (DECL_MODE (TYPE_FIELDS (type))) && align < 128) return 128; } - else if (TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == VECTOR_TYPE + else if (SCALAR_FLOAT_TYPE_P (type) || VECTOR_TYPE_P (type) || TREE_CODE (type) == INTEGER_TYPE) { @@ -23831,7 +23827,7 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, for 64-bit code), accept that SIMDLEN, otherwise warn and don't emit corresponding clone. */ tree ctype = ret_type; - if (TREE_CODE (ret_type) == VOID_TYPE) + if (VOID_TYPE_P (ret_type)) ctype = base_type; int cnt = GET_MODE_BITSIZE (TYPE_MODE (ctype)) * clonei->simdlen; if (SCALAR_INT_MODE_P (TYPE_MODE (ctype))) diff --git a/gcc/config/i386/winnt-cxx.cc b/gcc/config/i386/winnt-cxx.cc index 9982d986501..6306d830fcf 100644 --- a/gcc/config/i386/winnt-cxx.cc +++ b/gcc/config/i386/winnt-cxx.cc @@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see bool i386_pe_type_dllimport_p (tree decl) { - gcc_assert (TREE_CODE (decl) == VAR_DECL + gcc_assert (VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL); if (TARGET_NOP_FUN_DLLIMPORT && TREE_CODE (decl) == FUNCTION_DECL) @@ -54,7 +54,7 @@ i386_pe_type_dllimport_p (tree decl) bool i386_pe_type_dllexport_p (tree decl) { - gcc_assert (TREE_CODE (decl) == VAR_DECL + gcc_assert (VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL); /* Avoid exporting compiler-generated default dtors and copy ctors. @@ -118,7 +118,7 @@ i386_pe_adjust_class_at_definition (tree t) /* Check FUNCTION_DECL's and static VAR_DECL's. */ for (member = TYPE_FIELDS (t); member; member = DECL_CHAIN (member)) - if (TREE_CODE (member) == VAR_DECL) + if (VAR_P (member)) maybe_add_dllexport (member); else if (TREE_CODE (member) == FUNCTION_DECL) { @@ -134,7 +134,7 @@ i386_pe_adjust_class_at_definition (tree t) /* Check vtables */ for (member = CLASSTYPE_VTABLES (t); member; member = DECL_CHAIN (member)) - if (TREE_CODE (member) == VAR_DECL) + if (VAR_P (member)) maybe_add_dllexport (member); } @@ -150,7 +150,7 @@ i386_pe_adjust_class_at_definition (tree t) /* Check FUNCTION_DECL's and static VAR_DECL's. */ for (member = TYPE_FIELDS (t); member; member = DECL_CHAIN (member)) - if (TREE_CODE (member) == VAR_DECL) + if (VAR_P (member)) maybe_add_dllimport (member); else if (TREE_CODE (member) == FUNCTION_DECL) { @@ -166,7 +166,7 @@ i386_pe_adjust_class_at_definition (tree t) /* Check vtables */ for (member = CLASSTYPE_VTABLES (t); member; member = DECL_CHAIN (member)) - if (TREE_CODE (member) == VAR_DECL) + if (VAR_P (member)) maybe_add_dllimport (member); /* We leave typeinfo tables alone. We can't mark TI objects as diff --git a/gcc/config/i386/winnt.cc b/gcc/config/i386/winnt.cc index 6b64eca3316..83a21c67704 100644 --- a/gcc/config/i386/winnt.cc +++ b/gcc/config/i386/winnt.cc @@ -147,7 +147,7 @@ i386_pe_determine_dllimport_p (tree decl) out-of-class definition of static data. */ assoc = associated_type (decl); if (assoc && lookup_attribute ("dllimport", TYPE_ATTRIBUTES (assoc)) - && TREE_CODE (decl) == VAR_DECL + && VAR_P (decl) && TREE_STATIC (decl) && TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl) /* vtable's are linkonce constants, so defining a vtable is not @@ -335,7 +335,7 @@ i386_pe_encode_section_info (tree decl, rtx rtl, int first) bool i386_pe_binds_local_p (const_tree exp) { - if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL) + if ((VAR_P (exp) || TREE_CODE (exp) == FUNCTION_DECL) && DECL_DLLIMPORT_P (exp)) return false; @@ -459,7 +459,7 @@ i386_pe_section_type_flags (tree decl, const char *, int reloc) { flags = SECTION_WRITE; - if (decl && TREE_CODE (decl) == VAR_DECL + if (decl && VAR_P (decl) && lookup_attribute ("shared", DECL_ATTRIBUTES (decl))) flags |= SECTION_PE_SHARED; } diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc index f32efb3bd80..92f34dd1ee7 100644 --- a/gcc/config/ia64/ia64.cc +++ b/gcc/config/ia64/ia64.cc @@ -873,7 +873,7 @@ ia64_encode_section_info (tree decl, rtx rtl, int first) default_encode_section_info (decl, rtl, first); /* Careful not to prod global register variables. */ - if (TREE_CODE (decl) == VAR_DECL + if (VAR_P (decl) && GET_CODE (DECL_RTL (decl)) == MEM && GET_CODE (XEXP (DECL_RTL (decl), 0)) == SYMBOL_REF && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) @@ -5156,7 +5156,7 @@ ia64_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, the next even boundary. Integer and floating point arguments do so if they are larger than 8 bytes, whether or not they are also aligned larger than 8 bytes. */ - if ((TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == INTEGER_TYPE) + if ((SCALAR_FLOAT_TYPE_P (type) || TREE_CODE (type) == INTEGER_TYPE) ? int_size_in_bytes (type) > 8 : TYPE_ALIGN (type) > 8 * BITS_PER_UNIT) { tree t = fold_build_pointer_plus_hwi (valist, 2 * UNITS_PER_WORD - 1); @@ -10003,7 +10003,7 @@ ia64_in_small_data_p (const_tree exp) if (TREE_CODE (exp) == FUNCTION_DECL) return false; - if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) + if (VAR_P (exp) && DECL_SECTION_NAME (exp)) { const char *section = DECL_SECTION_NAME (exp); diff --git a/gcc/config/iq2000/iq2000.cc b/gcc/config/iq2000/iq2000.cc index 067154a0a0d..733fecac2b7 100644 --- a/gcc/config/iq2000/iq2000.cc +++ b/gcc/config/iq2000/iq2000.cc @@ -1226,9 +1226,7 @@ iq2000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) int bias = 0; unsigned int *arg_words = &cum->arg_words; int struct_p = (type != 0 - && (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE)); + && RECORD_OR_UNION_TYPE_P (type)); if (TARGET_DEBUG_D_MODE) { @@ -1304,7 +1302,7 @@ iq2000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) if (TREE_CODE (field) == FIELD_DECL - && TREE_CODE (TREE_TYPE (field)) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (field)) && TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD && tree_fits_shwi_p (bit_position (field)) && int_bit_position (field) % BITS_PER_WORD == 0) @@ -1346,7 +1344,7 @@ iq2000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) if (field && int_bit_position (field) == bitpos - && TREE_CODE (TREE_TYPE (field)) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (field)) && TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD) reg = gen_rtx_REG (DFmode, regno++); else diff --git a/gcc/config/lm32/lm32.cc b/gcc/config/lm32/lm32.cc index 37a6eb86da0..6528358009d 100644 --- a/gcc/config/lm32/lm32.cc +++ b/gcc/config/lm32/lm32.cc @@ -787,7 +787,7 @@ lm32_in_small_data_p (const_tree exp) if (TREE_CODE (exp) == FUNCTION_DECL) return false; - if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) + if (VAR_P (exp) && DECL_SECTION_NAME (exp)) { const char *section = DECL_SECTION_NAME (exp); if (strcmp (section, ".sdata") == 0 || strcmp (section, ".sbss") == 0) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 7f4e0e59573..eb73d11b869 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -6535,7 +6535,7 @@ loongarch_handle_model_attribute (tree *node, tree name, tree arg, int, bool *no_add_attrs) { tree decl = *node; - if (TREE_CODE (decl) == VAR_DECL) + if (VAR_P (decl)) { if (DECL_THREAD_LOCAL_P (decl)) { diff --git a/gcc/config/m32c/m32c.cc b/gcc/config/m32c/m32c.cc index e0d06f833d3..65971d62990 100644 --- a/gcc/config/m32c/m32c.cc +++ b/gcc/config/m32c/m32c.cc @@ -3027,7 +3027,7 @@ m32c_insert_attributes (tree node ATTRIBUTE_UNUSED, unsigned addr; /* See if we need to make #pragma address variables volatile. */ - if (TREE_CODE (node) == VAR_DECL) + if (VAR_P (node)) { const char *name = IDENTIFIER_POINTER (DECL_NAME (node)); if (m32c_get_pragma_address (name, &addr)) diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc index e800af78e14..92e7f960f75 100644 --- a/gcc/config/mcore/mcore.cc +++ b/gcc/config/mcore/mcore.cc @@ -2953,7 +2953,7 @@ mcore_mark_dllimport (tree decl) and that would be a good question. */ /* Imported variables can't be initialized. */ - if (TREE_CODE (decl) == VAR_DECL + if (VAR_P (decl) && !DECL_VIRTUAL_P (decl) && DECL_INITIAL (decl)) { @@ -2963,7 +2963,7 @@ mcore_mark_dllimport (tree decl) /* `extern' needn't be specified with dllimport. Specify `extern' now and hope for the best. Sigh. */ - if (TREE_CODE (decl) == VAR_DECL + if (VAR_P (decl) /* ??? Is this test for vtables needed? */ && !DECL_VIRTUAL_P (decl)) { @@ -3024,7 +3024,7 @@ mcore_encode_section_info (tree decl, rtx rtl ATTRIBUTE_UNUSED, int first ATTRIB a subsequent definition nullified that. The attribute is gone but DECL_RTL still has @i.__imp_foo. We need to remove that. */ else if ((TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == VAR_DECL) + || VAR_P (decl)) && DECL_RTL (decl) != NULL_RTX && GET_CODE (DECL_RTL (decl)) == MEM && GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc index ebe78304f89..cbabf1af712 100644 --- a/gcc/config/microblaze/microblaze.cc +++ b/gcc/config/microblaze/microblaze.cc @@ -3232,7 +3232,7 @@ microblaze_elf_in_small_data_p (const_tree decl) if (TREE_CODE (decl) == FUNCTION_DECL) return false; - if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl)) + if (VAR_P (decl) && DECL_SECTION_NAME (decl)) { const char *section = DECL_SECTION_NAME (decl); if (strcmp (section, ".sdata") == 0 diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index ca822758b41..ca491b981a3 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -9838,7 +9838,7 @@ mips_output_aligned_decl_common (FILE *stream, tree decl, const char *name, .rdata then don't put them in .comm. */ if (TARGET_EMBEDDED_DATA && TARGET_UNINIT_CONST_IN_RODATA - && TREE_CODE (decl) == VAR_DECL + && VAR_P (decl) && TREE_READONLY (decl) && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)) { diff --git a/gcc/config/mmix/mmix.cc b/gcc/config/mmix/mmix.cc index eda2959adb9..1d36306fdb6 100644 --- a/gcc/config/mmix/mmix.cc +++ b/gcc/config/mmix/mmix.cc @@ -1262,7 +1262,7 @@ static void mmix_encode_section_info (tree decl, rtx rtl, int first) { /* Test for an external declaration, and do nothing if it is one. */ - if ((TREE_CODE (decl) == VAR_DECL + if ((VAR_P (decl) && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))) || (TREE_CODE (decl) == FUNCTION_DECL && TREE_PUBLIC (decl))) ; @@ -1291,7 +1291,7 @@ mmix_encode_section_info (tree decl, rtx rtl, int first) For now, functions and things we know or have been told are constant. */ if (TREE_CODE (decl) == FUNCTION_DECL || TREE_CONSTANT (decl) - || (TREE_CODE (decl) == VAR_DECL + || (VAR_P (decl) && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl) && (!DECL_INITIAL (decl) diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc index 89349dae9e6..d76c0bbce2f 100644 --- a/gcc/config/nvptx/nvptx.cc +++ b/gcc/config/nvptx/nvptx.cc @@ -452,7 +452,7 @@ nvptx_encode_section_info (tree decl, rtx rtl, int first) if (TREE_CONSTANT (decl)) area = DATA_AREA_CONST; - else if (TREE_CODE (decl) == VAR_DECL) + else if (VAR_P (decl)) { if (lookup_attribute ("shared", DECL_ATTRIBUTES (decl))) { @@ -635,7 +635,7 @@ pass_in_memory (machine_mode mode, const_tree type, bool for_return) { if (AGGREGATE_TYPE_P (type)) return true; - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) return true; } @@ -6699,7 +6699,7 @@ nvptx_generate_vector_shuffle (location_t loc, if (TREE_CODE (var_type) == COMPLEX_TYPE) var_type = TREE_TYPE (var_type); - if (TREE_CODE (var_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (var_type)) code = VIEW_CONVERT_EXPR; if (TYPE_SIZE (var_type) @@ -6789,7 +6789,7 @@ nvptx_lockless_update (location_t loc, gimple_stmt_iterator *gsi, tree var_type = TREE_TYPE (var); if (TREE_CODE (var_type) == COMPLEX_TYPE - || TREE_CODE (var_type) == REAL_TYPE) + || SCALAR_FLOAT_TYPE_P (var_type)) code = VIEW_CONVERT_EXPR; if (TYPE_SIZE (var_type) == TYPE_SIZE (long_long_unsigned_type_node)) diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc index db633b275e5..0fa9e5fd632 100644 --- a/gcc/config/pa/pa.cc +++ b/gcc/config/pa/pa.cc @@ -6387,7 +6387,7 @@ pa_function_arg_padding (machine_mode mode, const_tree type) && type && (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE - || TREE_CODE (type) == VECTOR_TYPE))) + || VECTOR_TYPE_P (type)))) { /* Return PAD_NONE if justification is not required. */ if (type @@ -9660,7 +9660,7 @@ pa_function_value (const_tree valtype, if (AGGREGATE_TYPE_P (valtype) || TREE_CODE (valtype) == COMPLEX_TYPE - || TREE_CODE (valtype) == VECTOR_TYPE) + || VECTOR_TYPE_P (valtype)) { HOST_WIDE_INT valsize = int_size_in_bytes (valtype); @@ -9709,7 +9709,7 @@ pa_function_value (const_tree valtype, else valmode = TYPE_MODE (valtype); - if (TREE_CODE (valtype) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (valtype) && !AGGREGATE_TYPE_P (valtype) && TYPE_MODE (valtype) != TFmode && !TARGET_SOFT_FLOAT) @@ -9828,7 +9828,7 @@ pa_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) || mode == BLKmode || (type && (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE - || TREE_CODE (type) == VECTOR_TYPE))) + || VECTOR_TYPE_P (type)))) { /* Double-extended precision (80-bit), quad-precision (128-bit) and aggregates including complex numbers are aligned on @@ -9888,7 +9888,7 @@ pa_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) if (mode == BLKmode || (type && (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE - || TREE_CODE (type) == VECTOR_TYPE))) + || VECTOR_TYPE_P (type)))) { rtx loc = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_REG (DImode, gpr_reg_base), diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 6e29be282ad..e65af522966 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -930,7 +930,7 @@ do { \ /* Return a nonzero value if DECL has a section attribute. */ #define IN_NAMED_SECTION_P(DECL) \ - ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \ + ((TREE_CODE (DECL) == FUNCTION_DECL || VAR_P (DECL)) \ && DECL_SECTION_NAME (DECL) != NULL) /* Define this macro if references to a symbol must be treated @@ -952,7 +952,7 @@ do { \ #define TEXT_SPACE_P(DECL)\ (TREE_CODE (DECL) == FUNCTION_DECL \ - || (TREE_CODE (DECL) == VAR_DECL \ + || (VAR_P (DECL) \ && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL) \ && (! DECL_INITIAL (DECL) || ! pa_reloc_needed (DECL_INITIAL (DECL))) \ && !flag_pic) \ diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index eaa0ee31105..5999aa37b2a 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -287,7 +287,7 @@ do { \ initialized variables and functions. */ #define MAKE_DECL_ONE_ONLY(DECL) \ do { \ - if (TREE_CODE (DECL) == VAR_DECL \ + if (VAR_P (DECL) \ && (DECL_INITIAL (DECL) == 0 \ || DECL_INITIAL (DECL) == error_mark_node)) \ DECL_COMMON (DECL) = 1; \ diff --git a/gcc/config/pdp11/pdp11.cc b/gcc/config/pdp11/pdp11.cc index 4af26f8cd70..f6dd841f184 100644 --- a/gcc/config/pdp11/pdp11.cc +++ b/gcc/config/pdp11/pdp11.cc @@ -1881,7 +1881,7 @@ pdp11_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) in registers. The rest go into memory. */ return (TYPE_MODE (type) == DImode || (FLOAT_MODE_P (TYPE_MODE (type)) && ! TARGET_AC0) - || TREE_CODE (type) == VECTOR_TYPE + || VECTOR_TYPE_P (type) || COMPLEX_MODE_P (TYPE_MODE (type))); } diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 8684271f8ac..c3e6d5f5cd6 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -4704,7 +4704,7 @@ riscv_in_small_data_p (const_tree x) if (TREE_CODE (x) == STRING_CST || TREE_CODE (x) == FUNCTION_DECL) return false; - if (TREE_CODE (x) == VAR_DECL && DECL_SECTION_NAME (x)) + if (VAR_P (x) && DECL_SECTION_NAME (x)) { const char *sec = DECL_SECTION_NAME (x); return strcmp (sec, ".sdata") == 0 || strcmp (sec, ".sbss") == 0; @@ -7014,7 +7014,7 @@ static const char * riscv_mangle_type (const_tree type) { /* Half-precision float, _Float16 is "DF16_". */ - if (TREE_CODE (type) == REAL_TYPE && TYPE_PRECISION (type) == 16) + if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16) return "DF16_"; /* Mangle all vector type for vector extension. */ diff --git a/gcc/config/rl78/rl78.cc b/gcc/config/rl78/rl78.cc index 7ed28d35883..9083096c4ae 100644 --- a/gcc/config/rl78/rl78.cc +++ b/gcc/config/rl78/rl78.cc @@ -4724,7 +4724,7 @@ static void rl78_insert_attributes (tree decl, tree *attributes ATTRIBUTE_UNUSED) { if (TARGET_ES0 - && TREE_CODE (decl) == VAR_DECL + && VAR_P (decl) && TREE_READONLY (decl) && TREE_ADDRESSABLE (decl) && TYPE_ADDR_SPACE (TREE_TYPE (decl)) == ADDR_SPACE_GENERIC) @@ -4880,7 +4880,7 @@ rl78_addsi3_internal (rtx * operands, unsigned int alternative) this address. So we can skip adding in the high bytes. */ if (TARGET_ES0 && GET_CODE (operands[2]) == SYMBOL_REF - && TREE_CODE (SYMBOL_REF_DECL (operands[2])) == VAR_DECL + && VAR_P (SYMBOL_REF_DECL (operands[2])) && TREE_READONLY (SYMBOL_REF_DECL (operands[2])) && ! TREE_SIDE_EFFECTS (SYMBOL_REF_DECL (operands[2]))) return "movw ax, %h1\n\taddw ax, %h2\n\tmovw %h0, ax"; diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index 69db93ef47b..7b01ba9dc5b 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -228,9 +228,7 @@ /* AIX increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ - ((TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + (RECORD_OR_UNION_TYPE_P (STRUCT) \ && TARGET_ALIGN_NATURAL == 0 \ ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ : MAX ((COMPUTED), (SPECIFIED))) diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 4d5d6f6d5a8..bf9dfaf2f34 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -427,12 +427,10 @@ /* Darwin increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ - ((TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + (RECORD_OR_UNION_TYPE_P (STRUCT) \ && TARGET_ALIGN_NATURAL == 0 \ ? darwin_rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ - : (TREE_CODE (STRUCT) == VECTOR_TYPE \ + : (VECTOR_TYPE_P (STRUCT) \ && ALTIVEC_VECTOR_MODE (TYPE_MODE (STRUCT))) \ ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \ : MAX ((COMPUTED), (SPECIFIED))) diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h index 111aa14bf9d..918d6c2ce5a 100644 --- a/gcc/config/rs6000/freebsd64.h +++ b/gcc/config/rs6000/freebsd64.h @@ -140,9 +140,7 @@ extern int dot_symbols; #undef ROUND_TYPE_ALIGN #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ ((TARGET_64BIT \ - && (TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + && RECORD_OR_UNION_TYPE_P (STRUCT) \ && TARGET_ALIGN_NATURAL == 0) \ ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ : MAX ((COMPUTED), (SPECIFIED))) diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 6e4acaf00c2..98b7255c95f 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -224,9 +224,7 @@ extern int dot_symbols; #undef ROUND_TYPE_ALIGN #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ ((TARGET_64BIT \ - && (TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + && RECORD_OR_UNION_TYPE_P (STRUCT) \ && TARGET_ALIGN_NATURAL == 0) \ ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ : MAX ((COMPUTED), (SPECIFIED))) diff --git a/gcc/config/rs6000/rs6000-call.cc b/gcc/config/rs6000/rs6000-call.cc index 214613e083e..5384c10b986 100644 --- a/gcc/config/rs6000/rs6000-call.cc +++ b/gcc/config/rs6000/rs6000-call.cc @@ -826,12 +826,12 @@ rs6000_function_arg_boundary (machine_mode mode, const_tree type) return 64; else if (FLOAT128_VECTOR_P (mode)) return 128; - else if (type && TREE_CODE (type) == VECTOR_TYPE + else if (type && VECTOR_TYPE_P (type) && int_size_in_bytes (type) >= 8 && int_size_in_bytes (type) < 16) return 64; else if (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode) - || (type && TREE_CODE (type) == VECTOR_TYPE + || (type && VECTOR_TYPE_P (type) && int_size_in_bytes (type) >= 16)) return 128; @@ -1094,7 +1094,7 @@ rs6000_function_arg_advance_1 (CUMULATIVE_ARGS *cum, machine_mode mode, if (TARGET_ALTIVEC_ABI && (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode) - || (type && TREE_CODE (type) == VECTOR_TYPE + || (type && VECTOR_TYPE_P (type) && int_size_in_bytes (type) == 16))) { bool stack = false; @@ -1699,7 +1699,7 @@ rs6000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) } else if (TARGET_ALTIVEC_ABI && (ALTIVEC_OR_VSX_VECTOR_MODE (mode) - || (type && TREE_CODE (type) == VECTOR_TYPE + || (type && VECTOR_TYPE_P (type) && int_size_in_bytes (type) == 16))) { if (named || abi == ABI_V4) @@ -2017,7 +2017,7 @@ rs6000_pass_by_reference (cumulative_args_t, const function_arg_info &arg) } /* Pass synthetic vectors in memory. */ - if (TREE_CODE (arg.type) == VECTOR_TYPE + if (VECTOR_TYPE_P (arg.type) && int_size_in_bytes (arg.type) > (TARGET_ALTIVEC_ABI ? 16 : 8)) { static bool warned_for_pass_big_vectors = false; diff --git a/gcc/config/rs6000/rs6000-logue.cc b/gcc/config/rs6000/rs6000-logue.cc index d6c9c6e5b52..bc6b153b59f 100644 --- a/gcc/config/rs6000/rs6000-logue.cc +++ b/gcc/config/rs6000/rs6000-logue.cc @@ -1171,12 +1171,12 @@ rs6000_function_ok_for_sibcall (tree decl, tree exp) prototype, so the argument type info must be available here. */ FOREACH_FUNCTION_ARGS(fntype, type, args_iter) - if (TREE_CODE (type) == VECTOR_TYPE + if (VECTOR_TYPE_P (type) && ALTIVEC_OR_VSX_VECTOR_MODE (TYPE_MODE (type))) nvreg++; FOREACH_FUNCTION_ARGS(TREE_TYPE (current_function_decl), type, args_iter) - if (TREE_CODE (type) == VECTOR_TYPE + if (VECTOR_TYPE_P (type) && ALTIVEC_OR_VSX_VECTOR_MODE (TYPE_MODE (type))) nvreg--; diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 3f129ea37d2..29ed0da6e20 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -8059,7 +8059,7 @@ rs6000_data_alignment (tree type, unsigned int align, enum data_align how) { if (how != align_opt) { - if (TREE_CODE (type) == VECTOR_TYPE && align < 128) + if (VECTOR_TYPE_P (type) && align < 128) align = 128; } @@ -20397,8 +20397,7 @@ static void rs6000_set_default_type_attributes (tree type) { if (rs6000_default_long_calls - && (TREE_CODE (type) == FUNCTION_TYPE - || TREE_CODE (type) == METHOD_TYPE)) + && FUNC_OR_METHOD_TYPE_P (type)) TYPE_ATTRIBUTES (type) = tree_cons (get_identifier ("longcall"), NULL_TREE, TYPE_ATTRIBUTES (type)); @@ -20640,7 +20639,7 @@ rs6000_elf_in_small_data_p (const_tree decl) if (TREE_CODE (decl) == FUNCTION_DECL) return false; - if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl)) + if (VAR_P (decl) && DECL_SECTION_NAME (decl)) { const char *section = DECL_SECTION_NAME (decl); if (compare_section_name (section, ".sdata") @@ -21364,7 +21363,7 @@ rs6000_xcoff_asm_named_section (const char *name, unsigned int flags, } #define IN_NAMED_SECTION(DECL) \ - ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \ + ((TREE_CODE (DECL) == FUNCTION_DECL || VAR_P (DECL)) \ && DECL_SECTION_NAME (DECL) != NULL) static section * @@ -21855,7 +21854,7 @@ rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first) flags = SYMBOL_REF_FLAGS (symbol); - if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl)) + if (VAR_P (decl) && DECL_THREAD_LOCAL_P (decl)) flags &= ~SYMBOL_FLAG_HAS_BLOCK_INFO; SYMBOL_REF_FLAGS (symbol) = flags; @@ -23736,7 +23735,7 @@ rs6000_function_value (const_tree valtype, /* VSX is a superset of Altivec and adds V2DImode/V2DFmode. Since the same return register is used in both cases, and we won't see V2DImode/V2DFmode for pure altivec, combine the two cases. */ - else if ((TREE_CODE (valtype) == VECTOR_TYPE || VECTOR_ALIGNMENT_P (mode)) + else if ((VECTOR_TYPE_P (valtype) || VECTOR_ALIGNMENT_P (mode)) && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI && ALTIVEC_OR_VSX_VECTOR_MODE (mode)) regno = ALTIVEC_ARG_RETURN; @@ -24116,7 +24115,7 @@ invalid_arg_for_unprototyped_fn (const_tree typelist, const_tree funcdecl, const { return (!rs6000_darwin64_abi && typelist == 0 - && TREE_CODE (TREE_TYPE (val)) == VECTOR_TYPE + && VECTOR_TYPE_P (TREE_TYPE (val)) && (funcdecl == NULL_TREE || (TREE_CODE (funcdecl) == FUNCTION_DECL && DECL_BUILT_IN_CLASS (funcdecl) != BUILT_IN_MD))) diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc index 56e77b69993..269f4f8e978 100644 --- a/gcc/config/s390/s390-c.cc +++ b/gcc/config/s390/s390-c.cc @@ -781,7 +781,7 @@ s390_fn_types_compatible (enum s390_builtin_ov_type_index typeindex, tree in_arg = (*arglist)[i]; tree in_type = TREE_TYPE (in_arg); - if (TREE_CODE (b_arg_type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (b_arg_type)) { /* Vector types have to match precisely. */ if (b_arg_type != in_type @@ -854,7 +854,7 @@ s390_vec_n_elem (tree fndecl) tree b_arg_chain; int n_elem = -1; - if (TREE_CODE (TREE_TYPE (TREE_TYPE (fndecl))) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))) n_elem = TYPE_VECTOR_SUBPARTS (TREE_TYPE (TREE_TYPE ((fndecl)))); for (b_arg_chain = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index 505de995da8..4fb4c45c497 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -604,7 +604,7 @@ s390_check_type_for_vector_abi (const_tree type, bool arg_p, bool in_struct_p) true here. */ s390_check_type_for_vector_abi (TREE_TYPE (type), arg_p, in_struct_p); } - else if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (type)) { tree arg_chain; @@ -12515,7 +12515,7 @@ s390_function_arg_integer (machine_mode mode, const_tree type) || POINTER_TYPE_P (type) || TREE_CODE (type) == NULLPTR_TYPE || TREE_CODE (type) == OFFSET_TYPE - || (TARGET_SOFT_FLOAT && TREE_CODE (type) == REAL_TYPE)) + || (TARGET_SOFT_FLOAT && SCALAR_FLOAT_TYPE_P (type))) return true; /* We also accept structs of size 1, 2, 4, 8 that are not @@ -12684,7 +12684,7 @@ s390_return_in_memory (const_tree type, const_tree fundecl ATTRIBUTE_UNUSED) if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type) || TREE_CODE (type) == OFFSET_TYPE - || TREE_CODE (type) == REAL_TYPE) + || SCALAR_FLOAT_TYPE_P (type)) return int_size_in_bytes (type) > 8; /* vector types which fit into a VR. */ @@ -13451,7 +13451,7 @@ s390_encode_section_info (tree decl, rtx rtl, int first) { default_encode_section_info (decl, rtl, first); - if (TREE_CODE (decl) == VAR_DECL) + if (VAR_P (decl)) { /* Store the alignment to be able to check if we can use a larl/load-relative instruction. We only handle the cases diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc index cf6188bd19d..938f7aa6281 100644 --- a/gcc/config/sh/sh.cc +++ b/gcc/config/sh/sh.cc @@ -7697,7 +7697,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, eff_type = type; while (TREE_CODE (eff_type) == RECORD_TYPE && (member = find_sole_member (eff_type)) - && (TREE_CODE (TREE_TYPE (member)) == REAL_TYPE + && (SCALAR_FLOAT_TYPE_P (TREE_TYPE (member)) || TREE_CODE (TREE_TYPE (member)) == COMPLEX_TYPE || TREE_CODE (TREE_TYPE (member)) == RECORD_TYPE)) { @@ -7718,14 +7718,14 @@ sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, bool pass_as_float; if (TARGET_FPU_DOUBLE) { - pass_as_float = ((TREE_CODE (eff_type) == REAL_TYPE && size <= 8) + pass_as_float = ((SCALAR_FLOAT_TYPE_P (eff_type) && size <= 8) || (TREE_CODE (eff_type) == COMPLEX_TYPE - && TREE_CODE (TREE_TYPE (eff_type)) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (eff_type)) && size <= 16)); } else { - pass_as_float = (TREE_CODE (eff_type) == REAL_TYPE && size == 4); + pass_as_float = (SCALAR_FLOAT_TYPE_P (eff_type) && size == 4); } addr = create_tmp_var (pptr_type_node); @@ -7738,7 +7738,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, { tree next_fp_tmp = create_tmp_var (TREE_TYPE (f_next_fp)); tree cmp; - bool is_double = size == 8 && TREE_CODE (eff_type) == REAL_TYPE; + bool is_double = size == 8 && SCALAR_FLOAT_TYPE_P (eff_type); tmp = build1 (ADDR_EXPR, pptr_type_node, unshare_expr (next_fp)); gimplify_assign (unshare_expr (addr), tmp, pre_p); @@ -8139,7 +8139,7 @@ sh_function_value (const_tree valtype, && (TREE_CODE (valtype) == INTEGER_TYPE || TREE_CODE (valtype) == ENUMERAL_TYPE || TREE_CODE (valtype) == BOOLEAN_TYPE - || TREE_CODE (valtype) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (valtype) || TREE_CODE (valtype) == OFFSET_TYPE)) && sh_promote_prototypes (fn_decl_or_type) ? SImode : TYPE_MODE (valtype)), diff --git a/gcc/config/sol2.cc b/gcc/config/sol2.cc index 78b780a41c0..25f62beec13 100644 --- a/gcc/config/sol2.cc +++ b/gcc/config/sol2.cc @@ -46,7 +46,7 @@ solaris_insert_attributes (tree decl, tree *attributes) { tree *x, next; - if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL) + if (solaris_pending_aligns != NULL && VAR_P (decl)) for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x)) { tree name = TREE_PURPOSE (*x); diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc index 8c0c9dce971..0aade05faf5 100644 --- a/gcc/config/sparc/sparc.cc +++ b/gcc/config/sparc/sparc.cc @@ -6904,7 +6904,7 @@ function_arg_slotno (const struct sparc_args *cum, machine_mode mode, their mode, depending upon whether VIS instructions are enabled. */ if (type && VECTOR_TYPE_P (type)) { - if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (type))) { /* The SPARC port defines no floating-point vector modes. */ gcc_assert (mode == BLKmode); diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index c34f2f53b39..2d45437f5a2 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -551,9 +551,7 @@ along with GCC; see the file COPYING3. If not see the smaller of COMPUTED and `BIGGEST_ALIGNMENT' */ #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ (TARGET_FASTER_STRUCTS ? \ - ((TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + (RECORD_OR_UNION_TYPE_P (STRUCT) \ && TYPE_FIELDS (STRUCT) != 0 \ ? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \ : MAX ((COMPUTED), (SPECIFIED))) \ diff --git a/gcc/config/stormy16/stormy16.cc b/gcc/config/stormy16/stormy16.cc index 81b32dbc958..cd453c2a2f7 100644 --- a/gcc/config/stormy16/stormy16.cc +++ b/gcc/config/stormy16/stormy16.cc @@ -1756,7 +1756,7 @@ xstormy16_encode_section_info (tree decl, rtx r, int first) { default_encode_section_info (decl, r, first); - if (TREE_CODE (decl) == VAR_DECL + if (VAR_P (decl) && (lookup_attribute ("below100", DECL_ATTRIBUTES (decl)) || lookup_attribute ("BELOW100", DECL_ATTRIBUTES (decl)))) { @@ -2427,7 +2427,7 @@ xstormy16_handle_below100_attribute (tree *node, "%<__BELOW100__%> attribute only applies to variables"); *no_add_attrs = true; } - else if (args == NULL_TREE && TREE_CODE (*node) == VAR_DECL) + else if (args == NULL_TREE && VAR_P (*node)) { if (! (TREE_PUBLIC (*node) || TREE_STATIC (*node))) { diff --git a/gcc/config/v850/v850.cc b/gcc/config/v850/v850.cc index 367ba033d66..0fb72716b17 100644 --- a/gcc/config/v850/v850.cc +++ b/gcc/config/v850/v850.cc @@ -2161,7 +2161,7 @@ v850_encode_section_info (tree decl, rtx rtl, int first) { default_encode_section_info (decl, rtl, first); - if (TREE_CODE (decl) == VAR_DECL + if (VAR_P (decl) && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) v850_encode_data_area (decl, XEXP (rtl, 0)); } @@ -2482,7 +2482,7 @@ v850_insert_attributes (tree decl, tree * attr_ptr ATTRIBUTE_UNUSED ) if (data_area_stack && data_area_stack->data_area && current_function_decl == NULL_TREE - && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL) + && (VAR_P (decl) || TREE_CODE (decl) == CONST_DECL) && v850_get_data_area (decl) == DATA_AREA_NORMAL) v850_set_data_area (decl, data_area_stack->data_area); @@ -2508,7 +2508,7 @@ v850_insert_attributes (tree decl, tree * attr_ptr ATTRIBUTE_UNUSED ) } if (current_function_decl == NULL_TREE - && (TREE_CODE (decl) == VAR_DECL + && (VAR_P (decl) || TREE_CODE (decl) == CONST_DECL || TREE_CODE (decl) == FUNCTION_DECL) && (!DECL_EXTERNAL (decl) || DECL_INITIAL (decl)) diff --git a/gcc/config/visium/visium.cc b/gcc/config/visium/visium.cc index ec4c2e9ae5c..48a61744db6 100644 --- a/gcc/config/visium/visium.cc +++ b/gcc/config/visium/visium.cc @@ -1313,7 +1313,7 @@ static bool visium_pass_by_reference (cumulative_args_t, const function_arg_info &arg) { tree type = arg.type; - return type && (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == VECTOR_TYPE); + return type && (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)); } /* Define how arguments are passed. @@ -1409,7 +1409,7 @@ visium_function_arg_advance (cumulative_args_t pcum_v, static bool visium_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) { - return (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == VECTOR_TYPE); + return (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)); } /* Define how scalar values are returned. */ diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index 9e5d314e143..bb1444c44b6 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -4287,7 +4287,7 @@ xtensa_multibss_section_type_flags (tree decl, const char *name, int reloc) suffix = strrchr (name, '.'); if (suffix && strcmp (suffix, ".bss") == 0) { - if (!decl || (TREE_CODE (decl) == VAR_DECL + if (!decl || (VAR_P (decl) && DECL_INITIAL (decl) == NULL_TREE)) flags |= SECTION_BSS; /* @nobits */ else From patchwork Sat May 13 23:23:11 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: 69308 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C13F3382A2EA for ; Sat, 13 May 2023 23:26:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C13F3382A2EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020394; bh=yLu0kXyAOJJ1pQ25ErBb/1cLOiZ7g6j2yLFhlKUKbdw=; 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=PE06J/p0n8paLgQG6sqt1bBIQi4lcVi5930fSyQQmcEwpgygnpIJMzmBrS2HnlAwh t6Bnh2vTOMOBD3484wACXYyozq8nLlY/bhrqNhxmxDkZ4uP1Lr6lm395PqvWCBIgth CYw6yG+mLKBpjMARa89Omvw73F3SkiY7nYTa+JbI= 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 ACB5E3858416; Sat, 13 May 2023 23:23:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACB5E3858416 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-50bcae898b2so20000775a12.0; Sat, 13 May 2023 16:23:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020235; x=1686612235; 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=yLu0kXyAOJJ1pQ25ErBb/1cLOiZ7g6j2yLFhlKUKbdw=; b=X+1z65aWdJoxIlUsn5X0sKwyhUJTk2mMsbhQz0BM4mEaYc7MMXGz39bwad7IAVklqA 8GAhrGb5T1uu5rE0X9trDzmQJkzgJEUW2h7ji0bC5VzcDx1HIqPjSS3udbWGd6xgxMUw yEfpsZojmc9LVijBRkpVem0+Im18Iyhx4UWg2FIuWChd01uh3oWB7rFgr2fl5sJ6mdI1 XeXoCsA4BQYgScuerq3AdNnU691D4mg0JavXI2sAr2F7OCSBr7v4ZPhCYEBx+JyKihZ7 Z3qk9O/waWcGBPwf8dYpB7zCEU4RBWThrdxTn+Rag4VekhBsLen5iEdCc4Y3tTY39afp OZ7g== X-Gm-Message-State: AC+VfDwyQUxe4rSGKfFaJrjeE0OyF//HzVBxtJp30EZ5em51PqQB2ALW al5RtKMnxx/Z/83wauYqbiCmwYmugPM= X-Google-Smtp-Source: ACHHUZ7VzZU/7QBHLarzoj8LANyMtF/NAjBWIh/92YmGXoH48EpMhMdrDIf3x2R6qgcBkWTqMAeq1g== X-Received: by 2002:a17:907:789:b0:965:fd71:f1d6 with SMTP id xd9-20020a170907078900b00965fd71f1d6mr24138547ejb.16.1684020234637; Sat, 13 May 2023 16:23:54 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id la17-20020a170907781100b00957dad777c1sm7311606ejc.107.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001AmT-00; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 04/14] c++: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:11 +0200 Message-Id: <20230513232321.279733-5-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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/cp/ChangeLog: * call.cc (promoted_arithmetic_type_p): Use _P defines from tree.h. (build_conditional_expr): Ditto. (convert_like_internal): Ditto. (convert_arg_to_ellipsis): Ditto. (build_over_call): Ditto. (compare_ics): Ditto. * class.cc (is_empty_base_ref): Ditto. * coroutines.cc (rewrite_param_uses): Ditto. * cp-tree.h (DECL_DISCRIMINATOR_P): Ditto. (ARITHMETIC_TYPE_P): Ditto. * cvt.cc (ocp_convert): Ditto. * cxx-pretty-print.cc (pp_cxx_template_argument_list): Ditto. * decl.cc (layout_var_decl): Ditto. (get_tuple_size): Ditto. * error.cc (dump_simple_decl): Ditto. * lambda.cc (start_lambda_scope): Ditto. * mangle.cc (write_template_arg): Ditto. * method.cc (spaceship_comp_cat): Ditto. * module.cc (node_template_info): Ditto. (trees_out::start): Ditto. (trees_out::decl_node): Ditto. (trees_in::read_var_def): Ditto. (set_instantiating_module): Ditto. * name-lookup.cc (maybe_record_mergeable_decl): Ditto. (consider_decl): Ditto. (maybe_add_fuzzy_decl): Ditto. * pt.cc (convert_nontype_argument): Ditto. * semantics.cc (handle_omp_array_sections_1): Ditto. (finish_omp_clauses): Ditto. (finish_omp_target_clauses_r): Ditto. (is_this_parameter): Ditto. * tree.cc (build_cplus_array_type): Ditto. (is_this_expression): Ditto. * typeck.cc (do_warn_enum_conversions): Ditto. * typeck2.cc (store_init_value): Ditto. (check_narrowing): Ditto. --- gcc/cp/call.cc | 42 +++++++++++++++++++------------------- gcc/cp/class.cc | 2 +- gcc/cp/coroutines.cc | 2 +- gcc/cp/cp-tree.h | 4 ++-- gcc/cp/cvt.cc | 2 +- gcc/cp/cxx-pretty-print.cc | 2 +- gcc/cp/decl.cc | 4 ++-- gcc/cp/error.cc | 2 +- gcc/cp/lambda.cc | 2 +- gcc/cp/mangle.cc | 2 +- gcc/cp/method.cc | 2 +- gcc/cp/module.cc | 12 +++++------ gcc/cp/name-lookup.cc | 6 +++--- gcc/cp/pt.cc | 2 +- gcc/cp/semantics.cc | 24 +++++++++++----------- gcc/cp/tree.cc | 4 ++-- gcc/cp/typeck.cc | 4 ++-- gcc/cp/typeck2.cc | 10 ++++----- 18 files changed, 64 insertions(+), 64 deletions(-) diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 2a06520c0c1..6e13d17f6b8 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -2746,7 +2746,7 @@ promoted_arithmetic_type_p (tree type) integral types plus floating types. */ return ((CP_INTEGRAL_TYPE_P (type) && same_type_p (type_promotes_to (type), type)) - || TREE_CODE (type) == REAL_TYPE); + || SCALAR_FLOAT_TYPE_P (type)); } /* Create any builtin operator overload candidates for the operator in @@ -5759,10 +5759,10 @@ build_conditional_expr (const op_location_t &loc, if ((TREE_CODE (arg2) == EXCESS_PRECISION_EXPR || TREE_CODE (arg3) == EXCESS_PRECISION_EXPR) && (TREE_CODE (arg2_type) == INTEGER_TYPE - || TREE_CODE (arg2_type) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (arg2_type) || TREE_CODE (arg2_type) == COMPLEX_TYPE) && (TREE_CODE (arg3_type) == INTEGER_TYPE - || TREE_CODE (arg3_type) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (arg3_type) || TREE_CODE (arg3_type) == COMPLEX_TYPE)) { semantic_result_type @@ -5775,8 +5775,8 @@ build_conditional_expr (const op_location_t &loc, t1 = TREE_TYPE (t1); if (TREE_CODE (t2) == COMPLEX_TYPE) t2 = TREE_TYPE (t2); - gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE - && TREE_CODE (t2) == REAL_TYPE + gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1) + && SCALAR_FLOAT_TYPE_P (t2) && (extended_float_type_p (t1) || extended_float_type_p (t2)) && cp_compare_floating_point_conversion_ranks @@ -6127,8 +6127,8 @@ build_conditional_expr (const op_location_t &loc, t1 = TREE_TYPE (t1); if (TREE_CODE (t2) == COMPLEX_TYPE) t2 = TREE_TYPE (t2); - gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE - && TREE_CODE (t2) == REAL_TYPE + gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1) + && SCALAR_FLOAT_TYPE_P (t2) && (extended_float_type_p (t1) || extended_float_type_p (t2)) && cp_compare_floating_point_conversion_ranks @@ -6147,8 +6147,8 @@ build_conditional_expr (const op_location_t &loc, t1 = TREE_TYPE (t1); if (TREE_CODE (t2) == COMPLEX_TYPE) t2 = TREE_TYPE (t2); - gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE - && TREE_CODE (t2) == REAL_TYPE + gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1) + && SCALAR_FLOAT_TYPE_P (t2) && (extended_float_type_p (t1) || extended_float_type_p (t2)) && cp_compare_floating_point_conversion_ranks @@ -6185,8 +6185,8 @@ build_conditional_expr (const op_location_t &loc, else if ((complain & tf_warning) && warn_deprecated_enum_float_conv && ((TREE_CODE (arg2_type) == ENUMERAL_TYPE - && TREE_CODE (arg3_type) == REAL_TYPE) - || (TREE_CODE (arg2_type) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (arg3_type)) + || (SCALAR_FLOAT_TYPE_P (arg2_type) && TREE_CODE (arg3_type) == ENUMERAL_TYPE))) { if (TREE_CODE (arg2_type) == ENUMERAL_TYPE) @@ -8321,8 +8321,8 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum, "direct-initialization", totype, TREE_TYPE (expr)); - if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE - && TREE_CODE (totype) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (expr)) + && SCALAR_FLOAT_TYPE_P (totype) && (extended_float_type_p (TREE_TYPE (expr)) || extended_float_type_p (totype))) switch (cp_compare_floating_point_conversion_ranks (TREE_TYPE (expr), @@ -8976,7 +8976,7 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain) type that is subject to the floating-point promotion (_conv.fpprom_), the value of the argument is converted to the promoted type before the call. */ - if (TREE_CODE (arg_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (arg_type) && (TYPE_PRECISION (arg_type) < TYPE_PRECISION (double_type_node)) && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (arg_type)) @@ -9798,7 +9798,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) obj_arg = NULL_TREE; } /* Look through *(const T *)&obj. */ - else if (obj_arg && TREE_CODE (obj_arg) == INDIRECT_REF) + else if (obj_arg && INDIRECT_REF_P (obj_arg)) { tree addr = TREE_OPERAND (obj_arg, 0); STRIP_NOPS (addr); @@ -10462,7 +10462,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) obj_arg = NULL_TREE; } /* Look through *(const T *)&obj. */ - else if (obj_arg && TREE_CODE (obj_arg) == INDIRECT_REF) + else if (obj_arg && INDIRECT_REF_P (obj_arg)) { tree addr = TREE_OPERAND (obj_arg, 0); STRIP_NOPS (addr); @@ -12199,7 +12199,7 @@ compare_ics (conversion *ics1, conversion *ics2) std::swap (fp3, t3); } if (TYPE_MAIN_VARIANT (fp1) == TYPE_MAIN_VARIANT (fp3) - && TREE_CODE (fp1) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (fp1) /* Only apply this rule if at least one of the 3 types is extended floating-point type, otherwise keep them as before for compatibility reasons with types like __float128. @@ -12207,15 +12207,15 @@ compare_ics (conversion *ics1, conversion *ics2) ranks and so when just those 3 types are involved, this rule doesn't trigger. */ && (extended_float_type_p (fp1) - || (TREE_CODE (fp2) == REAL_TYPE && extended_float_type_p (fp2)) - || (TREE_CODE (t3) == REAL_TYPE && extended_float_type_p (t3)))) + || (SCALAR_FLOAT_TYPE_P (fp2) && extended_float_type_p (fp2)) + || (SCALAR_FLOAT_TYPE_P (t3) && extended_float_type_p (t3)))) { if (TREE_CODE (fp2) != REAL_TYPE) { ret = -ret; std::swap (fp2, t3); } - if (TREE_CODE (fp2) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (fp2)) { /* cp_compare_floating_point_conversion_ranks returns -1, 0 or 1 if the conversion rank is equal (-1 or 1 if the subrank is @@ -12242,7 +12242,7 @@ compare_ics (conversion *ics1, conversion *ics2) FP1 <-> T3 conversion is better. */ return -ret; } - else if (TREE_CODE (t3) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (t3) && IN_RANGE (cp_compare_floating_point_conversion_ranks (fp1, t3), -1, 1)) diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index 68b62086340..bc84f4f731a 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -673,7 +673,7 @@ convert_to_base_statically (tree expr, tree base) bool is_empty_base_ref (tree expr) { - if (TREE_CODE (expr) == INDIRECT_REF) + if (INDIRECT_REF_P (expr)) expr = TREE_OPERAND (expr, 0); if (TREE_CODE (expr) != NOP_EXPR) return false; diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index 59a240ebd40..3493d3c6ed3 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -3780,7 +3780,7 @@ rewrite_param_uses (tree *stmt, int *do_subtree ATTRIBUTE_UNUSED, void *d) param_frame_data *data = (param_frame_data *) d; /* For lambda closure content, we have to look specifically. */ - if (TREE_CODE (*stmt) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*stmt)) + if (VAR_P (*stmt) && DECL_HAS_VALUE_EXPR_P (*stmt)) { tree t = DECL_VALUE_EXPR (*stmt); return cp_walk_tree (&t, rewrite_param_uses, d, NULL); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 714b6d55f4f..a1b882f11fe 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3189,7 +3189,7 @@ struct GTY(()) lang_decl { /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */ #define DECL_DISCRIMINATOR_P(NODE) \ - (((TREE_CODE (NODE) == VAR_DECL && TREE_STATIC (NODE)) \ + (((VAR_P (NODE) && TREE_STATIC (NODE)) \ || DECL_IMPLICIT_TYPEDEF_P (NODE)) \ && DECL_FUNCTION_SCOPE_P (NODE)) @@ -4453,7 +4453,7 @@ get_vec_init_expr (tree t) Keep these checks in ascending code order. */ #define ARITHMETIC_TYPE_P(TYPE) \ (CP_INTEGRAL_TYPE_P (TYPE) \ - || TREE_CODE (TYPE) == REAL_TYPE \ + || SCALAR_FLOAT_TYPE_P (TYPE) \ || TREE_CODE (TYPE) == COMPLEX_TYPE) /* [basic.types] diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc index 17827d06a4a..c6b52f07050 100644 --- a/gcc/cp/cvt.cc +++ b/gcc/cp/cvt.cc @@ -810,7 +810,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags, /* enum = enum, enum = int, enum = float, (enum)pointer are all errors. */ if (((INTEGRAL_OR_ENUMERATION_TYPE_P (intype) - || TREE_CODE (intype) == REAL_TYPE) + || SCALAR_FLOAT_TYPE_P (intype)) && ! (convtype & CONV_STATIC)) || TYPE_PTR_P (intype)) { diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc index 4b547c77ef4..909a9dc917f 100644 --- a/gcc/cp/cxx-pretty-print.cc +++ b/gcc/cp/cxx-pretty-print.cc @@ -1966,7 +1966,7 @@ pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t) if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL && TYPE_P (DECL_TEMPLATE_RESULT (arg)))) pp->type_id (arg); - else if (TREE_CODE (arg) == VAR_DECL && DECL_NTTP_OBJECT_P (arg)) + else if (VAR_P (arg) && DECL_NTTP_OBJECT_P (arg)) pp->expression (DECL_INITIAL (arg)); else pp->expression (arg); diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 23a2b2fef0b..a672e4844f1 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -6349,7 +6349,7 @@ layout_var_decl (tree decl) && !vec_safe_is_empty (CONSTRUCTOR_ELTS (DECL_INITIAL (decl))) && DECL_SIZE (decl) != NULL_TREE && TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST - && TYPE_SIZE (type) != NULL_TREE + && COMPLETE_TYPE_P (type) && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST && tree_int_cst_equal (DECL_SIZE (decl), TYPE_SIZE (type))) { @@ -8927,7 +8927,7 @@ get_tuple_size (tree type) return NULL_TREE; tree val = lookup_qualified_name (inst, value_identifier, LOOK_want::NORMAL, /*complain*/false); - if (TREE_CODE (val) == VAR_DECL || TREE_CODE (val) == CONST_DECL) + if (VAR_P (val) || TREE_CODE (val) == CONST_DECL) val = maybe_constant_value (val); if (TREE_CODE (val) == INTEGER_CST) return val; diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 9b967ce409d..31319aa9e87 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -1140,7 +1140,7 @@ dump_global_iord (cxx_pretty_printer *pp, tree t) static void dump_simple_decl (cxx_pretty_printer *pp, tree t, tree type, int flags) { - if (TREE_CODE (t) == VAR_DECL && DECL_NTTP_OBJECT_P (t)) + if (VAR_P (t) && DECL_NTTP_OBJECT_P (t)) return dump_expr (pp, DECL_INITIAL (t), flags); if (flags & TFF_DECL_SPECIFIERS) diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc index 9925209b2ed..a359bc6ee8d 100644 --- a/gcc/cp/lambda.cc +++ b/gcc/cp/lambda.cc @@ -1474,7 +1474,7 @@ void start_lambda_scope (tree decl) { gcc_checking_assert (decl); - if (current_function_decl && TREE_CODE (decl) == VAR_DECL) + if (current_function_decl && VAR_P (decl)) // If we're inside a function, we ignore variable scope. Don't push. lambda_scope.nesting++; else diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc index a235f23459d..826c5e76c1d 100644 --- a/gcc/cp/mangle.cc +++ b/gcc/cp/mangle.cc @@ -3793,7 +3793,7 @@ write_template_arg (tree node) } } - if (TREE_CODE (node) == VAR_DECL && DECL_NTTP_OBJECT_P (node)) + if (VAR_P (node) && DECL_NTTP_OBJECT_P (node)) /* We want to mangle the argument, not the var we stored it in. */ node = tparm_object_argument (node); diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc index 00eae56eb5b..cbcc7948b37 100644 --- a/gcc/cp/method.cc +++ b/gcc/cp/method.cc @@ -1048,7 +1048,7 @@ spaceship_comp_cat (tree optype) { if (INTEGRAL_OR_ENUMERATION_TYPE_P (optype) || TYPE_PTROBV_P (optype)) return cc_strong_ordering; - else if (TREE_CODE (optype) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (optype)) return cc_partial_ordering; /* ??? should vector <=> produce a vector of one of the above? */ diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index ac2fe66b080..ecde98d69b4 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -4042,7 +4042,7 @@ node_template_info (tree decl, int &use) } } else if (DECL_LANG_SPECIFIC (decl) - && (TREE_CODE (decl) == VAR_DECL + && (VAR_P (decl) || TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == FIELD_DECL @@ -5151,7 +5151,7 @@ trees_out::start (tree t, bool code_streamed) switch (TREE_CODE (t)) { default: - if (TREE_CODE_CLASS (TREE_CODE (t)) == tcc_vl_exp) + if (VL_EXP_CLASS_P (t)) u (VL_EXP_OPERAND_LENGTH (t)); break; @@ -8551,7 +8551,7 @@ trees_out::decl_node (tree decl, walk_kind ref) { tinfo: /* A typeinfo, tt_tinfo_typedef or tt_tinfo_var. */ - bool is_var = TREE_CODE (decl) == VAR_DECL; + bool is_var = VAR_P (decl); tree type = TREE_TYPE (decl); unsigned ix = get_pseudo_tinfo_index (type); if (streaming_p ()) @@ -8651,7 +8651,7 @@ trees_out::decl_node (tree decl, walk_kind ref) Mostly things that can be defined outside of their (original declaration) context. */ gcc_checking_assert (TREE_CODE (decl) == TEMPLATE_DECL - || TREE_CODE (decl) == VAR_DECL + || VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == USING_DECL @@ -11702,7 +11702,7 @@ bool trees_in::read_var_def (tree decl, tree maybe_template) { /* Do not mark the virtual table entries as used. */ - bool vtable = TREE_CODE (decl) == VAR_DECL && DECL_VTABLE_OR_VTT_P (decl); + bool vtable = VAR_P (decl) && DECL_VTABLE_OR_VTT_P (decl); unused += vtable; tree init = tree_node (); tree dyn_init = init ? NULL_TREE : tree_node (); @@ -18776,7 +18776,7 @@ void set_instantiating_module (tree decl) { gcc_assert (TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == VAR_DECL + || VAR_P (decl) || TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == CONCEPT_DECL || TREE_CODE (decl) == TEMPLATE_DECL diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index ad03141df43..eb5c333b5ea 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -3488,7 +3488,7 @@ maybe_record_mergeable_decl (tree *slot, tree name, tree decl) tree not_tmpl = STRIP_TEMPLATE (decl); if ((TREE_CODE (not_tmpl) == FUNCTION_DECL - || TREE_CODE (not_tmpl) == VAR_DECL) + || VAR_P (not_tmpl)) && DECL_THIS_STATIC (not_tmpl)) /* Internal linkage. */ return; @@ -6932,7 +6932,7 @@ consider_decl (tree decl, best_match &bm, { /* Skip compiler-generated variables (e.g. __for_begin/__for_end within range for). */ - if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)) + if (VAR_P (decl) && DECL_ARTIFICIAL (decl)) return; tree suggestion = DECL_NAME (decl); @@ -6967,7 +6967,7 @@ maybe_add_fuzzy_decl (auto_vec &vec, tree decl) { /* Skip compiler-generated variables (e.g. __for_begin/__for_end within range for). */ - if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)) + if (VAR_P (decl) && DECL_ARTIFICIAL (decl)) return false; tree suggestion = DECL_NAME (decl); diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 696df2bdd9f..16d658e3c6a 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -7487,7 +7487,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) integral promotions (_conv.prom_) and integral conversions (_conv.integral_) are applied. */ if (INTEGRAL_OR_ENUMERATION_TYPE_P (type) - || TREE_CODE (type) == REAL_TYPE) + || SCALAR_FLOAT_TYPE_P (type)) { if (cxx_dialect < cxx11) { diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 13c6582b628..05df6282302 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -5169,7 +5169,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec &types, && TREE_CODE (TREE_OPERAND (t, 0)) == COMPONENT_REF) t = TREE_OPERAND (t, 0); ret = t; - while (TREE_CODE (t) == INDIRECT_REF) + while (INDIRECT_REF_P (t)) { t = TREE_OPERAND (t, 0); STRIP_NOPS (t); @@ -5206,7 +5206,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec &types, } t = TREE_OPERAND (t, 0); while (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -8097,7 +8097,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) if (REFERENCE_REF_P (t)) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF) + || INDIRECT_REF_P (t)) { t = TREE_OPERAND (t, 0); STRIP_NOPS (t); @@ -8182,7 +8182,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH_DETACH) OMP_CLAUSE_DECL (c) = t; } - while (TREE_CODE (t) == INDIRECT_REF + while (INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -8201,7 +8201,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) remove = true; indir_component_ref_p = false; if (TREE_CODE (t) == COMPONENT_REF - && (TREE_CODE (TREE_OPERAND (t, 0)) == INDIRECT_REF + && (INDIRECT_REF_P (TREE_OPERAND (t, 0)) || TREE_CODE (TREE_OPERAND (t, 0)) == ARRAY_REF)) { t = TREE_OPERAND (TREE_OPERAND (t, 0), 0); @@ -8255,7 +8255,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = TREE_OPERAND (t, 0); } while (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -8706,7 +8706,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = OMP_CLAUSE_DECL (c); while (TREE_CODE (t) == TREE_LIST) t = TREE_CHAIN (t); - while (TREE_CODE (t) == INDIRECT_REF + while (INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) t = TREE_OPERAND (t, 0); } @@ -9021,7 +9021,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) { t = OMP_CLAUSE_DECL (c); while (handled_component_p (t) - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ADDR_EXPR || TREE_CODE (t) == MEM_REF || TREE_CODE (t) == NON_LVALUE_EXPR) @@ -9070,7 +9070,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) if (TREE_CODE (t) == POINTER_PLUS_EXPR) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == ADDR_EXPR - || TREE_CODE (t) == INDIRECT_REF) + || INDIRECT_REF_P (t)) t = TREE_OPERAND (t, 0); if (DECL_P (t)) bitmap_clear_bit (&aligned_head, DECL_UID (t)); @@ -9609,7 +9609,7 @@ finish_omp_target_clauses_r (tree *tp, int *walk_subtrees, void *ptr) of DECL_VALUE_EXPRs during the target body walk seems the only way to find them. */ if (current_closure - && (TREE_CODE (t) == VAR_DECL + && (VAR_P (t) || TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL) && DECL_HAS_VALUE_EXPR_P (t) @@ -12362,8 +12362,8 @@ is_this_parameter (tree t) if (!DECL_P (t) || DECL_NAME (t) != this_identifier) return false; gcc_assert (TREE_CODE (t) == PARM_DECL - || (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t)) - || (cp_binding_oracle && TREE_CODE (t) == VAR_DECL)); + || (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t)) + || (cp_binding_oracle && VAR_P (t))); return true; } diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 131b212ff73..19dfb3ed782 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -1173,7 +1173,7 @@ build_cplus_array_type (tree elt_type, tree index_type, int dependent) } /* Avoid spurious warnings with VLAs (c++/54583). */ - if (TYPE_SIZE (t) && EXPR_P (TYPE_SIZE (t))) + if (CAN_HAVE_LOCATION_P (TYPE_SIZE (t))) suppress_warning (TYPE_SIZE (t), OPT_Wunused); /* Push these needs up to the ARRAY_TYPE so that initialization takes @@ -3911,7 +3911,7 @@ is_this_expression (tree t) { t = get_innermost_component (t); /* See through deferences and no-op conversions. */ - if (TREE_CODE (t) == INDIRECT_REF) + if (INDIRECT_REF_P (t)) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == NOP_EXPR) t = TREE_OPERAND (t, 0); diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 53ac925a092..a4ceb8a1703 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -4996,8 +4996,8 @@ do_warn_enum_conversions (location_t loc, enum tree_code code, tree type0, } } else if ((TREE_CODE (type0) == ENUMERAL_TYPE - && TREE_CODE (type1) == REAL_TYPE) - || (TREE_CODE (type0) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (type1)) + || (SCALAR_FLOAT_TYPE_P (type0) && TREE_CODE (type1) == ENUMERAL_TYPE)) { const bool enum_first_p = TREE_CODE (type0) == ENUMERAL_TYPE; diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index bf03967a71f..6affdc73fb1 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -907,7 +907,7 @@ store_init_value (tree decl, tree init, vec** cleanups, int flags) here it should have been digested into an actual value for the type. */ gcc_checking_assert (TREE_CODE (value) != CONSTRUCTOR || processing_template_decl - || TREE_CODE (type) == VECTOR_TYPE + || VECTOR_TYPE_P (type) || !TREE_HAS_CONSTRUCTOR (value)); /* If the initializer is not a constant, fill in DECL_INITIAL with @@ -974,7 +974,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, return ok; if (CP_INTEGRAL_TYPE_P (type) - && TREE_CODE (ftype) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (ftype)) ok = false; else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype) && CP_INTEGRAL_TYPE_P (type)) @@ -992,8 +992,8 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, } /* [dcl.init.list]#7.2: "from long double to double or float, or from double to float". */ - else if (TREE_CODE (ftype) == REAL_TYPE - && TREE_CODE (type) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (ftype) + && SCALAR_FLOAT_TYPE_P (type)) { if ((extended_float_type_p (ftype) || extended_float_type_p (type)) ? /* "from a floating-point type T to another floating-point type @@ -1030,7 +1030,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, } } else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype) - && TREE_CODE (type) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (type)) { ok = false; if (TREE_CODE (init) == INTEGER_CST) From patchwork Sat May 13 23:23:12 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: 69305 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 768CC3836F37 for ; Sat, 13 May 2023 23:25:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 768CC3836F37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020338; bh=ZJV79/3lv5TfRTFSHzAifChQkNPVQS2NIeTDn10EkD0=; 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=d6zzgKqJD6WGVVczALkQx2/+59i72ZbXfSxkdIyXUNywKevYUoX7GfejjWiK2N7aN eHnLCejEeu/IzIj2fHVh/X+3vgnQ+BdNNqbtEp4rK/kE+52bxJczx4YxeB5kv7OVp2 Y4MjAhs88/92fKM9whaa7s4R73WppVGN99EHyJjc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 0AAF03858412; Sat, 13 May 2023 23:23:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AAF03858412 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-50bc4ba28cbso20067125a12.0; Sat, 13 May 2023 16:23:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020231; x=1686612231; 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=ZJV79/3lv5TfRTFSHzAifChQkNPVQS2NIeTDn10EkD0=; b=G/yoE8hU/gPeLvKCmY/uYaGT3XxetgEUsUHFgD+oPqXr4GZJG6HvrNggOhEV8a01PW NXUDsWo8dMl06ObufRanyVP9f2aUvkDYL8DvW1lcHPyqdoZ6CItlkNLNc2iB03Zkwsfz +fM505Hg453YcdNCYn3bVRrZbmcOM73SNUh+7RhRuLjhjVTaZYbpAQ17HQgfcYdgM6VQ p/xR2z+dICoDK7mN34P7OkbINcVVpbLiM9aka+MA9Hsd+49Zlihdn0iDJXyXgx+jnK41 mUkdVsUg8i2+uZ6OfqUT+BDh4NRfjbVUQNq3Vo4Lu1vUBQz2PYDGPo4np779KRBP9ruv LVBg== X-Gm-Message-State: AC+VfDwzETa48AGuia7jOS0b2d7Mf6zKVUx/ACUwDRoYSNFxB/3QcZ8u Wt7Q9ZcsAyYOZrRFoUn0ietCjNJLxkI= X-Google-Smtp-Source: ACHHUZ64c+4ZLvsIgJRMSpIBP8ybYWlZss+VJdGP+OjGVCU9Uw7hqib0eEHHtloPOo1ZgSKFwOOyJQ== X-Received: by 2002:a17:907:6d15:b0:96a:bfc:7335 with SMTP id sa21-20020a1709076d1500b0096a0bfc7335mr14535803ejc.53.1684020230993; Sat, 13 May 2023 16:23:50 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id ht7-20020a170907608700b0096a16e49b0fsm5744167ejc.51.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001AmX-04; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 05/14] m2: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:12 +0200 Message-Id: <20230513232321.279733-6-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.1 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/m2/ChangeLog: * gm2-gcc/m2builtins.cc (doradix): Use _P defines from tree.h. (doplaces): Ditto. (doexponentmin): Ditto. (doexponentmax): Ditto. (dolarge): Ditto. (dosmall): Ditto. (dogUnderflow): Ditto. * gm2-gcc/m2convert.cc (unsafe_conversion_p): Ditto. * gm2-gcc/m2expr.cc (m2expr_build_unary_op_check): Ditto. (m2expr_build_binary_op_check): Ditto. * gm2-gcc/m2tree.cc (m2tree_is_var): Ditto. * gm2-gcc/m2treelib.cc (build_modify_expr): Ditto. * gm2-gcc/m2type.cc (gm2_finish_decl): Ditto. * m2pp.cc (hextree): Ditto. (m2pp_call_expr): Ditto. --- gcc/m2/gm2-gcc/m2builtins.cc | 14 +++++++------- gcc/m2/gm2-gcc/m2convert.cc | 8 ++++---- gcc/m2/gm2-gcc/m2expr.cc | 4 ++-- gcc/m2/gm2-gcc/m2tree.cc | 2 +- gcc/m2/gm2-gcc/m2treelib.cc | 2 +- gcc/m2/gm2-gcc/m2type.cc | 4 ++-- gcc/m2/m2pp.cc | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gcc/m2/gm2-gcc/m2builtins.cc b/gcc/m2/gm2-gcc/m2builtins.cc index 8d104c41a1e..3d13e2018d7 100644 --- a/gcc/m2/gm2-gcc/m2builtins.cc +++ b/gcc/m2/gm2-gcc/m2builtins.cc @@ -552,7 +552,7 @@ m2builtins_GetBuiltinTypeInfo (location_t location, tree type, static tree doradix (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { enum machine_mode mode = TYPE_MODE (type); int radix = REAL_MODE_FORMAT (mode)->b; @@ -568,7 +568,7 @@ doradix (location_t location ATTRIBUTE_UNUSED, tree type) static tree doplaces (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { /* Taken from c-family/c-cppbuiltin.cc. */ /* The number of decimal digits, q, such that any floating-point @@ -592,7 +592,7 @@ doplaces (location_t location ATTRIBUTE_UNUSED, tree type) static tree doexponentmin (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { enum machine_mode mode = TYPE_MODE (type); int emin = REAL_MODE_FORMAT (mode)->emin; @@ -607,7 +607,7 @@ doexponentmin (location_t location ATTRIBUTE_UNUSED, tree type) static tree doexponentmax (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { enum machine_mode mode = TYPE_MODE (type); int emax = REAL_MODE_FORMAT (mode)->emax; @@ -640,7 +640,7 @@ computeLarge (tree type) static tree dolarge (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) return computeLarge (type); return NULL_TREE; } @@ -667,7 +667,7 @@ computeSmall (tree type) static tree dosmall (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) return computeSmall (type); return NULL_TREE; } @@ -735,7 +735,7 @@ dorounds (location_t location ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED) static tree dogUnderflow (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { enum machine_mode mode = TYPE_MODE (type); const struct real_format *fmt = REAL_MODE_FORMAT (mode); diff --git a/gcc/m2/gm2-gcc/m2convert.cc b/gcc/m2/gm2-gcc/m2convert.cc index f806669dc39..5d35bcee239 100644 --- a/gcc/m2/gm2-gcc/m2convert.cc +++ b/gcc/m2/gm2-gcc/m2convert.cc @@ -91,7 +91,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns) /* Warn for real constant that is not an exact integer converted to integer type. */ - if (TREE_CODE (expr_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (expr_type) && TREE_CODE (type) == INTEGER_TYPE) { if (!real_isinteger (TREE_REAL_CST_PTR (expr), @@ -121,7 +121,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns) else give_warning = UNSAFE_OTHER; } - else if (TREE_CODE (type) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type)) { /* Warn for an integer constant that does not fit into real type. */ if (TREE_CODE (expr_type) == INTEGER_TYPE) @@ -133,7 +133,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns) /* Warn for a real constant that does not fit into a smaller real type. */ - else if (TREE_CODE (expr_type) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (expr_type) && TYPE_PRECISION (type) < TYPE_PRECISION (expr_type)) { REAL_VALUE_TYPE a = TREE_REAL_CST (expr); @@ -145,7 +145,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns) else { /* Warn for real types converted to integer types. */ - if (TREE_CODE (expr_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (expr_type) && TREE_CODE (type) == INTEGER_TYPE) give_warning = UNSAFE_REAL; diff --git a/gcc/m2/gm2-gcc/m2expr.cc b/gcc/m2/gm2-gcc/m2expr.cc index e46d894d636..8021eb00671 100644 --- a/gcc/m2/gm2-gcc/m2expr.cc +++ b/gcc/m2/gm2-gcc/m2expr.cc @@ -1041,7 +1041,7 @@ m2expr_build_unary_op_check (location_t location, enum tree_code code, if (check != NULL) result = build2 (COMPOUND_EXPR, argtype, check, result); - if (TREE_CODE (argtype) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (argtype)) m2expr_checkRealOverflow (location, code, result); return m2expr_FoldAndStrip (result); @@ -2594,7 +2594,7 @@ m2expr_build_binary_op_check (location_t location, enum tree_code code, if (check != NULL) result = build2 (COMPOUND_EXPR, TREE_TYPE (result), check, result); - if (TREE_CODE (type1) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type1)) m2expr_checkRealOverflow (location, code, result); return result; } diff --git a/gcc/m2/gm2-gcc/m2tree.cc b/gcc/m2/gm2-gcc/m2tree.cc index 0fc2fe57b63..99405123290 100644 --- a/gcc/m2/gm2-gcc/m2tree.cc +++ b/gcc/m2/gm2-gcc/m2tree.cc @@ -29,7 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see bool m2tree_is_var (tree var) { - return TREE_CODE (var) == VAR_DECL; + return VAR_P (var); } bool diff --git a/gcc/m2/gm2-gcc/m2treelib.cc b/gcc/m2/gm2-gcc/m2treelib.cc index 9ec095d5284..6694af66d8b 100644 --- a/gcc/m2/gm2-gcc/m2treelib.cc +++ b/gcc/m2/gm2-gcc/m2treelib.cc @@ -99,7 +99,7 @@ build_modify_expr (location_t location, tree lhs, enum tree_code modifycode, if (TREE_CODE (lhs) == COMPONENT_REF && (TREE_CODE (lhstype) == INTEGER_TYPE || TREE_CODE (lhstype) == BOOLEAN_TYPE - || TREE_CODE (lhstype) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (lhstype) || TREE_CODE (lhstype) == ENUMERAL_TYPE)) lhstype = TREE_TYPE (get_unwidened (lhs, 0)); diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc index 2808ddf8b8a..eeee3557c62 100644 --- a/gcc/m2/gm2-gcc/m2type.cc +++ b/gcc/m2/gm2-gcc/m2type.cc @@ -1247,7 +1247,7 @@ gm2_finish_decl (location_t location, tree decl) int was_incomplete = (DECL_SIZE (decl) == 0); m2assert_AssertLocation (location); - if (TREE_CODE (decl) == VAR_DECL) + if (VAR_P (decl)) { if (DECL_SIZE (decl) == 0 && TREE_TYPE (decl) != error_mark_node && COMPLETE_TYPE_P (TREE_TYPE (decl))) @@ -1278,7 +1278,7 @@ gm2_finish_decl (location_t location, tree decl) functions, unless the type is an undefined structure or union. If not, it will get done when the type is completed. */ - if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL) + if (VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL) { if (DECL_FILE_SCOPE_P (decl)) { diff --git a/gcc/m2/m2pp.cc b/gcc/m2/m2pp.cc index 21d1cb9dce7..52a29384e8d 100644 --- a/gcc/m2/m2pp.cc +++ b/gcc/m2/m2pp.cc @@ -579,7 +579,7 @@ hextree (tree t) hextree (DECL_INITIAL (t)); hextree (DECL_SAVED_TREE (t)); } - if (TREE_CODE (t) == VAR_DECL) + if (VAR_P (t)) { pretty *state = initPretty (FALSE); @@ -2364,7 +2364,7 @@ m2pp_call_expr (pretty *s, tree t) int has_return_type = TRUE; tree proc; - if (type && (TREE_CODE (type) == VOID_TYPE)) + if (type && VOID_TYPE_P (type)) has_return_type = FALSE; if (TREE_CODE (call) == ADDR_EXPR || TREE_CODE (call) == NON_LVALUE_EXPR) From patchwork Sat May 13 23:23:13 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: 69312 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E8A1A3858426 for ; Sat, 13 May 2023 23:40:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8A1A3858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684021228; bh=hPMp9fqLPTamnu8RY1H/m9OJoctTSt8rsgmO/n6C47U=; 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=kWNMHplaiHM+dlZgPYPBHCHTtlfwmIMxiqEaL+3huR+TYzCGNp6hfMRg0ZsEgLfx/ 3rWOpcdse4qPcSXEX2xa803zPiKjbvNfRwuKOt7XFkCyIB5YfcPUNsqs10DMTVgNQo 656aNTFyrYASrhAkOGzO2XevdCDoY7NiaPcQ/fKY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id D94A93858D3C; Sat, 13 May 2023 23:39:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D94A93858D3C Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-96aae59bbd6so397337166b.3; Sat, 13 May 2023 16:39:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684021198; x=1686613198; 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=hPMp9fqLPTamnu8RY1H/m9OJoctTSt8rsgmO/n6C47U=; b=HGaOuOijMKzz/9XD+Qc6klg6BQRO8TAVGnQfKxyf1cG9AbY6o2Kj65lKXnAeGB3m4e PRXypNtzHWkC6NZgB7xhWDLJdngYE3nY9VJt7WsaQhURFy4Ze/Lf9GhIlOJnjZK44XRq C0rsje6NJIcGzO6pmRfLIEZ/jnRUpOFvRFQbtEhxl8zJ34x3vdiFmRfUVAe4lnhWBOAI D6CtTIbMkoVUjpOfZs1t+WQFhKomGunxE7mbkTsWJHDYjXg4LkxqFVie4dSVradrgizh v+r/y18P7I14ZgaXj0pRXznNvaqJzC00toecmxZ/1C1TDpoDS0v0OnSOo+TdGHNTxPcC slBg== X-Gm-Message-State: AC+VfDwuoBpJ6OEK0yHCKzqtfp7UcNLkTECUuh2nnppP0e9tz8fqJljL 7GMj11wvafm8K6ZJPHzDR3bkQWcbvIo= X-Google-Smtp-Source: ACHHUZ62oQtPDk+OHR8hu7x8lS3tQZrC02aQKWu6tAvsf86u2VS1mIU1dxgDIvpcBWlxebiNklxltg== X-Received: by 2002:a17:907:1c03:b0:94e:4489:f24d with SMTP id nc3-20020a1709071c0300b0094e4489f24dmr28119768ejc.61.1684021197848; Sat, 13 May 2023 16:39:57 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id v9-20020a170906338900b0094ee99eeb01sm7356621eja.150.2023.05.13.16.39.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:39:57 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amb-08; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 06/14] lto: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:13 +0200 Message-Id: <20230513232321.279733-7-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.4 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/ChangeLog: * lto-streamer-in.cc (lto_input_var_decl_ref): Use _P defines from tree.h. (lto_read_body_or_constructor): Ditto. * lto-streamer-out.cc (tree_is_indexable): Ditto. (lto_output_var_decl_ref): Ditto. (DFS::DFS_write_tree_body): Ditto. (wrap_refs): Ditto. (write_symbol_extension_info): Ditto. gcc/lto/ChangeLog: * lto-common.cc (lto_maybe_register_decl): * lto-symtab.cc (warn_type_compatibility_p): (lto_symtab_resolve_replaceable_p): (lto_symtab_merge_decls_1): * lto-symtab.h (lto_symtab_prevailing_decl): --- gcc/lto-streamer-in.cc | 4 ++-- gcc/lto-streamer-out.cc | 11 +++++------ gcc/lto/lto-common.cc | 2 +- gcc/lto/lto-symtab.cc | 8 ++++---- gcc/lto/lto-symtab.h | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gcc/lto-streamer-in.cc b/gcc/lto-streamer-in.cc index 03cb41cfa16..2cb83406db5 100644 --- a/gcc/lto-streamer-in.cc +++ b/gcc/lto-streamer-in.cc @@ -671,7 +671,7 @@ lto_input_var_decl_ref (lto_input_block *ib, lto_file_decl_data *file_data) unsigned int ix_u = streamer_read_uhwi (ib); tree result = (*file_data->current_decl_state ->streams[LTO_DECL_STREAM])[ix_u]; - gcc_assert (TREE_CODE (result) == VAR_DECL); + gcc_assert (VAR_P (result)); return result; } @@ -1653,7 +1653,7 @@ lto_read_body_or_constructor (struct lto_file_decl_data *file_data, struct symta if (TYPE_P (t)) { - gcc_assert (TYPE_CANONICAL (t) == NULL_TREE); + gcc_assert (TYPE_STRUCTURAL_EQUALITY_P (t)); if (type_with_alias_set_p (t) && canonical_type_used_p (t)) TYPE_CANONICAL (t) = TYPE_MAIN_VARIANT (t); diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc index 0bca530313c..5ab2eb4301e 100644 --- a/gcc/lto-streamer-out.cc +++ b/gcc/lto-streamer-out.cc @@ -178,7 +178,7 @@ tree_is_indexable (tree t) && lto_variably_modified_type_p (DECL_CONTEXT (t))) return false; else - return (TYPE_P (t) || DECL_P (t) || TREE_CODE (t) == SSA_NAME); + return (IS_TYPE_OR_DECL_P (t) || TREE_CODE (t) == SSA_NAME); } @@ -346,7 +346,7 @@ void lto_output_var_decl_ref (struct lto_out_decl_state *decl_state, struct lto_output_stream * obs, tree decl) { - gcc_checking_assert (TREE_CODE (decl) == VAR_DECL); + gcc_checking_assert (VAR_P (decl)); streamer_write_uhwi_stream (obs, lto_get_index (&decl_state->streams[LTO_DECL_STREAM], decl)); @@ -1078,8 +1078,7 @@ DFS::DFS_write_tree_body (struct output_block *ob, else if (RECORD_OR_UNION_TYPE_P (expr)) for (tree t = TYPE_FIELDS (expr); t; t = TREE_CHAIN (t)) DFS_follow_tree_edge (t); - else if (TREE_CODE (expr) == FUNCTION_TYPE - || TREE_CODE (expr) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (expr)) DFS_follow_tree_edge (TYPE_ARG_TYPES (expr)); if (!POINTER_TYPE_P (expr)) @@ -2626,7 +2625,7 @@ wrap_refs (tree *tp, int *ws, void *) { tree t = *tp; if (handled_component_p (t) - && TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL + && VAR_P (TREE_OPERAND (t, 0)) && TREE_PUBLIC (TREE_OPERAND (t, 0))) { tree decl = TREE_OPERAND (t, 0); @@ -3064,7 +3063,7 @@ write_symbol_extension_info (tree t) ? GCCST_VARIABLE : GCCST_FUNCTION); lto_write_data (&c, 1); unsigned char section_kind = 0; - if (TREE_CODE (t) == VAR_DECL) + if (VAR_P (t)) { section *s = get_variable_section (t, false); if (s->common.flags & SECTION_BSS) diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc index 882dd8971a4..537570204b3 100644 --- a/gcc/lto/lto-common.cc +++ b/gcc/lto/lto-common.cc @@ -958,7 +958,7 @@ lto_register_function_decl_in_symtab (class data_in *data_in, tree decl, static void lto_maybe_register_decl (class data_in *data_in, tree t, unsigned ix) { - if (TREE_CODE (t) == VAR_DECL) + if (VAR_P (t)) lto_register_var_decl_in_symtab (data_in, t, ix); else if (TREE_CODE (t) == FUNCTION_DECL && !fndecl_built_in_p (t)) diff --git a/gcc/lto/lto-symtab.cc b/gcc/lto/lto-symtab.cc index 2b57d0d5371..79ba8ddde20 100644 --- a/gcc/lto/lto-symtab.cc +++ b/gcc/lto/lto-symtab.cc @@ -214,7 +214,7 @@ warn_type_compatibility_p (tree prevailing_type, tree type, /* Function types needs special care, because types_compatible_p never thinks prototype is compatible to non-prototype. */ - if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE) + if (FUNC_OR_METHOD_TYPE_P (type)) { if (TREE_CODE (type) != TREE_CODE (prevailing_type)) lev |= 1; @@ -401,7 +401,7 @@ lto_symtab_resolve_replaceable_p (symtab_node *e) || DECL_WEAK (e->decl)) return true; - if (TREE_CODE (e->decl) == VAR_DECL) + if (VAR_P (e->decl)) return (DECL_COMMON (e->decl) || (!flag_no_common && !DECL_INITIAL (e->decl))); @@ -803,7 +803,7 @@ lto_symtab_merge_decls_1 (symtab_node *first) This is needed for C++ typeinfos, for example in lto/20081204-1 there are typeifos in both units, just one of them do have size. */ - if (TREE_CODE (prevailing->decl) == VAR_DECL) + if (VAR_P (prevailing->decl)) { for (e = prevailing->next_sharing_asm_name; e; e = e->next_sharing_asm_name) @@ -848,7 +848,7 @@ lto_symtab_merge_decls_1 (symtab_node *first) break; case FUNCTION_DECL: - gcc_assert (TREE_CODE (e->decl) == VAR_DECL); + gcc_assert (VAR_P (e->decl)); error_at (DECL_SOURCE_LOCATION (e->decl), "function %qD redeclared as variable", prevailing->decl); diff --git a/gcc/lto/lto-symtab.h b/gcc/lto/lto-symtab.h index f654f2cdebb..a60f262869b 100644 --- a/gcc/lto/lto-symtab.h +++ b/gcc/lto/lto-symtab.h @@ -46,7 +46,7 @@ lto_symtab_prevailing_decl (tree decl) return DECL_CHAIN (decl); else { - if ((TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL) + if ((VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL) && DECL_VIRTUAL_P (decl) && (TREE_PUBLIC (decl) || DECL_EXTERNAL (decl)) && !symtab_node::get (decl)) From patchwork Sat May 13 23:23:14 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: 69299 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64C713854169 for ; Sat, 13 May 2023 23:24:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64C713854169 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020263; bh=hT7lJZNRWjjnNZozsnbzkPggov69uoecQAgXTLAydvY=; 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=bvQMnwOMkGX/lwJhvQdATdofs0PeUSWh7/Hhy4GrNJMdWVqQoa4kGzdlV+qbLcK3P h9u8TEM4yBNS42IsR14GSTmqOsapI6jfi3l2FYKPiHq0x5tHtTSJHlxmg4mZGkB+Qh ujXwAPYwDIonCb5J8D54Xp3jgC/GhZ+zKQd919So= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 2FA4E385840D; Sat, 13 May 2023 23:23:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2FA4E385840D Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-966400ee79aso1637701466b.0; Sat, 13 May 2023 16:23:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020230; x=1686612230; 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=hT7lJZNRWjjnNZozsnbzkPggov69uoecQAgXTLAydvY=; b=Tf3UMbgKhazSqVOAw9UbT4Iia37nswFWRJVBYrWeSSQt6E+LkRTKKas4ajo8PxXdOh 4Pb95bGPakTwaSA1WcndSvt2DirGfaFitMn2sMKcf6rZ8E2igNKO3+Lrfs41G3tBZnZh Fd68xGXSe7eSqz9BCAkkrFXdS8D3ZAEKObGJZ7B5brLZTB6pN1yxPLEGbG2YpUEyde7k ENs4U2G++5nxzfwhva8R8LoxG9O4Mq7zzdjIP5RblazGanBlC0XU3UStFs2DQiVCTEVt LOtifRPL8sruqFzSB6hWCOY783VySow4fmWz8qIb0gdGVTWUVH/r7hJgXPgxRxr8tyNZ sPqg== X-Gm-Message-State: AC+VfDyMlv39D7OqvVXRijkvLGfc9x2ynTQRkUXoXYT+eGN9DL1SluqE Ck9MBt5dIYWV8FY0Hgr/CtU23WOWNn4= X-Google-Smtp-Source: ACHHUZ4sQWHlWYFwiENUPoL3F0eKNnfEhoabKzdUYeU5wj4L5fQ5UM1eU1CF1DMwESEJeyiKvmz/zA== X-Received: by 2002:a17:907:9816:b0:96a:77a2:bba with SMTP id ji22-20020a170907981600b0096a77a20bbamr10435462ejc.60.1684020229984; Sat, 13 May 2023 16:23:49 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id hx7-20020a170906846700b00965a4350411sm7248506ejc.9.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amf-0E; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 07/14] d: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:14 +0200 Message-Id: <20230513232321.279733-8-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=-9.9 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/d/ChangeLog: * d-codegen.cc (underlying_complex_expr): Use _P defines from tree.h. * d-convert.cc (convert): Ditto. (convert_for_rvalue): Ditto. --- gcc/d/d-codegen.cc | 2 +- gcc/d/d-convert.cc | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc index 5c6c300ecec..9bae06077b5 100644 --- a/gcc/d/d-codegen.cc +++ b/gcc/d/d-codegen.cc @@ -1599,7 +1599,7 @@ underlying_complex_expr (tree type, tree expr) /* Build a constructor from the real and imaginary parts. */ if (COMPLEX_FLOAT_TYPE_P (TREE_TYPE (expr)) && (!INDIRECT_REF_P (expr) - || !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (expr, 0))))) + || !CONVERT_EXPR_P (TREE_OPERAND (expr, 0)))) { vec *ve = NULL; CONSTRUCTOR_APPEND_ELT (ve, TYPE_FIELDS (type), diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc index 9e7fcd506f8..cdbd69cf012 100644 --- a/gcc/d/d-convert.cc +++ b/gcc/d/d-convert.cc @@ -257,7 +257,7 @@ convert (tree type, tree expr) return fold_convert (type, expr); if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK) return error_mark_node; - if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE) + if (VOID_TYPE_P (TREE_TYPE (expr))) { error ("void value not ignored as it ought to be"); return error_mark_node; @@ -270,8 +270,7 @@ convert (tree type, tree expr) case INTEGER_TYPE: case ENUMERAL_TYPE: - if (TREE_CODE (etype) == POINTER_TYPE - || TREE_CODE (etype) == REFERENCE_TYPE) + if (POINTER_TYPE_P (etype)) { if (integer_zerop (e)) return build_int_cst (type, 0); @@ -300,7 +299,7 @@ convert (tree type, tree expr) return fold (convert_to_real (type, e)); case COMPLEX_TYPE: - if (TREE_CODE (etype) == REAL_TYPE && TYPE_IMAGINARY_FLOAT (etype)) + if (SCALAR_FLOAT_TYPE_P (etype) && TYPE_IMAGINARY_FLOAT (etype)) return fold_build2 (COMPLEX_EXPR, type, build_zero_cst (TREE_TYPE (type)), convert (TREE_TYPE (type), expr)); @@ -656,7 +655,7 @@ convert_for_rvalue (tree expr, Type *etype, Type *totype) && ebtype->ty == TY::Tsarray && tbtype->nextOf ()->ty == ebtype->nextOf ()->ty && INDIRECT_REF_P (expr) - && CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (expr, 0))) + && CONVERT_EXPR_P (TREE_OPERAND (expr, 0)) && TREE_CODE (TREE_OPERAND (TREE_OPERAND (expr, 0), 0)) == ADDR_EXPR) { /* If expression is a vector that was casted to an array either by From patchwork Sat May 13 23:23:15 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: 69306 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 590E238555BF for ; Sat, 13 May 2023 23:26:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 590E238555BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020374; bh=3sMHHQ8gEZtgAclcE8kvW8NCY8sZ7hnfueaVLOuhScE=; 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=SZybsyVk/BbBr7INXHtQU+qUAb41wLWro9dd28b0uCRwgtVf9FGJb0B38ykqUfExE XrmvKujuZqnIERVkIQ+9375Qchra3vuMmIpCU/gCo/G3xIua8qHyVAvbBVbvmEXljL FYh+7sdAt0MFemFa5aKqHe5TI6+D+GrPjmEPG2lw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id EFDE83857729; Sat, 13 May 2023 23:23:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFDE83857729 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-96598a7c5e0so1828289066b.3; Sat, 13 May 2023 16:23:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020234; x=1686612234; 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=3sMHHQ8gEZtgAclcE8kvW8NCY8sZ7hnfueaVLOuhScE=; b=Nei+F2bmd6PJ0DdZCNxmxudHaYLconWQqt1jU+6mKGAaViUR2oik/uoEcJ/LwyqaxV eCrtPiOn+FFbvvqRrzg7SKMCEiJ/CPaEtt+xEEK0g6/8B5psYcVTHCNHrCU8OpIIpz8r qhwWBEx0r4stNZ4OqdM+OsT5LQsUS6XHnproJUd6uOUoEANAaCU63JvcA9bt2EbeliS/ MHw7RkKMTMxKoiwSj6MYGHwQHUeOO1sWQVLzxUPKWelRVLWQ4aLhVi9G+3cBY2JQSy6k iEUR4IPpTH7ob+5XTu08N8z0s3hFb8mrm8naRNLVfh8tbV1sFNH2aPfz9vr5kZeak1x0 Dwbg== X-Gm-Message-State: AC+VfDwFf6Ak9A0Q91EJffTxvFeFcKTRTevY9KnLALUUMtb1zaPBUEIn qJ06mQAUOLXz30568YNRjEfdsclfy9Y= X-Google-Smtp-Source: ACHHUZ4amVTR6Wpkf7EB4Y4i0PoMdviSp4FZQoaljvsr/79zKZ1hO/eGggR6/oOuujHWGoGrAQeosg== X-Received: by 2002:a17:907:96a4:b0:96a:1f7c:3207 with SMTP id hd36-20020a17090796a400b0096a1f7c3207mr17664025ejc.19.1684020234195; Sat, 13 May 2023 16:23:54 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id ml23-20020a170906cc1700b0094ea3a32694sm7368777ejb.190.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amj-0L; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 08/14] fortran: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:15 +0200 Message-Id: <20230513232321.279733-9-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.2 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/fortran/ChangeLog: * trans-array.cc (is_pointer_array): Use _P() defines from tree.h. (gfc_conv_scalarized_array_ref): Ditto. (gfc_conv_array_ref): Ditto. * trans-decl.cc (gfc_finish_decl): Ditto. (gfc_get_symbol_decl): Ditto. * trans-expr.cc (gfc_trans_pointer_assignment): Ditto. (gfc_trans_arrayfunc_assign): Ditto. (gfc_trans_assignment_1): Ditto. * trans-intrinsic.cc (gfc_conv_intrinsic_minmax): Ditto. (conv_intrinsic_ieee_value): Ditto. * trans-io.cc (gfc_convert_array_to_string): Ditto. * trans-openmp.cc (gfc_omp_is_optional_argument): Ditto. (gfc_trans_omp_clauses): Ditto. * trans-stmt.cc (gfc_conv_label_variable): Ditto. * trans.cc (gfc_build_addr_expr): Ditto. (get_array_span): Ditto. --- gcc/fortran/trans-array.cc | 10 +++++----- gcc/fortran/trans-decl.cc | 4 ++-- gcc/fortran/trans-expr.cc | 6 +++--- gcc/fortran/trans-intrinsic.cc | 4 ++-- gcc/fortran/trans-io.cc | 2 +- gcc/fortran/trans-openmp.cc | 7 +++---- gcc/fortran/trans-stmt.cc | 2 +- gcc/fortran/trans.cc | 4 ++-- 8 files changed, 19 insertions(+), 20 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 9f8aa09673a..15719845ca8 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -880,7 +880,7 @@ is_pointer_array (tree expr) || GFC_CLASS_TYPE_P (TREE_TYPE (expr))) return false; - if (TREE_CODE (expr) == VAR_DECL + if (VAR_P (expr) && GFC_DECL_PTR_ARRAY_P (expr)) return true; @@ -888,7 +888,7 @@ is_pointer_array (tree expr) && GFC_DECL_PTR_ARRAY_P (expr)) return true; - if (TREE_CODE (expr) == INDIRECT_REF + if (INDIRECT_REF_P (expr) && GFC_DECL_PTR_ARRAY_P (TREE_OPERAND (expr, 0))) return true; @@ -3803,7 +3803,7 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar, { if (TREE_CODE (info->descriptor) == COMPONENT_REF) decl = info->descriptor; - else if (TREE_CODE (info->descriptor) == INDIRECT_REF) + else if (INDIRECT_REF_P (info->descriptor)) decl = TREE_OPERAND (info->descriptor, 0); if (decl == NULL_TREE) @@ -4057,7 +4057,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr, { if (TREE_CODE (se->expr) == COMPONENT_REF) decl = se->expr; - else if (TREE_CODE (se->expr) == INDIRECT_REF) + else if (INDIRECT_REF_P (se->expr)) decl = TREE_OPERAND (se->expr, 0); else decl = se->expr; @@ -4069,7 +4069,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr, if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (se->expr))) { decl = se->expr; - if (TREE_CODE (decl) == INDIRECT_REF) + if (INDIRECT_REF_P (decl)) decl = TREE_OPERAND (decl, 0); } else diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index cd32542eb86..7f21dc2b09f 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -558,7 +558,7 @@ gfc_finish_decl (tree decl) return; if (DECL_SIZE (decl) == NULL_TREE - && TYPE_SIZE (TREE_TYPE (decl)) != NULL_TREE) + && COMPLETE_TYPE_P (TREE_TYPE (decl))) layout_decl (decl, 0); /* A few consistency checks. */ @@ -1889,7 +1889,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) length = fold_convert (gfc_charlen_type_node, length); gfc_finish_var_decl (length, sym); if (!sym->attr.associate_var - && TREE_CODE (length) == VAR_DECL + && VAR_P (length) && sym->value && sym->value->expr_type != EXPR_NULL && sym->value->ts.u.cl->length) { diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index d902e8f3281..292aba76aaa 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -10246,7 +10246,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) gfc_conv_descriptor_data_set (&block, desc, data); /* Copy the span. */ - if (TREE_CODE (rse.expr) == VAR_DECL + if (VAR_P (rse.expr) && GFC_DECL_PTR_ARRAY_P (rse.expr)) span = gfc_conv_descriptor_span_get (rse.expr); else @@ -10933,7 +10933,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) { tmp = sym->backend_decl; lhs = sym->backend_decl; - if (TREE_CODE (tmp) == INDIRECT_REF) + if (INDIRECT_REF_P (tmp)) tmp = TREE_OPERAND (tmp, 0); sym->backend_decl = gfc_create_var (TREE_TYPE (tmp), "lhs"); gfc_add_modify (&se.pre, sym->backend_decl, tmp); @@ -11883,7 +11883,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, if (expr2->ts.type == BT_CHARACTER && !expr1->ts.deferred && !(VAR_P (rse.string_length) || TREE_CODE (rse.string_length) == PARM_DECL - || TREE_CODE (rse.string_length) == INDIRECT_REF)) + || INDIRECT_REF_P (rse.string_length))) string_length = gfc_evaluate_now (rse.string_length, &rse.pre); else if (expr2->ts.type == BT_CHARACTER) { diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index e0c171d5f25..a0e1110c5e0 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -4112,7 +4112,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, enum tree_code op) /* Handle absent optional arguments by ignoring the comparison. */ if (argexpr->expr->expr_type == EXPR_VARIABLE && argexpr->expr->symtree->n.sym->attr.optional - && TREE_CODE (val) == INDIRECT_REF) + && INDIRECT_REF_P (val)) { cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, @@ -10155,7 +10155,7 @@ conv_intrinsic_ieee_value (gfc_se *se, gfc_expr *expr) arg = gfc_evaluate_now (arg, &se->pre); type = gfc_typenode_for_spec (&expr->ts); - gcc_assert (TREE_CODE (type) == REAL_TYPE); + gcc_assert (SCALAR_FLOAT_TYPE_P (type)); ret = gfc_create_var (type, NULL); gfc_init_block (&body); diff --git a/gcc/fortran/trans-io.cc b/gcc/fortran/trans-io.cc index 9b54d2f0d31..0c0e3332778 100644 --- a/gcc/fortran/trans-io.cc +++ b/gcc/fortran/trans-io.cc @@ -791,7 +791,7 @@ gfc_convert_array_to_string (gfc_se * se, gfc_expr * e) } else { - gcc_assert (TREE_CODE (se->expr) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (se->expr)); tree ptr = TREE_OPERAND (se->expr, 0); gcc_assert (TREE_CODE (ptr) == POINTER_PLUS_EXPR); diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 96aecdd1cb3..16ffb74a0f7 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -73,7 +73,7 @@ static bool gfc_omp_is_optional_argument (const_tree decl) { /* Note: VAR_DECL can occur with BIND(C) and array descriptors. */ - return ((TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == VAR_DECL) + return ((TREE_CODE (decl) == PARM_DECL || VAR_P (decl)) && DECL_LANG_SPECIFIC (decl) && TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))) @@ -3334,9 +3334,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, } } else if (present - && TREE_CODE (decl) == INDIRECT_REF - && (TREE_CODE (TREE_OPERAND (decl, 0)) - == INDIRECT_REF)) + && INDIRECT_REF_P (decl) + && INDIRECT_REF_P (TREE_OPERAND (decl, 0))) { /* A single indirectref is handled by the middle end. */ gcc_assert (!POINTER_TYPE_P (TREE_TYPE (decl))); diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index 589f200162a..b5b82941b41 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -82,7 +82,7 @@ gfc_conv_label_variable (gfc_se * se, gfc_expr * expr) if (TREE_CODE (se->expr) == COMPONENT_REF) se->expr = TREE_OPERAND (se->expr, 1); /* Deals with dummy argument. Get the parameter declaration. */ - else if (TREE_CODE (se->expr) == INDIRECT_REF) + else if (INDIRECT_REF_P (se->expr)) se->expr = TREE_OPERAND (se->expr, 0); } diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc index f7745add045..0b32b6896cd 100644 --- a/gcc/fortran/trans.cc +++ b/gcc/fortran/trans.cc @@ -332,7 +332,7 @@ gfc_build_addr_expr (tree type, tree t) else natural_type = build_pointer_type (base_type); - if (TREE_CODE (t) == INDIRECT_REF) + if (INDIRECT_REF_P (t)) { if (!type) type = natural_type; @@ -365,7 +365,7 @@ get_array_span (tree type, tree decl) if (TREE_CODE (decl) == COMPONENT_REF && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))) return gfc_conv_descriptor_span_get (decl); - else if (TREE_CODE (decl) == INDIRECT_REF + else if (INDIRECT_REF_P (decl) && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))) return gfc_conv_descriptor_span_get (decl); From patchwork Sat May 13 23:23:16 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: 69310 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F3F5038768A9 for ; Sat, 13 May 2023 23:27:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3F5038768A9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020458; bh=UwdphHobJdHdr7kpfathxNdrPsZPCvK03KU6b/A3WQE=; 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=wSy8QCXRohr1F9rFxRHZyxsf43q5kklO7ZYAcOO+hL9tOdEYLCRGku3bY9UxiZmP3 oE5YJzT89xLy1vYrz1f7QzTyPSu7Ll7zVI+3NhOvT/7uGpIF4upvnKkWEz+BSjIP75 wVpniZxMSJ6N7bkHO92QZw82GwE01eBygrT54+2w= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 466A2385841C; Sat, 13 May 2023 23:23:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 466A2385841C Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-965c3f9af2aso1728227666b.0; Sat, 13 May 2023 16:23:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020232; x=1686612232; 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=UwdphHobJdHdr7kpfathxNdrPsZPCvK03KU6b/A3WQE=; b=IRfNdYaGxUaqJDtJxlmvKYFI5XUNtdw5jjyheIqDhgSxaQqY89+7L/NE6E9lBhEmuL a1ViE3WAk2xGhWUMzSCbgTZpZDzjGfI2JciHQ9XJveq1VcX1COBrZdUYiv+v3cQ6morz T4TCnCmb6foX0cmU1VHWYhIeIkZAr+CUvjPmFm9iCluWDcs75caSDZG+Q9if3Bt1Shlm ofKze37jUgEYAbdzzcMfETXBhV8oIs0sJgkIgd1+XTX2KFh3pmVt7S8uJ22e5t6dji9C nZ1uTmUKAFEKqI3b8vkMYQQt1HzyGBSHEmw9o46TuxGim7ex3GoxRFIkN3o86vtR2vEQ 2RuA== X-Gm-Message-State: AC+VfDwtzw/nMM12vPS5nQHp2pV5BFbHkqDf0eyzv73YAnlx/DD6wVS8 eBWm4xDE1Z6hocsMoSScJ3JTw69Morw= X-Google-Smtp-Source: ACHHUZ6D9y1rcE9v8B90/A3YVLU8tf/OFZ8sCBDsnqek7eCu6xKX0BnGEnr7h7lxdzewJ1hmn5whUg== X-Received: by 2002:a17:907:7fa4:b0:96a:8ef4:e1bd with SMTP id qk36-20020a1709077fa400b0096a8ef4e1bdmr8446047ejc.18.1684020232035; Sat, 13 May 2023 16:23:52 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id hy27-20020a1709068a7b00b0094f1fe1696bsm7260438ejc.216.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amn-0R; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 09/14] rust: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:16 +0200 Message-Id: <20230513232321.279733-10-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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::type_cast_expression): Use _P() defines from tree.h * backend/rust-tree.cc (build_cplus_array_type): Ditto. * backend/rust-tree.h (ARITHMETIC_TYPE_P): Ditto. (gnu_vector_type_p): Ditto. * checks/lints/rust-lint-unused-var.cc (check_decl): Ditto. * rust-gcc.cc (Gcc_backend::fill_in_array): Ditto. (Gcc_backend::named_type): Ditto. (Gcc_backend::convert_expression): Ditto. (Gcc_backend::init_statement): Ditto. --- gcc/rust/backend/rust-compile-expr.cc | 2 +- gcc/rust/backend/rust-tree.cc | 2 +- gcc/rust/backend/rust-tree.h | 4 ++-- gcc/rust/checks/lints/rust-lint-unused-var.cc | 2 +- gcc/rust/rust-gcc.cc | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index d7945dbf26b..3dc34828e32 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -2267,7 +2267,7 @@ CompileExpr::type_cast_expression (tree type_to_cast_to, tree expr_tree, // FIXME check for TREE_OVERFLOW? return cast; } - else if (TREE_CODE (type_to_cast_to) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type_to_cast_to)) { tree cast = convert_to_real (type_to_cast_to, expr_tree); // FIXME diff --git a/gcc/rust/backend/rust-tree.cc b/gcc/rust/backend/rust-tree.cc index 8243d4cf5c6..7e11e6584ae 100644 --- a/gcc/rust/backend/rust-tree.cc +++ b/gcc/rust/backend/rust-tree.cc @@ -2404,7 +2404,7 @@ build_cplus_array_type (tree elt_type, tree index_type, int dependent) } /* Avoid spurious warnings with VLAs (c++/54583). */ - if (TYPE_SIZE (t) && EXPR_P (TYPE_SIZE (t))) + if (CAN_HAVE_LOCATION_P (TYPE_SIZE (t))) suppress_warning (TYPE_SIZE (t), OPT_Wunused); /* Push these needs up to the ARRAY_TYPE so that initialization takes diff --git a/gcc/rust/backend/rust-tree.h b/gcc/rust/backend/rust-tree.h index 284fd873c1c..6d243b7f86e 100644 --- a/gcc/rust/backend/rust-tree.h +++ b/gcc/rust/backend/rust-tree.h @@ -54,7 +54,7 @@ Keep these checks in ascending code order. */ #define ARITHMETIC_TYPE_P(TYPE) \ - (RS_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE \ + (RS_INTEGRAL_TYPE_P (TYPE) || SCALAR_FLOAT_TYPE_P (TYPE) \ || TREE_CODE (TYPE) == COMPLEX_TYPE) /* True iff TYPE is cv decltype(nullptr). */ @@ -3250,7 +3250,7 @@ identifier_p (tree t) inline bool gnu_vector_type_p (const_tree type) { - return TREE_CODE (type) == VECTOR_TYPE && !TYPE_INDIVISIBLE_P (type); + return VECTOR_TYPE_P (type) && !TYPE_INDIVISIBLE_P (type); } extern vec * diff --git a/gcc/rust/checks/lints/rust-lint-unused-var.cc b/gcc/rust/checks/lints/rust-lint-unused-var.cc index ba5ffb9372b..2cf5cd60f15 100644 --- a/gcc/rust/checks/lints/rust-lint-unused-var.cc +++ b/gcc/rust/checks/lints/rust-lint-unused-var.cc @@ -25,7 +25,7 @@ namespace Analysis { static void check_decl (tree *t) { - rust_assert (TREE_CODE (*t) == VAR_DECL || TREE_CODE (*t) == PARM_DECL + rust_assert (VAR_P (*t) || TREE_CODE (*t) == PARM_DECL || TREE_CODE (*t) == CONST_DECL); tree var_name = DECL_NAME (*t); diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index cf20b5b98e0..b1995bdb56a 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -886,7 +886,7 @@ Gcc_backend::fill_in_array (tree fill, tree element_type, tree length_tree) if (element_type == error_mark_node || length_tree == error_mark_node) return error_mark_node; - gcc_assert (TYPE_SIZE (element_type) != NULL_TREE); + gcc_assert (COMPLETE_TYPE_P (element_type)); length_tree = fold_convert (sizetype, length_tree); @@ -923,7 +923,7 @@ Gcc_backend::named_type (const std::string &name, tree type, Location location) // give it whatever Rust name we have at this point. if (TYPE_NAME (type) == NULL_TREE && location.gcc_location () == BUILTINS_LOCATION - && (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == REAL_TYPE + && (TREE_CODE (type) == INTEGER_TYPE || SCALAR_FLOAT_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE || TREE_CODE (type) == BOOLEAN_TYPE)) { @@ -1173,7 +1173,7 @@ Gcc_backend::convert_expression (tree type_tree, tree expr_tree, } else if (TREE_CODE (type_tree) == INTEGER_TYPE) ret = convert_to_integer (type_tree, expr_tree); - else if (TREE_CODE (type_tree) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type_tree)) ret = convert_to_real (type_tree, expr_tree); else if (TREE_CODE (type_tree) == COMPLEX_TYPE) ret = convert_to_complex (type_tree, expr_tree); @@ -1935,7 +1935,7 @@ Gcc_backend::init_statement (tree, Bvariable *var, tree init_tree) tree var_tree = var->get_decl (); if (var_tree == error_mark_node || init_tree == error_mark_node) return error_mark_node; - gcc_assert (TREE_CODE (var_tree) == VAR_DECL); + gcc_assert (VAR_P (var_tree)); // To avoid problems with GNU ld, we don't make zero-sized // externally visible variables. That might lead us to doing an From patchwork Sat May 13 23:23:17 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: 69301 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D87B23857023 for ; Sat, 13 May 2023 23:24:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D87B23857023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020273; bh=hCL12ukz3HuuPwM+7MkZRoxA0vehmKR7JGbFbt9PC9A=; 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=hlq6135ENdKETJK+TzAzudqnGsL0kZwW1h1m0xb99q1qnTEfUqK4romwffIQWHRd2 qNAlfbA9iCrR5C2WtMzOyJrSm586WirYnA42SbwT4/yA5PF4CyBEdMY+qBwyNqoaJM XiKRZB81n8UB7Ei/Rv99swoHCplOBDE7jdYcliKM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 0F1023858408; Sat, 13 May 2023 23:23:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0F1023858408 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-96ab81aa68dso342020466b.3; Sat, 13 May 2023 16:23:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020229; x=1686612229; 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=hCL12ukz3HuuPwM+7MkZRoxA0vehmKR7JGbFbt9PC9A=; b=Sgigd6Rf5nu7YYDpyyEz2N9IMTNkmzsHcYG12udx0raHoIHihfv+bSo1SE2+v85J23 WpA85baojEJBPyYy8QyGyACuVy89NWyPWdwUrPCS0XT8cS528mNrVNV4NhUT0j7BDrOf pq1Mhg0LTcSgIuiZKxtbTqcd8PPe5kTa9YExfYC9W4pdYUsSx3mnZLtXgvQFytqZJISg BIdG+bRAy85pvEzNZ/s5/d1OVP2KZvYswX7P7unV/2vG5UadCW3SJQtwaKV1aF7TL9fz rvQM50qkgavududBohzjWORPhY0asD4nHKxpJT3iHsW94temBbB9wCMb3xC36i84jerp BEew== X-Gm-Message-State: AC+VfDxnA08uU/9R8A7X6FoMQiUaZZQQoPq74hih3eKDUyJaDX+kgSLJ bU5EYSVMeGX+rf5kfDJgg2ivLFSSM4Y= X-Google-Smtp-Source: ACHHUZ77yQ7IkRjl3a+o1twX/EkFcyj/Q4mz8nnVKHIFb3eFYhqI79eknRdSH6ajlQEaB8LqhDYvbQ== X-Received: by 2002:a17:907:7da0:b0:96a:ed6e:7d58 with SMTP id oz32-20020a1709077da000b0096aed6e7d58mr2003746ejc.7.1684020229094; Sat, 13 May 2023 16:23:49 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id h25-20020a1709070b1900b0094ef923a6ccsm7317336ejl.219.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amr-0U; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 10/14] c: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:17 +0200 Message-Id: <20230513232321.279733-11-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.0 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/c-family/ChangeLog: * c-ada-spec.cc (has_static_fields): Use _P() defines from tree.h. (dump_ada_declaration): Ditto. (dump_ada_structure): Ditto. * c-common.cc (unsafe_conversion_p): Ditto. (shorten_compare): Ditto. (pointer_int_sum): Ditto. (c_common_truthvalue_conversion): Ditto. (scalar_to_vector): Ditto. * c-common.h (gnu_vector_type_p): Ditto. * c-omp.cc (c_omp_depend_t_p): Ditto. (c_omp_split_clauses): Ditto. * c-ubsan.cc (ubsan_instrument_division): Ditto. * c-warn.cc (conversion_warning): Ditto. (warnings_for_convert_and_check): Ditto. gcc/c/ChangeLog: * c-convert.cc (c_convert): Ditto. * c-decl.cc (merge_decls): Ditto. * c-parser.cc (c_parser_omp_clause_reduction): Ditto. (c_parser_omp_declare_reduction): Ditto. * c-typeck.cc (build_component_ref): Ditto. (convert_argument): Ditto. (pointer_diff): Ditto. (build_unary_op): Ditto. (build_c_cast): Ditto. (build_modify_expr): Ditto. (store_init_value): Ditto. (constexpr_init_fits_real_type): Ditto. (check_constexpr_init): Ditto. (c_finish_return): Ditto. (handle_omp_array_sections_1): Ditto. (c_finish_omp_clauses): Ditto. * gimple-parser.cc (c_finish_gimple_return): Ditto. libcc1/ChangeLog: * libcc1plugin.cc (plugin_float_type): Ditto. * libcp1plugin.cc (plugin_reactivate_decl): Ditto. (plugin_get_float_type): Ditto. --- gcc/c-family/c-ada-spec.cc | 6 ++--- gcc/c-family/c-common.cc | 32 +++++++++++------------ gcc/c-family/c-common.h | 2 +- gcc/c-family/c-omp.cc | 5 ++-- gcc/c-family/c-ubsan.cc | 2 +- gcc/c-family/c-warn.cc | 6 ++--- gcc/c/c-convert.cc | 4 +-- gcc/c/c-decl.cc | 6 ++--- gcc/c/c-parser.cc | 4 +-- gcc/c/c-typeck.cc | 52 +++++++++++++++++++------------------- gcc/c/gimple-parser.cc | 2 +- libcc1/libcc1plugin.cc | 2 +- libcc1/libcp1plugin.cc | 4 +-- 13 files changed, 63 insertions(+), 64 deletions(-) diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc index b50b3877564..050994d8416 100644 --- a/gcc/c-family/c-ada-spec.cc +++ b/gcc/c-family/c-ada-spec.cc @@ -1051,7 +1051,7 @@ has_static_fields (const_tree type) return false; for (tree fld = TYPE_FIELDS (type); fld; fld = TREE_CHAIN (fld)) - if (TREE_CODE (fld) == VAR_DECL && DECL_NAME (fld)) + if (VAR_P (fld) && DECL_NAME (fld)) return true; return false; @@ -3244,7 +3244,7 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) if (need_indent) INDENT (spc); - if ((TREE_CODE (t) == FIELD_DECL || TREE_CODE (t) == VAR_DECL) + if ((TREE_CODE (t) == FIELD_DECL || VAR_P (t)) && DECL_NAME (t)) check_type_name_conflict (buffer, t); @@ -3462,7 +3462,7 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested, /* Print the static fields of the structure, if any. */ for (tree tmp = TYPE_FIELDS (node); tmp; tmp = TREE_CHAIN (tmp)) { - if (TREE_CODE (tmp) == VAR_DECL && DECL_NAME (tmp)) + if (VAR_P (tmp) && DECL_NAME (tmp)) { if (need_semicolon) { diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index 2b4c82facf7..9c8eed5442a 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -1483,7 +1483,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign) /* Warn for real constant that is not an exact integer converted to integer type. */ - if (TREE_CODE (expr_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (expr_type) && TREE_CODE (type) == INTEGER_TYPE) { if (!real_isinteger (TREE_REAL_CST_PTR (expr), TYPE_MODE (expr_type))) @@ -1508,7 +1508,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign) else give_warning = UNSAFE_OTHER; } - else if (TREE_CODE (type) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type)) { /* Warn for an integer constant that does not fit into real type. */ if (TREE_CODE (expr_type) == INTEGER_TYPE) @@ -1519,7 +1519,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign) } /* Warn for a real constant that does not fit into a smaller real type. */ - else if (TREE_CODE (expr_type) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (expr_type) && TYPE_PRECISION (type) < TYPE_PRECISION (expr_type)) { REAL_VALUE_TYPE a = TREE_REAL_CST (expr); @@ -1579,7 +1579,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign) else { /* Warn for real types converted to integer types. */ - if (TREE_CODE (expr_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (expr_type) && TREE_CODE (type) == INTEGER_TYPE) give_warning = UNSAFE_REAL; @@ -1651,7 +1651,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign) all the range of values of the integer type cannot be represented by the real type. */ else if (TREE_CODE (expr_type) == INTEGER_TYPE - && TREE_CODE (type) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (type)) { /* Don't warn about char y = 0xff; float x = (int) y; */ expr = get_unwidened (expr, 0); @@ -1662,8 +1662,8 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign) } /* Warn for real types converted to smaller real types. */ - else if (TREE_CODE (expr_type) == REAL_TYPE - && TREE_CODE (type) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (expr_type) + && SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) < TYPE_PRECISION (expr_type)) give_warning = UNSAFE_REAL; @@ -1677,13 +1677,13 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign) tree to_type = TREE_TYPE (type); /* Warn for real types converted to integer types. */ - if (TREE_CODE (from_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (from_type) && TREE_CODE (to_type) == INTEGER_TYPE) give_warning = UNSAFE_REAL; /* Warn for real types converted to smaller real types. */ - else if (TREE_CODE (from_type) == REAL_TYPE - && TREE_CODE (to_type) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (from_type) + && SCALAR_FLOAT_TYPE_P (to_type) && TYPE_PRECISION (to_type) < TYPE_PRECISION (from_type)) give_warning = UNSAFE_REAL; @@ -1706,7 +1706,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign) give_warning = UNSAFE_SIGN; } else if (TREE_CODE (from_type) == INTEGER_TYPE - && TREE_CODE (to_type) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (to_type) && !int_safely_convertible_to_real_p (from_type, to_type)) give_warning = UNSAFE_OTHER; } @@ -2951,8 +2951,8 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr, unsignedp1 = TYPE_UNSIGNED (TREE_TYPE (op1)); /* If one of the operands must be floated, we cannot optimize. */ - real1 = TREE_CODE (TREE_TYPE (primop0)) == REAL_TYPE; - real2 = TREE_CODE (TREE_TYPE (primop1)) == REAL_TYPE; + real1 = SCALAR_FLOAT_TYPE_P (TREE_TYPE (primop0)); + real2 = SCALAR_FLOAT_TYPE_P (TREE_TYPE (primop1)); /* If first arg is constant, swap the args (changing operation so value is preserved), for canonicalization. Don't do this if @@ -3283,7 +3283,7 @@ pointer_int_sum (location_t loc, enum tree_code resultcode, /* The result is a pointer of the same type that is being added. */ tree result_type = TREE_TYPE (ptrop); - if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE) + if (VOID_TYPE_P (TREE_TYPE (result_type))) { if (complain && warn_pointer_arith) pedwarn (loc, OPT_Wpointer_arith, @@ -3730,7 +3730,7 @@ c_common_truthvalue_conversion (location_t location, tree expr) goto ret; } - if (TREE_CODE (TREE_TYPE (expr)) == FIXED_POINT_TYPE) + if (FIXED_POINT_TYPE_P (TREE_TYPE (expr))) { tree fixed_zero_node = build_fixed (TREE_TYPE (expr), FCONST0 (TYPE_MODE @@ -8649,7 +8649,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1, } else if (!integer_only_op /* Allow integer --> real conversion if safe. */ - && (TREE_CODE (type0) == REAL_TYPE + && (SCALAR_FLOAT_TYPE_P (type0) || TREE_CODE (type0) == INTEGER_TYPE) && SCALAR_FLOAT_TYPE_P (TREE_TYPE (type1))) { diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index f96350b64af..336a09f4a40 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -790,7 +790,7 @@ extern bool override_libcpp_locations; inline bool gnu_vector_type_p (const_tree type) { - return TREE_CODE (type) == VECTOR_TYPE && !TYPE_INDIVISIBLE_P (type); + return VECTOR_TYPE_P (type) && !TYPE_INDIVISIBLE_P (type); } struct visibility_flags diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc index f72ca4c6acd..4faddb00bbc 100644 --- a/gcc/c-family/c-omp.cc +++ b/gcc/c-family/c-omp.cc @@ -674,8 +674,7 @@ c_omp_depend_t_p (tree type) && ((TREE_CODE (TYPE_NAME (type)) == TYPE_DECL ? DECL_NAME (TYPE_NAME (type)) : TYPE_NAME (type)) == get_identifier ("omp_depend_t")) - && (!TYPE_CONTEXT (type) - || TREE_CODE (TYPE_CONTEXT (type)) == TRANSLATION_UNIT_DECL) + && TYPE_FILE_SCOPE_P (type) && COMPLETE_TYPE_P (type) && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST && !compare_tree_int (TYPE_SIZE (type), @@ -2672,7 +2671,7 @@ c_omp_split_clauses (location_t loc, enum tree_code code, if (TREE_CODE (t) == POINTER_PLUS_EXPR) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == ADDR_EXPR - || TREE_CODE (t) == INDIRECT_REF) + || INDIRECT_REF_P (t)) t = TREE_OPERAND (t, 0); if (DECL_P (t)) bitmap_clear_bit (&allocate_head, DECL_UID (t)); diff --git a/gcc/c-family/c-ubsan.cc b/gcc/c-family/c-ubsan.cc index cfb7cbf389c..51aa83a378d 100644 --- a/gcc/c-family/c-ubsan.cc +++ b/gcc/c-family/c-ubsan.cc @@ -57,7 +57,7 @@ ubsan_instrument_division (location_t loc, tree op0, tree op1) && sanitize_flags_p (SANITIZE_DIVIDE)) t = fold_build2 (EQ_EXPR, boolean_type_node, op1, build_int_cst (type, 0)); - else if (TREE_CODE (type) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (type) && sanitize_flags_p (SANITIZE_FLOAT_DIVIDE)) { t = fold_build2 (EQ_EXPR, boolean_type_node, diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc index 9ac43a1af6e..d4d62c48b20 100644 --- a/gcc/c-family/c-warn.cc +++ b/gcc/c-family/c-warn.cc @@ -1227,7 +1227,7 @@ conversion_warning (location_t loc, tree type, tree expr, tree result) { bool cstresult = (result - && TREE_CODE_CLASS (TREE_CODE (result)) == tcc_constant); + && CONSTANT_CLASS_P (result)); if (TYPE_UNSIGNED (type)) { if (cstresult) @@ -1255,7 +1255,7 @@ conversion_warning (location_t loc, tree type, tree expr, tree result) expr_type, type, expr); } } - else if (TREE_CODE_CLASS (TREE_CODE (result)) == tcc_constant) + else if (CONSTANT_CLASS_P (result)) warning_at (loc, warnopt, "conversion from %qT to %qT changes value from %qE to %qE", expr_type, type, expr, result); @@ -1404,7 +1404,7 @@ warnings_for_convert_and_check (location_t loc, tree type, tree expr, while (TREE_CODE (result) == COMPOUND_EXPR) result = TREE_OPERAND (result, 1); - bool cst = TREE_CODE_CLASS (TREE_CODE (result)) == tcc_constant; + bool cst = CONSTANT_CLASS_P (result); tree exprtype = TREE_TYPE (expr); tree result_diag; /* We're interested in the actual numerical value here, not its ASCII diff --git a/gcc/c/c-convert.cc b/gcc/c/c-convert.cc index 0f35dc4fe9a..5754d00b30a 100644 --- a/gcc/c/c-convert.cc +++ b/gcc/c/c-convert.cc @@ -99,7 +99,7 @@ c_convert (tree type, tree expr, bool init_const) return fold_convert_loc (loc, type, expr); if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK) return error_mark_node; - if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE) + if (VOID_TYPE_P (TREE_TYPE (expr))) { error ("void value not ignored as it ought to be"); return error_mark_node; @@ -119,7 +119,7 @@ c_convert (tree type, tree expr, bool init_const) case INTEGER_TYPE: if (sanitize_flags_p (SANITIZE_FLOAT_CAST) && current_function_decl != NULL_TREE - && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (expr)) && COMPLETE_TYPE_P (type)) { expr = save_expr (expr); diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 1b53f2d0785..e378d461127 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -2746,11 +2746,11 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) system header. Otherwise, keep source location of definition rather than declaration and of prototype rather than non-prototype unless that prototype is built-in. */ - if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS) + if (HAS_DECL_ASSEMBLER_NAME_P (olddecl) && DECL_IN_SYSTEM_HEADER (olddecl) && !DECL_IN_SYSTEM_HEADER (newdecl) ) DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl); - else if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS) + else if (HAS_DECL_ASSEMBLER_NAME_P (olddecl) && DECL_IN_SYSTEM_HEADER (newdecl) && !DECL_IN_SYSTEM_HEADER (olddecl)) DECL_SOURCE_LOCATION (olddecl) = DECL_SOURCE_LOCATION (newdecl); @@ -2777,7 +2777,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) if (VAR_P (olddecl) && C_DECL_THREADPRIVATE_P (olddecl)) C_DECL_THREADPRIVATE_P (newdecl) = 1; - if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS)) + if (HAS_DECL_ASSEMBLER_NAME_P (olddecl)) { /* Copy the assembler name. Currently, it can only be defined in the prototype. */ diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index c9f06930e3a..11ac8653d5b 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -15730,7 +15730,7 @@ c_parser_omp_clause_reduction (c_parser *parser, enum omp_clause_code kind, OMP_CLAUSE_REDUCTION_INSCAN (c) = 1; if (code == ERROR_MARK || !(INTEGRAL_TYPE_P (type) - || TREE_CODE (type) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE)) OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) = c_omp_reduction_lookup (reduc_id, @@ -23293,7 +23293,7 @@ c_parser_omp_declare_reduction (c_parser *parser, enum pragma_context context) if (type == error_mark_node) ; else if ((INTEGRAL_TYPE_P (type) - || TREE_CODE (type) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE) && orig_reduc_id == NULL_TREE) error_at (loc, "predeclared arithmetic type in " diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index f619e2a67e7..191a90ff651 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -2662,7 +2662,7 @@ build_component_ref (location_t loc, tree datum, tree component, /* Special-case the error message for "ptr.field" for the case where the user has confused "." vs "->". */ rich_location richloc (line_table, loc); - if (TREE_CODE (datum) == INDIRECT_REF && arrow_loc != UNKNOWN_LOCATION) + if (INDIRECT_REF_P (datum) && arrow_loc != UNKNOWN_LOCATION) { richloc.add_fixit_insert_before (arrow_loc, "(*"); richloc.add_fixit_insert_after (arrow_loc, ")"); @@ -3414,7 +3414,7 @@ convert_argument (location_t ploc, tree function, tree fundecl, unsigned int formal_prec = TYPE_PRECISION (type); if (INTEGRAL_TYPE_P (type) - && TREE_CODE (valtype) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (valtype)) warning_at (ploc, OPT_Wtraditional_conversion, "passing argument %d of %qE as integer rather " "than floating due to prototype", @@ -3426,12 +3426,12 @@ convert_argument (location_t ploc, tree function, tree fundecl, "than complex due to prototype", argnum, rname); else if (TREE_CODE (type) == COMPLEX_TYPE - && TREE_CODE (valtype) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (valtype)) warning_at (ploc, OPT_Wtraditional_conversion, "passing argument %d of %qE as complex rather " "than floating due to prototype", argnum, rname); - else if (TREE_CODE (type) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (type) && INTEGRAL_TYPE_P (valtype)) warning_at (ploc, OPT_Wtraditional_conversion, "passing argument %d of %qE as floating rather " @@ -3443,7 +3443,7 @@ convert_argument (location_t ploc, tree function, tree fundecl, "passing argument %d of %qE as complex rather " "than integer due to prototype", argnum, rname); - else if (TREE_CODE (type) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (type) && TREE_CODE (valtype) == COMPLEX_TYPE) warning_at (ploc, OPT_Wtraditional_conversion, "passing argument %d of %qE as floating rather " @@ -3452,8 +3452,8 @@ convert_argument (location_t ploc, tree function, tree fundecl, /* ??? At some point, messages should be written about conversions between complex types, but that's too messy to do now. */ - else if (TREE_CODE (type) == REAL_TYPE - && TREE_CODE (valtype) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type) + && SCALAR_FLOAT_TYPE_P (valtype)) { /* Warn if any argument is passed as `float', since without a prototype it would be `double'. */ @@ -4131,7 +4131,7 @@ pointer_diff (location_t loc, tree op0, tree op1, tree *instrument_expr) else inttype = restype; - if (TREE_CODE (target_type) == VOID_TYPE) + if (VOID_TYPE_P (target_type)) pedwarn (loc, OPT_Wpointer_arith, "pointer of type % used in subtraction"); if (TREE_CODE (target_type) == FUNCTION_TYPE) @@ -4828,7 +4828,7 @@ build_unary_op (location_t location, enum tree_code code, tree xarg, TREE_TYPE (argtype)); } else if (TREE_CODE (TREE_TYPE (argtype)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (argtype)) == VOID_TYPE) + || VOID_TYPE_P (TREE_TYPE (argtype))) { if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) pedwarn (location, OPT_Wpointer_arith, @@ -6251,7 +6251,7 @@ build_c_cast (location_t loc, tree type, tree expr) /* Ignore any integer overflow caused by the cast. */ if (TREE_CODE (value) == INTEGER_CST && !FLOAT_TYPE_P (otype)) { - if (CONSTANT_CLASS_P (ovalue) && TREE_OVERFLOW (ovalue)) + if (TREE_OVERFLOW_P (ovalue)) { if (!TREE_OVERFLOW (value)) { @@ -6477,7 +6477,7 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype, if (TREE_CODE (lhs) == COMPONENT_REF && (TREE_CODE (lhstype) == INTEGER_TYPE || TREE_CODE (lhstype) == BOOLEAN_TYPE - || TREE_CODE (lhstype) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (lhstype) || TREE_CODE (lhstype) == ENUMERAL_TYPE)) lhstype = TREE_TYPE (get_unwidened (lhs, 0)); @@ -7938,7 +7938,7 @@ store_init_value (location_t init_loc, tree decl, tree init, tree origtype) /* Not fully determined before folding. */ arith_const_expr = true; } - bool constexpr_p = (TREE_CODE (decl) == VAR_DECL + bool constexpr_p = (VAR_P (decl) && C_DECL_DECLARED_CONSTEXPR (decl)); value = digest_init (init_loc, type, init, origtype, npc, int_const_expr, arith_const_expr, true, @@ -8119,7 +8119,7 @@ print_spelling (char *buffer) static bool constexpr_init_fits_real_type (tree type, tree init) { - gcc_assert (TREE_CODE (type) == REAL_TYPE); + gcc_assert (SCALAR_FLOAT_TYPE_P (type)); gcc_assert (TREE_CODE (init) == INTEGER_CST || TREE_CODE (init) == REAL_CST); if (TREE_CODE (init) == REAL_CST && TYPE_MODE (TREE_TYPE (init)) == TYPE_MODE (type)) @@ -8226,14 +8226,14 @@ check_constexpr_init (location_t loc, tree type, tree init, compatible (not just the same mode); all quiet NaN and infinity initializations are considered to preserve the value. */ if (TREE_CODE (TREE_TYPE (init)) == COMPLEX_TYPE - && TREE_CODE (type) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (type)) { error_at (loc, "% initializer for a real type is of " "complex type"); return; } - if (TREE_CODE (type) == REAL_TYPE - && TREE_CODE (TREE_TYPE (init)) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (type) + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (init)) && DECIMAL_FLOAT_TYPE_P (TREE_TYPE (init)) && !DECIMAL_FLOAT_TYPE_P (type)) { @@ -11313,7 +11313,7 @@ c_finish_return (location_t loc, tree retval, tree origtype) "declared here"); } } - else if (valtype == NULL_TREE || TREE_CODE (valtype) == VOID_TYPE) + else if (valtype == NULL_TREE || VOID_TYPE_P (valtype)) { current_function_returns_null = 1; bool warned_here; @@ -11345,7 +11345,7 @@ c_finish_return (location_t loc, tree retval, tree origtype) save = in_late_binary_op; if (C_BOOLEAN_TYPE_P (TREE_TYPE (res)) || TREE_CODE (TREE_TYPE (res)) == COMPLEX_TYPE - || (TREE_CODE (TREE_TYPE (t)) == REAL_TYPE + || (SCALAR_FLOAT_TYPE_P (TREE_TYPE (t)) && (TREE_CODE (TREE_TYPE (res)) == INTEGER_TYPE || TREE_CODE (TREE_TYPE (res)) == ENUMERAL_TYPE) && sanitize_flags_p (SANITIZE_FLOAT_CAST))) @@ -13668,7 +13668,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec &types, t, omp_clause_code_name[OMP_CLAUSE_CODE (c)]); return error_mark_node; } - while (TREE_CODE (t) == INDIRECT_REF) + while (INDIRECT_REF_P (t)) { t = TREE_OPERAND (t, 0); STRIP_NOPS (t); @@ -13702,7 +13702,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec &types, } t = TREE_OPERAND (t, 0); while (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -15402,7 +15402,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) { t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF) + || INDIRECT_REF_P (t)) { t = TREE_OPERAND (t, 0); STRIP_NOPS (t); @@ -15479,7 +15479,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) bias) to zero here, so it is not set erroneously to the pointer size later on in gimplify.cc. */ OMP_CLAUSE_SIZE (c) = size_zero_node; - while (TREE_CODE (t) == INDIRECT_REF + while (INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -15495,7 +15495,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) indir_component_ref_p = false; if (TREE_CODE (t) == COMPONENT_REF && (TREE_CODE (TREE_OPERAND (t, 0)) == MEM_REF - || TREE_CODE (TREE_OPERAND (t, 0)) == INDIRECT_REF + || INDIRECT_REF_P (TREE_OPERAND (t, 0)) || TREE_CODE (TREE_OPERAND (t, 0)) == ARRAY_REF)) { t = TREE_OPERAND (TREE_OPERAND (t, 0), 0); @@ -15550,7 +15550,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = TREE_OPERAND (t, 0); } while (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -16094,7 +16094,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) if (TREE_CODE (t) == POINTER_PLUS_EXPR) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == ADDR_EXPR - || TREE_CODE (t) == INDIRECT_REF) + || INDIRECT_REF_P (t)) t = TREE_OPERAND (t, 0); if (DECL_P (t)) bitmap_clear_bit (&aligned_head, DECL_UID (t)); @@ -16131,7 +16131,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) { tree t = OMP_CLAUSE_DECL (c); while (handled_component_p (t) - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ADDR_EXPR || TREE_CODE (t) == MEM_REF || TREE_CODE (t) == NON_LVALUE_EXPR) diff --git a/gcc/c/gimple-parser.cc b/gcc/c/gimple-parser.cc index 5423a790cc0..cc3a8899d97 100644 --- a/gcc/c/gimple-parser.cc +++ b/gcc/c/gimple-parser.cc @@ -2472,7 +2472,7 @@ c_finish_gimple_return (location_t loc, tree retval) if (! retval) current_function_returns_null = 1; - else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE) + else if (valtype == 0 || VOID_TYPE_P (valtype)) { current_function_returns_null = 1; if (TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE) diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc index 7e0fecae145..283eaf20685 100644 --- a/libcc1/libcc1plugin.cc +++ b/libcc1/libcc1plugin.cc @@ -632,7 +632,7 @@ plugin_float_type (cc1_plugin::connection *self, if (!result) return convert_out (error_mark_node); - gcc_assert (TREE_CODE (result) == REAL_TYPE); + gcc_assert (SCALAR_FLOAT_TYPE_P (result)); gcc_assert (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (result)); return convert_out (result); diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index 8d394c0cfdb..3c8e9e8b436 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -713,7 +713,7 @@ plugin_reactivate_decl (cc1_plugin::connection *, { tree decl = convert_in (decl_in); tree scope = convert_in (scope_in); - gcc_assert (TREE_CODE (decl) == VAR_DECL + gcc_assert (VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == TYPE_DECL); cp_binding_level *b; @@ -3296,7 +3296,7 @@ plugin_get_float_type (cc1_plugin::connection *, if (!result) return convert_out (error_mark_node); - gcc_assert (TREE_CODE (result) == REAL_TYPE); + gcc_assert (SCALAR_FLOAT_TYPE_P (result)); gcc_assert (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (result)); return convert_out (result); From patchwork Sat May 13 23:23:18 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: 69304 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6607B38768B7 for ; Sat, 13 May 2023 23:25:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6607B38768B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020335; bh=P1EfbTsqHUp1fAIX8qMLreTNngcPypHSiUr0Cj4Go/E=; 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=rlvpdZRSoGHqGPBgVwfgyfHos7X2Ek+YQPd+E6a7ulxQKs84u1Y3g+EVvBBm4dmNC Fn5HHXjuNEfZw/WTSyq2glSVxHDRx0zeNNBV6nRxJI4HnM3/48pKqsxbmLciX9PbiA Y05gC2p1eoPHXiVpGm73P6H8aUBGtNgcLUB6cIN4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id B0F483858426; Sat, 13 May 2023 23:23:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B0F483858426 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9659c5b14d8so1887605966b.3; Sat, 13 May 2023 16:23:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020233; x=1686612233; 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=P1EfbTsqHUp1fAIX8qMLreTNngcPypHSiUr0Cj4Go/E=; b=B8d10l9YBNVVMTeTbpHyXQ1cZs1PDJBBfWmKugcGDLTaIrHN2f88PfmykYH4zmCH4f cuCBtgT6IktKbP3f8EoTtN+90U2pi9Uy/6rCgdGddKivZnHR9eotOzCTGqfCQI0kvEap R5gP3tAI+CDDzJHhuW4SMz9KVE+S5U5Jw7tsw9sfeZdUDOtGVvn/F7qjvEQwA+MT+Clh H0UtABwJlf06xMuI1ZDHBLoQlUU42gcgUFEnZOcc+vk43wCctW2AZRnTj64ykS9T2zhw GCC08v210jyfy1cYxlxwdTZcMIIGHzcS9raiAFlSteI17RF8h9Zl0wlxl8GhyKp/uYXK USsg== X-Gm-Message-State: AC+VfDw57d0hsq04j4RVg78ou+YzavpMLxz1yeDAfkP+mviOqjFeaj/8 3Kd8nEN/SYFmzN+r/yC8HcUEWHPHwls= X-Google-Smtp-Source: ACHHUZ4c2uc4e+MUGX4hqBk5WGe7gujEggszj3RtXaPEbMf+ewVza4mLiD08WtEyCdt3QfJ+wMecZQ== X-Received: by 2002:a17:907:c26:b0:966:238a:c93 with SMTP id ga38-20020a1709070c2600b00966238a0c93mr26464554ejc.68.1684020232686; Sat, 13 May 2023 16:23:52 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id m26-20020a17090677da00b0096ae4451c65sm1239461ejn.157.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amv-0Y; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 11/14] objc: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:18 +0200 Message-Id: <20230513232321.279733-12-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.2 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/objc/ChangeLog: * objc-act.cc (objc_volatilize_decl): Use _P() defines from tree.h. (objc_is_global_reference_p): Ditto. (objc_generate_write_barrier): Ditto. (objc_gimplify_property_ref): Ditto. * objc-next-runtime-abi-01.cc (next_runtime_abi_01_receiver_is_class_object): Ditto. * objc-next-runtime-abi-02.cc (next_runtime_abi_02_receiver_is_class_object): Ditto. (next_runtime_abi_02_build_objc_method_call): Ditto. --- gcc/objc/objc-act.cc | 10 +++++----- gcc/objc/objc-next-runtime-abi-01.cc | 2 +- gcc/objc/objc-next-runtime-abi-02.cc | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/objc/objc-act.cc b/gcc/objc/objc-act.cc index 08201749207..e4c49e664e1 100644 --- a/gcc/objc/objc-act.cc +++ b/gcc/objc/objc-act.cc @@ -2338,7 +2338,7 @@ objc_volatilize_decl (tree decl) /* Do not mess with variables that are 'static' or (already) 'volatile'. */ if (!TREE_THIS_VOLATILE (decl) && !TREE_STATIC (decl) - && (TREE_CODE (decl) == VAR_DECL + && (VAR_P (decl) || TREE_CODE (decl) == PARM_DECL)) { if (local_variables_to_volatilize == NULL) @@ -3793,7 +3793,7 @@ objc_is_ivar_reference_p (tree expr) static int objc_is_global_reference_p (tree expr) { - return (TREE_CODE (expr) == INDIRECT_REF || TREE_CODE (expr) == PLUS_EXPR + return (INDIRECT_REF_P (expr) || TREE_CODE (expr) == PLUS_EXPR ? objc_is_global_reference_p (TREE_OPERAND (expr, 0)) : DECL_P (expr) ? (DECL_FILE_SCOPE_P (expr) || TREE_STATIC (expr)) @@ -3812,7 +3812,7 @@ objc_generate_write_barrier (tree lhs, enum tree_code modifycode, tree rhs) /* See if we have any lhs casts, and strip them out. NB: The lvalue casts will have been transformed to the form '*(type *)&expr'. */ - if (TREE_CODE (lhs) == INDIRECT_REF) + if (INDIRECT_REF_P (lhs)) { outer = TREE_OPERAND (lhs, 0); @@ -3864,7 +3864,7 @@ objc_generate_write_barrier (tree lhs, enum tree_code modifycode, tree rhs) || TREE_CODE (outer) == ARRAY_REF)) outer = TREE_OPERAND (outer, 0); - if (TREE_CODE (outer) == INDIRECT_REF) + if (INDIRECT_REF_P (outer)) { outer = TREE_OPERAND (outer, 0); indirect_p = 1; @@ -9694,7 +9694,7 @@ objc_gimplify_property_ref (tree *expr_p) if (TREE_CODE (getter) == TARGET_EXPR) { gcc_assert (MAYBE_CLASS_TYPE_P (TREE_TYPE (getter))); - gcc_assert (TREE_CODE (TREE_OPERAND (getter, 0)) == VAR_DECL); + gcc_assert (VAR_P (TREE_OPERAND (getter, 0))); call_exp = TREE_OPERAND (getter, 1); } #endif diff --git a/gcc/objc/objc-next-runtime-abi-01.cc b/gcc/objc/objc-next-runtime-abi-01.cc index 8f68f784efe..70ab5262e17 100644 --- a/gcc/objc/objc-next-runtime-abi-01.cc +++ b/gcc/objc/objc-next-runtime-abi-01.cc @@ -754,7 +754,7 @@ next_runtime_abi_01_get_arg_type_list_base (vec **argtypes, static tree next_runtime_abi_01_receiver_is_class_object (tree receiver) { - if (TREE_CODE (receiver) == VAR_DECL + if (VAR_P (receiver) && IS_CLASS (TREE_TYPE (receiver))) { /* The receiver is a variable created by build_class_reference_decl. */ diff --git a/gcc/objc/objc-next-runtime-abi-02.cc b/gcc/objc/objc-next-runtime-abi-02.cc index bcfc0ce8e19..6548c0078e0 100644 --- a/gcc/objc/objc-next-runtime-abi-02.cc +++ b/gcc/objc/objc-next-runtime-abi-02.cc @@ -1571,7 +1571,7 @@ next_runtime_abi_02_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, static tree next_runtime_abi_02_receiver_is_class_object (tree receiver) { - if (TREE_CODE (receiver) == VAR_DECL + if (VAR_P (receiver) && IS_CLASS (TREE_TYPE (receiver)) && vec_safe_length (classrefs)) { @@ -1824,7 +1824,7 @@ next_runtime_abi_02_build_objc_method_call (location_t loc, checked. */ bool check_for_nil = flag_objc_nilcheck; if (super - || (TREE_CODE (receiver) == VAR_DECL + || (VAR_P (receiver) && TREE_TYPE (receiver) == objc_class_type)) check_for_nil = false; From patchwork Sat May 13 23:23:19 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: 69303 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 218793873E51 for ; Sat, 13 May 2023 23:25:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 218793873E51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020327; bh=lcgcGderMCLlnyMkN1MUhO2uI+89Y9qIEMeAHXpzNcI=; 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=vs0qJVCu0/b2MODVRdM0qjYz7FdMwjHb/Dv2+oNPdlwGu6dYIDwSHbm7HYdEwWbUL hnbjMMSAXAUY58Or0lhNfzjeJZYDmaKSw1pt3wHGUE6HPnoDcqraoETwbNflx/Ctae I6EVbCKRy3VsvT1/QvO+PK57cKTWPTK8iYw00gTQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id E78323858431; Sat, 13 May 2023 23:23:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E78323858431 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-50be17a1eceso21153277a12.2; Sat, 13 May 2023 16:23:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020233; x=1686612233; 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=lcgcGderMCLlnyMkN1MUhO2uI+89Y9qIEMeAHXpzNcI=; b=YOMTutvDfwUJpqR3qOZOVHmgXZQdcygekavQcFpqN2oL/kDtRX6zidKQnZRgwwADNo KJl1CfgABl3qyj8G9IpRZ+VqTL5sdBrQinoyPzXFYrfVuioggvIVAyhTPNo8bYDjUXlZ Mfj6orV7/olcVzOGtk0UBou4B6W9UnRF1elji/ZCSnUvhkPe8wpheWPx+8lYNEP47ybH tlt096eebudVCmQCHPp2egzkfFKFKNSp+FF7UPF1w+0Kh/LfldNENRzi7CXOG503h7Q+ yDXwrdZO8eEdYw7vSVTtDBMV6kWcJ9GvoOwq+7GiauZRlBe+o0Nlx5sdqftp2dar35Gp x4DA== X-Gm-Message-State: AC+VfDxmeLGIHti4teL3FHAKmO13g3QzX1Gu0uiybjre9No7dDgUvH2U JpSHPYxekDHJwvQ2sUP4kv9Lj7FmQw8= X-Google-Smtp-Source: ACHHUZ74aSUyWDtnJfLrlEdoDtS5uUU50qLILrDpLpDWEG8ZkioBypb+wRyJlY+HJMxB0kzsb+i4aQ== X-Received: by 2002:a17:907:2685:b0:94f:3bf7:dacf with SMTP id bn5-20020a170907268500b0094f3bf7dacfmr24595794ejc.71.1684020233043; Sat, 13 May 2023 16:23:53 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id u15-20020aa7db8f000000b0050bc863d32asm5442560edt.27.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amz-0c; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 12/14] go: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:19 +0200 Message-Id: <20230513232321.279733-13-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.2 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/go/ChangeLog: * go-gcc.cc (Gcc_backend::fill_in_array): Use _P() defines from tree.h. (Gcc_backend::named_type): Ditto. (Gcc_backend::convert_expression): Ditto. (operator_to_tree_code): Ditto. (Gcc_backend::init_statement): Ditto. gcc/ChangeLog: * godump.cc (go_format_type): Ditto. (go_output_typedef): Ditto. --- gcc/go/go-gcc.cc | 10 +++++----- gcc/godump.cc | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 41ae9f83731..ad001a9044a 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -1168,7 +1168,7 @@ Gcc_backend::fill_in_array(Btype* fill, Btype* element_type, if (element_type_tree == error_mark_node || length_tree == error_mark_node) return this->error_type(); - gcc_assert(TYPE_SIZE(element_type_tree) != NULL_TREE); + gcc_assert (COMPLETE_TYPE_P (element_type_tree)); length_tree = fold_convert(sizetype, length_tree); @@ -1347,7 +1347,7 @@ Gcc_backend::named_type(const std::string& name, Btype* btype, if (TYPE_NAME(type) == NULL_TREE && location.gcc_location() == BUILTINS_LOCATION && (TREE_CODE(type) == INTEGER_TYPE - || TREE_CODE(type) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (type) || TREE_CODE(type) == COMPLEX_TYPE || TREE_CODE(type) == BOOLEAN_TYPE)) { @@ -1670,7 +1670,7 @@ Gcc_backend::convert_expression(Btype* type, Bexpression* expr, } else if (TREE_CODE(type_tree) == INTEGER_TYPE) ret = fold(convert_to_integer(type_tree, expr_tree)); - else if (TREE_CODE(type_tree) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type_tree)) ret = fold(convert_to_real(type_tree, expr_tree)); else if (TREE_CODE(type_tree) == COMPLEX_TYPE) ret = fold(convert_to_complex(type_tree, expr_tree)); @@ -1880,7 +1880,7 @@ operator_to_tree_code(Operator op, tree type) code = MULT_EXPR; break; case OPERATOR_DIV: - if (TREE_CODE(type) == REAL_TYPE || TREE_CODE(type) == COMPLEX_TYPE) + if (SCALAR_FLOAT_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE) code = RDIV_EXPR; else code = TRUNC_DIV_EXPR; @@ -2223,7 +2223,7 @@ Gcc_backend::init_statement(Bfunction*, Bvariable* var, Bexpression* init) tree init_tree = init->get_tree(); if (var_tree == error_mark_node || init_tree == error_mark_node) return this->error_statement(); - gcc_assert(TREE_CODE(var_tree) == VAR_DECL); + gcc_assert (VAR_P (var_tree)); // To avoid problems with GNU ld, we don't make zero-sized // externally visible variables. That might lead us to doing an diff --git a/gcc/godump.cc b/gcc/godump.cc index 0893d5fbc97..1a62753af12 100644 --- a/gcc/godump.cc +++ b/gcc/godump.cc @@ -791,7 +791,7 @@ go_format_type (class godump_container *container, tree type, tree real_type; real_type = TREE_TYPE (type); - if (TREE_CODE (real_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (real_type)) { switch (TYPE_PRECISION (real_type)) { @@ -1100,7 +1100,7 @@ go_output_typedef (class godump_container *container, tree decl) if (TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE && TYPE_SIZE (TREE_TYPE (decl)) != 0 && !container->decls_seen.contains (TREE_TYPE (decl)) - && (TYPE_CANONICAL (TREE_TYPE (decl)) == NULL_TREE + && (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (decl)) || !container->decls_seen.contains (TYPE_CANONICAL (TREE_TYPE (decl))))) { From patchwork Sat May 13 23:23:20 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: 69302 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 46B133852919 for ; Sat, 13 May 2023 23:25:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46B133852919 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020315; bh=f14T0/nVhMTgqVhsbp1z+xmpjY0LXEs331MLA0nIxG8=; 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=Bcc3dk9WX3fuJYr+s5bIqlInol2c8qxScFcrHWoc0LNRsv+3F03mv2NzzgZqlKp4H g0kEk/zIQKIQRTl6K67opgmul6jLEvuw+4ZpZq+wYYBoMKH4Px7tEtSrSZp4OOCC4t 5/nvXtLZTyerkFZ5OAsLuxtv0yP7zzW+PTN4aF9M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 190CD3856DFC; Sat, 13 May 2023 23:23:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 190CD3856DFC Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-9659e9bbff5so2094459766b.1; 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=1684020236; x=1686612236; 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=f14T0/nVhMTgqVhsbp1z+xmpjY0LXEs331MLA0nIxG8=; b=hueOFX4uhZVBYm1auVsot85jG9cBEMqlBTdpJk+86GnuUe8QXPkqecrVayTz0+6Ut1 OUlA5bjaOGfoZjJBxvuRpmxMENncJUVhdQ7dBuqUrVP+5Hw4qOYxU9P9KOJ0CuYnv5LM NkOBrgQ+t4IrSp+li82GQTMZMtnDU/O5fHtMfzSK58CDYE/uULWjew9NfOfS8yMEZZ40 srsrBCQmqVAcOSQgYJLQQMjpX6kQoavktrF/SEFhTr5jf9R04qJC3w+yNeTy9IMEeU/N ++qvCwzIM3EvhZN3gYpy1nWzbHIu1Yghz1DSfSSyjRg5d9gUe7uoykLlufPa3BisThQj +sjQ== X-Gm-Message-State: AC+VfDxcXIu9TF0lTL3TN/+ZCBBw96Ng8f/hPiQ0LZmlL+IWdo3cOTUY ORu865B1+1Xtn76MMLDwuWE09uf55cM= X-Google-Smtp-Source: ACHHUZ6jLBSiF2M5Y03gc8dV7pgN2DyBmpvBa7Dukc4swIsnmtJmzCktCI2H9YjODBR9EoJA5AkXFg== X-Received: by 2002:a17:907:360c:b0:966:23e5:c8f7 with SMTP id bk12-20020a170907360c00b0096623e5c8f7mr23770130ejc.62.1684020236294; Sat, 13 May 2023 16:23:56 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id s15-20020a056402164f00b0050d56dffc93sm5527893edx.12.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:50 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001An3-0h; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 13/14] omp: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:20 +0200 Message-Id: <20230513232321.279733-14-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.2 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer gcc/ChangeLog: * omp-low.cc (scan_sharing_clauses): Use _P() defines from tree.h. (lower_reduction_clauses): Ditto. (lower_send_clauses): Ditto. (lower_omp_task_reductions): Ditto. * omp-oacc-neuter-broadcast.cc (install_var_field): Ditto. (worker_single_copy): Ditto. * omp-offload.cc (oacc_rewrite_var_decl): Ditto. * omp-simd-clone.cc (plausible_type_for_simd_clone): Ditto. --- gcc/omp-low.cc | 36 ++++++++++++++++---------------- gcc/omp-oacc-neuter-broadcast.cc | 10 ++++----- gcc/omp-offload.cc | 2 +- gcc/omp-simd-clone.cc | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index dddf5b59d8f..9db33d2a48b 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -1267,7 +1267,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) tree t = TREE_OPERAND (decl, 0); if (TREE_CODE (t) == POINTER_PLUS_EXPR) t = TREE_OPERAND (t, 0); - if (TREE_CODE (t) == INDIRECT_REF + if (INDIRECT_REF_P (t) || TREE_CODE (t) == ADDR_EXPR) t = TREE_OPERAND (t, 0); if (is_omp_target (ctx->stmt)) @@ -1276,7 +1276,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) { gcc_assert (DECL_HAS_VALUE_EXPR_P (t)); t = DECL_VALUE_EXPR (t); - gcc_assert (TREE_CODE (t) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (t)); t = TREE_OPERAND (t, 0); gcc_assert (DECL_P (t)); } @@ -1383,7 +1383,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) } else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR) { - if (TREE_CODE (decl) == INDIRECT_REF) + if (INDIRECT_REF_P (decl)) decl = TREE_OPERAND (decl, 0); install_var_field (decl, true, 3, ctx); } @@ -1457,7 +1457,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && 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)); install_var_local (decl2, ctx); @@ -1467,7 +1467,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) 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); goto do_private; @@ -1635,7 +1635,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) == GOMP_MAP_FIRSTPRIVATE_REFERENCE))) { if (TREE_CODE (decl) == COMPONENT_REF - || (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) @@ -1646,7 +1646,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && 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)); install_var_local (decl2, ctx); @@ -1660,7 +1660,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && 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)); install_var_field (decl2, true, 3, ctx); @@ -1802,7 +1802,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) decl = OMP_CLAUSE_DECL (c); if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR) { - while (TREE_CODE (decl) == INDIRECT_REF + while (INDIRECT_REF_P (decl) || TREE_CODE (decl) == ARRAY_REF) decl = TREE_OPERAND (decl, 0); } @@ -1815,7 +1815,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && is_gimple_omp_offloaded (ctx->stmt)) { 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)); install_var_local (decl2, ctx); @@ -1902,7 +1902,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && 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)); fixup_remapped_decl (decl2, ctx, false); @@ -7772,7 +7772,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, context e.g. on orphaned loop construct. Pretend this is private variable's outer reference. */ ccode = OMP_CLAUSE_PRIVATE; - if (TREE_CODE (var) == INDIRECT_REF) + if (INDIRECT_REF_P (var)) var = TREE_OPERAND (var, 0); } orig_var = var; @@ -7780,7 +7780,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, { gcc_assert (DECL_HAS_VALUE_EXPR_P (var)); var = DECL_VALUE_EXPR (var); - gcc_assert (TREE_CODE (var) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (var)); var = TREE_OPERAND (var, 0); gcc_assert (DECL_P (var)); } @@ -7853,7 +7853,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, } /* For ref build_outer_var_ref already performs this, so only new_var needs a dereference. */ - if (TREE_CODE (d) == INDIRECT_REF) + if (INDIRECT_REF_P (d)) { new_var = build_simple_mem_ref_loc (clause_loc, new_var); gcc_assert (omp_privatize_by_reference (var) @@ -8118,7 +8118,7 @@ lower_send_clauses (tree clauses, gimple_seq *ilist, gimple_seq *olist, val = TREE_OPERAND (val, 0); if (TREE_CODE (val) == POINTER_PLUS_EXPR) val = TREE_OPERAND (val, 0); - if (TREE_CODE (val) == INDIRECT_REF + if (INDIRECT_REF_P (val) || TREE_CODE (val) == ADDR_EXPR) val = TREE_OPERAND (val, 0); if (is_variable_sized (val)) @@ -9351,14 +9351,14 @@ lower_omp_task_reductions (omp_context *ctx, enum tree_code code, tree clauses, tree v = var; if (TREE_CODE (var) == ADDR_EXPR) var = TREE_OPERAND (var, 0); - else if (TREE_CODE (var) == INDIRECT_REF) + else if (INDIRECT_REF_P (var)) var = TREE_OPERAND (var, 0); tree orig_var = var; if (is_variable_sized (var)) { gcc_assert (DECL_HAS_VALUE_EXPR_P (var)); var = DECL_VALUE_EXPR (var); - gcc_assert (TREE_CODE (var) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (var)); var = TREE_OPERAND (var, 0); gcc_assert (DECL_P (var)); } @@ -9367,7 +9367,7 @@ lower_omp_task_reductions (omp_context *ctx, enum tree_code code, tree clauses, gcc_assert (TREE_CODE (v) == ADDR_EXPR); else if (TREE_CODE (v) == ADDR_EXPR) t = build_fold_addr_expr (t); - else if (TREE_CODE (v) == INDIRECT_REF) + else if (INDIRECT_REF_P (v)) t = build_fold_indirect_ref (t); if (TREE_CODE (TREE_OPERAND (decl, 0)) == POINTER_PLUS_EXPR) { diff --git a/gcc/omp-oacc-neuter-broadcast.cc b/gcc/omp-oacc-neuter-broadcast.cc index 6328253018e..779dc6b1afb 100644 --- a/gcc/omp-oacc-neuter-broadcast.cc +++ b/gcc/omp-oacc-neuter-broadcast.cc @@ -555,7 +555,7 @@ install_var_field (tree var, tree record_type, field_map_t *fields) name = get_identifier (tmp); } } - else if (TREE_CODE (var) == VAR_DECL) + else if (VAR_P (var)) { name = DECL_NAME (var); if (!name) @@ -577,7 +577,7 @@ install_var_field (tree var, tree record_type, field_map_t *fields) tree field = build_decl (BUILTINS_LOCATION, FIELD_DECL, name, type); - if (TREE_CODE (var) == VAR_DECL && type == TREE_TYPE (var)) + if (VAR_P (var) && type == TREE_TYPE (var)) { SET_DECL_ALIGN (field, DECL_ALIGN (var)); DECL_USER_ALIGN (field) = DECL_USER_ALIGN (var); @@ -1143,7 +1143,7 @@ worker_single_copy (basic_block from, basic_block to, update_stmt (barrier_phi); } else - gcc_assert (TREE_CODE (var) == VAR_DECL); + gcc_assert (VAR_P (var)); /* If we had no record type, we will have no fields map. */ field_map_t *fields = record_field_map->get (record_type); @@ -1162,7 +1162,7 @@ worker_single_copy (basic_block from, basic_block to, gsi_insert_after (©out_gsi, recv, GSI_CONTINUE_LINKING); update_stmt (recv); - if (TREE_CODE (var) == VAR_DECL) + if (VAR_P (var)) { /* If it's a VAR_DECL, we only copied to an SSA temporary. Copy to the final location now. */ @@ -1194,7 +1194,7 @@ worker_single_copy (basic_block from, basic_block to, gimple_seq_add_stmt (&sender_seq, send); update_stmt (send); } - else if (TREE_CODE (var) == VAR_DECL) + else if (VAR_P (var)) { tree tmp = make_ssa_name (TREE_TYPE (var)); gassign *send = gimple_build_assign (tmp, var); diff --git a/gcc/omp-offload.cc b/gcc/omp-offload.cc index 3bd144e9ccf..0d3c8794d54 100644 --- a/gcc/omp-offload.cc +++ b/gcc/omp-offload.cc @@ -1888,7 +1888,7 @@ oacc_rewrite_var_decl (tree *tp, int *walk_subtrees, void *data) *base = *new_decl; info->modified = true; } - else if (TREE_CODE (*tp) == VAR_DECL) + else if (VAR_P (*tp)) { tree *new_decl = info->adjusted_vars->get (*tp); if (new_decl) diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc index 03ff86e7d18..c1cb7cc8a5c 100644 --- a/gcc/omp-simd-clone.cc +++ b/gcc/omp-simd-clone.cc @@ -150,7 +150,7 @@ auto_simd_check_stmt (gimple *stmt, tree outer) static bool plausible_type_for_simd_clone (tree t) { - if (TREE_CODE (t) == VOID_TYPE) + if (VOID_TYPE_P (t)) return true; else if (RECORD_OR_UNION_TYPE_P (t) || !is_a (TYPE_MODE (t))) /* Small record/union types may fit into a scalar mode, but are 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: 69311 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AA093881D1A for ; Sat, 13 May 2023 23:29:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AA093881D1A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020580; 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=Jp2wLbVFApEf3Lv2+u+kDByEXJ+dth3erxzvjgHP/LlqS+uY/fvl+KLN5yk5aMRkw I05sgu7Hi8d9i3yWLYiXJ7O7E3Q65KKaX5AK8WAPtTmOBdr6K6sVgfTbsiWtyYOXZ/ jxQZ9Oli7o3W1VcnILeOpEyNZa+4oP/nyYBiG3D4= 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-Google-Smtp-Source: ACHHUZ4Cijv4wytyXcoS1lkf8QufPRMxyXtEdcunsTO0mPqY7Irwue31vPMDRlhSy6VhCyQAKjoP6w== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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)