From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12295 invoked by alias); 13 May 2015 21:01:59 -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 12285 invoked by uid 89); 13 May 2015 21:01:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 May 2015 21:01:57 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Ysdmq-0003U0-Dw from Thomas_Schwinge@mentor.com ; Wed, 13 May 2015 14:01:52 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Wed, 13 May 2015 22:01:51 +0100 From: Thomas Schwinge To: Jakub Jelinek , CC: Cesar Philippidis Subject: [gomp4] Prohibit exceptions in OpenACC regions In-Reply-To: <552DAA53.7080809@mentor.com> References: <552DAA53.7080809@mentor.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 13 May 2015 21:15:00 -0000 Message-ID: <87pp64jioe.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2015-05/txt/msg01276.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 12618 Hi! On Tue, 14 Apr 2015 17:01:23 -0700, Cesar Philippidis wrote: > This patch addresses the SjLj compile time failures, typically > associated with routine calls in c++. My solution to this problem is to > introduce a new "oacc function" attribute and prevent > finish_eh_generation from inserting any EH code for functions marked > with those attributes. I was thinking about creating a new target > machine hook to selectively disable EH for targets which don't support > it. However, I figured openacc acc shouldn't generate exceptions so I > went with the attribute approach. >=20 > For those curious, I chose the name "oacc function" for the attribute > because it gets attached to both parallel/kernels regions and acc routine= s. Committed to gomp-4_0-branch in r223180: commit 92c8a16805acc367b81f89ada760e136b5f7eab1 Author: tschwinge Date: Wed May 13 21:00:33 2015 +0000 Prohibit exceptions in OpenACC regions =20=20=20=20 gcc/ * except.c (finish_eh_generation): Don't finalize exeception handlers for functions containing the "oacc function" attribute. * omp-low.c (create_omp_child_function): Add an "oacc function" attribute to acc regions. gcc/c-family/ * c-common.c (c_common_attribute_table): Add an "oacc function" attribute. gcc/c/ * c-parser.c (c_finish_oacc_routine): Add an "oacc function" attribute to routines. gcc/cp/ * parser.c (cp_parser_late_parsing_oacc_routine): Add an "oacc function" attribute to routines. gcc/fortran/ * f95-lang.c (gfc_attribute_table): Add and "oacc function" attribute. * gfortran.h (symbol_attribute): Add oacc_function bit. * openmp.c (gfc_match_oacc_routine): Use it. * trans-decl.c (add_attributes_to_decl): Lower it. libgomp/ * testsuite/libgomp.oacc-c-c++-common/routine-1.c: Remove -fno-exceptions. * testsuite/libgomp.oacc-c-c++-common/routine-2.c: Likewise. =20=20=20=20 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@2231= 80 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 5 +++++ gcc/c-family/ChangeLog.gomp | 5 +++++ gcc/c-family/c-common.c | 1 + gcc/c/ChangeLog.gomp | 3 +++ gcc/c/c-parser.c | 4 +++- gcc/cp/ChangeLog.gomp | 3 +++ gcc/cp/parser.c | 1 + gcc/except.c | 4 ++++ gcc/fortran/ChangeLog.gomp | 8 ++++++++ gcc/fortran/f95-lang.c | 6 ++++-- gcc/fortran/gfortran.h | 3 +++ gcc/fortran/openmp.c | 1 + gcc/fortran/trans-decl.c | 4 ++++ gcc/omp-low.c | 6 ++++++ libgomp/ChangeLog.gomp | 6 ++++++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c | 4 ++-- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-2.c | 4 ++-- 17 files changed, 61 insertions(+), 7 deletions(-) diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 9e72962..a4683c3 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,5 +1,10 @@ 2015-05-13 Cesar Philippidis =20 + * except.c (finish_eh_generation): Don't finalize exeception + handlers for functions containing the "oacc function" attribute. + * omp-low.c (create_omp_child_function): Add an "oacc function" + attribute to acc regions. + * langhooks-def.h (lhd_omp_mappable_type): Add bool argument. * langhooks.c (lhd_omp_mappable_type): Likewise, for the parameter. diff --git gcc/c-family/ChangeLog.gomp gcc/c-family/ChangeLog.gomp index 3e01b28..9f999cd 100644 --- gcc/c-family/ChangeLog.gomp +++ gcc/c-family/ChangeLog.gomp @@ -1,3 +1,8 @@ +2015-05-13 Cesar Philippidis + + * c-common.c (c_common_attribute_table): Add an "oacc function" + attribute. + 2015-05-13 Thomas Schwinge Bernd Schmidt Cesar Philippidis diff --git gcc/c-family/c-common.c gcc/c-family/c-common.c index 5835517..c6e15fc 100644 --- gcc/c-family/c-common.c +++ gcc/c-family/c-common.c @@ -824,6 +824,7 @@ const struct attribute_spec c_common_attribute_table[] = =3D { "bnd_instrument", 0, 0, true, false, false, handle_bnd_instrument, false }, { "oacc declare", 0, -1, true, false, false, NULL, false }, + { "oacc function", 0, 0, true, false, false, NULL, false }, { NULL, 0, 0, false, false, false, NULL, false } }; =20 diff --git gcc/c/ChangeLog.gomp gcc/c/ChangeLog.gomp index 08c8ed0..c99f29d 100644 --- gcc/c/ChangeLog.gomp +++ gcc/c/ChangeLog.gomp @@ -1,5 +1,8 @@ 2015-05-13 Cesar Philippidis =20 + * c-parser.c (c_finish_oacc_routine): Add an "oacc function" + attribute to routines. + * c-decl.c (c_decl_attributes): Update call to omp_mappable_type. * c-typeck.c (c_finish_omp_clauses): Likewise. =20 diff --git gcc/c/c-parser.c gcc/c/c-parser.c index 999f3d4..74adeb8 100644 --- gcc/c/c-parser.c +++ gcc/c/c-parser.c @@ -13032,7 +13032,9 @@ c_finish_oacc_routine (c_parser *parser, tree fndec= l, tree clauses, clauses =3D build_tree_list (get_identifier ("omp declare target"), clauses); TREE_CHAIN (clauses) =3D DECL_ATTRIBUTES (fndecl); - DECL_ATTRIBUTES (fndecl) =3D clauses; + DECL_ATTRIBUTES (fndecl) + =3D tree_cons (get_identifier ("oacc function"), + NULL_TREE, clauses); } =20 /* OpenACC 2.0: diff --git gcc/cp/ChangeLog.gomp gcc/cp/ChangeLog.gomp index 529206a..a3ca81f 100644 --- gcc/cp/ChangeLog.gomp +++ gcc/cp/ChangeLog.gomp @@ -1,5 +1,8 @@ 2015-05-13 Cesar Philippidis =20 + * parser.c (cp_parser_late_parsing_oacc_routine): Add an + "oacc function" attribute to routines. + * cp-tree.h (cp_omp_mappable_type): Add bool parameter. * decl2.c (cp_check_const_attributes): Likewise. Use it. (cp_omp_mappable_type): Update call to cp_omp_mappable_type. diff --git gcc/cp/parser.c gcc/cp/parser.c index ee097e2..e418ca2 100644 --- gcc/cp/parser.c +++ gcc/cp/parser.c @@ -33249,6 +33249,7 @@ cp_parser_late_parsing_oacc_routine (cp_parser *par= ser, tree attrs) cl =3D tree_cons (NULL_TREE, cl, NULL_TREE); =20 attrs =3D build_tree_list (get_identifier ("omp declare target"), cl); + attrs =3D tree_cons (get_identifier ("oacc function"), NULL_TREE, attrs); data->fndecl_seen =3D true; return attrs; } diff --git gcc/except.c gcc/except.c index d609592..b638f17 100644 --- gcc/except.c +++ gcc/except.c @@ -1503,6 +1503,10 @@ finish_eh_generation (void) { basic_block bb; =20 + if (lookup_attribute ("oacc function", + DECL_ATTRIBUTES (current_function_decl))) + return; + /* Construct the landing pads. */ if (targetm_common.except_unwind_info (&global_options) =3D=3D UI_SJLJ) sjlj_build_landing_pads (); diff --git gcc/fortran/ChangeLog.gomp gcc/fortran/ChangeLog.gomp index cdfb1f0..8a2cd7b 100644 --- gcc/fortran/ChangeLog.gomp +++ gcc/fortran/ChangeLog.gomp @@ -1,3 +1,11 @@ +2015-05-13 Cesar Philippidis + + * f95-lang.c (gfc_attribute_table): Add and "oacc function" + attribute. + * gfortran.h (symbol_attribute): Add oacc_function bit. + * openmp.c (gfc_match_oacc_routine): Use it. + * trans-decl.c (add_attributes_to_decl): Lower it. + 2015-05-13 Thomas Schwinge Bernd Schmidt Cesar Philippidis diff --git gcc/fortran/f95-lang.c gcc/fortran/f95-lang.c index 84be2a3..5003581 100644 --- gcc/fortran/f95-lang.c +++ gcc/fortran/f95-lang.c @@ -104,8 +104,8 @@ static alias_set_type gfc_get_alias_set (tree); static void gfc_init_ts (void); static tree gfc_builtin_function (tree); =20 -/* Handle an "omp declare target" attribute; arguments as in - struct attribute_spec.handler. */ +/* Handle an "omp declare target" or "oacc function" attribute; + arguments as in struct attribute_spec.handler. */ static tree gfc_handle_omp_declare_target_attribute (tree *, tree, tree, int, bool *) { @@ -119,6 +119,8 @@ static const struct attribute_spec gfc_attribute_table[= ] =3D affects_type_identity } */ { "omp declare target", 0, 0, true, false, false, gfc_handle_omp_declare_target_attribute, false }, + { "oacc function", 0, 0, true, false, false, + gfc_handle_omp_declare_target_attribute, false }, { NULL, 0, 0, false, false, false, NULL, false } }; =20 diff --git gcc/fortran/gfortran.h gcc/fortran/gfortran.h index 58689c3..e73c269 100644 --- gcc/fortran/gfortran.h +++ gcc/fortran/gfortran.h @@ -861,6 +861,9 @@ typedef struct /* Mentioned in OMP DECLARE TARGET. */ unsigned omp_declare_target:1; =20 + /* This is an OpenACC acclerator function. */ + unsigned oacc_function:1; + /* Attributes set by compiler extensions (!GCC$ ATTRIBUTES). */ unsigned ext_attr:EXT_ATTR_NUM; =20 diff --git gcc/fortran/openmp.c gcc/fortran/openmp.c index 0aa7d51..fc16d8c 100644 --- gcc/fortran/openmp.c +++ gcc/fortran/openmp.c @@ -1776,6 +1776,7 @@ gfc_match_oacc_routine (void) gfc_current_ns->proc_name->name, &old_loc)) goto cleanup; + gfc_current_ns->proc_name->attr.oacc_function =3D 1; } else gcc_unreachable (); diff --git gcc/fortran/trans-decl.c gcc/fortran/trans-decl.c index 3dbf128..6cdc472 100644 --- gcc/fortran/trans-decl.c +++ gcc/fortran/trans-decl.c @@ -1309,6 +1309,10 @@ add_attributes_to_decl (symbol_attribute sym_attr, t= ree list) list =3D tree_cons (get_identifier ("omp declare target"), NULL_TREE, list); =20 + if (sym_attr.oacc_function) + list =3D tree_cons (get_identifier ("oacc function"), + NULL_TREE, list); + return list; } =20 diff --git gcc/omp-low.c gcc/omp-low.c index a71f554..c4f8033 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -2559,6 +2559,12 @@ create_omp_child_function (omp_context *ctx, bool ta= sk_copy) =3D tree_cons (get_identifier ("omp target entrypoint"), NULL_TREE, DECL_ATTRIBUTES (decl)); =20 + if (is_gimple_omp_oacc (ctx->stmt) + && !lookup_attribute ("omp function", DECL_ATTRIBUTES (decl))) + DECL_ATTRIBUTES (decl) + =3D tree_cons (get_identifier ("oacc function"), NULL_TREE, + DECL_ATTRIBUTES (decl)); + t =3D build_decl (DECL_SOURCE_LOCATION (decl), RESULT_DECL, NULL_TREE, void_type_node); DECL_ARTIFICIAL (t) =3D 1; diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp index fb2bbc3..1d7d9da 100644 --- libgomp/ChangeLog.gomp +++ libgomp/ChangeLog.gomp @@ -1,3 +1,9 @@ +2015-05-13 Cesar Philippidis + + * testsuite/libgomp.oacc-c-c++-common/routine-1.c: Remove + -fno-exceptions. + * testsuite/libgomp.oacc-c-c++-common/routine-2.c: Likewise. + 2015-05-13 Thomas Schwinge Bernd Schmidt Cesar Philippidis diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c libgomp/= testsuite/libgomp.oacc-c-c++-common/routine-1.c index a27d076..144f892 100644 --- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c +++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-1.c @@ -1,7 +1,7 @@ -/* FIXME: remove -fno-var-tracking and -fno-exceptions from dg-options. */ +/* FIXME: remove -fno-var-tracking from dg-options. */ =20 /* { dg-do run } */ -/* { dg-options "-fno-inline -fno-var-tracking -fno-exceptions" } */ +/* { dg-options "-fno-inline -fno-var-tracking" } */ =20 #include #include diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-2.c libgomp/= testsuite/libgomp.oacc-c-c++-common/routine-2.c index 8ec4d8b..f08aeda 100644 --- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-2.c +++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-2.c @@ -1,7 +1,7 @@ -/* FIXME: remove -fno-var-tracking and -fno-exceptions from dg-options. */ +/* FIXME: remove -fno-var-tracking from dg-options. */ =20 /* { dg-do run } */ -/* { dg-options "-fno-inline -fno-var-tracking -fno-exceptions" } */ +/* { dg-options "-fno-inline -fno-var-tracking" } */ =20 #include #include Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 472 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVU7uxAAoJEPoxNhtoi6COD3QIALHUya4rUTzG4ld/LiOz0rUx v1inMF32UMZ1kT8sEv/VQ18kVgoYiHy5vDRlcTrbfHZRUQ0gofBZr4ZGyBwDwckO XtYBAL7FJyPlPF9HqYNipRFXsbq2cgB7aZXrEwU9deElqHCS0qfWuBzLTiL0zLdF ZAggky8IxTWvuNrs6d+bR3ylrBpa7hfZg09GFAttR70vWRuc1vaZNpraMYKs2qam 2q4b6kqU7OTSsYwtJhOhg+LZRxq5R3KznvdSW9DwTqVPmwlsDnQ+uzaszrzv2S0l GoKSzJZNuLKcttSng/V/RbHsSefq9NSLOfJakrfB2uApKs/ZZEPc1HsuG5Exdq8= =+vIE -----END PGP SIGNATURE----- --=-=-=--