From patchwork Thu Jun 8 18:57:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 105085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp478978vqr; Thu, 8 Jun 2023 11:59:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6LZqgSOMTyXde8UrOrJqLKdAO3mHsJFyrxR9H43QEZUCzHtCBh1AJXnNbXHfWR7vgAr84O X-Received: by 2002:a05:6402:345c:b0:514:75c3:269b with SMTP id l28-20020a056402345c00b0051475c3269bmr7302963edc.41.1686250740412; Thu, 08 Jun 2023 11:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686250740; cv=none; d=google.com; s=arc-20160816; b=mbmck2ldTJrFBZbVJRyZqXD3Y0J6fU4zAd3XmOvE7I9FII3PD/bJjZRlu96LYhyltN iXONd4lfsgAi8wwBsxDyBGLa/p/P2YGo9OEtX072Jlt18C+nKsStSOJj/hbjgbCR2nTK PQ5YKnMLigo2qGGGX6RlRxrgAWAGNdR0oWaQTqAr/w4quDdEkTzO1Qz6zNNygxWTIFCc TOvPl4uI5Nrg1+LBzL5Zf7x442UdptJHSVmT6pIONzwImQ/oI3qFmcGe9pomnz5yORHY DxLZnfkzXzWIJHY15eUpT1N3uLFhSJ8nv34HETbMabnMr+VTWSmi6lBmGOAQdbJ2Fxm/ JAtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:content-language :subject:cc:to:user-agent:mime-version:date:message-id:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=l32jdCy5KHRFLqqd86in25KsOoppZ7U5TQv0Ss2dVJM=; b=0aHbtkXxM+QukQJ5vTMUP86nt/f2VKV7E4gxPclKHLWsooTC6NSujJHeDoVud8XANa 0Hg7H8KbW23lMKbR+FhLhh3RGmiiw1Epp7dMBCnChKVQslR6VQdSN4FqgMOmu5HpWWOH QGyIGPGhDSbxlI+n6f9WNrjPaMFBE3D8AcqcqH9xGLEYjZpW1GWhuzsNrm5N4jgpbMId 3IngWTOCHLLsy5hK42LTY/J8GhftEsTffzLKJTUiu1nj+LfajMRckQjMr8LjB8ZcriqN qlzO9mEHd94/BvmJAsr7fVfgTQ7hzruM+0G2V8rNPLpiR0L8dInbIi92arwO5BULtDb4 zo8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="iAC/RQ46"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r10-20020aa7cb8a000000b005149e0f8897si1077141edt.331.2023.06.08.11.59.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 11:59:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="iAC/RQ46"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3FE68385661A for ; Thu, 8 Jun 2023 18:58:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FE68385661A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686250711; bh=l32jdCy5KHRFLqqd86in25KsOoppZ7U5TQv0Ss2dVJM=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=iAC/RQ46e89VNdv2eD+v+p+hbzPbMrUxB/9F0wI+OmgR5vDsbqgSwnnGtCPVmJtzH VtzZx9kFXirzEvs8u6oKnN9yaV/nsH6XcCQBJ64T2uEGryVapKDym5P9+AZqe1rnjC XJafis4Dc+RumEpB/WVZXWMeHvj3tKBZATAikdOg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id BE023385701B for ; Thu, 8 Jun 2023 18:57:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE023385701B Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604--tFhat0_MT-v2z1H1q4gxA-1; Thu, 08 Jun 2023 14:57:44 -0400 X-MC-Unique: -tFhat0_MT-v2z1H1q4gxA-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6260e66ec46so11098776d6.3 for ; Thu, 08 Jun 2023 11:57:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686250663; x=1688842663; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ccuL1OEYpNoHItOJBxDcuwvVi+VSowGFeIU6rIOGKN4=; b=E3NpvotKLKzlAoM+ecq1dyk8TiZl8HBlHEw9NbGNX4Q1G0TsH57lqTEStJLwumu5Dk V4dHt7FTnZUjVst0WamQhPz+X60N2IEnEf+1hPvomQzahGFn1OGpIohB1Wk+3+bfGRuG 6tWLe1Idu31ZiVt7ppQHZ7ji8fq5yOsLmgR5Poiyn68mKLn9Pxmrz5zP+mcYrJ9lr0rh FB+TelA2UbxQJe1ExCitAhDjJ6bHsgRPSTMkLllLWoIhRGz3khYU7UjurpoczaaOkTgT 3qramKoTswEZS7zp0iAYZpeuCa5C7ZSCljocVtFDNc+IyCEkLahSZrdIwnYGniAE+0Sn HmjQ== X-Gm-Message-State: AC+VfDz58DYQAXE+pNuRv+dq+0gKuamCNlojU0/FMZO/RdiBuQgj3oi0 lRmBePb0ISOkBzM3NpHIkRBG0CxTe8N64rdKzSOXqnqqtSbohWkPgR4uhJWV+1KzYWLsK7F73MR sI3I6VQicy5DnGVrr5f8qqo3Ee2dJuQVFeBjzMRyOdO7qXEjtKoVhH5K1vFaeCR+XSocUC+0Jt8 uh4g== X-Received: by 2002:ad4:5fca:0:b0:626:3a98:95a with SMTP id jq10-20020ad45fca000000b006263a98095amr2689759qvb.22.1686250663150; Thu, 08 Jun 2023 11:57:43 -0700 (PDT) X-Received: by 2002:ad4:5fca:0:b0:626:3a98:95a with SMTP id jq10-20020ad45fca000000b006263a98095amr2689746qvb.22.1686250662800; Thu, 08 Jun 2023 11:57:42 -0700 (PDT) Received: from ?IPV6:2607:fea8:51df:4200::ca58? ([2607:fea8:51df:4200::ca58]) by smtp.gmail.com with ESMTPSA id v14-20020a0ccd8e000000b006263784674esm611425qvm.14.2023.06.08.11.57.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jun 2023 11:57:42 -0700 (PDT) Message-ID: Date: Thu, 8 Jun 2023 14:57:41 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 To: gcc-patches Cc: "hernandez, aldy" Subject: [COMMITTED 2/4] - Remove tree_code from range-operator. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768162056355908832?= X-GMAIL-MSGID: =?utf-8?q?1768162056355908832?= Range_operator had a tree code added last release to facilitate bitmask operations.  This was intended to be a temporary change until we could figure out something more strategic going forward. This patch removes the tree_code and replaces it with a virtual routine to perform the masking. Each of the affected tree codes operators now call the bitmask routine via a virtual function.  At some point we may want to consolidate the code that CCP is using so that it resides in the range_operator, but the extensive parameter list used by that CCP routine makes that prohibitive to do at the moment. Bootstraps on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From c5065669a36ba0c26841cb108d32f03058757e85 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Wed, 31 May 2023 10:55:28 -0400 Subject: [PATCH 2/4] Remove tree_code from range-operator. Range_operator had a tree code added last release to facilitate bitmask operations. This removes the tree_code and replaces it with a virtual routine to peform the masking. Remove any duplicate instances which are no longer needed. * range-op.cc (range_operator::fold_range): Call virtual routine. (range_operator::update_bitmask): New. (operator_equal::update_bitmask): New. (operator_not_equal::update_bitmask): New. (operator_lt::update_bitmask): New. (operator_le::update_bitmask): New. (operator_gt::update_bitmask): New. (operator_ge::update_bitmask): New. (operator_ge::update_bitmask): New. (operator_plus::update_bitmask): New. (operator_minus::update_bitmask): New. (operator_pointer_diff::update_bitmask): New. (operator_min::update_bitmask): New. (operator_max::update_bitmask): New. (operator_mult::update_bitmask): New. (operator_div:operator_div):New. (operator_div::update_bitmask): New. (operator_div::m_code): New member. (operator_exact_divide::operator_exact_divide): New constructor. (operator_lshift::update_bitmask): New. (operator_rshift::update_bitmask): New. (operator_bitwise_and::update_bitmask): New. (operator_bitwise_or::update_bitmask): New. (operator_bitwise_xor::update_bitmask): New. (operator_trunc_mod::update_bitmask): New. (op_ident, op_unknown, op_ptr_min_max): New. (op_nop, op_convert): Delete. (op_ssa, op_paren, op_obj_type): Delete. (op_realpart, op_imagpart): Delete. (op_ptr_min, op_ptr_max): Delete. (pointer_plus_operator:update_bitmask): New. (range_op_table::set): Do not use m_code. (integral_table::integral_table): Adjust to single instances. * range-op.h (range_operator::range_operator): Delete. (range_operator::m_code): Delete. (range_operator::update_bitmask): New. --- gcc/range-op.cc | 110 +++++++++++++++++++++++++++++++++--------------- gcc/range-op.h | 6 +-- 2 files changed, 79 insertions(+), 37 deletions(-) diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 3ab2c665901..2deca3bac93 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -286,7 +286,7 @@ range_operator::fold_range (irange &r, tree type, break; } op1_op2_relation_effect (r, type, lh, rh, rel); - update_known_bitmask (r, m_code, lh, rh); + update_bitmask (r, lh, rh); return true; } @@ -298,7 +298,7 @@ range_operator::fold_range (irange &r, tree type, wi_fold_in_parts (r, type, lh.lower_bound (), lh.upper_bound (), rh.lower_bound (), rh.upper_bound ()); op1_op2_relation_effect (r, type, lh, rh, rel); - update_known_bitmask (r, m_code, lh, rh); + update_bitmask (r, lh, rh); return true; } @@ -316,12 +316,12 @@ range_operator::fold_range (irange &r, tree type, if (r.varying_p ()) { op1_op2_relation_effect (r, type, lh, rh, rel); - update_known_bitmask (r, m_code, lh, rh); + update_bitmask (r, lh, rh); return true; } } op1_op2_relation_effect (r, type, lh, rh, rel); - update_known_bitmask (r, m_code, lh, rh); + update_bitmask (r, lh, rh); return true; } @@ -387,6 +387,14 @@ range_operator::op1_op2_relation_effect (irange &lhs_range ATTRIBUTE_UNUSED, return false; } +// Apply any known bitmask updates based on this operator. + +void +range_operator::update_bitmask (irange &, const irange &, + const irange &) const +{ +} + // Create and return a range from a pair of wide-ints that are known // to have overflowed (or underflowed). @@ -562,6 +570,8 @@ public: const irange &val, relation_trio = TRIO_VARYING) const; virtual relation_kind op1_op2_relation (const irange &lhs) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, EQ_EXPR, lh, rh); } } op_equal; // Check if the LHS range indicates a relation between OP1 and OP2. @@ -682,6 +692,8 @@ public: const irange &op1, relation_trio = TRIO_VARYING) const; virtual relation_kind op1_op2_relation (const irange &lhs) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, NE_EXPR, lh, rh); } } op_not_equal; // Check if the LHS range indicates a relation between OP1 and OP2. @@ -862,6 +874,8 @@ public: const irange &op1, relation_trio = TRIO_VARYING) const; virtual relation_kind op1_op2_relation (const irange &lhs) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, LT_EXPR, lh, rh); } } op_lt; // Check if the LHS range indicates a relation between OP1 and OP2. @@ -982,6 +996,8 @@ public: const irange &op1, relation_trio = TRIO_VARYING) const; virtual relation_kind op1_op2_relation (const irange &lhs) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, LE_EXPR, lh, rh); } } op_le; // Check if the LHS range indicates a relation between OP1 and OP2. @@ -1099,6 +1115,8 @@ public: const irange &op1, relation_trio = TRIO_VARYING) const; virtual relation_kind op1_op2_relation (const irange &lhs) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, GT_EXPR, lh, rh); } } op_gt; // Check if the LHS range indicates a relation between OP1 and OP2. @@ -1215,6 +1233,8 @@ public: const irange &op1, relation_trio = TRIO_VARYING) const; virtual relation_kind op1_op2_relation (const irange &lhs) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, GE_EXPR, lh, rh); } } op_ge; // Check if the LHS range indicates a relation between OP1 and OP2. @@ -1339,6 +1359,8 @@ public: virtual relation_kind lhs_op2_relation (const irange &lhs, const irange &op1, const irange &op2, relation_kind rel) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, PLUS_EXPR, lh, rh); } } op_plus; // Check to see if the range of OP2 indicates anything about the relation @@ -1648,6 +1670,8 @@ public: const irange &op1_range, const irange &op2_range, relation_kind rel) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, MINUS_EXPR, lh, rh); } } op_minus; void @@ -1801,6 +1825,8 @@ class operator_pointer_diff : public range_operator const irange &op1_range, const irange &op2_range, relation_kind rel) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, POINTER_DIFF_EXPR, lh, rh); } } op_pointer_diff; bool @@ -1822,6 +1848,8 @@ public: const wide_int &lh_ub, const wide_int &rh_lb, const wide_int &rh_ub) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, MIN_EXPR, lh, rh); } } op_min; void @@ -1844,6 +1872,8 @@ public: const wide_int &lh_ub, const wide_int &rh_lb, const wide_int &rh_ub) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, MAX_EXPR, lh, rh); } } op_max; void @@ -1952,6 +1982,8 @@ public: const irange &lhs, const irange &op1, relation_trio) const final override; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, MULT_EXPR, lh, rh); } } op_mult; bool @@ -2162,6 +2194,7 @@ operator_widen_mult_unsigned::wi_fold (irange &r, tree type, class operator_div : public cross_product_operator { public: + operator_div (tree_code div_kind) { m_code = div_kind; } virtual void wi_fold (irange &r, tree type, const wide_int &lh_lb, const wide_int &lh_ub, @@ -2170,8 +2203,17 @@ public: virtual bool wi_op_overflows (wide_int &res, tree type, const wide_int &, const wide_int &) const final override; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, m_code, lh, rh); } +protected: + tree_code m_code; }; +static operator_div op_trunc_div (TRUNC_DIV_EXPR); +static operator_div op_floor_div (FLOOR_DIV_EXPR); +static operator_div op_round_div (ROUND_DIV_EXPR); +static operator_div op_ceil_div (CEIL_DIV_EXPR); + bool operator_div::wi_op_overflows (wide_int &res, tree type, const wide_int &w0, const wide_int &w1) const @@ -2265,6 +2307,7 @@ class operator_exact_divide : public operator_div { using range_operator::op1_range; public: + operator_exact_divide () : operator_div (EXACT_DIV_EXPR) { } virtual bool op1_range (irange &r, tree type, const irange &lhs, const irange &op2, @@ -2314,6 +2357,8 @@ public: tree type, const wide_int &, const wide_int &) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, LSHIFT_EXPR, lh, rh); } } op_lshift; class operator_rshift : public cross_product_operator @@ -2343,6 +2388,8 @@ public: const irange &op1, const irange &op2, relation_kind rel) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, RSHIFT_EXPR, lh, rh); } } op_rshift; @@ -2682,7 +2729,7 @@ private: const irange &outer) const; void fold_pair (irange &r, unsigned index, const irange &inner, const irange &outer) const; -}; +} op_cast; // Add a partial equivalence between the LHS and op1 for casts. @@ -3026,6 +3073,8 @@ public: const irange &op1, const irange &op2, relation_kind) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, BIT_AND_EXPR, lh, rh); } private: void simple_op1_range_solver (irange &r, tree type, const irange &lhs, @@ -3524,6 +3573,8 @@ public: const wide_int &lh_ub, const wide_int &rh_lb, const wide_int &rh_ub) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, BIT_IOR_EXPR, lh, rh); } } op_bitwise_or; void @@ -3636,6 +3687,8 @@ public: const irange &op1_range, const irange &op2_range, relation_kind rel) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, BIT_XOR_EXPR, lh, rh); } } op_bitwise_xor; void @@ -3777,6 +3830,8 @@ public: const irange &lhs, const irange &op1, relation_trio) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, TRUNC_MOD_EXPR, lh, rh); } } op_trunc_mod; void @@ -4046,7 +4101,7 @@ public: const irange &op1, const irange &op2, relation_kind rel) const; -}; +} op_ident; // Determine if there is a relationship between LHS and OP1. @@ -4091,7 +4146,7 @@ public: const irange &op1, const irange &op2, relation_trio rel = TRIO_VARYING) const; -}; +} op_unknown; bool operator_unknown::fold_range (irange &r, tree type, @@ -4365,6 +4420,8 @@ public: const irange &lhs, const irange &op1, relation_trio = TRIO_VARYING) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, POINTER_PLUS_EXPR, lh, rh); } } op_pointer_plus; void @@ -4436,7 +4493,7 @@ public: virtual void wi_fold (irange & r, tree type, const wide_int &lh_lb, const wide_int &lh_ub, const wide_int &rh_lb, const wide_int &rh_ub) const; -}; +} op_ptr_min_max; void pointer_min_max_operator::wi_fold (irange &r, tree type, @@ -4562,21 +4619,8 @@ range_op_table::set (enum tree_code code, range_operator &op) { gcc_checking_assert (m_range_tree[code] == NULL); m_range_tree[code] = &op; - gcc_checking_assert (op.m_code == ERROR_MARK || op.m_code == code); - op.m_code = code; } -// Shared operators that require separate instantiations because they -// do not share a common tree code. -static operator_cast op_nop, op_convert; -static operator_identity op_ssa, op_paren, op_obj_type; -static operator_unknown op_realpart, op_imagpart; -static pointer_min_max_operator op_ptr_min, op_ptr_max; -static operator_div op_trunc_div; -static operator_div op_floor_div; -static operator_div op_round_div; -static operator_div op_ceil_div; - // Instantiate a range op table for integral operations. class integral_table : public range_op_table @@ -4605,8 +4649,8 @@ integral_table::integral_table () set (EXACT_DIV_EXPR, op_exact_div); set (LSHIFT_EXPR, op_lshift); set (RSHIFT_EXPR, op_rshift); - set (NOP_EXPR, op_nop); - set (CONVERT_EXPR, op_convert); + set (NOP_EXPR, op_cast); + set (CONVERT_EXPR, op_cast); set (TRUTH_AND_EXPR, op_logical_and); set (BIT_AND_EXPR, op_bitwise_and); set (TRUTH_OR_EXPR, op_logical_or); @@ -4616,11 +4660,11 @@ integral_table::integral_table () set (TRUTH_NOT_EXPR, op_logical_not); set (BIT_NOT_EXPR, op_bitwise_not); set (INTEGER_CST, op_integer_cst); - set (SSA_NAME, op_ssa); - set (PAREN_EXPR, op_paren); - set (OBJ_TYPE_REF, op_obj_type); - set (IMAGPART_EXPR, op_imagpart); - set (REALPART_EXPR, op_realpart); + set (SSA_NAME, op_ident); + set (PAREN_EXPR, op_ident); + set (OBJ_TYPE_REF, op_ident); + set (IMAGPART_EXPR, op_unknown); + set (REALPART_EXPR, op_unknown); set (POINTER_DIFF_EXPR, op_pointer_diff); set (ABS_EXPR, op_abs); set (ABSU_EXPR, op_absu); @@ -4640,8 +4684,8 @@ pointer_table::pointer_table () { set (BIT_AND_EXPR, op_pointer_and); set (BIT_IOR_EXPR, op_pointer_or); - set (MIN_EXPR, op_ptr_min); - set (MAX_EXPR, op_ptr_max); + set (MIN_EXPR, op_ptr_min_max); + set (MAX_EXPR, op_ptr_min_max); set (POINTER_PLUS_EXPR, op_pointer_plus); set (EQ_EXPR, op_equal); @@ -4650,11 +4694,11 @@ pointer_table::pointer_table () set (LE_EXPR, op_le); set (GT_EXPR, op_gt); set (GE_EXPR, op_ge); - set (SSA_NAME, op_ssa); + set (SSA_NAME, op_ident); set (INTEGER_CST, op_integer_cst); set (ADDR_EXPR, op_addr); - set (NOP_EXPR, op_nop); - set (CONVERT_EXPR, op_convert); + set (NOP_EXPR, op_cast); + set (CONVERT_EXPR, op_cast); set (BIT_NOT_EXPR, op_bitwise_not); set (BIT_XOR_EXPR, op_bitwise_xor); diff --git a/gcc/range-op.h b/gcc/range-op.h index 03ef6b98542..5bfbc89df52 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -50,7 +50,6 @@ class range_operator { friend class range_op_table; public: - range_operator () : m_code (ERROR_MARK) { } // Perform an operation between 2 ranges and return it. virtual bool fold_range (irange &r, tree type, const irange &lh, @@ -114,9 +113,8 @@ protected: const wide_int &lb, const wide_int &ub, unsigned limit) const; - - // Tree code of the range operator or ERROR_MARK if unknown. - tree_code m_code; + // Apply any bitmasks implied by these ranges. + virtual void update_bitmask (irange &, const irange &, const irange &) const; }; // Like range_operator above, but for floating point operators. -- 2.40.1