From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20579 invoked by alias); 6 Oct 2019 22:33:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 20510 invoked by uid 89); 6 Oct 2019 22:32:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: esa3.mentor.iphmx.com Received: from esa3.mentor.iphmx.com (HELO esa3.mentor.iphmx.com) (68.232.137.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 06 Oct 2019 22:32:58 +0000 IronPort-SDR: FLHjZqXlao9vKVYxFB3kbCfYqiwtWhprmi74vPN8i0KNu/0wyM9wC65sFDrKQ0REXxYNGiiBlM NK+zP4NVwCQURMoq/GlCGSgeRBdXEdPx0n30DwM2pgtv4vV4aklMl43n3sxYF32HmQRLpp6lBm 2PEog4R+yNOtNxhLEspYxIkU50uiweMLleSxFgQy1QPQuIcg2o1aN3MH0O1G17es84OMUtxlpI jFAv3jS0RGhuvemqmb9yBhxCkzcc1OxHnzVo7jroVTYHJ2AUhkqR5MRwfrzujTalmSADC00fZn eJs= Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 06 Oct 2019 14:32:54 -0800 IronPort-SDR: v+ZvReeelzdA1Cdy5KLUZL3Bn8BAESL1crcbHEuAW1grH+6E1cYKjmzaqwu/nWQyNQrGx6eESD Ql4U0DZQeBGbr4C6qar1971ROGHsE3HyMIr7KqD8+8BY69vpl/mFmSM40SmN8gn/rgID68aSZ9 RheNnoOU1ZA9sLmCWEOT6z2GXk95mN9jZ+b5skS1y42NpbW+PAMEaT7HU2uiVFq46o2P8O24qg ENGrFDF1Aprrtc5maaBwED0VOMx0pwnos0jDjjhLKp1u9i/NOF/oeaJaoPBtB7pqZ3cN8xuoiz qCo= From: Julian Brown To: CC: , Subject: [PATCH 1/4] Add function for pretty-printing OpenACC clause names Date: Sun, 06 Oct 2019 22:33:00 -0000 Message-ID: <20191006223237.81842-2-julian@codesourcery.com> In-Reply-To: <20191006223237.81842-1-julian@codesourcery.com> References: <20191006223237.81842-1-julian@codesourcery.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Return-Path: julian@codesourcery.com X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg00443.txt.bz2 This patch adds a function to pretty-print OpenACC clause names from OMP_CLAUSE_MAP_KINDs, for error output. The function is used by subsequent patches. Previously approved as part of: https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01292.html FAOD, OK for trunk? Julian ChangeLog gcc/ * c-family/c-common.h (c_omp_map_clause_name): Add prototype. * c-family/c-omp.c (c_omp_map_clause_name): New function. --- gcc/c-family/c-common.h | 1 + gcc/c-family/c-omp.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 1e13aaa16fc..6fddae6b9e5 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1189,6 +1189,7 @@ extern tree c_omp_declare_simd_clauses_to_numbers (tree, tree); extern void c_omp_declare_simd_clauses_to_decls (tree, tree); extern bool c_omp_predefined_variable (tree); extern enum omp_clause_default_kind c_omp_predetermined_sharing (tree); +extern const char *c_omp_map_clause_name (tree, bool); /* Return next tree in the chain for chain_next walking of tree nodes. */ static inline tree diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 0048289b691..1bd91b9ebe8 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -2120,3 +2120,36 @@ c_omp_predetermined_sharing (tree decl) return OMP_CLAUSE_DEFAULT_UNSPECIFIED; } + +/* For OpenACC, the OMP_CLAUSE_MAP_KIND of an OMP_CLAUSE_MAP is used internally + to distinguish clauses as seen by the user. Return the "friendly" clause + name for error messages etc., where possible. See also + c/c-parser.c:c_parser_oacc_data_clause and + cp/parser.c:cp_parser_oacc_data_clause. */ + +const char * +c_omp_map_clause_name (tree clause, bool oacc) +{ + if (oacc && OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP) + switch (OMP_CLAUSE_MAP_KIND (clause)) + { + case GOMP_MAP_FORCE_ALLOC: + case GOMP_MAP_ALLOC: return "create"; + case GOMP_MAP_FORCE_TO: + case GOMP_MAP_TO: return "copyin"; + case GOMP_MAP_FORCE_FROM: + case GOMP_MAP_FROM: return "copyout"; + case GOMP_MAP_FORCE_TOFROM: + case GOMP_MAP_TOFROM: return "copy"; + case GOMP_MAP_RELEASE: return "delete"; + case GOMP_MAP_FORCE_PRESENT: return "present"; + case GOMP_MAP_ATTACH: return "attach"; + case GOMP_MAP_FORCE_DETACH: + case GOMP_MAP_DETACH: return "detach"; + case GOMP_MAP_DEVICE_RESIDENT: return "device_resident"; + case GOMP_MAP_LINK: return "link"; + case GOMP_MAP_FORCE_DEVICEPTR: return "deviceptr"; + default: break; + } + return omp_clause_code_name[OMP_CLAUSE_CODE (clause)]; +} -- 2.23.0