From patchwork Thu Apr 14 13:36:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 610464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qm1tL5Vk0z9sC3 for ; Thu, 14 Apr 2016 23:36:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=C4LRTgJ4; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=Enn N1HhPx49FtgjfACMAFkKwSLP486a27JN+gBa0EQdNcCRid8F7F7w5wFuQ3rNvxvk 6BcvHsZ19Nueir1J4/wpryE9fhEX0BfmRsPO/CPd8UfPSBgn6zlgnO3bW44/yImf FtdrYx2Z61lk5IlMOiZbyZ+sPzD7TgiImTFs3Yrs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=NI0IwVQ87 0Mx4L2GEd9aZWDb5io=; b=C4LRTgJ4pVYkOwOFsIjJOIT43Ep7qVdooJpDOaehH 7NL9f3n7edhWJGfx9vaLsPT5HZX2GCMUaXyfV7kO81AUy3MXOjb8ETXeFXmswXs4 DEPSNahjAdRSw/EoWjSER/Oro3G5IPsi225+WmbegwIixf9lqdZKF5ytTTq1F8Kz hg= Received: (qmail 120788 invoked by alias); 14 Apr 2016 13:36:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 120773 invoked by uid 89); 14 Apr 2016 13:36:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=4312, 20, 8, 43, 12, 58137 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 14 Apr 2016 13:36:38 +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 1aqhRi-0007V8-82 from Thomas_Schwinge@mentor.com ; Thu, 14 Apr 2016 06:36:34 -0700 Received: from hertz.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; Thu, 14 Apr 2016 14:36:32 +0100 From: Thomas Schwinge To: Bernd Schmidt , Martin Jambor , Jakub Jelinek , Subject: Re: Splitting up gcc/omp-low.c? In-Reply-To: <570E8DE3.6070007@redhat.com> References: <20151207111758.GA24234@virgil.suse.cz> <20151207112243.GF24234@virgil.suse.cz> <20151209131930.GS5675@tucnak.redhat.com> <87si3b4mk3.fsf@kepler.schwinge.homeip.net> <5668638A.5030500@redhat.com> <20151210080835.GX5675@tucnak.redhat.com> <87y48o5toc.fsf@hertz.schwinge.homeip.net> <87twj54hx6.fsf@hertz.schwinge.homeip.net> <570E8417.3080208@redhat.com> <87r3e94cku.fsf@hertz.schwinge.homeip.net> <570E8DE3.6070007@redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Thu, 14 Apr 2016 15:36:28 +0200 Message-ID: <87k2k048ir.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Wed, 13 Apr 2016 20:20:19 +0200, Bernd Schmidt wrote: > On 04/13/2016 07:56 PM, Thomas Schwinge wrote: > > 0001-Split-up-gcc-omp-low.c-plain.patch.xz attached. > > That looks much better. However, the //OMPWHATEVER comments are not > really all that helpful. They're helpful in the word-diff patch, as they show where I moved stuff. I agree that they can't serve this purpose in the line-diff patch. > I think the next step would be to clear out all > this stuff including the OMPCUT markers I think the first step would be to get agreement on the several questions that I posted yesterday. That is, which stuff to move, into which files, how to structure it all, and so on. That's what I hoped the word-diff patch would help with. Everything else sounds a bit like busywork to me; that is: > start with an > initial patch that includes everything that actually modifies code > rather than moving it (omp_is_reference seems to be the major thing here). I don't know how meaningful it is to create/discuss/review/commit the following patch until the overall approach has been agreed upon? commit 8ac6b83350022c74bb2af8006e51f3620889e7c1 Author: Thomas Schwinge Date: Thu Apr 14 15:25:24 2016 +0200 gcc/omp-low.c:is_reference -> gcc/omp-low.h:omp_is_reference gcc/ * omp-low.h: Include "langhooks.h". Define omp_is_reference here, and... * omp-low.c: ... don't define is_reference here. Adjust all users. --- gcc/omp-low.c | 102 +++++++++++++++++++++++++++------------------------------- gcc/omp-low.h | 10 ++++++ 2 files changed, 57 insertions(+), 55 deletions(-) Grüße Thomas diff --git gcc/omp-low.c gcc/omp-low.c index 7335abc..bb9c61e 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -1039,21 +1039,13 @@ is_variable_sized (const_tree expr) return !TREE_CONSTANT (TYPE_SIZE_UNIT (TREE_TYPE (expr))); } -/* Return true if DECL is a reference type. */ - -static inline bool -is_reference (tree decl) -{ - return lang_hooks.decls.omp_privatize_by_reference (decl); -} - /* Return the type of a decl. If the decl is reference type, return its base type. */ static inline tree get_base_type (tree decl) { tree type = TREE_TYPE (decl); - if (is_reference (decl)) + if (omp_is_reference (decl)) type = TREE_TYPE (type); return type; } @@ -1348,7 +1340,7 @@ build_outer_var_ref (tree var, omp_context *ctx, bool lastprivate = false) } x = lookup_decl (var, outer); } - else if (is_reference (var)) + else if (omp_is_reference (var)) /* This can happen with orphaned constructs. If var is reference, it is possible it is shared and as such valid. */ x = var; @@ -1371,7 +1363,7 @@ build_outer_var_ref (tree var, omp_context *ctx, bool lastprivate = false) } } - if (is_reference (var)) + if (omp_is_reference (var)) x = build_simple_mem_ref (x); return x; @@ -1433,7 +1425,7 @@ install_var_field (tree var, bool by_ref, int mask, omp_context *ctx, if (base_pointers_restrict) type = build_qualified_type (type, TYPE_QUAL_RESTRICT); } - else if ((mask & 3) == 1 && is_reference (var)) + else if ((mask & 3) == 1 && omp_is_reference (var)) type = TREE_TYPE (type); field = build_decl (DECL_SOURCE_LOCATION (var), @@ -1904,7 +1896,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, if ((! TREE_READONLY (decl) && !OMP_CLAUSE_SHARED_READONLY (c)) || TREE_ADDRESSABLE (decl) || by_ref - || is_reference (decl)) + || omp_is_reference (decl)) { by_ref = use_pointer_for_field (decl, ctx); install_var_field (decl, by_ref, 3, ctx); @@ -1954,7 +1946,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, && is_gimple_omp_offloaded (ctx->stmt)) { if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE) - install_var_field (decl, !is_reference (decl), 3, ctx); + install_var_field (decl, !omp_is_reference (decl), 3, ctx); else if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) install_var_field (decl, true, 3, ctx); else @@ -1973,7 +1965,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, by_ref = use_pointer_for_field (decl, NULL); if (is_task_ctx (ctx) - && (global || by_ref || is_reference (decl))) + && (global || by_ref || omp_is_reference (decl))) { install_var_field (decl, false, 1, ctx); if (!global) @@ -4673,10 +4665,10 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, tree ref = build_outer_var_ref (var, ctx); /* For ref build_outer_var_ref already performs this. */ if (TREE_CODE (d) == INDIRECT_REF) - gcc_assert (is_reference (var)); + gcc_assert (omp_is_reference (var)); else if (TREE_CODE (d) == ADDR_EXPR) ref = build_fold_addr_expr (ref); - else if (is_reference (var)) + else if (omp_is_reference (var)) ref = build_fold_addr_expr (ref); ref = fold_convert_loc (clause_loc, ptype, ref); if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) @@ -4840,7 +4832,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, gimplify_assign (ptr, x, ilist); } } - else if (is_reference (var)) + else if (omp_is_reference (var)) { /* For references that are being privatized for Fortran, allocate new backing storage for the new pointer @@ -5007,7 +4999,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, case OMP_CLAUSE_FIRSTPRIVATE: if (is_task_ctx (ctx)) { - if (is_reference (var) || is_variable_sized (var)) + if (omp_is_reference (var) || is_variable_sized (var)) goto do_dtor; else if (is_global_var (maybe_lookup_decl_in_outer_ctx (var, ctx)) @@ -5135,14 +5127,14 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, gimple *tseq; x = build_outer_var_ref (var, ctx); - if (is_reference (var) + if (omp_is_reference (var) && !useless_type_conversion_p (TREE_TYPE (placeholder), TREE_TYPE (x))) x = build_fold_addr_expr_loc (clause_loc, x); SET_DECL_VALUE_EXPR (placeholder, x); DECL_HAS_VALUE_EXPR_P (placeholder) = 1; tree new_vard = new_var; - if (is_reference (var)) + if (omp_is_reference (var)) { gcc_assert (TREE_CODE (new_var) == MEM_REF); new_vard = TREE_OPERAND (new_var, 0); @@ -5200,7 +5192,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, for it because it is undesirable if SIMD arrays are used. But if they aren't used, we need to emit the deferred initialization now. */ - else if (is_reference (var) && is_simd) + else if (omp_is_reference (var) && is_simd) handle_simd_reference (clause_loc, new_vard, ilist); x = lang_hooks.decls.omp_clause_default_ctor (c, unshare_expr (new_var), @@ -5236,7 +5228,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, code = PLUS_EXPR; tree new_vard = new_var; - if (is_simd && is_reference (var)) + if (is_simd && omp_is_reference (var)) { gcc_assert (TREE_CODE (new_var) == MEM_REF); new_vard = TREE_OPERAND (new_var, 0); @@ -5263,7 +5255,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, } else { - if (is_reference (var) && is_simd) + if (omp_is_reference (var) && is_simd) handle_simd_reference (clause_loc, new_vard, ilist); gimplify_assign (new_var, x, ilist); if (is_simd) @@ -5514,7 +5506,7 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list, } if (!x) x = build_outer_var_ref (var, ctx, true); - if (is_reference (var)) + if (omp_is_reference (var)) new_var = build_simple_mem_ref_loc (clause_loc, new_var); x = lang_hooks.decls.omp_clause_assign_op (c, x, new_var); gimplify_and_add (x, stmt_list); @@ -5645,7 +5637,7 @@ lower_oacc_reductions (location_t loc, tree clauses, tree level, bool inner, && maybe_lookup_field (orig, outer) && !is_private) { ref_to_res = build_receiver_ref (orig, false, outer); - if (is_reference (orig)) + if (omp_is_reference (orig)) ref_to_res = build_simple_mem_ref (ref_to_res); tree type = TREE_TYPE (var); @@ -5666,7 +5658,7 @@ lower_oacc_reductions (location_t loc, tree clauses, tree level, bool inner, if (!ref_to_res) ref_to_res = integer_zero_node; - if (is_reference (orig)) + if (omp_is_reference (orig)) { tree type = TREE_TYPE (var); const char *id = IDENTIFIER_POINTER (DECL_NAME (var)); @@ -5821,7 +5813,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx) } } new_var = lookup_decl (var, ctx); - if (var == OMP_CLAUSE_DECL (c) && is_reference (var)) + if (var == OMP_CLAUSE_DECL (c) && omp_is_reference (var)) new_var = build_simple_mem_ref_loc (clause_loc, new_var); ref = build_outer_var_ref (var, ctx); code = OMP_CLAUSE_REDUCTION_CODE (c); @@ -5875,7 +5867,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx) if (TREE_CODE (d) == INDIRECT_REF) { new_var = build_simple_mem_ref_loc (clause_loc, new_var); - gcc_assert (is_reference (var) && var == orig_var); + gcc_assert (omp_is_reference (var) && var == orig_var); } else if (TREE_CODE (d) == ADDR_EXPR) { @@ -5888,7 +5880,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx) else { gcc_assert (orig_var == var); - if (is_reference (var)) + if (omp_is_reference (var)) ref = build_fold_addr_expr (ref); } if (DECL_P (v)) @@ -5962,7 +5954,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx) { tree placeholder = OMP_CLAUSE_REDUCTION_PLACEHOLDER (c); - if (is_reference (var) + if (omp_is_reference (var) && !useless_type_conversion_p (TREE_TYPE (placeholder), TREE_TYPE (ref))) ref = build_fold_addr_expr_loc (clause_loc, ref); @@ -6030,7 +6022,7 @@ lower_copyprivate_clauses (tree clauses, gimple_seq *slist, gimple_seq *rlist, ref); ref = build_fold_indirect_ref_loc (clause_loc, ref); } - if (is_reference (var)) + if (omp_is_reference (var)) { ref = fold_convert_loc (clause_loc, TREE_TYPE (new_var), ref); ref = build_simple_mem_ref_loc (clause_loc, ref); @@ -6169,7 +6161,7 @@ lower_send_clauses (tree clauses, gimple_seq *ilist, gimple_seq *olist, break; case OMP_CLAUSE_LASTPRIVATE: - if (by_ref || is_reference (val)) + if (by_ref || omp_is_reference (val)) { if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c)) continue; @@ -6186,7 +6178,7 @@ lower_send_clauses (tree clauses, gimple_seq *ilist, gimple_seq *olist, case OMP_CLAUSE_REDUCTION: do_in = true; if (val == OMP_CLAUSE_DECL (c)) - do_out = !(by_ref || is_reference (val)); + do_out = !(by_ref || omp_is_reference (val)); else by_ref = TREE_CODE (TREE_TYPE (val)) == ARRAY_TYPE; break; @@ -8829,7 +8821,7 @@ expand_omp_for_generic (struct omp_region *region, && !OMP_CLAUSE_LINEAR_NO_COPYIN (c)) { tree d = OMP_CLAUSE_DECL (c); - bool is_ref = is_reference (d); + bool is_ref = omp_is_reference (d); tree t = d, a, dest; if (is_ref) t = build_simple_mem_ref_loc (OMP_CLAUSE_LOCATION (c), t); @@ -9478,7 +9470,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, && !OMP_CLAUSE_LINEAR_NO_COPYIN (c)) { tree d = OMP_CLAUSE_DECL (c); - bool is_ref = is_reference (d); + bool is_ref = omp_is_reference (d); tree t = d, a, dest; if (is_ref) t = build_simple_mem_ref_loc (OMP_CLAUSE_LOCATION (c), t); @@ -9977,7 +9969,7 @@ expand_omp_for_static_chunk (struct omp_region *region, && !OMP_CLAUSE_LINEAR_NO_COPYIN (c)) { tree d = OMP_CLAUSE_DECL (c); - bool is_ref = is_reference (d); + bool is_ref = omp_is_reference (d); tree t = d, a, dest; if (is_ref) t = build_simple_mem_ref_loc (OMP_CLAUSE_LOCATION (c), t); @@ -15419,7 +15411,7 @@ create_task_copyfn (gomp_task *task_stmt, omp_context *ctx) sf = *tcctx.cb.decl_map->get (sf); src = build_simple_mem_ref_loc (loc, sarg); src = omp_build_component_ref (src, sf); - if (use_pointer_for_field (decl, NULL) || is_reference (decl)) + if (use_pointer_for_field (decl, NULL) || omp_is_reference (decl)) src = build_simple_mem_ref_loc (loc, src); } else @@ -15888,7 +15880,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE) { gcc_assert (is_gimple_omp_oacc (ctx->stmt)); - if (is_reference (new_var)) + if (omp_is_reference (new_var)) { /* Create a local object to hold the instance value. */ @@ -15916,7 +15908,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) goto oacc_firstprivate; map_cnt++; var = OMP_CLAUSE_DECL (c); - if (!is_reference (var) + if (!omp_is_reference (var) && !is_gimple_reg_type (TREE_TYPE (var))) { tree new_var = lookup_decl (var, ctx); @@ -16122,7 +16114,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE) { gcc_assert (is_gimple_omp_oacc (ctx->stmt)); - if (!is_reference (var)) + if (!omp_is_reference (var)) { if (is_gimple_reg (var) && OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)) @@ -16268,7 +16260,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) if (is_oacc_parallel (ctx)) goto oacc_firstprivate_map; ovar = OMP_CLAUSE_DECL (c); - if (is_reference (ovar)) + if (omp_is_reference (ovar)) talign = TYPE_ALIGN_UNIT (TREE_TYPE (TREE_TYPE (ovar))); else talign = DECL_ALIGN_UNIT (ovar); @@ -16276,7 +16268,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) x = build_sender_ref (ovar, ctx); tkind = GOMP_MAP_FIRSTPRIVATE; type = TREE_TYPE (ovar); - if (is_reference (ovar)) + if (omp_is_reference (ovar)) type = TREE_TYPE (type); if ((INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) <= POINTER_SIZE) @@ -16284,7 +16276,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) { tkind = GOMP_MAP_FIRSTPRIVATE_INT; tree t = var; - if (is_reference (var)) + if (omp_is_reference (var)) t = build_simple_mem_ref (var); else if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)) TREE_NO_WARNING (var) = 1; @@ -16293,7 +16285,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) t = fold_convert (TREE_TYPE (x), t); gimplify_assign (x, t, &ilist); } - else if (is_reference (var)) + else if (omp_is_reference (var)) gimplify_assign (x, var, &ilist); else if (is_gimple_reg (var)) { @@ -16312,7 +16304,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) } if (tkind == GOMP_MAP_FIRSTPRIVATE_INT) s = size_int (0); - else if (is_reference (var)) + else if (omp_is_reference (var)) s = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ovar))); else s = TYPE_SIZE_UNIT (TREE_TYPE (ovar)); @@ -16346,7 +16338,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) var = build_fold_addr_expr (var); else { - if (is_reference (ovar)) + if (omp_is_reference (ovar)) { type = TREE_TYPE (type); if (TREE_CODE (type) != ARRAY_TYPE) @@ -16425,13 +16417,13 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) if (is_gimple_omp_oacc (ctx->stmt)) break; var = OMP_CLAUSE_DECL (c); - if (is_reference (var) + if (omp_is_reference (var) || is_gimple_reg_type (TREE_TYPE (var))) { tree new_var = lookup_decl (var, ctx); tree type; type = TREE_TYPE (var); - if (is_reference (var)) + if (omp_is_reference (var)) type = TREE_TYPE (type); if ((INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) <= POINTER_SIZE) @@ -16443,7 +16435,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) x = fold_convert (type, x); gimplify_expr (&x, &new_body, NULL, is_gimple_val, fb_rvalue); - if (is_reference (var)) + if (omp_is_reference (var)) { tree v = create_tmp_var_raw (type, get_name (var)); gimple_add_tmp_var (v); @@ -16457,7 +16449,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) } else { - x = build_receiver_ref (var, !is_reference (var), ctx); + x = build_receiver_ref (var, !omp_is_reference (var), ctx); gimplify_expr (&x, &new_body, NULL, is_gimple_val, fb_rvalue); gimple_seq_add_stmt (&new_body, @@ -16481,7 +16473,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) if (is_gimple_omp_oacc (ctx->stmt)) break; var = OMP_CLAUSE_DECL (c); - if (is_reference (var)) + if (omp_is_reference (var)) { location_t clause_loc = OMP_CLAUSE_LOCATION (c); tree new_var = lookup_decl (var, ctx); @@ -16536,7 +16528,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) { tree type = TREE_TYPE (var); tree new_var = lookup_decl (var, ctx); - if (is_reference (var)) + if (omp_is_reference (var)) { type = TREE_TYPE (type); if (TREE_CODE (type) != ARRAY_TYPE) @@ -16625,7 +16617,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) offset)); } else - is_ref = is_reference (var); + is_ref = omp_is_reference (var); if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_REFERENCE) is_ref = false; bool ref_to_array = false; @@ -16705,7 +16697,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) gimple_seq_add_stmt (&new_body, gimple_build_assign (new_pvar, x)); } - else if (is_reference (var) && !is_gimple_omp_oacc (ctx->stmt)) + else if (omp_is_reference (var) && !is_gimple_omp_oacc (ctx->stmt)) { location_t clause_loc = OMP_CLAUSE_LOCATION (c); tree new_var = lookup_decl (var, ctx); diff --git gcc/omp-low.h gcc/omp-low.h index b1f7885..a7bfc03 100644 --- gcc/omp-low.h +++ gcc/omp-low.h @@ -20,6 +20,8 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_OMP_LOW_H #define GCC_OMP_LOW_H +#include "langhooks.h" + struct omp_region; extern tree find_omp_clause (tree, enum omp_clause_code); @@ -41,4 +43,12 @@ extern int get_oacc_fn_dim_size (tree, int); extern GTY(()) vec *offload_funcs; extern GTY(()) vec *offload_vars; +/* Return true if DECL is a reference type. */ + +static inline bool +omp_is_reference (tree decl) +{ + return lang_hooks.decls.omp_privatize_by_reference (decl); +} + #endif /* GCC_OMP_LOW_H */