From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34395 invoked by alias); 29 Apr 2015 14:31:52 -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 34378 invoked by uid 89); 29 Apr 2015 14:31:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,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, 29 Apr 2015 14:31:48 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YnT1b-0001VW-RT from Thomas_Schwinge@mentor.com ; Wed, 29 Apr 2015 07:31:44 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 29 Apr 2015 15:31:42 +0100 From: Thomas Schwinge To: Jakub Jelinek CC: , Cesar Philippidis Subject: Re: OMP_CLAUSES with clauses in operand 0 In-Reply-To: <20150429114355.GF1751@tucnak.redhat.com> References: <553E695A.2070007@mentor.com> <87zj5ttqpz.fsf@schwinge.name> <553E787A.1020109@mentor.com> <87383kt7kx.fsf@schwinge.name> <20150429085332.GC1751@tucnak.redhat.com> <87egn3s2p4.fsf@schwinge.name> <20150429093231.GD1751@tucnak.redhat.com> <877fsvrxuu.fsf@schwinge.name> <20150429114355.GF1751@tucnak.redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 29 Apr 2015 14:37:00 -0000 Message-ID: <871tj3roor.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2015-04/txt/msg01886.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 13875 Hi Jakub! On Wed, 29 Apr 2015 13:43:55 +0200, Jakub Jelinek wrote: > On Wed, Apr 29, 2015 at 01:13:29PM +0200, Thomas Schwinge wrote: > > On Wed, 29 Apr 2015 11:32:31 +0200, Jakub Jelinek wr= ote: > > > Yeah, it is a non-starter, it has unnecessary runtime overhead everyw= here > > > where it is used. > >=20 > > Huh. OMP_CLAUSES is currently used in a dozen places in > > cp/cp-gimplify.c, cp/pt.c, and gimplify.c. I've been expecting my > > changed code to be well-optimizable, for the compiler already knows > > TREE_CODE(NODE) in a lot of these places. Doing a quick before (1)/aft= er > > (2) comparison test with -g -O2 on x86_64 GNU/Linux using GCC 4.8.3, the > > object file sizes are as follows: > >=20 > > text data bss dec hex filename > > 37027 0 16 37043 90b3 1/build-gcc/gcc/cp/cp-gimpl= ify.o > > 36307 0 16 36323 8de3 2/build-gcc/gcc/cp/cp-gimpl= ify.o > > text data bss dec hex filename > > 458742 0 136 458878 7007e 1/build-gcc/gcc/cp/pt.o > > 458630 0 136 458766 7000e 2/build-gcc/gcc/cp/pt.o > > text data bss dec hex filename > > 166056 0 48 166104 288d8 1/build-gcc/gcc/gimplify.o > > 166200 0 48 166248 28968 2/build-gcc/gcc/gimplify.o > >=20 > > ..., so actually smaller for the first two files. Admittedly, there is= a > > 144 bytes (0.0867 %) size increase in gimplify.o, and I have not measur= ed > > the actual runtime overhead (which I'm totally expecting to be "in the > > noise", but...), so I'm assuming that my proposal to keep the interface > > simple does not pay for the presumed runtime overhead, so I guess I'm > > posting this patch just for the archives... >=20 > I really don't understand how you could get smaller code out of that, that > doesn't make any sense. I tried a quick -fdump-tree-all comparison but that doesn't lead anywhere, because a vast number of IDs change. Any tricks how to tackle such a thing? > So yes, I really prefer OMP_STANDALONE_CLAUSES over OMP_CLAUSES for > everything. Like this (for trunk)? commit 300e28fce192cb56d73cb61f787872643030f0bf Author: Thomas Schwinge Date: Wed Apr 29 16:18:49 2015 +0200 Add OMP_STANDALONE_CLAUSES. =20=20=20=20 gcc/ * tree.h (OACC_CACHE_CLAUSES, OACC_DECLARE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_UPDATE_CLAUSES, OMP_TARGET_UPDATE_CLAUSES): Merge into... (OMP_STANDALONE_CLAUSES): ... this new macro. Adjust all users. --- gcc/c/c-parser.c | 11 ++++------- gcc/cp/parser.c | 11 ++++------- gcc/cp/pt.c | 4 ++-- gcc/gimplify.c | 18 ++++++++---------- gcc/tree-pretty-print.c | 12 ++++++------ gcc/tree.def | 12 ++++++------ gcc/tree.h | 19 ++----------------- 7 files changed, 32 insertions(+), 55 deletions(-) diff --git gcc/c/c-parser.c gcc/c/c-parser.c index f5e2ac2c..86b77f3 100644 --- gcc/c/c-parser.c +++ gcc/c/c-parser.c @@ -11987,7 +11987,7 @@ c_parser_oacc_cache (location_t loc, c_parser *pars= er) =20 stmt =3D make_node (OACC_CACHE); TREE_TYPE (stmt) =3D void_type_node; - OACC_CACHE_CLAUSES (stmt) =3D clauses; + OMP_STANDALONE_CLAUSES (stmt) =3D clauses; SET_EXPR_LOCATION (stmt, loc); add_stmt (stmt); =20 @@ -12155,10 +12155,7 @@ c_parser_oacc_enter_exit_data (c_parser *parser, b= ool enter) =20 stmt =3D enter ? make_node (OACC_ENTER_DATA) : make_node (OACC_EXIT_DATA= ); TREE_TYPE (stmt) =3D void_type_node; - if (enter) - OACC_ENTER_DATA_CLAUSES (stmt) =3D clauses; - else - OACC_EXIT_DATA_CLAUSES (stmt) =3D clauses; + OMP_STANDALONE_CLAUSES (stmt) =3D clauses; SET_EXPR_LOCATION (stmt, loc); add_stmt (stmt); } @@ -12285,7 +12282,7 @@ c_parser_oacc_update (c_parser *parser) =20 tree stmt =3D make_node (OACC_UPDATE); TREE_TYPE (stmt) =3D void_type_node; - OACC_UPDATE_CLAUSES (stmt) =3D clauses; + OMP_STANDALONE_CLAUSES (stmt) =3D clauses; SET_EXPR_LOCATION (stmt, loc); add_stmt (stmt); } @@ -13858,7 +13855,7 @@ c_parser_omp_target_update (location_t loc, c_parse= r *parser, =20 tree stmt =3D make_node (OMP_TARGET_UPDATE); TREE_TYPE (stmt) =3D void_type_node; - OMP_TARGET_UPDATE_CLAUSES (stmt) =3D clauses; + OMP_STANDALONE_CLAUSES (stmt) =3D clauses; SET_EXPR_LOCATION (stmt, loc); add_stmt (stmt); return false; diff --git gcc/cp/parser.c gcc/cp/parser.c index 4ea2ca2..61fd34f 100644 --- gcc/cp/parser.c +++ gcc/cp/parser.c @@ -31386,7 +31386,7 @@ cp_parser_omp_target_update (cp_parser *parser, cp_= token *pragma_tok, =20 tree stmt =3D make_node (OMP_TARGET_UPDATE); TREE_TYPE (stmt) =3D void_type_node; - OMP_TARGET_UPDATE_CLAUSES (stmt) =3D clauses; + OMP_STANDALONE_CLAUSES (stmt) =3D clauses; SET_EXPR_LOCATION (stmt, pragma_tok->location); add_stmt (stmt); return false; @@ -31496,7 +31496,7 @@ cp_parser_oacc_cache (cp_parser *parser, cp_token *= pragma_tok) =20 stmt =3D make_node (OACC_CACHE); TREE_TYPE (stmt) =3D void_type_node; - OACC_CACHE_CLAUSES (stmt) =3D clauses; + OMP_STANDALONE_CLAUSES (stmt) =3D clauses; SET_EXPR_LOCATION (stmt, pragma_tok->location); add_stmt (stmt); =20 @@ -31606,10 +31606,7 @@ cp_parser_oacc_enter_exit_data (cp_parser *parser,= cp_token *pragma_tok, =20 stmt =3D enter ? make_node (OACC_ENTER_DATA) : make_node (OACC_EXIT_DATA= ); TREE_TYPE (stmt) =3D void_type_node; - if (enter) - OACC_ENTER_DATA_CLAUSES (stmt) =3D clauses; - else - OACC_EXIT_DATA_CLAUSES (stmt) =3D clauses; + OMP_STANDALONE_CLAUSES (stmt) =3D clauses; SET_EXPR_LOCATION (stmt, pragma_tok->location); add_stmt (stmt); return stmt; @@ -31746,7 +31743,7 @@ cp_parser_oacc_update (cp_parser *parser, cp_token = *pragma_tok) =20 stmt =3D make_node (OACC_UPDATE); TREE_TYPE (stmt) =3D void_type_node; - OACC_UPDATE_CLAUSES (stmt) =3D clauses; + OMP_STANDALONE_CLAUSES (stmt) =3D clauses; SET_EXPR_LOCATION (stmt, pragma_tok->location); add_stmt (stmt); return stmt; diff --git gcc/cp/pt.c gcc/cp/pt.c index 129517a..9e83c22 100644 --- gcc/cp/pt.c +++ gcc/cp/pt.c @@ -14203,10 +14203,10 @@ tsubst_expr (tree t, tree args, tsubst_flags_t co= mplain, tree in_decl, break; =20 case OMP_TARGET_UPDATE: - tmp =3D tsubst_omp_clauses (OMP_TARGET_UPDATE_CLAUSES (t), false, + tmp =3D tsubst_omp_clauses (OMP_STANDALONE_CLAUSES (t), false, args, complain, in_decl); t =3D copy_node (t); - OMP_TARGET_UPDATE_CLAUSES (t) =3D tmp; + OMP_STANDALONE_CLAUSES (t) =3D tmp; add_stmt (t); break; =20 diff --git gcc/gimplify.c gcc/gimplify.c index c68bd47..a68748a 100644 --- gcc/gimplify.c +++ gcc/gimplify.c @@ -6799,8 +6799,9 @@ gimplify_oacc_cache (tree *expr_p, gimple_seq *pre_p) { tree expr =3D *expr_p; =20 - gimplify_scan_omp_clauses (&OACC_CACHE_CLAUSES (expr), pre_p, ORT_WORKSH= ARE); - gimplify_adjust_omp_clauses (pre_p, &OACC_CACHE_CLAUSES (expr)); + gimplify_scan_omp_clauses (&OMP_STANDALONE_CLAUSES (expr), pre_p, + ORT_WORKSHARE); + gimplify_adjust_omp_clauses (pre_p, &OMP_STANDALONE_CLAUSES (expr)); =20 /* TODO: Do something sensible with this information. */ =20 @@ -7427,34 +7428,31 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *p= re_p) static void gimplify_omp_target_update (tree *expr_p, gimple_seq *pre_p) { - tree expr =3D *expr_p, clauses; + tree expr =3D *expr_p; int kind; gomp_target *stmt; =20 switch (TREE_CODE (expr)) { case OACC_ENTER_DATA: - clauses =3D OACC_ENTER_DATA_CLAUSES (expr); kind =3D GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA; break; case OACC_EXIT_DATA: - clauses =3D OACC_EXIT_DATA_CLAUSES (expr); kind =3D GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA; break; case OACC_UPDATE: - clauses =3D OACC_UPDATE_CLAUSES (expr); kind =3D GF_OMP_TARGET_KIND_OACC_UPDATE; break; case OMP_TARGET_UPDATE: - clauses =3D OMP_TARGET_UPDATE_CLAUSES (expr); kind =3D GF_OMP_TARGET_KIND_UPDATE; break; default: gcc_unreachable (); } - gimplify_scan_omp_clauses (&clauses, pre_p, ORT_WORKSHARE); - gimplify_adjust_omp_clauses (pre_p, &clauses); - stmt =3D gimple_build_omp_target (NULL, kind, clauses); + gimplify_scan_omp_clauses (&OMP_STANDALONE_CLAUSES (expr), pre_p, + ORT_WORKSHARE); + gimplify_adjust_omp_clauses (pre_p, &OMP_STANDALONE_CLAUSES (expr)); + stmt =3D gimple_build_omp_target (NULL, kind, OMP_STANDALONE_CLAUSES (ex= pr)); =20 gimplify_seq_add_stmt (pre_p, stmt); *expr_p =3D NULL_TREE; diff --git gcc/tree-pretty-print.c gcc/tree-pretty-print.c index d7c049f..26f517f 100644 --- gcc/tree-pretty-print.c +++ gcc/tree-pretty-print.c @@ -2585,27 +2585,27 @@ dump_generic_node (pretty_printer *pp, tree node, i= nt spc, int flags, =20 case OACC_DECLARE: pp_string (pp, "#pragma acc declare"); - dump_omp_clauses (pp, OACC_DECLARE_CLAUSES (node), spc, flags); + dump_omp_clauses (pp, OMP_STANDALONE_CLAUSES (node), spc, flags); break; =20 case OACC_UPDATE: pp_string (pp, "#pragma acc update"); - dump_omp_clauses (pp, OACC_UPDATE_CLAUSES (node), spc, flags); + dump_omp_clauses (pp, OMP_STANDALONE_CLAUSES (node), spc, flags); break; =20 case OACC_ENTER_DATA: pp_string (pp, "#pragma acc enter data"); - dump_omp_clauses (pp, OACC_ENTER_DATA_CLAUSES (node), spc, flags); + dump_omp_clauses (pp, OMP_STANDALONE_CLAUSES (node), spc, flags); break; =20 case OACC_EXIT_DATA: pp_string (pp, "#pragma acc exit data"); - dump_omp_clauses (pp, OACC_EXIT_DATA_CLAUSES (node), spc, flags); + dump_omp_clauses (pp, OMP_STANDALONE_CLAUSES (node), spc, flags); break; =20 case OACC_CACHE: pp_string (pp, "#pragma acc cache"); - dump_omp_clauses (pp, OACC_CACHE_CLAUSES (node), spc, flags); + dump_omp_clauses (pp, OMP_STANDALONE_CLAUSES (node), spc, flags); break; =20 case OMP_PARALLEL: @@ -2673,7 +2673,7 @@ dump_generic_node (pretty_printer *pp, tree node, int= spc, int flags, =20 case OMP_TARGET_UPDATE: pp_string (pp, "#pragma omp target update"); - dump_omp_clauses (pp, OMP_TARGET_UPDATE_CLAUSES (node), spc, flags); + dump_omp_clauses (pp, OMP_STANDALONE_CLAUSES (node), spc, flags); is_expr =3D false; break; =20 diff --git gcc/tree.def gcc/tree.def index b4b4164..2dd70b9 100644 --- gcc/tree.def +++ gcc/tree.def @@ -1157,28 +1157,28 @@ DEFTREECODE (OMP_ORDERED, "omp_ordered", tcc_statem= ent, 1) DEFTREECODE (OMP_CRITICAL, "omp_critical", tcc_statement, 2) =20 /* OpenACC - #pragma acc cache (variable1 ... variableN) - Operand 0: OACC_CACHE_CLAUSES: List of variables (transformed into + Operand 0: OMP_STANDALONE_CLAUSES: List of variables (transformed into OMP_CLAUSE__CACHE_ clauses). */ DEFTREECODE (OACC_CACHE, "oacc_cache", tcc_statement, 1) =20 /* OpenACC - #pragma acc declare [clause1 ... clauseN] - Operand 0: OACC_DECLARE_CLAUSES: List of clauses. */ + Operand 0: OMP_STANDALONE_CLAUSES: List of clauses. */ DEFTREECODE (OACC_DECLARE, "oacc_declare", tcc_statement, 1) =20 /* OpenACC - #pragma acc enter data [clause1 ... clauseN] - Operand 0: OACC_ENTER_DATA_CLAUSES: List of clauses. */ + Operand 0: OMP_STANDALONE_CLAUSES: List of clauses. */ DEFTREECODE (OACC_ENTER_DATA, "oacc_enter_data", tcc_statement, 1) =20 /* OpenACC - #pragma acc exit data [clause1 ... clauseN] - Operand 0: OACC_EXIT_DATA_CLAUSES: List of clauses. */ + Operand 0: OMP_STANDALONE_CLAUSES: List of clauses. */ DEFTREECODE (OACC_EXIT_DATA, "oacc_exit_data", tcc_statement, 1) =20 /* OpenACC - #pragma acc update [clause1 ... clauseN] - Operand 0: OACC_UPDATE_CLAUSES: List of clauses. */ + Operand 0: OMP_STANDALONE_CLAUSES: List of clauses. */ DEFTREECODE (OACC_UPDATE, "oacc_update", tcc_statement, 1) =20 /* OpenMP - #pragma omp target update [clause1 ... clauseN] - Operand 0: OMP_TARGET_UPDATE_CLAUSES: List of clauses. */ + Operand 0: OMP_STANDALONE_CLAUSES: List of clauses. */ DEFTREECODE (OMP_TARGET_UPDATE, "omp_target_update", tcc_statement, 1) =20 /* OMP_ATOMIC through OMP_ATOMIC_CAPTURE_NEW must be consecutive, diff --git gcc/tree.h gcc/tree.h index 2ec9708..3c4633b 100644 --- gcc/tree.h +++ gcc/tree.h @@ -1222,21 +1222,6 @@ extern void protected_set_expr_location (tree, locat= ion_t); #define OACC_HOST_DATA_CLAUSES(NODE) \ TREE_OPERAND (OACC_HOST_DATA_CHECK (NODE), 1) =20 -#define OACC_CACHE_CLAUSES(NODE) \ - TREE_OPERAND (OACC_CACHE_CHECK (NODE), 0) - -#define OACC_DECLARE_CLAUSES(NODE) \ - TREE_OPERAND (OACC_DECLARE_CHECK (NODE), 0) - -#define OACC_ENTER_DATA_CLAUSES(NODE) \ - TREE_OPERAND (OACC_ENTER_DATA_CHECK (NODE), 0) - -#define OACC_EXIT_DATA_CLAUSES(NODE) \ - TREE_OPERAND (OACC_EXIT_DATA_CHECK (NODE), 0) - -#define OACC_UPDATE_CLAUSES(NODE) \ - TREE_OPERAND (OACC_UPDATE_CHECK (NODE), 0) - #define OMP_PARALLEL_BODY(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE)= , 0) #define OMP_PARALLEL_CLAUSES(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE)= , 1) =20 @@ -1283,8 +1268,8 @@ extern void protected_set_expr_location (tree, locati= on_t); #define OMP_TARGET_BODY(NODE) TREE_OPERAND (OMP_TARGET_CHECK (NODE), 0) #define OMP_TARGET_CLAUSES(NODE) TREE_OPERAND (OMP_TARGET_CHECK (NODE), = 1) =20 -#define OMP_TARGET_UPDATE_CLAUSES(NODE)\ - TREE_OPERAND (OMP_TARGET_UPDATE_CHECK (NODE), 0) +#define OMP_STANDALONE_CLAUSES(NODE) \ + TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_CACHE, OMP_TARGET_UPDATE), 0) =20 #define OMP_CLAUSE_SIZE(NODE) \ OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE), \ Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 472 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVQOtEAAoJEPoxNhtoi6CORVwIAJgeCyp8qtkvz1Go2nIsF23j i8J08w0tpkBjjyatxT27wTcroQkapCwwaO+VZUjRPmP/KSBb29JrEgoFMAadTeNt 5JH5I/75qx5iBuPNEWikiCIwZj7gdCuKM7PC2MYj4aFRWlTD0oEfZKpSyQhiqTun gOeSjlWaSBN6lBzB09jgX9SH6RyDGDXSClsgJHhpdWrWc0DWSyIQeYFHQhUtlcuJ GZtvLN0W2uILixWm/afcBXBQ0Ojtc9F5z8vIOusSVCwcdPTyOsonphPGj1BpAxmZ vxZpTjJ2Z+x1o9ooSGeAV+eHA6XsHJAzTXCJOIWUG5PXx1mjVhH01icqd5TGURc= =pLMz -----END PGP SIGNATURE----- --=-=-=--