From patchwork Sat Jun 10 00:35:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1793259 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=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=h5ayyyUN; dkim-atps=neutral Received: from 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 4QdJsP5Ld8z20Vx for ; Sat, 10 Jun 2023 10:36:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C052B3856968 for ; Sat, 10 Jun 2023 00:36:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C052B3856968 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686357367; bh=aCzL1MBwAPwMlqBfjcrbJZR9++PpPfQqLKn5gGMna58=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=h5ayyyUNQW1fVCn9xvd5vE48YUA5kUzR+MbribDtkRKa387acroiDpHGdxsOoRmlj nc/dd4qXX9Rm3tctzrd92qH+4/zd0qhL46AvqES+FYZuWwx0s7f0MGElyG0Lh4rlET N5ngNAiAdVsz7K9rsfUf6STdP6ajjt0r31xwquwc= 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 50D083854E48 for ; Sat, 10 Jun 2023 00:35:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 50D083854E48 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-IChLDsqPNOabLVUNUpXfKg-1; Fri, 09 Jun 2023 20:35:40 -0400 X-MC-Unique: IChLDsqPNOabLVUNUpXfKg-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-75caeec5545so366816885a.0 for ; Fri, 09 Jun 2023 17:35:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686357339; x=1688949339; 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=prxKxENhqRYiPlQnO31iuhk9RPyzEebY5jVEus5j8HA=; b=KIzTSDw7GLcne2XNjDCi+kM9JRN+X7MeJgS21j3PbyvpdaIw03JTDtjFu5QiaM1G0/ l0bBw+9UaIqD+9l2wmlRhnisku5uCIJVQc5R4lqxUozHBphdfyjkO63LJIczZGMY7Dex ih7seda9pUBoUwx/sWt/OMS4EA3jZWnKC5frHnwL5sRHknmpKFDcDrGNG3PM1oadxJOV 4BPTqJq0qhe4Nw5Ovi7z8RLkodz9FhEqcnmmP3ZM0IiLOdZUutQ8wuYdEpHrvEEH7lFD zRiaaJziS0lEspSz6z7Je+ef8hYs9nEjaMVf/oMNIFDTx8Yr3I1by5Kq2JF5y71vVGl1 0TCw== X-Gm-Message-State: AC+VfDx2nE2pz4fk/wmEuIuAx0v0AwOlycxmRLOgeWSygS1X+PVL/VVZ adMoRTfBwc3Ec3D9B+XaiJw91gRAu3XCICfmQInAkkOaq8DTi9bpT6tUb57EBBMwm9oFAYeeyA2 7khzUXkA/qjAPhTynO4GiGEfBj4ZSCec/2JftiJZG6b2YldFIqZB0M4RNHJ7zyDp9rGg8YV2AWc YL3A== X-Received: by 2002:a05:620a:2591:b0:75e:b9c7:46d7 with SMTP id x17-20020a05620a259100b0075eb9c746d7mr3827147qko.21.1686357339547; Fri, 09 Jun 2023 17:35:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ymy1SPSNkOT5htJMLZKYXuM9WP3VVm69Nd0zPD+1EJevIDsmKX+yWHY6n3tbrNC65fZsX/Q== X-Received: by 2002:a05:620a:2591:b0:75e:b9c7:46d7 with SMTP id x17-20020a05620a259100b0075eb9c746d7mr3827132qko.21.1686357339238; Fri, 09 Jun 2023 17:35:39 -0700 (PDT) Received: from ?IPV6:2607:fea8:51df:4200::ca58? ([2607:fea8:51df:4200::ca58]) by smtp.gmail.com with ESMTPSA id g7-20020a05620a108700b0075b327a2988sm1354495qkk.133.2023.06.09.17.35.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Jun 2023 17:35:38 -0700 (PDT) Message-ID: <4bd184ed-98b9-9c61-6a31-e7ae721b18ce@redhat.com> Date: Fri, 9 Jun 2023 20:35:37 -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 9/15] Unify operator_cst range operator X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-12.4 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" THis patch move the CONST operator into the mixed header.  It also sets REAL_CST to use this instead, as it has no op1_range routines. Bootstrap on x86_64-pc-linux-gnu and pass all regressions. Pushed. Andrew From 35a580f09eaceda5b0dd370b1e39fe05ba0a154f Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Fri, 9 Jun 2023 13:37:11 -0400 Subject: [PATCH 09/31] Unify operator_cst range operator Move the declaration of the class to the range-op-mixed header, add the floating point prototypes as well, and use it in the new unified table. * range-op-float.cc (operator_cst::fold_range): New. * range-op-mixed.h (class operator_cst): Move from integer file. * range-op.cc (op_cst): New object. (unified_table::unified_table): Add op_cst. Also use for REAL_CST. (class operator_cst): Move to range-op-mixed.h. (integral_table::integral_table): Remove op_cst. (pointer_table::pointer_table): Remove op_cst. --- gcc/range-op-float.cc | 7 +++++++ gcc/range-op-mixed.h | 12 ++++++++++++ gcc/range-op.cc | 16 +++------------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index bc8ecc61bce..11d76f2ef25 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -557,6 +557,13 @@ operator_identity::op1_range (frange &r, tree, const frange &lhs, return true; } +bool +operator_cst::fold_range (frange &r, tree, const frange &op1, + const frange &, relation_trio) const +{ + r = op1; + return true; +} bool operator_equal::op2_range (frange &r, tree type, diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h index f30f7d019ee..5b7fbe89856 100644 --- a/gcc/range-op-mixed.h +++ b/gcc/range-op-mixed.h @@ -292,4 +292,16 @@ public: relation_kind rel) const final override; }; +class operator_cst : public range_operator +{ +public: + using range_operator::fold_range; + bool fold_range (irange &r, tree type, + const irange &op1, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override; + bool fold_range (frange &r, tree type, + const frange &op1, const frange &op2, + relation_trio = TRIO_VARYING) const final override; +}; + #endif // GCC_RANGE_OP_MIXED_H diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 70684b4c7f7..31d4e1a1739 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -69,6 +69,7 @@ operator_le op_le; operator_gt op_gt; operator_ge op_ge; operator_identity op_ident; +operator_cst op_cst; // Invoke the initialization routines for each class of range. @@ -87,7 +88,8 @@ unified_table::unified_table () set (SSA_NAME, op_ident); set (PAREN_EXPR, op_ident); set (OBJ_TYPE_REF, op_ident); - set (REAL_CST, op_ident); + set (REAL_CST, op_cst); + set (INTEGER_CST, op_cst); } // The tables are hidden and accessed via a simple extern function. @@ -4224,16 +4226,6 @@ operator_bitwise_not::op1_range (irange &r, tree type, } -class operator_cst : public range_operator -{ - using range_operator::fold_range; -public: - virtual bool fold_range (irange &r, tree type, - const irange &op1, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; -} op_integer_cst; - bool operator_cst::fold_range (irange &r, tree type ATTRIBUTE_UNUSED, const irange &lh, @@ -4758,7 +4750,6 @@ integral_table::integral_table () set (BIT_IOR_EXPR, op_bitwise_or); set (BIT_XOR_EXPR, op_bitwise_xor); set (BIT_NOT_EXPR, op_bitwise_not); - set (INTEGER_CST, op_integer_cst); set (ABS_EXPR, op_abs); set (NEGATE_EXPR, op_negate); set (ADDR_EXPR, op_addr); @@ -4792,7 +4783,6 @@ pointer_table::pointer_table () set (MIN_EXPR, op_ptr_min_max); set (MAX_EXPR, op_ptr_min_max); - set (INTEGER_CST, op_integer_cst); set (ADDR_EXPR, op_addr); set (NOP_EXPR, op_cast); set (CONVERT_EXPR, op_cast); -- 2.40.1