From patchwork Wed Dec 15 15:54:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frederik Harwath X-Patchwork-Id: 48965 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8E3B33858001 for ; Wed, 15 Dec 2021 16:10:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id C4497385843E for ; Wed, 15 Dec 2021 15:56:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C4497385843E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: VMvI8ZbRfpguSIkaZ60jiWX6PVtn38OFoZpdLHkbwvZSp2BFyno6jXmHdmsKi4qatwJF/zAi2v hgWxwW9x/1Odysgh6r2AGbLd+zDUPaFCVDYDj8bZaXHb821/NN/o8QOXEyotSiwGqfl0q8fmtB j7vzmSjM7O47tyi9Hq+7ytNT8/MDXMo2b9pDRy54Na/lY97Owoeae7jxaEhaZtZ0nK/lOnT3DB abNReA6LuAOkc25a+j3+ULNHlV+FQ9TR6zgLKOCg8x+wG8dWKixZW79ylGIryShO/13Ii4oPTf 0AQSvbGwWrMFgEeFOy5nwKgp X-IronPort-AV: E=Sophos;i="5.88,207,1635235200"; d="scan'208";a="69738395" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 15 Dec 2021 07:56:26 -0800 IronPort-SDR: wgP8Gv6i5ksAj57JUkg7nMO1Z0+EOfz1etSMwJkM4qv4mDFIi2e7NdTXy2lbmFpv1HSSqVwdvE pXMcSiBOrJR+r2Lje3iKwCAxPH932pycd4cKsLW7PBt/iSlc4C1eaQTqW41dhaS8Bsftz3nav7 oKUFpfURn1Zom1QRdKB0qQl38U5Jp59bRWyrbAT5s9nASf8xt1d7BgnS3yV1nKL39UzmsikeFC SgPx/s+8l+e3eZKuCiMIjYdzOoZfjz2jlwbM/C55p6vC7Ei97ayOes4ad6ARtng2KqI6q16K7+ Xgg= From: Frederik Harwath To: Subject: [PATCH 23/40] Add function for printing a single OMP_CLAUSE Date: Wed, 15 Dec 2021 16:54:30 +0100 Message-ID: <20211215155447.19379-24-frederik@codesourcery.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211215155447.19379-1-frederik@codesourcery.com> References: <20211215155447.19379-1-frederik@codesourcery.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-Spam-Status: No, score=-12.7 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Cc: rguenther@suse.de, thomas@codesourcery.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Commit 89f4f339130c ("For 'OMP_CLAUSE' in 'dump_generic_node', dump the whole OMP clause chain") changed the dumping behavior for OMP_CLAUSEs. The old behavior is required for a follow-up commit ("openacc: Add data optimization pass") that optimizes single OMP_CLAUSEs. gcc/ChangeLog: * tree-pretty-print.c (print_omp_clause_to_str): Add new function. * tree-pretty-print.h (print_omp_clause_to_str): Add declaration. --- gcc/tree-pretty-print.c | 11 +++++++++++ gcc/tree-pretty-print.h | 1 + 2 files changed, 12 insertions(+) -- 2.33.0 ----------------- 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 diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 275dc7d8af73..e85370cfe722 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1360,6 +1360,17 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags) } } +/* Print the single clause at the top of the clause chain C to a string and + return it. Note that print_generic_expr_to_str prints the whole clause chain + instead. The caller must free the returned memory. */ + +char * +print_omp_clause_to_str (tree c) +{ + pretty_printer pp; + dump_omp_clause (&pp, c, 0, TDF_VOPS|TDF_MEMSYMS); + return xstrdup (pp_formatted_text (&pp)); +} /* Dump chain of OMP clauses. diff --git a/gcc/tree-pretty-print.h b/gcc/tree-pretty-print.h index dacd256302b2..f9ff0ee1ce0b 100644 --- a/gcc/tree-pretty-print.h +++ b/gcc/tree-pretty-print.h @@ -41,6 +41,7 @@ extern void print_generic_expr (FILE *, tree, dump_flags_t = TDF_NONE); extern char *print_generic_expr_to_str (tree); extern void dump_omp_clauses (pretty_printer *, tree, int, dump_flags_t, bool = true); +extern char *print_omp_clause_to_str (tree); extern void dump_omp_atomic_memory_order (pretty_printer *, enum omp_memory_order); extern void dump_omp_loop_non_rect_expr (pretty_printer *, tree, int,