From patchwork Fri Apr 21 13:51:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 86322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1082091vqo; Fri, 21 Apr 2023 06:52:19 -0700 (PDT) X-Google-Smtp-Source: AKy350ZqHnjHzXbSuyJD2SwR2u8M+9IlfhlZA4CzN6pum96EW/zT7milbbDObXKFR3b1pUfcUw8h X-Received: by 2002:a17:906:5a45:b0:93e:fa12:aa1a with SMTP id my5-20020a1709065a4500b0093efa12aa1amr2044450ejc.1.1682085139149; Fri, 21 Apr 2023 06:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682085139; cv=none; d=google.com; s=arc-20160816; b=kWTuLpQJo7LcIxplMyf9aRUPGkml/dNHOMcNlRETL1/wlZCMfRuwBch3umwo0+Z0TZ kAu02gEToqrd7ZDqfU/iW97U/vxBw1uqrBiqYn22tOjsJGl2569C0dx6FdGSq5csZI6p iH0tE7mFzBlPpa98Lrrim7O25R2tU0II2zfdfn6mmNILxtfenNsZZlOXREGr8BDvGDX1 DPOH36jvkcdTJZtVJgryOOmCSdMCXm/qxVovnsnsx99F5bd4FznUin8bkywYx/LUePSm Tq6gQesEEsQ5wggtn2jBDm2JHqcQt9ZRNJjhMrjO7/r27sRzoUrxaiIGsAOzutlH0JqS hwfw== 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:message-id :mime-version:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=+Mpn/9fXIaTow1wgB3kRwzOPkvdYiV9naAZtNg0LLN4=; b=aU3BD9yWlyjTJnpxDW0WtkgdbZrR3d7U+TQnaee3hckEykMq1kprUDJHtKUYyoybgZ pDgORv/WeZCPwQ5dRDY7Uo8qSgBo8ipPZA2vtn0/ho23EyHXAma1XGxTFqdeB8R84Izu VJl3KZXsj1TvOV3g/387kGRrrOAHT8EPqLWPj+MUwhYMnghhcv2d3VvFe08q5XggOUaZ SXt4kRxse0eEQ7XUNn4Lcuh0BnFf9gkKOI3K9uUowFX9rRAgQIx3cKAPX8wgxuIwPhjY mzSUw4sZVoxqzA9NKIoDQkQfknaMkaykEjLPspbVGIOYA+wuH/xf9QtGEV0qoPEiRe7v ejeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oWAIUJxU; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id 25-20020a170906005900b0094f8aa49c6asi3261922ejg.603.2023.04.21.06.52.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 06:52:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oWAIUJxU; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 7410C3857010 for ; Fri, 21 Apr 2023 13:52:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7410C3857010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682085130; bh=+Mpn/9fXIaTow1wgB3kRwzOPkvdYiV9naAZtNg0LLN4=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=oWAIUJxUYCYK4pzRl14jBHRCCdblzLROS2/tQFuoYB697v7VQvDQpXGnTswLeTm/u eNn9tca7v8XAZYiVN6As14lB7trYehPqOIzV6o1YehnW1sz44jxvzngzODbI9fRt5I WsHIQ2VuUty9XAkqJ6xMzo7exMs2+ndxmbRI+Fio= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 033D13858C83 for ; Fri, 21 Apr 2023 13:51:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 033D13858C83 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 28CAC1FDDC for ; Fri, 21 Apr 2023 13:51:23 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0BA1613456 for ; Fri, 21 Apr 2023 13:51:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id W6W5AduUQmRKZgAAMHmgww (envelope-from ) for ; Fri, 21 Apr 2023 13:51:23 +0000 Date: Fri, 21 Apr 2023 15:51:22 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Add operator* to gimple_stmt_iterator and gphi_iterator MIME-Version: 1.0 Message-Id: <20230421135123.0BA1613456@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener 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?1763794107112226628?= X-GMAIL-MSGID: =?utf-8?q?1763794107112226628?= This allows STL style iterator dereference. It's the same as gsi_stmt () or .phi (). Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * gimple-iterator.h (gimple_stmt_iterator::operator*): Add. (gphi_iterator::operator*): Likewise. --- gcc/gimple-iterator.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h index 38352aa95af..b709923f00d 100644 --- a/gcc/gimple-iterator.h +++ b/gcc/gimple-iterator.h @@ -24,6 +24,8 @@ along with GCC; see the file COPYING3. If not see struct gimple_stmt_iterator { + gimple *operator * () const { return ptr; } + /* Sequence node holding the current statement. */ gimple_seq_node ptr; @@ -38,6 +40,8 @@ struct gimple_stmt_iterator /* Iterator over GIMPLE_PHI statements. */ struct gphi_iterator : public gimple_stmt_iterator { + gphi *operator * () const { return as_a (ptr); } + gphi *phi () const { return as_a (ptr);