From patchwork Tue Aug 6 21:27:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1969684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=ixcH4u09; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wdmdl4JsRz1yfC for ; Wed, 7 Aug 2024 07:28:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E7293858402 for ; Tue, 6 Aug 2024 21:28:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 12F0E385840F for ; Tue, 6 Aug 2024 21:27:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12F0E385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 12F0E385840F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979650; cv=none; b=gJ9+GFLg7nVFM8HJRq9OncxyF04oxaaYAzKizBJqMEMTnXtFSSYWBCTD5BDQbKydRlFa52+T5ls7NsImGozY/Mvgs3k17un4ArCSfVXpvA0eZX2mDGxEx0NyaXoJ/Bqj3nhoFuJYzkj1GfgSSe7B8QfAyz/SJybEpvvkyCAcDWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722979650; c=relaxed/simple; bh=JExkefDsjVZwvDA4v/F3ULVO0FlKuOIsG/u7+J8Na1s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pDWGPZZa8/QCjsPKhaabjbNHicjAj/LMrK5ymU2pGyyE2LpydV2Ifwy8EMbuwtBXFZYK4u4J9rFe/+RLfrLka+lKGZDdMssp15ISHbNypstWWuAGGdDHyFNuUl5C47xFiidzdQEcYUGb7J5uZn6u5xUEP0V1iQxugAN1WoZfPzc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 476H6Q5T007104 for ; Tue, 6 Aug 2024 21:27:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= iv6eRUfCJAiuZcbNJE1tH73PSkC++l0FmHNvCxW2vso=; b=ixcH4u091BD3nY/5 UvrbzIJaTf0ihZtzy0+LbpMKYRqHC6fKOufQ8w4GUXthfS4wqSozsDWpUnidLrJt u2XL9dSdlfLlTkciuaWEba6O/c3I3zsAc/UlNAt4lb+tiwh5oySCEktL8AyT7nsq 5e49R3XSwVRIvlfVojkSfhXEEB++DEIX96RjEvNr4be0M8YtlAibXNUryV6megrj 8CUejma3cPhH8FO06uNaVQ8KaDzcnVzw6jp7zd19Myv+X0t7URfsnr+Az10DaeIJ FeQo424tmhKsFLWoamUavO2Cwdi8flmLwvr9zPjbmc+U/YA42S3qUrjnGkHl1Xx3 174sDQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40scx6rv8a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Aug 2024 21:27:27 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 476LRQDl025283 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 6 Aug 2024 21:27:26 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 6 Aug 2024 14:27:25 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 4/5] ranger: Make some classes local to the TU Date: Tue, 6 Aug 2024 14:27:13 -0700 Message-ID: <20240806212714.308434-5-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240806212714.308434-1-quic_apinski@quicinc.com> References: <20240806212714.308434-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: gpcXRvevEjgnbHijlS3x7MheEru3L5Gd X-Proofpoint-GUID: gpcXRvevEjgnbHijlS3x7MheEru3L5Gd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_17,2024-08-06_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 clxscore=1015 suspectscore=0 phishscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060150 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org This is another small cleanup in the ranger code, since these classes and the instance of them are local to the sources already, make them final classes and make them local by wrapping them with an anonymous namespace. Note some classes/instances were unused in the first place so I didn't deleted them but `#if 0` them out. I don't know if they are being planned to be used in the future or not but still having them be compiled in is wrong and would cause an unused variable warnings now with them being in an anonymous namespace. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * range-op-float.cc (class foperator_unordered): Wrap with anonymous namespace and mark as final. (class foperator_ordered): Likewise. (class foperator_unordered_lt): Likewise. (class foperator_unordered_le): Likewise. (class foperator_unordered_gt): Likewise. (class foperator_unordered_ge): Likewise. (class foperator_unordered_equal): Likewise. (class foperator_ltgt): Likewise. * range-op-ptr.cc (class pointer_plus_operator): Wrap with anonymous namespace and mark as final. (class pointer_min_max_operator): #if out and mark as final. (class pointer_and_operator): Likewise. (class pointer_or_operator): Likewise. (class operator_pointer_diff): Wrap with anonymous namespace and mark as final. Signed-off-by: Andrew Pinski --- gcc/range-op-float.cc | 27 +++++++++++++++++++-------- gcc/range-op-ptr.cc | 20 +++++++++++++++----- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 2754dd87568..e8e06d5fec3 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -1333,9 +1333,11 @@ operator_ge::op1_op2_relation (const irange &lhs, const frange &, return VREL_VARYING; } +namespace { + // UNORDERED_EXPR comparison. -class foperator_unordered : public range_operator +class foperator_unordered final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1409,7 +1411,7 @@ foperator_unordered::op1_range (frange &r, tree type, // ORDERED_EXPR comparison. -class foperator_ordered : public range_operator +class foperator_ordered final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1478,6 +1480,8 @@ foperator_ordered::op1_range (frange &r, tree type, return true; } +} // anonymous namespace + bool operator_negate::fold_range (frange &r, tree type, const frange &op1, const frange &op2, @@ -1607,7 +1611,9 @@ operator_abs::op1_range (frange &r, tree type, return true; } -class foperator_unordered_lt : public range_operator +namespace { + +class foperator_unordered_lt final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1719,7 +1725,7 @@ foperator_unordered_lt::op2_range (frange &r, tree type, return true; } -class foperator_unordered_le : public range_operator +class foperator_unordered_le final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1827,7 +1833,7 @@ foperator_unordered_le::op2_range (frange &r, return true; } -class foperator_unordered_gt : public range_operator +class foperator_unordered_gt final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -1939,7 +1945,7 @@ foperator_unordered_gt::op2_range (frange &r, return true; } -class foperator_unordered_ge : public range_operator +class foperator_unordered_ge final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -2050,7 +2056,7 @@ foperator_unordered_ge::op2_range (frange &r, tree type, return true; } -class foperator_unordered_equal : public range_operator +class foperator_unordered_equal final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -2132,7 +2138,7 @@ foperator_unordered_equal::op1_range (frange &r, tree type, return true; } -class foperator_ltgt : public range_operator +class foperator_ltgt final : public range_operator { using range_operator::fold_range; using range_operator::op1_range; @@ -2214,6 +2220,8 @@ foperator_ltgt::op1_range (frange &r, tree type, return true; } +} // anonymous namespace + // Final tweaks for float binary op op1_range/op2_range. // Return TRUE if the operation is performed and a valid range is available. @@ -2729,6 +2737,7 @@ operator_mult::rv_fold (frange &r, tree type, r.set (type, lb, ub, nan_state (maybe_nan)); } +namespace { class foperator_div : public range_operator { @@ -2899,6 +2908,8 @@ private: } } fop_div; +} + // Initialize any float operators to the primary table diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc index 24e206c00cd..e5b496eaac2 100644 --- a/gcc/range-op-ptr.cc +++ b/gcc/range-op-ptr.cc @@ -288,7 +288,9 @@ build_ge (prange &r, tree type, const prange &val) r.set (type, val.lower_bound (), max_limit (type)); } -class pointer_plus_operator : public range_operator +namespace { + +class pointer_plus_operator final : public range_operator { using range_operator::update_bitmask; using range_operator::fold_range; @@ -451,7 +453,11 @@ pointer_plus_operator::op2_range (irange &r, tree type, return true; } -class pointer_min_max_operator : public range_operator +#if 0 + +/* These are not used currently. Since we are in an + anonymous namespace, they are needed to be #if'ed out. */ +class pointer_min_max_operator final : public range_operator { public: virtual void wi_fold (irange & r, tree type, @@ -479,7 +485,7 @@ pointer_min_max_operator::wi_fold (irange &r, tree type, r.set_varying (type); } -class pointer_and_operator : public range_operator +class pointer_and_operator final : public range_operator { public: virtual void wi_fold (irange &r, tree type, @@ -503,7 +509,7 @@ pointer_and_operator::wi_fold (irange &r, tree type, } -class pointer_or_operator : public range_operator +class pointer_or_operator final : public range_operator { public: using range_operator::op1_range; @@ -565,7 +571,9 @@ pointer_or_operator::wi_fold (irange &r, tree type, r.set_varying (type); } -class operator_pointer_diff : public range_operator +#endif + +class operator_pointer_diff final : public range_operator { using range_operator::update_bitmask; using range_operator::op1_op2_relation_effect; @@ -612,6 +620,8 @@ operator_pointer_diff::op1_op2_relation_effect (irange &lhs_range, tree type, rel); } +} // anonymous namespace + bool operator_identity::fold_range (prange &r, tree type ATTRIBUTE_UNUSED, const prange &lh ATTRIBUTE_UNUSED,