From patchwork Tue Oct 24 08:55:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 157311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1806370vqx; Tue, 24 Oct 2023 01:55:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEjJrP/+en5uzYgHuuv8T+pK058IqpIcGdXZ9xfGb+e3uoIGCsdxXZVuNXhL9ZypOQqopQ X-Received: by 2002:a05:622a:141:b0:417:ccef:7fd0 with SMTP id v1-20020a05622a014100b00417ccef7fd0mr13182303qtw.22.1698137758008; Tue, 24 Oct 2023 01:55:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698137757; cv=pass; d=google.com; s=arc-20160816; b=c7LHZe2aSssSWgr1NyDXaeGfrnvjO7Kgt4UeKaq+Ma+sljxhIgjkWHoIMb3peiwJUh 2NAReRHNsWbMt6uR5agH29QyCgXBbydMdIJmQ460vK/geO/UiwSOpbQTMElZu/u6vB2L culsCuvfxcH4X5EhXb8BS1Tm/clgaz6Ez0BM/CVaz/qV2QCZjqjeuS71kE6c5iXlpRp2 nxX6Gwh06y2WHZfW9kHz0u1waF8lcJTef10lj8MjIHlQ+nxT0d47LIyVguzcpCtUElbo 5vfyZHITJQptj4Ezf7LfIAAqFC4sGsq1O3R3mlcMxBjF64GYQ0dKfwO52wn0b74jb6NZ 27/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=C0oN0IwYJMWjsiKMOSUxTUNuvckUAgENdn68ejq7dis=; fh=JAYvVgwoN6uZjxUztkrzb4lRiG2At7dCjUsiqWXoc/Y=; b=Els3U202a6QfWKg/tnqMFZXdR0eE7GN9kH54eGt+a9WFMIjPZzJBtec26c0DRRTL51 u5j24jiTj7bzB9DQEjVI8TvM/8+VyXE+WWupjbHCPgcrWdMwiKlYtz9fI5EBBGQZdlKQ WQ0vbrZTnOuhBpvssNqiRPyNdxA4XGiebOLgGe3xx2ZEd8CGRL47brPkUQsNPppzstuk f71J80AVMzirmCLseY2ZrMCiHHp45FwHLKCr4VL/l2ktSr0vBCeJ5ApDJvWihTG/lI6b m7tDyUEe8ziwf9Zgg5Nl5zX+koHp3K6T4+RW1d+G09IPHKjIVim/Y8+65WEGBXSKJ7UL 32Lw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); 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" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id v9-20020ac85789000000b00417aec1fb7bsi6896678qta.353.2023.10.24.01.55.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 01:55:57 -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; arc=pass (i=1); 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9576A3858C50 for ; Tue, 24 Oct 2023 08:55:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id F1AD03858C50 for ; Tue, 24 Oct 2023 08:55:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1AD03858C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F1AD03858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.129.153 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698137731; cv=none; b=EamMxhMHDLpNk6AM0OmhcJE+Xs9gcz1GETGj9QtDvMM6kuWVkajNg2Tzcclh/YeZH65+h4oAE9m6iHT4MNWq7Vblu8Cjn8rVZn7TnyKccX6H0T0XwGpWfJpHD2c29HEiVvmc7oqex0bap2fLeZGxGwRW5OcZqHE+BEd3NpAyrAM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698137731; c=relaxed/simple; bh=BM083kq7z6mG3jF8GBnTngGWpFol2R89eyTlAEq+uXU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=V0xNYsm5XVZ5ahvaft9VX1fjI20x3Gq72xRDVgpvBKzp1DyyxbhUcBX7c+S4JPKLl3IVWTSVjrZpr3Xh23so79Sj2/M9/7sdPSDNvWTNhR9d1Ktlf3oKOBDVNiAiEJZB3WyiKut/zh3k5O27SaKXwE0Ptc8AAzDYRW2F2GMeUY8= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: 9dVaT6XXQbysRcDevRgCgw== X-CSE-MsgGUID: PD4hsVP7Qp+xYpP6jY+qvw== X-IronPort-AV: E=Sophos;i="6.03,247,1694764800"; d="scan'208,223";a="23271477" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 24 Oct 2023 00:55:26 -0800 IronPort-SDR: kygm70qtQmst7l4hQH7QrBlHnGdV0mEm7bemq2fWoXKIPMmVGEXn8ArZjnwioqaQT0jUCdVB+X Cp6+cRI4KDdYlUtbN/422J6yyNqw4hvMuoPS2EBt+gz1tknOwJr2x+YeHhFukq2ehSSI2j7/K8 6tTCnwu1WawgLBbxOoVVirzV9u8ipXik2KIPIXtSGu3r8nQI7ggATUmi8EjeDSGvCvuE+Nl2RM YlMRdJ0JW46GqXB+F62toXdaOpW6ud3NZLSIO34nbmpl29k5P5PZfWMmxhvIu5NAIYHD3lSeO+ +ac= From: Thomas Schwinge To: Jakub Jelinek , , Tobias Burnus Subject: OpenMP/Fortran: Group handling of 'if' clause without and with modifier (was: [committed] Partial OpenMP 4.5 fortran support) In-Reply-To: <20161110114159.GG3541@tucnak.redhat.com> References: <20161110114159.GG3541@tucnak.redhat.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Tue, 24 Oct 2023 10:55:20 +0200 Message-ID: <87cyx42ydj.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780626497852073683 X-GMAIL-MSGID: 1780626497852073683 Hi! On 2016-11-10T12:41:59+0100, Jakub Jelinek wrote: > gcc/fortran/ > * gfortran.h [...] > (struct gfc_omp_clauses): Add [...] > [...] > [...] and if_exprs fields. Etc. OK to push (after testing) the attached "OpenMP/Fortran: Group handling of 'if' clause without and with modifier"? That makes an upcoming change a bit lighter. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From a6e15fe6b08e2ced98435739506f9fc10db96a63 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 24 Oct 2023 10:43:40 +0200 Subject: [PATCH] OpenMP/Fortran: Group handling of 'if' clause without and with modifier The 'if' clause with modifier was introduced in commit b4c3a85be96585374bf95c981ba2f602667cf5b7 (Subversion r242037) "Partial OpenMP 4.5 fortran support", but -- in some instances -- didn't place it next to the existing handling of 'if' clause without modifier. Unify that; no change in behavior. gcc/fortran/ * dump-parse-tree.cc (show_omp_clauses): Group handling of 'if' clause without and with modifier. * frontend-passes.cc (gfc_code_walker): Likewise. * gfortran.h (gfc_omp_clauses): Likewise. * openmp.cc (gfc_free_omp_clauses): Likewise. --- gcc/fortran/dump-parse-tree.cc | 42 +++++++++++++++++----------------- gcc/fortran/frontend-passes.cc | 4 ++-- gcc/fortran/gfortran.h | 2 +- gcc/fortran/openmp.cc | 4 ++-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc index 68122e3e6fd..cc4846e5d74 100644 --- a/gcc/fortran/dump-parse-tree.cc +++ b/gcc/fortran/dump-parse-tree.cc @@ -1593,6 +1593,27 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses) show_expr (omp_clauses->if_expr); fputc (')', dumpfile); } + for (i = 0; i < OMP_IF_LAST; i++) + if (omp_clauses->if_exprs[i]) + { + static const char *ifs[] = { + "CANCEL", + "PARALLEL", + "SIMD", + "TASK", + "TASKLOOP", + "TARGET", + "TARGET DATA", + "TARGET UPDATE", + "TARGET ENTER DATA", + "TARGET EXIT DATA" + }; + fputs (" IF(", dumpfile); + fputs (ifs[i], dumpfile); + fputs (": ", dumpfile); + show_expr (omp_clauses->if_exprs[i]); + fputc (')', dumpfile); + } if (omp_clauses->final_expr) { fputs (" FINAL(", dumpfile); @@ -1999,27 +2020,6 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses) show_expr (omp_clauses->detach); fputc (')', dumpfile); } - for (i = 0; i < OMP_IF_LAST; i++) - if (omp_clauses->if_exprs[i]) - { - static const char *ifs[] = { - "CANCEL", - "PARALLEL", - "SIMD", - "TASK", - "TASKLOOP", - "TARGET", - "TARGET DATA", - "TARGET UPDATE", - "TARGET ENTER DATA", - "TARGET EXIT DATA" - }; - fputs (" IF(", dumpfile); - fputs (ifs[i], dumpfile); - fputs (": ", dumpfile); - show_expr (omp_clauses->if_exprs[i]); - fputc (')', dumpfile); - } if (omp_clauses->destroy) fputs (" DESTROY", dumpfile); if (omp_clauses->depend_source) diff --git a/gcc/fortran/frontend-passes.cc b/gcc/fortran/frontend-passes.cc index 536884b13f0..0378e0dba06 100644 --- a/gcc/fortran/frontend-passes.cc +++ b/gcc/fortran/frontend-passes.cc @@ -5652,6 +5652,8 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn, OMP_LIST_MAP, OMP_LIST_TO, OMP_LIST_FROM }; size_t idx; WALK_SUBEXPR (co->ext.omp_clauses->if_expr); + for (idx = 0; idx < OMP_IF_LAST; idx++) + WALK_SUBEXPR (co->ext.omp_clauses->if_exprs[idx]); WALK_SUBEXPR (co->ext.omp_clauses->final_expr); WALK_SUBEXPR (co->ext.omp_clauses->num_threads); WALK_SUBEXPR (co->ext.omp_clauses->chunk_size); @@ -5667,8 +5669,6 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn, WALK_SUBEXPR (co->ext.omp_clauses->num_tasks); WALK_SUBEXPR (co->ext.omp_clauses->priority); WALK_SUBEXPR (co->ext.omp_clauses->detach); - for (idx = 0; idx < OMP_IF_LAST; idx++) - WALK_SUBEXPR (co->ext.omp_clauses->if_exprs[idx]); for (idx = 0; idx < ARRAY_SIZE (list_types); idx++) for (n = co->ext.omp_clauses->lists[list_types[idx]]; n; n = n->next) diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 88f33b0957e..9c1a39a19de 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1545,6 +1545,7 @@ typedef struct gfc_omp_clauses { gfc_omp_namelist *lists[OMP_LIST_NUM]; struct gfc_expr *if_expr; + struct gfc_expr *if_exprs[OMP_IF_LAST]; struct gfc_expr *final_expr; struct gfc_expr *num_threads; struct gfc_expr *chunk_size; @@ -1561,7 +1562,6 @@ typedef struct gfc_omp_clauses struct gfc_expr *priority; struct gfc_expr *detach; struct gfc_expr *depobj; - struct gfc_expr *if_exprs[OMP_IF_LAST]; struct gfc_expr *dist_chunk_size; struct gfc_expr *message; struct gfc_omp_assumptions *assume; diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 1cc65d7fa49..caa5c9e15a3 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -161,6 +161,8 @@ gfc_free_omp_clauses (gfc_omp_clauses *c) return; gfc_free_expr (c->if_expr); + for (i = 0; i < OMP_IF_LAST; i++) + gfc_free_expr (c->if_exprs[i]); gfc_free_expr (c->final_expr); gfc_free_expr (c->num_threads); gfc_free_expr (c->chunk_size); @@ -176,8 +178,6 @@ gfc_free_omp_clauses (gfc_omp_clauses *c) gfc_free_expr (c->num_tasks); gfc_free_expr (c->priority); gfc_free_expr (c->detach); - for (i = 0; i < OMP_IF_LAST; i++) - gfc_free_expr (c->if_exprs[i]); gfc_free_expr (c->async_expr); gfc_free_expr (c->gang_num_expr); gfc_free_expr (c->gang_static_expr); -- 2.34.1