From patchwork Tue Jul 18 23:12:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1809503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=AZfg7ln+; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R5Fg74348z1yY9 for ; Wed, 19 Jul 2023 09:35:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 25A30385B531 for ; Tue, 18 Jul 2023 23:35:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25A30385B531 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689723309; bh=0BtAOcl9NuYK7BmIi4jnqhaWNe+ltWEWYutUrZCH1e4=; 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=AZfg7ln+OYhvVW2PkVSL4ScSRuSILW7DTyA4mT6hQq9wka3eGXkxefDMaFyePlV5v 2n1jsjPkD98SCruLk3zgYRv5+KZsp3g4KvrtHK4LCrpfmD66fhFmjg5Mg+HLppJv7v KmQmyPnvZHCTw3ltqHvU7TUdteGBPqo4ywidLqn8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id 9BACD3856962; Tue, 18 Jul 2023 23:34:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BACD3856962 Received: from pps.filterd (m0247473.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36INRRH7011094; Tue, 18 Jul 2023 23:34:42 GMT Received: from mxout21.s.uw.edu (mxout21.s.uw.edu [140.142.32.139]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rwwtnufme-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 23:34:41 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout21.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36INYPMM002286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 16:34:26 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 36INX5Lx022682 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jul 2023 16:34:25 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: Ken Matsui Subject: [PATCH 1/8] c++, tree: Move TYPE_REF_P to tree.h Date: Tue, 18 Jul 2023 16:12:43 -0700 Message-ID: <20230718233301.28677-2-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org> References: <20230718233301.28677-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: Wd4zmCtGZMXOtfu6Tm153YxnTV50hOLM X-Proofpoint-ORIG-GUID: Wd4zmCtGZMXOtfu6Tm153YxnTV50hOLM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-18_17,2023-07-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 bulkscore=0 spamscore=0 malwarescore=0 priorityscore=1501 clxscore=1034 adultscore=0 mlxlogscore=995 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180208 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, 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: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch moves TYPE_REF_P from cp/cp-tree.h to tree.h to simplify the same code as it and to declare TYPE_REF_IS_LVALUE that determines if a type is a C++ lvalue reference. gcc/cp/ChangeLog: * cp-tree.h (TYPE_REF_P): Remove. gcc/ChangeLog: * tree.h (TYPE_REF_P): Define. Signed-off-by: Ken Matsui --- gcc/cp/cp-tree.h | 4 ---- gcc/tree.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 3de0e154c12..8c96d868650 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4710,10 +4710,6 @@ get_vec_init_expr (tree t) #define TYPE_PTR_P(NODE) \ (TREE_CODE (NODE) == POINTER_TYPE) -/* Returns true if NODE is a reference. */ -#define TYPE_REF_P(NODE) \ - (TREE_CODE (NODE) == REFERENCE_TYPE) - /* Returns true if NODE is a pointer or a reference. */ #define INDIRECT_TYPE_P(NODE) \ (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE)) diff --git a/gcc/tree.h b/gcc/tree.h index 4c04245e2b1..ca3e0ce8f5e 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -678,6 +678,10 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define AGGREGATE_TYPE_P(TYPE) \ (TREE_CODE (TYPE) == ARRAY_TYPE || RECORD_OR_UNION_TYPE_P (TYPE)) +/* Nonzero if this type is a reference. */ +#define TYPE_REF_P(NODE) \ + (TREE_CODE (NODE) == REFERENCE_TYPE) + /* Nonzero if TYPE represents a pointer or reference type. (It should be renamed to INDIRECT_TYPE_P.) Keep these checks in ascending code order. */ From patchwork Tue Jul 18 23:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1809504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=HhtuakqO; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R5FhR3VX9z1yY9 for ; Wed, 19 Jul 2023 09:36:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 779E13858C60 for ; Tue, 18 Jul 2023 23:36:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 779E13858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689723381; bh=I2lNkPFMthr8lH+xZmfRBNbcQliPs7Ha6x2a6mGMhJM=; 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=HhtuakqO5oeS1fY1qu0sypeYyTHvZI7xY6xs3UoFDaASxoEinwSPzA2DM2irDu0aD cwIsY1hZwqpmBYB3TB0vqj317UqxIHNomGeW6t1X81drK1y+rdhO9s934aBnNj3w9V 6aCCv+p0ioMW67IL4GBw8FWgfB+gy4Km/4Eg6j24= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00641c01.pphosted.com (mx0b-00641c01.pphosted.com [205.220.177.146]) by sourceware.org (Postfix) with ESMTPS id 3A0473858413; Tue, 18 Jul 2023 23:35:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A0473858413 Received: from pps.filterd (m0247476.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36INGpEM009067; Tue, 18 Jul 2023 23:35:48 GMT Received: from mxout22.s.uw.edu (mxout22.s.uw.edu [128.95.242.222]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rx03n21td-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 23:35:47 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout22.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36INZ7so026503 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 16:35:07 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 36INX5M0022682 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jul 2023 16:35:07 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: Ken Matsui Subject: [PATCH 2/8] gcc: Use TYPE_REF_P Date: Tue, 18 Jul 2023 16:12:44 -0700 Message-ID: <20230718233301.28677-3-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org> References: <20230718233301.28677-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: XUFkFP3ENCHxfjUjhA9EKhPltWlCURuA X-Proofpoint-GUID: XUFkFP3ENCHxfjUjhA9EKhPltWlCURuA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-18_17,2023-07-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1034 priorityscore=1501 lowpriorityscore=0 adultscore=0 phishscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 impostorscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180208 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, 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: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" gcc/ada/ChangeLog: * gcc-interface/trans.cc (return_slot_opt_for_pure_call_p): Use TYPE_REF_P. * gcc-interface/utils2.cc (build_unary_op): Likewise. gcc/ChangeLog: * alias.cc (get_alias_set): Use TYPE_REF_P. * config/gcn/gcn-tree.cc (gcn_goacc_get_worker_red_decl): Likewise. * fold-const.cc (fold_unary_loc): Likewise. * gimple.cc (gimple_call_nonnull_result_p): Likewise. * gimplify.cc (gimplify_decl_expr): Likewise. (omp_notice_variable): Likewise. (omp_accumulate_sibling_list): Likewise. (omp_build_struct_sibling_lists): Likewise. (gimplify_scan_omp_clauses): Likewise. (omp_shared_to_firstprivate_optimizable_decl_p): Likewise. (gimplify_adjust_omp_clauses_1): Likewise. (gimplify_omp_taskloop_expr): Likewise. * ipa-free-lang-data.cc (find_decls_types_r): Likewise. * ipa-sra.cc (create_parameter_descriptors): Likewise. * langhooks.cc (lhd_omp_scalar_p): Likewise. * match.pd: Likewise. * omp-low.cc (scan_sharing_clauses): Likewise. (lower_rec_input_clauses): Likewise. (create_task_copyfn): Likewise. (lower_omp_target): Likewise. (lower_omp_1): Likewise. * omp-simd-clone.cc (simd_clone_clauses_extract): Likewise. (simd_clone_linear_addend): Likewise. (simd_clone_adjust): Likewise. * tree-inline.cc (remap_type_1): Likewise. * tree.cc (reconstruct_complex_type): Likewise. (verify_type_variant): Likewise. (verify_type): Likewise. (nonnull_arg_p): Likewise. * tree.h (POINTER_TYPE_P): Likewise. * var-tracking.cc (prepare_call_arguments): Likewise. (vt_add_function_parameter): Likewise. gcc/c-family/ChangeLog: * c-attribs.cc (has_attribute): Use TYPE_REF_P. * c-common.cc (c_common_truthvalue_conversion): Likewise. (c_apply_type_quals_to_decl): Likewise. * c-pretty-print.cc (c_pretty_printer::unary_expression): Likewise. * c-ubsan.cc (ubsan_maybe_instrument_reference_or_call): Likewise. * c-warn.cc (warn_if_unused_value): Likewise. gcc/cp/ChangeLog: * constexpr.cc (check_bit_cast_type): Use TYPE_REF_P. * coroutines.cc (analyze_fn_parms): Likewise. * decl.cc (finish_function): Likewise. * init.cc (find_allocator_temps_r): Likewise. * method.cc (early_check_defaulted_comparison): Likewise. (build_comparison_op): Likewise. * pt.cc (value_dependent_expression_p): Likewise. * semantics.cc (cp_oacc_check_attachments): Likewise. (finish_omp_target_clauses_r): Likewise. (finish_omp_target_clauses): Likewise. gcc/d/ChangeLog: * d-builtins.cc (build_frontend_type): Use TYPE_REF_P. * d-codegen.cc (indirect_ref): Likewise. * d-convert.cc (d_truthvalue_conversion): Likewise. gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_descriptor_data_get): Use TYPE_REF_P. (structure_alloc_comps): Likewise. * trans-decl.cc (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_conv_class_to_class): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_caf_get): Likewise. (conv_caf_send): Likewise. (trans_caf_is_present): Likewise. (conv_intrinsic_atomic_op): Likewise. (conv_intrinsic_atomic_ref): Likewise. (conv_intrinsic_atomic_cas): Likewise. * trans-openmp.cc (gfc_omp_privatize_by_reference): Likewise. (gfc_omp_finish_clause): Likewise. (gfc_omp_scalar_p): Likewise. (gfc_trans_omp_array_reduction_or_udr): Likewise. (gfc_trans_omp_clauses): Likewise. gcc/lto/ChangeLog: * lto-common.cc (lto_fixup_prevailing_type): Use TYPE_REF_P. gcc/m2/ChangeLog: * gm2-gcc/m2tree.cc (m2tree_skip_reference_type): Use TYPE_REF_P. * gm2-gcc/m2treelib.cc (m2treelib_get_set_value): Likewise. * m2pp.cc (m2pp_parameter): Likewise. (m2pp_param_type): Likewise. gcc/objc/ChangeLog: * objc-act.cc: Use TYPE_REF_P. Signed-off-by: Ken Matsui --- gcc/ada/gcc-interface/trans.cc | 2 +- gcc/ada/gcc-interface/utils2.cc | 2 +- gcc/alias.cc | 2 +- gcc/c-family/c-attribs.cc | 2 +- gcc/c-family/c-common.cc | 7 +++---- gcc/c-family/c-pretty-print.cc | 2 +- gcc/c-family/c-ubsan.cc | 4 ++-- gcc/c-family/c-warn.cc | 2 +- gcc/config/gcn/gcn-tree.cc | 2 +- gcc/cp/constexpr.cc | 2 +- gcc/cp/coroutines.cc | 2 +- gcc/cp/decl.cc | 2 +- gcc/cp/init.cc | 2 +- gcc/cp/method.cc | 4 ++-- gcc/cp/pt.cc | 2 +- gcc/cp/semantics.cc | 10 +++++----- gcc/d/d-builtins.cc | 2 +- gcc/d/d-codegen.cc | 2 +- gcc/d/d-convert.cc | 4 ++-- gcc/fold-const.cc | 2 +- gcc/fortran/trans-array.cc | 4 ++-- gcc/fortran/trans-decl.cc | 2 +- gcc/fortran/trans-expr.cc | 2 +- gcc/fortran/trans-intrinsic.cc | 16 ++++++++-------- gcc/fortran/trans-openmp.cc | 10 +++++----- gcc/gimple.cc | 2 +- gcc/gimplify.cc | 18 +++++++++--------- gcc/ipa-free-lang-data.cc | 2 +- gcc/ipa-sra.cc | 2 +- gcc/langhooks.cc | 2 +- gcc/lto/lto-common.cc | 2 +- gcc/m2/gm2-gcc/m2tree.cc | 2 +- gcc/m2/gm2-gcc/m2treelib.cc | 2 +- gcc/m2/m2pp.cc | 4 ++-- gcc/match.pd | 2 +- gcc/objc/objc-act.cc | 2 +- gcc/omp-low.cc | 17 ++++++++--------- gcc/omp-simd-clone.cc | 8 ++++---- gcc/tree-inline.cc | 2 +- gcc/tree.cc | 10 +++++----- gcc/tree.h | 2 +- gcc/var-tracking.cc | 6 +++--- 42 files changed, 88 insertions(+), 90 deletions(-) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index f5eadbbc895..203d63b2e5e 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -4540,7 +4540,7 @@ return_slot_opt_for_pure_call_p (tree target, tree call) FOR_EACH_CALL_EXPR_ARG (arg, iter, call) { tree arg_type = TREE_TYPE (arg); - if (TREE_CODE (arg_type) == REFERENCE_TYPE) + if (TYPE_REF_P (arg_type)) arg_type = TREE_TYPE (arg_type); if (is_array_of_scalar_type (arg_type)) diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 95bbce2f1b4..022bbf97e8e 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -1406,7 +1406,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) = build_pointer_type_for_mode (TREE_TYPE (result_type), TYPE_MODE (result_type), true); - else if (TREE_CODE (result_type) == REFERENCE_TYPE + else if (TYPE_REF_P (result_type) && !TYPE_REF_CAN_ALIAS_ALL (result_type)) result_type = build_reference_type_for_mode (TREE_TYPE (result_type), diff --git a/gcc/alias.cc b/gcc/alias.cc index 7c1af1fe96e..3f2e74b00a4 100644 --- a/gcc/alias.cc +++ b/gcc/alias.cc @@ -1041,7 +1041,7 @@ get_alias_set (tree t) p = ptr_type_node; break; } - if (TREE_CODE (p) == REFERENCE_TYPE) + if (TYPE_REF_P (p)) /* In LTO we want languages that use references to be compatible with languages that use pointers. */ reference.safe_push (true && !in_lto_p); diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc index e2792ca6898..852fd2503ec 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -6098,7 +6098,7 @@ has_attribute (location_t atloc, tree t, tree attr, tree (*convert)(tree)) if (code == INDIRECT_REF) { tree op0 = TREE_OPERAND (t, 0); - if (TREE_CODE (TREE_TYPE (op0)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (op0))) t = op0; else break; diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index 6ab63dae997..6add84c9504 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -3657,7 +3657,7 @@ c_common_truthvalue_conversion (location_t location, tree expr) if (POINTER_TYPE_P (totype) && !c_inhibit_evaluation_warnings - && TREE_CODE (fromtype) == REFERENCE_TYPE) + && TYPE_REF_P (fromtype)) { tree inner = expr; STRIP_NOPS (inner); @@ -3672,8 +3672,7 @@ c_common_truthvalue_conversion (location_t location, tree expr) /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE, since that affects how `default_conversion' will behave. */ - if (TREE_CODE (totype) == REFERENCE_TYPE - || TREE_CODE (fromtype) == REFERENCE_TYPE) + if (TYPE_REF_P (totype) || TYPE_REF_P (fromtype)) break; /* Don't strip a conversion from C++0x scoped enum, since they don't implicitly convert to other types. */ @@ -3768,7 +3767,7 @@ c_apply_type_quals_to_decl (int type_quals, tree decl) return; if ((type_quals & TYPE_QUAL_CONST) - || (type && TREE_CODE (type) == REFERENCE_TYPE)) + || (type && TYPE_REF_P (type))) /* We used to check TYPE_NEEDS_CONSTRUCTING here, but now a constexpr constructor can produce constant init, so rely on cp_finish_decl to clear TREE_READONLY if the variable has non-constant init. */ diff --git a/gcc/c-family/c-pretty-print.cc b/gcc/c-family/c-pretty-print.cc index 7536a7c471f..63a77231500 100644 --- a/gcc/c-family/c-pretty-print.cc +++ b/gcc/c-family/c-pretty-print.cc @@ -2181,7 +2181,7 @@ c_pretty_printer::unary_expression (tree e) else if (code == INDIRECT_REF) { tree type = TREE_TYPE (TREE_OPERAND (e, 0)); - if (type && TREE_CODE (type) == REFERENCE_TYPE) + if (type && TYPE_REF_P (type)) /* Reference decay is implicit, don't print anything. */; else pp_c_star (this); diff --git a/gcc/c-family/c-ubsan.cc b/gcc/c-family/c-ubsan.cc index 51aa83a378d..355dc67aa61 100644 --- a/gcc/c-family/c-ubsan.cc +++ b/gcc/c-family/c-ubsan.cc @@ -534,7 +534,7 @@ ubsan_maybe_instrument_reference_or_call (location_t loc, tree op, tree ptype, && TREE_CODE (TREE_TYPE (op)) == POINTER_TYPE) op = TREE_OPERAND (op, 0); if (TREE_CODE (op) == NOP_EXPR - && TREE_CODE (TREE_TYPE (op)) == REFERENCE_TYPE) + && TYPE_REF_P (TREE_TYPE (op))) { if (mina && mina > min_align_of_type (TREE_TYPE (TREE_TYPE (op)))) instrument = true; @@ -570,7 +570,7 @@ ubsan_maybe_instrument_reference_or_call (location_t loc, tree op, tree ptype, return NULL_TREE; op = save_expr (orig_op); gcc_assert (POINTER_TYPE_P (ptype)); - if (TREE_CODE (ptype) == REFERENCE_TYPE) + if (TYPE_REF_P (ptype)) ptype = build_pointer_type (TREE_TYPE (ptype)); tree kind = build_int_cst (ptype, ckind); tree align = build_int_cst (pointer_sized_int_node, mina); diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc index d4d62c48b20..b92b4f9ecb1 100644 --- a/gcc/c-family/c-warn.cc +++ b/gcc/c-family/c-warn.cc @@ -659,7 +659,7 @@ warn_if_unused_value (const_tree exp, location_t locus, bool quiet) case INDIRECT_REF: /* Don't warn about automatic dereferencing of references, since the user cannot control it. */ - if (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (TREE_OPERAND (exp, 0)))) { exp = TREE_OPERAND (exp, 0); goto restart; diff --git a/gcc/config/gcn/gcn-tree.cc b/gcc/config/gcn/gcn-tree.cc index c99c1767659..eed16bcfd27 100644 --- a/gcc/config/gcn/gcn-tree.cc +++ b/gcc/config/gcn/gcn-tree.cc @@ -310,7 +310,7 @@ gcn_goacc_get_worker_red_decl (tree type, unsigned offset) { machine_function *machfun = cfun->machine; - if (TREE_CODE (type) == REFERENCE_TYPE) + if (TYPE_REF_P (type)) type = TREE_TYPE (type); tree var_type diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 9d85c3be5cc..8c416d7bdfc 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -4544,7 +4544,7 @@ check_bit_cast_type (const constexpr_ctx *ctx, location_t loc, tree type, } return true; } - if (TREE_CODE (type) == REFERENCE_TYPE) + if (TYPE_REF_P (type)) { if (!ctx->quiet) { diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index 3493d3c6ed3..a6e04dc0f10 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -3834,7 +3834,7 @@ analyze_fn_parms (tree orig) actual_type = error_mark_node; parm.orig_type = actual_type; parm.by_ref = parm.pt_ref = parm.rv_ref = false; - if (TREE_CODE (actual_type) == REFERENCE_TYPE) + if (TYPE_REF_P (actual_type)) { /* If the user passes by reference, then we will save the pointer to the original. As noted in diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 792ab330dd0..c08056ca3d2 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -18210,7 +18210,7 @@ finish_function (bool inline_p) if (IDENTIFIER_ASSIGN_OP_P (DECL_NAME (fndecl))) { tree valtype = TREE_TYPE (DECL_RESULT (fndecl)); - if (TREE_CODE (valtype) == REFERENCE_TYPE + if (TYPE_REF_P (valtype) && current_class_ref && same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (valtype), TREE_TYPE (current_class_ref)) diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc index ff5014ca576..01eb4b55889 100644 --- a/gcc/cp/init.cc +++ b/gcc/cp/init.cc @@ -4366,7 +4366,7 @@ find_allocator_temps_r (tree *tp, int *walk_subtrees, void *data) { tree arg = get_nth_callarg (t, i); tree atype = TREE_TYPE (arg); - if (TREE_CODE (atype) == REFERENCE_TYPE + if (TYPE_REF_P (atype) && is_std_allocator (TREE_TYPE (atype))) { STRIP_NOPS (arg); diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc index 8ed967ddb21..524efc4e260 100644 --- a/gcc/cp/method.cc +++ b/gcc/cp/method.cc @@ -1207,7 +1207,7 @@ early_check_defaulted_comparison (tree fn) tree parmtype = TREE_VALUE (parmnode); if (CLASS_TYPE_P (parmtype)) saw_byval = true; - else if (TREE_CODE (parmtype) == REFERENCE_TYPE + else if (TYPE_REF_P (parmtype) && !TYPE_REF_IS_RVALUE (parmtype) && TYPE_QUALS (TREE_TYPE (parmtype)) == TYPE_QUAL_CONST) { @@ -1533,7 +1533,7 @@ build_comparison_op (tree fndecl, bool defining, tsubst_flags_t complain) /* A defaulted comparison operator function for class C is defined as deleted if any non-static data member of C is of reference type or C has variant members. */ - if (TREE_CODE (expr_type) == REFERENCE_TYPE) + if (TYPE_REF_P (expr_type)) { if (complain & tf_error) inform (field_loc, "cannot default compare " diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 255d18b9539..cb82e1b268b 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -28023,7 +28023,7 @@ value_dependent_expression_p (tree expression) if (TREE_CODE (expression) == TREE_LIST) return any_value_dependent_elements_p (expression); - if (TREE_CODE (type) == REFERENCE_TYPE + if (TYPE_REF_P (type) && has_value_dependent_address (expression)) return true; diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 8fb47fd179e..8f4b2532934 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -6816,7 +6816,7 @@ cp_oacc_check_attachments (tree c) type = TREE_TYPE (t); - if (TREE_CODE (type) == REFERENCE_TYPE) + if (TYPE_REF_P (type)) type = TREE_TYPE (type); if (TREE_CODE (type) != POINTER_TYPE) @@ -9645,7 +9645,7 @@ finish_omp_target_clauses_r (tree *tp, int *walk_subtrees, void *ptr) tree fld = TREE_OPERAND (t, 1); if (data->ptr_members_accessed.get (fld) == NULL) { - if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (t))) t = convert_from_reference (t); data->ptr_members_accessed.put (fld, t); } @@ -9834,7 +9834,7 @@ finish_omp_target_clauses (location_t loc, tree body, tree *clauses_ptr) tree closure_expr = DECL_VALUE_EXPR (orig_decl); if (TREE_CODE (TREE_TYPE (orig_decl)) == POINTER_TYPE - || TREE_CODE (TREE_TYPE (orig_decl)) == REFERENCE_TYPE) + || TYPE_REF_P (TREE_TYPE (orig_decl))) { /* this-pointer is processed above, outside this loop. */ if (omp_target_this_expr @@ -9931,7 +9931,7 @@ finish_omp_target_clauses (location_t loc, tree body, tree *clauses_ptr) if (!cxx_mark_addressable (ptr_member)) gcc_unreachable (); - if (TREE_CODE (TREE_TYPE (field_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (field_decl))) { /* For reference to pointers, we need to map the referenced pointer first for things to be correct. */ @@ -10026,7 +10026,7 @@ finish_omp_target_clauses (location_t loc, tree body, tree *clauses_ptr) OMP_CLAUSE_SIZE (c) = size_zero_node; new_clauses.safe_push (c); } - else if (TREE_CODE (TREE_TYPE (fld)) == REFERENCE_TYPE) + else if (TYPE_REF_P (TREE_TYPE (fld))) { tree exp = build3 (COMPONENT_REF, TREE_TYPE (fld), lobj, fld, NULL_TREE); diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index 60f76fc694c..bfd455613de 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -307,7 +307,7 @@ build_frontend_type (tree type) } StorageClass sc = STCundefined; - if (TREE_CODE (argtype) == REFERENCE_TYPE) + if (TYPE_REF_P (argtype)) { argtype = TREE_TYPE (argtype); sc |= STCref; diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc index 2738958fde1..ab48b55ada7 100644 --- a/gcc/d/d-codegen.cc +++ b/gcc/d/d-codegen.cc @@ -1625,7 +1625,7 @@ indirect_ref (tree type, tree exp) /* Maybe rewrite: *(e1, e2) => (e1, *e2) */ tree init = stabilize_expr (&exp); - if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (exp))) exp = fold_build1 (INDIRECT_REF, type, exp); else { diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc index 2b9d8e78fb6..ec75eccbbaf 100644 --- a/gcc/d/d-convert.cc +++ b/gcc/d/d-convert.cc @@ -185,8 +185,8 @@ d_truthvalue_conversion (tree expr) case CONVERT_EXPR: /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE, since that affects how `default_conversion' will behave. */ - if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE - || TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (expr)) + || TYPE_REF_P (TREE_TYPE (TREE_OPERAND (expr, 0)))) break; /* Fall through. */ diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index a02ede79fed..15a4e120201 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -9507,7 +9507,7 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) when type is a reference type and arg00's type is not, because arg00 could be validly nullptr and if arg01 doesn't return, we don't want false positive binding of reference to nullptr. */ - if (TREE_CODE (type) == REFERENCE_TYPE + if (TYPE_REF_P (type) && !in_gimple_form && sanitize_flags_p (SANITIZE_NULL) && TREE_CODE (TREE_TYPE (arg00)) != REFERENCE_TYPE) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 951cecfa5d5..94d8e57750a 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -258,7 +258,7 @@ tree gfc_conv_descriptor_data_get (tree desc) { tree type = TREE_TYPE (desc); - if (TREE_CODE (type) == REFERENCE_TYPE) + if (TYPE_REF_P (type)) gcc_unreachable (); tree field = gfc_get_descriptor_field (desc, DATA_FIELD); @@ -9105,7 +9105,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, tree dest, decl_type = TREE_TYPE (decl); if ((POINTER_TYPE_P (decl_type)) - || (TREE_CODE (decl_type) == REFERENCE_TYPE && rank == 0)) + || (TYPE_REF_P (decl_type) && rank == 0)) { decl = build_fold_indirect_ref_loc (input_location, decl); /* Deref dest in sync with decl, but only when it is not NULL. */ diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index b0fd25e92a3..a141fbdeed3 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -7648,7 +7648,7 @@ gfc_generate_function_code (gfc_namespace * ns) if (POINTER_TYPE_P (TREE_TYPE (type))) /* For instance, allocatable scalars. */ type = TREE_TYPE (type); - if (TREE_CODE (type) == REFERENCE_TYPE) + if (TYPE_REF_P (type)) type = build_pointer_type (TREE_TYPE (type)); desc_p = build_decl (loc, VAR_DECL, get_identifier (fsym->name), type); if (!fsym->attr.dimension) diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index ef3e6d08f78..b019cda1813 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -1298,7 +1298,7 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts, gcc_assert (tmp != NULL_TREE); /* Dereference if needs be. */ - if (TREE_CODE (TREE_TYPE (tmp)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (tmp))) tmp = build_fold_indirect_ref_loc (input_location, tmp); if (!(gfc_is_class_array_function (e) && parmse->class_vptr)) diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index b6ea26e413d..87ff0a15237 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -1777,7 +1777,7 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind, lhs_kind = kind; caf_decl = gfc_get_tree_for_caf_expr (array_expr); - if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (caf_decl))) caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl); image_index = gfc_caf_get_image_index (&se->pre, array_expr, caf_decl); @@ -1899,7 +1899,7 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind, gfc_add_block_to_block (&se->post, &argse.post); caf_decl = gfc_get_tree_for_caf_expr (array_expr); - if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (caf_decl))) caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl); image_index = gfc_caf_get_image_index (&se->pre, array_expr, caf_decl); gfc_get_caf_token_offset (se, &token, &offset, caf_decl, argse.expr, @@ -2166,7 +2166,7 @@ conv_caf_send (gfc_code *code) { /* Obtain token, offset and image index for the LHS. */ caf_decl = gfc_get_tree_for_caf_expr (lhs_expr); - if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (caf_decl))) caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl); image_index = gfc_caf_get_image_index (&block, lhs_expr, caf_decl); tmp = lhs_se.expr; @@ -2305,7 +2305,7 @@ conv_caf_send (gfc_code *code) { gfc_add_expr_to_block (&block, tmp); caf_decl = gfc_get_tree_for_caf_expr (rhs_expr); - if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (caf_decl))) caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl); rhs_image_index = gfc_caf_get_image_index (&block, rhs_expr, caf_decl); tmp = rhs_se.expr; @@ -8783,7 +8783,7 @@ trans_caf_is_present (gfc_se *se, gfc_expr *expr) gcc_assert (caf_reference != NULL_TREE); caf_decl = gfc_get_tree_for_caf_expr (expr); - if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (caf_decl))) caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl); image_index = gfc_caf_get_image_index (&se->pre, expr, caf_decl); gfc_get_caf_token_offset (se, &token, NULL, caf_decl, NULL, @@ -11845,7 +11845,7 @@ conv_intrinsic_atomic_op (gfc_code *code) } caf_decl = gfc_get_tree_for_caf_expr (atom_expr); - if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (caf_decl))) caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl); if (gfc_is_coindexed (atom_expr)) @@ -12001,7 +12001,7 @@ conv_intrinsic_atomic_ref (gfc_code *code) tree orig_value = NULL_TREE, vardecl = NULL_TREE; caf_decl = gfc_get_tree_for_caf_expr (atom_expr); - if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (caf_decl))) caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl); if (gfc_is_coindexed (atom_expr)) @@ -12123,7 +12123,7 @@ conv_intrinsic_atomic_cas (gfc_code *code) tree image_index, caf_decl, offset, token; caf_decl = gfc_get_tree_for_caf_expr (atom_expr); - if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (caf_decl))) caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl); if (gfc_is_coindexed (atom_expr)) diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index c88ee3c7656..a676442ca9e 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -219,7 +219,7 @@ gfc_omp_privatize_by_reference (const_tree decl) { tree type = TREE_TYPE (decl); - if (TREE_CODE (type) == REFERENCE_TYPE + if (TYPE_REF_P (type) && (!DECL_ARTIFICIAL (decl) || TREE_CODE (decl) == PARM_DECL)) return true; @@ -1584,7 +1584,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p, bool openacc) OMP_CLAUSE_DECL (c) = decl; OMP_CLAUSE_SIZE (c) = NULL_TREE; } - if (TREE_CODE (TREE_TYPE (orig_decl)) == REFERENCE_TYPE + if (TYPE_REF_P (TREE_TYPE (orig_decl)) && (GFC_DECL_GET_SCALAR_POINTER (orig_decl) || GFC_DECL_GET_SCALAR_ALLOCATABLE (orig_decl))) { @@ -1747,7 +1747,7 @@ bool gfc_omp_scalar_p (tree decl, bool ptr_alloc_ok) { tree type = TREE_TYPE (decl); - if (TREE_CODE (type) == REFERENCE_TYPE) + if (TYPE_REF_P (type)) type = TREE_TYPE (type); if (TREE_CODE (type) == POINTER_TYPE) { @@ -2015,7 +2015,7 @@ gfc_trans_omp_array_reduction_or_udr (tree c, gfc_omp_namelist *n, locus where) type = TREE_TYPE (decl); outer_decl = create_tmp_var_raw (type); if (TREE_CODE (decl) == PARM_DECL - && TREE_CODE (type) == REFERENCE_TYPE + && TYPE_REF_P (type) && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (type)) && GFC_TYPE_ARRAY_AKIND (TREE_TYPE (type)) == GFC_ARRAY_ALLOCATABLE) { @@ -3277,7 +3277,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, OMP_CLAUSE_SIZE (node4) = size; } decl = build_fold_indirect_ref (decl); - if ((TREE_CODE (TREE_TYPE (orig_decl)) == REFERENCE_TYPE + if ((TYPE_REF_P (TREE_TYPE (orig_decl)) || gfc_omp_is_optional_argument (orig_decl)) && (GFC_DECL_GET_SCALAR_POINTER (orig_decl) || GFC_DECL_GET_SCALAR_ALLOCATABLE (orig_decl))) diff --git a/gcc/gimple.cc b/gcc/gimple.cc index e0ba42add39..1c1ff796465 100644 --- a/gcc/gimple.cc +++ b/gcc/gimple.cc @@ -1706,7 +1706,7 @@ gimple_call_nonnull_result_p (gcall *call) /* References are always non-NULL. */ if (flag_delete_null_pointer_checks - && TREE_CODE (TREE_TYPE (fndecl)) == REFERENCE_TYPE) + && TYPE_REF_P (TREE_TYPE (fndecl))) return true; if (flag_delete_null_pointer_checks diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 36e5df050b9..b3ff91b3bd2 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -1861,7 +1861,7 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p) && !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (decl))) { gimplify_type_sizes (TREE_TYPE (decl), seq_p); - if (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (decl))) gimplify_type_sizes (TREE_TYPE (TREE_TYPE (decl)), seq_p); } @@ -1872,7 +1872,7 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p) && !TYPE_SIZES_GIMPLIFIED (DECL_ORIGINAL_TYPE (decl))) { gimplify_type_sizes (DECL_ORIGINAL_TYPE (decl), seq_p); - if (TREE_CODE (DECL_ORIGINAL_TYPE (decl)) == REFERENCE_TYPE) + if (TYPE_REF_P (DECL_ORIGINAL_TYPE (decl))) gimplify_type_sizes (TREE_TYPE (DECL_ORIGINAL_TYPE (decl)), seq_p); } @@ -7905,7 +7905,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) else if (lang_hooks.decls.omp_scalar_p (decl, false)) gdmk = GDMK_SCALAR; else if (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE - || (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE + || (TYPE_REF_P (TREE_TYPE (decl)) && (TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == POINTER_TYPE))) gdmk = GDMK_POINTER; @@ -10418,7 +10418,7 @@ omp_accumulate_sibling_list (enum omp_region_type region_type, ptrdiff_type_node, baddr); /* This isn't going to be good enough when we add support for more complicated lvalue expressions. FIXME. */ - if (TREE_CODE (TREE_TYPE (sdecl)) == REFERENCE_TYPE + if (TYPE_REF_P (TREE_TYPE (sdecl)) && TREE_CODE (TREE_TYPE (TREE_TYPE (sdecl))) == POINTER_TYPE) sdecl = build_simple_mem_ref (sdecl); tree decladdr = fold_convert_loc (OMP_CLAUSE_LOCATION (grp_end), @@ -10677,7 +10677,7 @@ omp_build_struct_sibling_lists (enum tree_code code, } tree stype = TREE_TYPE (decl); - if (TREE_CODE (stype) == REFERENCE_TYPE) + if (TYPE_REF_P (stype)) stype = TREE_TYPE (stype); if (TYPE_SIZE_UNIT (stype) == NULL || TREE_CODE (TYPE_SIZE_UNIT (stype)) != INTEGER_CST) @@ -11801,7 +11801,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION && TREE_CODE (OMP_CLAUSE_DECL (c)) == MEM_REF && (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE - || (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE + || (TYPE_REF_P (TREE_TYPE (decl)) && (TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == POINTER_TYPE)))) omp_firstprivatize_variable (outer_ctx, decl); @@ -12184,7 +12184,7 @@ omp_shared_to_firstprivate_optimizable_decl_p (tree decl) return false; tree type = TREE_TYPE (decl); if (!is_gimple_reg_type (type) - || TREE_CODE (type) == REFERENCE_TYPE + || TYPE_REF_P (type) || TREE_ADDRESSABLE (type)) return false; /* Don't optimize too large decls, as each thread/task will have @@ -12432,7 +12432,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data) { tree nc = build_omp_clause (input_location, OMP_CLAUSE_MAP); OMP_CLAUSE_DECL (nc) = decl; - if (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE + if (TYPE_REF_P (TREE_TYPE (decl)) && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == POINTER_TYPE) OMP_CLAUSE_DECL (clause) = build_simple_mem_ref_loc (input_location, decl); @@ -13591,7 +13591,7 @@ gimplify_omp_taskloop_expr (tree type, tree *tp, gimple_seq *pre_p, here. */ if (type && TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (*tp)) == REFERENCE_TYPE) + && TYPE_REF_P (TREE_TYPE (*tp))) { tree v = create_tmp_var (TYPE_MAIN_VARIANT (type)); tree m = build2 (INIT_EXPR, TREE_TYPE (v), v, *tp); diff --git a/gcc/ipa-free-lang-data.cc b/gcc/ipa-free-lang-data.cc index ff9657a6e06..1a2417e8592 100644 --- a/gcc/ipa-free-lang-data.cc +++ b/gcc/ipa-free-lang-data.cc @@ -771,7 +771,7 @@ find_decls_types_r (tree *tp, int *ws, void *data) in them. */ if (TREE_CODE (t) == POINTER_TYPE) fld_worklist_push (TYPE_NEXT_PTR_TO (t), fld); - if (TREE_CODE (t) == REFERENCE_TYPE) + if (TYPE_REF_P (t)) fld_worklist_push (TYPE_NEXT_REF_TO (t), fld); if (!POINTER_TYPE_P (t)) fld_worklist_push (TYPE_MIN_VALUE_RAW (t), fld); diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc index c35e03b7abd..e203d8941ff 100644 --- a/gcc/ipa-sra.cc +++ b/gcc/ipa-sra.cc @@ -1206,7 +1206,7 @@ create_parameter_descriptors (cgraph_node *node, if (POINTER_TYPE_P (type)) { desc->by_ref = true; - if (TREE_CODE (type) == REFERENCE_TYPE + if (TYPE_REF_P (type) || (num == 0 && TREE_CODE (TREE_TYPE (node->decl)) == METHOD_TYPE)) desc->safe_ref = true; diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc index 9a1a9eccca9..e3030286ecc 100644 --- a/gcc/langhooks.cc +++ b/gcc/langhooks.cc @@ -650,7 +650,7 @@ bool lhd_omp_scalar_p (tree decl, bool ptr_ok) { tree type = TREE_TYPE (decl); - if (TREE_CODE (type) == REFERENCE_TYPE) + if (TYPE_REF_P (type)) type = TREE_TYPE (type); if (TREE_CODE (type) == COMPLEX_TYPE) type = TREE_TYPE (type); diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc index 703e665b698..207a5d4f926 100644 --- a/gcc/lto/lto-common.cc +++ b/gcc/lto/lto-common.cc @@ -998,7 +998,7 @@ lto_fixup_prevailing_type (tree t) TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (TREE_TYPE (t)); TYPE_POINTER_TO (TREE_TYPE (t)) = t; } - else if (TREE_CODE (t) == REFERENCE_TYPE && !TYPE_REF_IS_RVALUE (t)) + else if (TYPE_REF_P (t) && !TYPE_REF_IS_RVALUE (t)) { TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (TREE_TYPE (t)); TYPE_REFERENCE_TO (TREE_TYPE (t)) = t; diff --git a/gcc/m2/gm2-gcc/m2tree.cc b/gcc/m2/gm2-gcc/m2tree.cc index 99405123290..2c87945ec06 100644 --- a/gcc/m2/gm2-gcc/m2tree.cc +++ b/gcc/m2/gm2-gcc/m2tree.cc @@ -95,7 +95,7 @@ m2tree_skip_const_decl (tree exp) tree m2tree_skip_reference_type (tree exp) { - if (TREE_CODE (exp) == REFERENCE_TYPE) + if (TYPE_REF_P (exp)) return m2tree_skip_reference_type (TREE_TYPE (exp)); if (TREE_CODE (exp) == POINTER_TYPE) return m2tree_skip_reference_type (TREE_TYPE (exp)); diff --git a/gcc/m2/gm2-gcc/m2treelib.cc b/gcc/m2/gm2-gcc/m2treelib.cc index 6694af66d8b..56231701f7a 100644 --- a/gcc/m2/gm2-gcc/m2treelib.cc +++ b/gcc/m2/gm2-gcc/m2treelib.cc @@ -302,7 +302,7 @@ m2treelib_get_set_value (location_t location, tree p, tree field, bool is_const, field); else { - ASSERT_CONDITION (TREE_CODE (TREE_TYPE (p)) == REFERENCE_TYPE); + ASSERT_CONDITION (TYPE_REF_P (TREE_TYPE (p))); value = m2expr_BuildComponentRef (location, p, field); } } diff --git a/gcc/m2/m2pp.cc b/gcc/m2/m2pp.cc index 52a29384e8d..d87995affe7 100644 --- a/gcc/m2/m2pp.cc +++ b/gcc/m2/m2pp.cc @@ -905,7 +905,7 @@ m2pp_parameter (pretty *s, tree t) { if (TREE_CODE (t) == PARM_DECL) { - if (TREE_TYPE (t) && (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)) + if (TREE_TYPE (t) && TYPE_REF_P (TREE_TYPE (t))) { m2pp_print (s, "VAR"); m2pp_needspace (s); @@ -929,7 +929,7 @@ m2pp_parameter (pretty *s, tree t) static void m2pp_param_type (pretty *s, tree t) { - if (t && (TREE_CODE (t) == REFERENCE_TYPE)) + if (t && TYPE_REF_P (t)) { m2pp_print (s, "VAR"); m2pp_needspace (s); diff --git a/gcc/match.pd b/gcc/match.pd index 054e6585876..5f7627c8d5e 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -6343,7 +6343,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* Don't perform this optimization in GENERIC if @0 has reference type when sanitizing. See PR101210. */ && !(GENERIC - && TREE_CODE (TREE_TYPE (@0)) == REFERENCE_TYPE + && TYPE_REF_P (TREE_TYPE (@0)) && (flag_sanitize & (SANITIZE_NULL | SANITIZE_ALIGNMENT)))) || (INTEGRAL_TYPE_P (TREE_TYPE (@0)) && POINTER_TYPE_P (TREE_TYPE (@1)) diff --git a/gcc/objc/objc-act.cc b/gcc/objc/objc-act.cc index e4c49e664e1..528a4ae812a 100644 --- a/gcc/objc/objc-act.cc +++ b/gcc/objc/objc-act.cc @@ -6374,7 +6374,7 @@ add_instance_variable (tree klass, objc_ivar_visibility_kind visibility, tree field_type = TREE_TYPE (field_decl); #ifdef OBJCPLUS - if (TREE_CODE (field_type) == REFERENCE_TYPE) + if (TYPE_REF_P (field_type)) { error ("illegal reference type specified for instance variable %qs", printable_ivar_name (field_decl)); diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index b882df048ef..5dd9b77c873 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -1298,7 +1298,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && (!is_global_var (maybe_lookup_decl_in_outer_ctx (t, ctx)) || (is_task_ctx (ctx) && (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE - || (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE + || (TYPE_REF_P (TREE_TYPE (t)) && (TREE_CODE (TREE_TYPE (TREE_TYPE (t))) == POINTER_TYPE))))) && !is_variable_sized (t) @@ -1308,7 +1308,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) { by_ref = use_pointer_for_field (t, NULL); if (is_task_ctx (ctx) - && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE + && TYPE_REF_P (TREE_TYPE (t)) && TREE_CODE (TREE_TYPE (TREE_TYPE (t))) == POINTER_TYPE) { install_var_field (t, false, 1, ctx); @@ -5306,7 +5306,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, { bool by_ref = use_pointer_for_field (var, NULL); x = build_receiver_ref (var, by_ref, ctx); - if (TREE_CODE (TREE_TYPE (var)) == REFERENCE_TYPE + if (TYPE_REF_P (TREE_TYPE (var)) && (TREE_CODE (TREE_TYPE (TREE_TYPE (var))) == POINTER_TYPE)) x = build_fold_addr_expr (x); @@ -12200,7 +12200,7 @@ create_task_copyfn (gomp_task *task_stmt, omp_context *ctx) src = build_simple_mem_ref_loc (loc, sarg); src = omp_build_component_ref (src, sf); if (decl != OMP_CLAUSE_DECL (c) - && TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE + && TYPE_REF_P (TREE_TYPE (decl)) && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == POINTER_TYPE) src = build_simple_mem_ref_loc (loc, src); dst = build_simple_mem_ref_loc (loc, arg); @@ -13313,7 +13313,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) { gcc_checking_assert (is_gimple_omp_oacc (ctx->stmt)); s = TREE_TYPE (ovar); - if (TREE_CODE (s) == REFERENCE_TYPE + if (TYPE_REF_P (s) || omp_check_optional_argument (ovar, false)) s = TREE_TYPE (s); s = TYPE_SIZE_UNIT (s); @@ -14046,7 +14046,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) else if (TREE_CODE (OMP_CLAUSE_DECL (c)) == COMPONENT_REF) { type = TREE_TYPE (OMP_CLAUSE_DECL (c)); - is_ref = TREE_CODE (type) == REFERENCE_TYPE; + is_ref = TYPE_REF_P (type); new_var = build2 (MEM_REF, type, build_fold_addr_expr (new_var), build_int_cst (build_pointer_type (type), @@ -14076,7 +14076,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) new_var = decl2; type = TREE_TYPE (new_var); } - else if (TREE_CODE (type) == REFERENCE_TYPE + else if (TYPE_REF_P (type) && TREE_CODE (TREE_TYPE (type)) == POINTER_TYPE) { type = TREE_TYPE (type); @@ -14617,8 +14617,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx) tree lhs = get_base_address (gimple_assign_lhs (stmt)); if (TREE_CODE (lhs) == MEM_REF && DECL_P (TREE_OPERAND (lhs, 0)) - && TREE_CODE (TREE_TYPE (TREE_OPERAND (lhs, - 0))) == REFERENCE_TYPE) + && TYPE_REF_P (TREE_TYPE (TREE_OPERAND (lhs, 0)))) lhs = TREE_OPERAND (lhs, 0); if (DECL_P (lhs)) if (tree *v = up->lastprivate_conditional_map->get (lhs)) diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc index c1cb7cc8a5c..a3046ed44d2 100644 --- a/gcc/omp-simd-clone.cc +++ b/gcc/omp-simd-clone.cc @@ -365,7 +365,7 @@ simd_clone_clauses_extract (struct cgraph_node *node, tree clauses, if (OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (t)) { enum cgraph_simd_clone_arg_type arg_type; - if (TREE_CODE (args[argno]) == REFERENCE_TYPE) + if (TYPE_REF_P (args[argno])) switch (OMP_CLAUSE_LINEAR_KIND (t)) { case OMP_CLAUSE_LINEAR_REF: @@ -410,7 +410,7 @@ simd_clone_clauses_extract (struct cgraph_node *node, tree clauses, else { enum cgraph_simd_clone_arg_type arg_type; - if (TREE_CODE (args[argno]) == REFERENCE_TYPE) + if (TYPE_REF_P (args[argno])) switch (OMP_CLAUSE_LINEAR_KIND (t)) { case OMP_CLAUSE_LINEAR_REF: @@ -1392,7 +1392,7 @@ simd_clone_linear_addend (struct cgraph_node *node, unsigned int i, gsi_insert_before (&gsi, g, GSI_SAME_STMT); ret = gimple_assign_lhs (g); } - if (TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE) + if (TYPE_REF_P (TREE_TYPE (arg))) { g = gimple_build_assign (make_ssa_name (TREE_TYPE (TREE_TYPE (arg))), build_simple_mem_ref (ret)); @@ -1823,7 +1823,7 @@ simd_clone_adjust (struct cgraph_node *node) tree orig_arg = node->simdclone->args[i].orig_arg; tree def = ssa_default_def (cfun, orig_arg); gcc_assert (!TREE_ADDRESSABLE (orig_arg) - && TREE_CODE (TREE_TYPE (orig_arg)) == REFERENCE_TYPE); + && TYPE_REF_P (TREE_TYPE (orig_arg))); if (def && !has_zero_uses (def)) { tree rtype = TREE_TYPE (TREE_TYPE (orig_arg)); diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc index 954b39ae1c6..95c7c360529 100644 --- a/gcc/tree-inline.cc +++ b/gcc/tree-inline.cc @@ -432,7 +432,7 @@ remap_type_1 (tree type, copy_body_data *id) insert_decl_map (id, type, new_tree); return new_tree; } - else if (TREE_CODE (type) == REFERENCE_TYPE) + else if (TYPE_REF_P (type)) { new_tree = build_reference_type_for_mode (remap_type (TREE_TYPE (type), id), TYPE_MODE (type), diff --git a/gcc/tree.cc b/gcc/tree.cc index 420857b110c..634a1820613 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -10050,7 +10050,7 @@ reconstruct_complex_type (tree type, tree bottom) outer = build_pointer_type_for_mode (inner, TYPE_MODE (type), TYPE_REF_CAN_ALIAS_ALL (type)); } - else if (TREE_CODE (type) == REFERENCE_TYPE) + else if (TYPE_REF_P (type)) { inner = reconstruct_complex_type (TREE_TYPE (type), bottom); outer = build_reference_type_for_mode (inner, TYPE_MODE (type), @@ -13387,7 +13387,7 @@ verify_type_variant (const_tree t, tree tv) /* FIXME: TYPE_SIZES_GIMPLIFIED may differs for Ada build. */ verify_variant_match (TYPE_UNSIGNED); verify_variant_match (TYPE_PACKED); - if (TREE_CODE (t) == REFERENCE_TYPE) + if (TYPE_REF_P (t)) verify_variant_match (TYPE_REF_IS_RVALUE); if (AGGREGATE_TYPE_P (t)) verify_variant_match (TYPE_REVERSE_STORAGE_ORDER); @@ -14033,7 +14033,7 @@ verify_type (const_tree t) error_found = true; } } - else if (TREE_CODE (t) == REFERENCE_TYPE) + else if (TYPE_REF_P (t)) { if (TYPE_NEXT_REF_TO (t) && TREE_CODE (TYPE_NEXT_REF_TO (t)) != REFERENCE_TYPE) @@ -14202,7 +14202,7 @@ verify_type (const_tree t) else if (TREE_CODE (t) == INTEGER_TYPE || TREE_CODE (t) == BOOLEAN_TYPE || TREE_CODE (t) == OFFSET_TYPE - || TREE_CODE (t) == REFERENCE_TYPE + || TYPE_REF_P (t) || TREE_CODE (t) == NULLPTR_TYPE || TREE_CODE (t) == POINTER_TYPE) { @@ -14395,7 +14395,7 @@ nonnull_arg_p (const_tree arg) return true; /* Values passed by reference are always non-NULL. */ - if (TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE + if (TYPE_REF_P (TREE_TYPE (arg)) && flag_delete_null_pointer_checks) return true; diff --git a/gcc/tree.h b/gcc/tree.h index ca3e0ce8f5e..d0d19153f91 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -687,7 +687,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, ascending code order. */ #define POINTER_TYPE_P(TYPE) \ - (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE) + (TREE_CODE (TYPE) == POINTER_TYPE || TYPE_REF_P (TYPE)) /* Nonzero if TYPE represents a pointer to function. */ #define FUNCTION_POINTER_TYPE_P(TYPE) \ diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc index d8dafa5481a..83e428fbc10 100644 --- a/gcc/var-tracking.cc +++ b/gcc/var-tracking.cc @@ -6282,7 +6282,7 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn) { for (t = TYPE_ARG_TYPES (type); t && t != void_list_node; t = TREE_CHAIN (t)) - if (TREE_CODE (TREE_VALUE (t)) == REFERENCE_TYPE + if (TYPE_REF_P (TREE_VALUE (t)) && INTEGRAL_TYPE_P (TREE_TYPE (TREE_VALUE (t)))) break; if ((t == NULL || t == void_list_node) && obj_type_ref == NULL_TREE) @@ -6433,7 +6433,7 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn) function_arg_info arg (TREE_VALUE (t), /*named=*/true); apply_pass_by_reference_rules (&args_so_far_v, arg); reg = targetm.calls.function_arg (args_so_far, arg); - if (TREE_CODE (arg.type) == REFERENCE_TYPE + if (TYPE_REF_P (arg.type) && INTEGRAL_TYPE_P (TREE_TYPE (arg.type)) && reg && REG_P (reg) @@ -9870,7 +9870,7 @@ vt_add_function_parameter (tree parm) if (dv_is_value_p (dv)) { record_entry_value (CSELIB_VAL_PTR (dv_as_value (dv)), incoming); - if (TREE_CODE (TREE_TYPE (parm)) == REFERENCE_TYPE + if (TYPE_REF_P (TREE_TYPE (parm)) && INTEGRAL_TYPE_P (TREE_TYPE (TREE_TYPE (parm)))) { machine_mode indmode From patchwork Tue Jul 18 23:12:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1809505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=TX2qBDJJ; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R5FpM5Ys6z1yY1 for ; Wed, 19 Jul 2023 09:41:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B811A385B513 for ; Tue, 18 Jul 2023 23:41:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B811A385B513 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689723688; bh=MXeLQUNyTc6Y7chOsQ/Fnr/s2aG6g9k0gWiGtPSkTqQ=; 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=TX2qBDJJ11X+55hAWz0/exmurBMWrtrKvqsSuGK4eu4IR58vJNRvWsjig2T31MSz1 rNU/3wvwiKKt4LMBtF+FO3/Q360Qq0fanr2zwdYQ9XF4brqu6f6As4vIeRa7wRQnKC t7M9znjvvEjz3SDFSsxZD1xduNO/rj2RXnOo47qA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id 1B9EE3858C60; Tue, 18 Jul 2023 23:41:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1B9EE3858C60 Received: from pps.filterd (m0247473.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36INa4NK030076; Tue, 18 Jul 2023 23:41:04 GMT Received: from mxout26.s.uw.edu (mxout26.s.uw.edu [140.142.234.176]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rwwtnufyf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 23:41:03 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout26.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36INakpL010870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 16:36:46 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 36INX5M1022682 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jul 2023 16:36:46 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: Ken Matsui Subject: [PATCH 3/8] c++, tree: Move TYPE_PTR_P to tree.h Date: Tue, 18 Jul 2023 16:12:45 -0700 Message-ID: <20230718233301.28677-4-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org> References: <20230718233301.28677-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: 3staAv_m1O9VeyJVzsQjBnZzbt4aCqEf X-Proofpoint-ORIG-GUID: 3staAv_m1O9VeyJVzsQjBnZzbt4aCqEf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-18_17,2023-07-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 bulkscore=0 spamscore=0 malwarescore=0 priorityscore=1501 clxscore=1034 adultscore=0 mlxlogscore=956 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180209 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, 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: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch moves TYPE_PTR_P from cp/cp-tree.h to tree.h to unify POINTER_TYPE_P in tree.h to INDIRECT_TYPE_P in cp/cp-tree.h, which are equivalent. gcc/cp/ChangeLog: * cp-tree.h (TYPE_PTR_P): Remove. gcc/ChangeLog: * tree.h (TYPE_PTR_P): Define. Signed-off-by: Ken Matsui --- gcc/cp/cp-tree.h | 4 ---- gcc/tree.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 8c96d868650..681aa95e57f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4706,10 +4706,6 @@ get_vec_init_expr (tree t) #define TYPE_PTRDATAMEM_P(NODE) \ (TREE_CODE (NODE) == OFFSET_TYPE) -/* Returns true if NODE is a pointer. */ -#define TYPE_PTR_P(NODE) \ - (TREE_CODE (NODE) == POINTER_TYPE) - /* Returns true if NODE is a pointer or a reference. */ #define INDIRECT_TYPE_P(NODE) \ (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE)) diff --git a/gcc/tree.h b/gcc/tree.h index d0d19153f91..48d57764d9c 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -678,6 +678,10 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define AGGREGATE_TYPE_P(TYPE) \ (TREE_CODE (TYPE) == ARRAY_TYPE || RECORD_OR_UNION_TYPE_P (TYPE)) +/* Nonzero if this type is a pointer. */ +#define TYPE_PTR_P(NODE) \ + (TREE_CODE (NODE) == POINTER_TYPE) + /* Nonzero if this type is a reference. */ #define TYPE_REF_P(NODE) \ (TREE_CODE (NODE) == REFERENCE_TYPE) From patchwork Tue Jul 18 23:12:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1809506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=DnBbgMZW; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R5Fq91F5Yz1yY1 for ; Wed, 19 Jul 2023 09:42:13 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C942E38555B3 for ; Tue, 18 Jul 2023 23:42:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C942E38555B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689723730; bh=/bWYG5XLs72glAVDQbSz4MebhtQwbjtiEsu3GBKK/XM=; 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=DnBbgMZW8gVYvfez3wqRVIKxLzQ0FGH1lQSqim9ShvY+m5m9FqLyDvW3oXksRb6GI nlj3FnLtue+lTZRs/jDENndTWCBy164ljm5VHvYUw+nrL2y49NBKM862HecC5+ddrA +RgtrJ07VSnmZ4ZtMS3dCXzT/xfYtKnz6zrJ1g9o= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00641c01.pphosted.com (mx0b-00641c01.pphosted.com [205.220.177.146]) by sourceware.org (Postfix) with ESMTPS id 0FEF5385AF8B; Tue, 18 Jul 2023 23:41:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FEF5385AF8B Received: from pps.filterd (m0247477.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36INfZnW026688; Tue, 18 Jul 2023 23:41:50 GMT Received: from mxout25.s.uw.edu (mxout25.s.uw.edu [140.142.234.175]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rwx0ju7cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 23:41:50 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout25.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36INfmOL011147 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 16:41:48 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 36INX5M2022682 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jul 2023 16:41:48 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: Ken Matsui Subject: [PATCH 4/8] c++, tree: Move INDIRECT_TYPE_P to tree.h Date: Tue, 18 Jul 2023 16:12:46 -0700 Message-ID: <20230718233301.28677-5-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org> References: <20230718233301.28677-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: cFEiRnkndBkLXt4CoN9C3ElVPknHt-kg X-Proofpoint-GUID: cFEiRnkndBkLXt4CoN9C3ElVPknHt-kg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-18_17,2023-07-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 phishscore=0 priorityscore=1501 impostorscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1034 mlxscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180209 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, 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: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch moves INDIRECT_TYPE_P from cp/cp-tree.h to tree.h to unify POINTER_TYPE_P in tree.h to INDIRECT_TYPE_P, which are equivalent. gcc/cp/ChangeLog: * cp-tree.h (INDIRECT_TYPE_P): Remove. gcc/ChangeLog: * tree.h (INDIRECT_TYPE_P): Define. Signed-off-by: Ken Matsui --- gcc/cp/cp-tree.h | 4 ---- gcc/tree.h | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 681aa95e57f..5236b168ecc 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4706,10 +4706,6 @@ get_vec_init_expr (tree t) #define TYPE_PTRDATAMEM_P(NODE) \ (TREE_CODE (NODE) == OFFSET_TYPE) -/* Returns true if NODE is a pointer or a reference. */ -#define INDIRECT_TYPE_P(NODE) \ - (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE)) - /* Returns true if NODE is an object type: [basic.types] diff --git a/gcc/tree.h b/gcc/tree.h index 48d57764d9c..c369b8470ab 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -686,6 +686,11 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define TYPE_REF_P(NODE) \ (TREE_CODE (NODE) == REFERENCE_TYPE) +/* Nonzero if TYPE represents a pointer or reference type. + Keep these checks in ascending code order. */ +#define INDIRECT_TYPE_P(NODE) \ + (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE)) + /* Nonzero if TYPE represents a pointer or reference type. (It should be renamed to INDIRECT_TYPE_P.) Keep these checks in ascending code order. */ From patchwork Tue Jul 18 23:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1809507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=g/HUb/gD; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R5Ft66rRLz1yY1 for ; Wed, 19 Jul 2023 09:44:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4327F385697B for ; Tue, 18 Jul 2023 23:44:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4327F385697B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689723884; bh=hky+RqvHOlBsNq2T1dtRqklvQchMvIBhD39cD6pkrOU=; 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=g/HUb/gD4IYTYiIBVCbb3S9gX/DK6Q40sr8lYPs6hq9EHIqSq09W7JMzB589Zwqlp m6J+vRZvk+8UYHzAMYAZ5LLs2z13eFU9TxBi4DbXCtJGoLT7hfAeoSN5YG/RxEiDV5 dQkr7++bass9iOfGBoJyM96of5S3TuEpWd5nWUg8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00641c01.pphosted.com (mx0b-00641c01.pphosted.com [205.220.177.146]) by sourceware.org (Postfix) with ESMTPS id 4E5853858C60; Tue, 18 Jul 2023 23:44:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E5853858C60 Received: from pps.filterd (m0247476.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36INVSDq004984; Tue, 18 Jul 2023 23:44:22 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rx03n22wf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 23:44:21 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout23.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36INiE2e005623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 16:44:14 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 36INX5M4022682 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jul 2023 16:44:14 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: Ken Matsui Subject: [PATCH 6/8] tree: Remove POINTER_TYPE_P Date: Tue, 18 Jul 2023 16:12:48 -0700 Message-ID: <20230718233301.28677-7-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org> References: <20230718233301.28677-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: gEXrxYenK_2zhQPNaiXOdFmxDG3Zq1Fw X-Proofpoint-GUID: gEXrxYenK_2zhQPNaiXOdFmxDG3Zq1Fw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-18_17,2023-07-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1034 priorityscore=1501 lowpriorityscore=0 adultscore=0 phishscore=0 mlxlogscore=865 spamscore=0 suspectscore=0 mlxscore=0 impostorscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180209 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, 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: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Since POINTER_TYPE_P was completely replaced by INDIRECT_TYPE_P, it can be deleted. gcc/ChangeLog: * tree.h (POINTER_TYPE_P): Remove. Signed-off-by: Ken Matsui --- gcc/tree.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gcc/tree.h b/gcc/tree.h index d548dce63f7..347e676e737 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -691,13 +691,6 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define INDIRECT_TYPE_P(NODE) \ (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE)) -/* Nonzero if TYPE represents a pointer or reference type. - (It should be renamed to INDIRECT_TYPE_P.) Keep these checks in - ascending code order. */ - -#define POINTER_TYPE_P(TYPE) \ - (TREE_CODE (TYPE) == POINTER_TYPE || TYPE_REF_P (TYPE)) - /* Nonzero if TYPE represents a pointer to function. */ #define FUNCTION_POINTER_TYPE_P(TYPE) \ (INDIRECT_TYPE_P (TYPE) && TREE_CODE (TREE_TYPE (TYPE)) == FUNCTION_TYPE) From patchwork Tue Jul 18 23:12:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1809508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Fu8ZO5ku; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R5FvD2g7qz20Cs for ; Wed, 19 Jul 2023 09:45:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98FBF385624F for ; Tue, 18 Jul 2023 23:45:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 98FBF385624F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689723941; bh=xrUeKKnPK/Rc87ZTWOPsuuI4zqJ3l4eGU5v2GDmrT/o=; 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=Fu8ZO5ku3fBr6GbrmRWCRE2Cdz38S1K4DIrRn2kXEiFkYiducGHh/A49zwLRAggzv ZxkEwKsUvyJmp6jYlGzdSzvnppnyxfQmjzeE2Iz7DQkZu5Do598pEjurvWPisg3j5c 8dWDfl06Zr1BGj5TS8AktG5FUr8eB74M9pxvx4Gw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id 87C68385701D; Tue, 18 Jul 2023 23:44:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87C68385701D Received: from pps.filterd (m0247472.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36INQ7NJ030925; Tue, 18 Jul 2023 23:44:54 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rx020t0wk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 23:44:53 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout23.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36INid6X005678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 16:44:39 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 36INX5M5022682 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jul 2023 16:44:39 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: Ken Matsui Subject: [PATCH 7/8] tree: Define TYPE_REF_IS_LVALUE Date: Tue, 18 Jul 2023 16:12:49 -0700 Message-ID: <20230718233301.28677-8-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org> References: <20230718233301.28677-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: cJ8x2ZGzfUj_VRKap3Mgj6BJc5Yj2SXz X-Proofpoint-ORIG-GUID: cJ8x2ZGzfUj_VRKap3Mgj6BJc5Yj2SXz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-18_18,2023-07-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1034 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=676 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180209 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, 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: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch defines TYPE_REF_IS_LVALUE to determine if a type is a C++ lvalue reference. gcc/ChangeLog: * tree.h (TYPE_REF_IS_LVALUE): Define. Signed-off-by: Ken Matsui --- gcc/tree.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/tree.h b/gcc/tree.h index 347e676e737..0b2cb894241 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1054,6 +1054,10 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define TYPE_REF_IS_RVALUE(NODE) \ (REFERENCE_TYPE_CHECK (NODE)->base.private_flag) +/* True if reference type NODE is a C++ lvalue reference. */ +#define TYPE_REF_IS_LVALUE(NODE) \ + (TYPE_REF_P (NODE) && !TYPE_REF_IS_RVALUE (NODE)) + /* Nonzero in a _DECL if the use of the name is defined as a deprecated feature by __attribute__((deprecated)). */ #define TREE_DEPRECATED(NODE) \ From patchwork Tue Jul 18 23:12:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1809509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=SP7sMLOI; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R5FwB4KQSz20Cs for ; Wed, 19 Jul 2023 09:46:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C44AB385AFBE for ; Tue, 18 Jul 2023 23:46:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C44AB385AFBE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689723991; bh=dWEOPivFVvGJSJ0LXaRxxCPTqq4aKJCGp8xcXtMjbD4=; 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=SP7sMLOIFNty4w2s0Rv5Z5FJeQ7WxKUciVYDy1QoYjq2LPoh0f3JEx7pmG+sCzRUz Colf76X8H7iIpeH6MrAS9khyALiX+jrXWgBkFavRPfDzuVsEls5X9KOf8Am0OZ5KF9 o0aMm6+8JAE5D6Wqt+CyzmhVojdA6Z9kzNFF9Pt0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00641c01.pphosted.com (mx0b-00641c01.pphosted.com [205.220.177.146]) by sourceware.org (Postfix) with ESMTPS id BFB533856089; Tue, 18 Jul 2023 23:46:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFB533856089 Received: from pps.filterd (m0247477.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36INfYAI026643; Tue, 18 Jul 2023 23:45:59 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rwx0ju7y8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 23:45:59 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout23.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36INjRZ0005854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 16:45:27 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 36INX5M6022682 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jul 2023 16:45:27 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: Ken Matsui Subject: [PATCH 8/8] c++, lto: Use TYPE_REF_IS_LVALUE Date: Tue, 18 Jul 2023 16:12:50 -0700 Message-ID: <20230718233301.28677-9-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org> References: <20230718233301.28677-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: l5FgXghvD51Bgv09SB19-Xg5iCINyF_V X-Proofpoint-GUID: l5FgXghvD51Bgv09SB19-Xg5iCINyF_V X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-18_17,2023-07-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 phishscore=0 priorityscore=1501 impostorscore=0 adultscore=0 mlxlogscore=940 lowpriorityscore=0 clxscore=1034 mlxscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180209 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, 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: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" gcc/cp/ChangeLog: * decl.cc (copy_fn_p): Use TYPE_REF_IS_LVALUE. * init.cc (maybe_warn_list_ctor): Likewise. * method.cc (early_check_defaulted_comparison): Likewise. * pt.cc (maybe_adjust_types_for_deduction): Likewise. (invalid_nontype_parm_type_p): Likewise. * tree.cc (structural_type_p): Likewise. gcc/lto/ChangeLog: * lto-common.cc (lto_fixup_prevailing_type): Use TYPE_REF_IS_LVALUE. Signed-off-by: Ken Matsui --- gcc/cp/decl.cc | 3 +-- gcc/cp/init.cc | 3 +-- gcc/cp/method.cc | 3 +-- gcc/cp/pt.cc | 6 ++---- gcc/cp/tree.cc | 2 +- gcc/lto/lto-common.cc | 2 +- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index c08056ca3d2..5e84f6a6f78 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -15250,8 +15250,7 @@ copy_fn_p (const_tree d) /* Pass by value copy assignment operator. */ result = -1; } - else if (TYPE_REF_P (arg_type) - && !TYPE_REF_IS_RVALUE (arg_type) + else if (TYPE_REF_IS_LVALUE (arg_type) && TYPE_MAIN_VARIANT (TREE_TYPE (arg_type)) == DECL_CONTEXT (d)) { if (CP_TYPE_CONST_P (TREE_TYPE (arg_type))) diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc index 01eb4b55889..8006576bfd6 100644 --- a/gcc/cp/init.cc +++ b/gcc/cp/init.cc @@ -778,8 +778,7 @@ maybe_warn_list_ctor (tree member, tree init) tree initlist = non_reference (parm); /* Do not warn if the parameter is an lvalue reference to non-const. */ - if (TYPE_REF_P (parm) && !TYPE_REF_IS_RVALUE (parm) - && !CP_TYPE_CONST_P (initlist)) + if (TYPE_REF_IS_LVALUE (parm) && !CP_TYPE_CONST_P (initlist)) return; tree targs = CLASSTYPE_TI_ARGS (initlist); diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc index 524efc4e260..59be43d12c6 100644 --- a/gcc/cp/method.cc +++ b/gcc/cp/method.cc @@ -1207,8 +1207,7 @@ early_check_defaulted_comparison (tree fn) tree parmtype = TREE_VALUE (parmnode); if (CLASS_TYPE_P (parmtype)) saw_byval = true; - else if (TYPE_REF_P (parmtype) - && !TYPE_REF_IS_RVALUE (parmtype) + else if (TYPE_REF_IS_LVALUE (parmtype) && TYPE_QUALS (TREE_TYPE (parmtype)) == TYPE_QUAL_CONST) { saw_byref = true; diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index cb82e1b268b..56207411a7d 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -22772,8 +22772,7 @@ maybe_adjust_types_for_deduction (tree tparms, too, but here handle it by stripping the reference from PARM rather than by adding it to ARG. */ if (forwarding_reference_p (*parm, TPARMS_PRIMARY_TEMPLATE (tparms)) - && TYPE_REF_P (*arg) - && !TYPE_REF_IS_RVALUE (*arg)) + && TYPE_REF_IS_LVALUE (*arg)) *parm = TREE_TYPE (*parm); /* Nothing else to do in this case. */ return 0; @@ -27595,8 +27594,7 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) return false; else if (TYPE_PTR_P (type)) return false; - else if (TYPE_REF_P (type) - && !TYPE_REF_IS_RVALUE (type)) + else if (TYPE_REF_IS_LVALUE (type)) return false; else if (TYPE_PTRMEM_P (type)) return false; diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 799183dc646..1ba7539b497 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -4928,7 +4928,7 @@ structural_type_p (tree t, bool explain) if (SCALAR_TYPE_P (t)) return true; /* an lvalue reference type, or */ - if (TYPE_REF_P (t) && !TYPE_REF_IS_RVALUE (t)) + if (TYPE_REF_IS_LVALUE (t)) return true; /* a literal class type with the following properties: - all base classes and non-static data members are public and non-mutable diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc index 4b748ced87f..6321a70d04a 100644 --- a/gcc/lto/lto-common.cc +++ b/gcc/lto/lto-common.cc @@ -998,7 +998,7 @@ lto_fixup_prevailing_type (tree t) TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (TREE_TYPE (t)); TYPE_POINTER_TO (TREE_TYPE (t)) = t; } - else if (TYPE_REF_P (t) && !TYPE_REF_IS_RVALUE (t)) + else if (TYPE_REF_IS_LVALUE (t)) { TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (TREE_TYPE (t)); TYPE_REFERENCE_TO (TREE_TYPE (t)) = t;