public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kwok Cheung Yeung <kcy@codesourcery.com>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: Tobias Burnus <tobias@codesourcery.com>,
	<gcc-patches@gcc.gnu.org>, "Jakub Jelinek" <jakub@redhat.com>
Subject: [committed] Re: [PATCH] openmp: Add support for the 'indirect' clause in C/C++
Date: Wed, 3 Jan 2024 14:47:54 +0000	[thread overview]
Message-ID: <79a12614-a2b8-4da6-8316-c172abda6dbf@codesourcery.com> (raw)
In-Reply-To: <87wmurru61.fsf@euler.schwinge.homeip.net>

[-- Attachment #1: Type: text/plain, Size: 1999 bytes --]

Hello

I have committed the following trivial patch to emit FUNC_MAP or 
IND_FUNC_MAP in separate branches of an if statement.

Kwok

On 09/11/2023 12:24 pm, Thomas Schwinge wrote:
> Similar to how you have it here:
> 
>> --- a/gcc/config/nvptx/mkoffload.cc
>> +++ b/gcc/config/nvptx/mkoffload.cc
>> @@ -51,6 +51,7 @@ struct id_map
>>   };
>>
>>   static id_map *func_ids, **funcs_tail = &func_ids;
>> +static id_map *ind_func_ids, **ind_funcs_tail = &ind_func_ids;
>>   static id_map *var_ids, **vars_tail = &var_ids;
>>
>>   /* Files to unlink.  */
>> @@ -302,6 +303,11 @@ process (FILE *in, FILE *out, uint32_t omp_requires)
> |                 else if (startswith (input + i, "FUNC_MAP "))
> |                   {
>>                      output_fn_ptr = true;
>>                      record_id (input + i + 9, &funcs_tail);
>>                    }
>> +               else if (startswith (input + i, "IND_FUNC_MAP "))
>> +                 {
>> +                   output_fn_ptr = true;
>> +                   record_id (input + i + 13, &ind_funcs_tail);
>> +                 }
>>                  else
>>                    abort ();
>>                  /* Skip to next line. */
> 
> ..., please also here:
> 
>> --- a/gcc/config/nvptx/nvptx.cc
>> +++ b/gcc/config/nvptx/nvptx.cc
>> @@ -5919,7 +5919,11 @@ nvptx_record_offload_symbol (tree decl)
>>        /* OpenMP offloading does not set this attribute.  */
>>        tree dims = attr ? TREE_VALUE (attr) : NULL_TREE;
>>
>> -     fprintf (asm_out_file, "//:FUNC_MAP \"%s\"",
>> +     fprintf (asm_out_file, "//:");
>> +     if (lookup_attribute ("omp declare target indirect",
>> +                           DECL_ATTRIBUTES (decl)))
>> +       fprintf (asm_out_file, "IND_");
>> +     fprintf (asm_out_file, "FUNC_MAP \"%s\"",
>>                 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
> 
> ... maintain separate 'if' branches for 'FUNC_MAP' vs. 'IND_FUNC_MAP', so
> that we're able to easily locate those with 'grep', for example.
> 

[-- Attachment #2: 0001-nvptx-Restructure-code-generating-function-map-label.patch --]
[-- Type: text/plain, Size: 1341 bytes --]

From 6ae84729940acff598e1a7f49d7b381025082ceb Mon Sep 17 00:00:00 2001
From: Kwok Cheung Yeung <kcy@codesourcery.com>
Date: Wed, 3 Jan 2024 14:27:39 +0000
Subject: [PATCH] nvptx: Restructure code generating function map labels

This restructures the code generating FUNC_MAP and IND_FUNC_MAP labels
in the assembly code for mkoffload to consume, hopefully making it a
bit clearer and easier to search for.

2024-01-03  Kwok Cheung Yeung  <kcy@codesourcery.com>

	gcc/
	* config/nvptx/nvptx.cc (nvptx_record_offload_symbol): Restucture
	printing of FUNC_MAP/IND_FUNC_MAP labels.
---
 gcc/config/nvptx/nvptx.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 724e403a0e9..9363d3ecc6a 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -5921,8 +5921,10 @@ nvptx_record_offload_symbol (tree decl)
 	fprintf (asm_out_file, "//:");
 	if (lookup_attribute ("omp declare target indirect",
 			      DECL_ATTRIBUTES (decl)))
-	  fprintf (asm_out_file, "IND_");
-	fprintf (asm_out_file, "FUNC_MAP \"%s\"",
+	  fprintf (asm_out_file, "IND_FUNC_MAP");
+	else
+	  fprintf (asm_out_file, "FUNC_MAP");
+	fprintf (asm_out_file, " \"%s\"",
 		 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
 
 	for (; dims; dims = TREE_CHAIN (dims))
-- 
2.34.1


  parent reply	other threads:[~2024-01-03 14:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-08 13:13 Kwok Cheung Yeung
2023-10-17 13:12 ` Tobias Burnus
2023-10-17 13:34   ` Jakub Jelinek
2023-10-17 14:41     ` Tobias Burnus
2023-11-03 19:53   ` Kwok Cheung Yeung
2023-11-06  8:48     ` Tobias Burnus
2023-11-07 21:37       ` Joseph Myers
2023-11-07 21:51         ` Jakub Jelinek
2023-11-07 21:59           ` Kwok Cheung Yeung
2023-11-09 12:24     ` Thomas Schwinge
2023-11-09 16:00       ` Tobias Burnus
2023-11-13 10:59         ` Thomas Schwinge
2023-11-13 11:47           ` Tobias Burnus
2024-04-11 10:10             ` Thomas Schwinge
2024-01-03 14:47       ` Kwok Cheung Yeung [this message]
2024-01-03 15:54       ` [committed] " Kwok Cheung Yeung
2024-01-22 20:33     ` [PATCH] openmp: Change to using a hashtab to lookup offload target addresses for indirect function calls Kwok Cheung Yeung
2024-01-24  7:06       ` rep.dot.nop
2024-01-29 17:48         ` [PATCH v2] " Kwok Cheung Yeung
2024-03-08 13:40           ` Thomas Schwinge
2024-03-14 11:38           ` Tobias Burnus
2024-01-22 20:41     ` [PATCH] openmp, fortran: Add Fortran support for indirect clause on the declare target directive Kwok Cheung Yeung
2024-01-23 19:14       ` Tobias Burnus
2024-02-05 21:37         ` [PATCH v2] " Kwok Cheung Yeung
2024-02-06  9:03           ` Tobias Burnus
2024-02-06  9:50             ` Kwok Cheung Yeung
2024-02-12  8:51               ` Tobias Burnus
2024-02-15 21:37                 ` [COMMITTED] libgomp: Update documentation for indirect calls in target regions Kwok Cheung Yeung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79a12614-a2b8-4da6-8316-c172abda6dbf@codesourcery.com \
    --to=kcy@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=thomas@codesourcery.com \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).