diff mbox

[gomp4,1/8] nvptx: remove assumption of OpenACC attrs presence

Message ID 1443028942-4081-2-git-send-email-amonakov@ispras.ru
State New
Headers show

Commit Message

Alexander Monakov Sept. 23, 2015, 5:22 p.m. UTC
This patch makes one OpenACC-specific path in nvptx_record_offload_symbol
optional.

	* config/nvptx/nvptx.c (nvptx_record_offload_symbol): Allow missing
        OpenACC attributes.
---
 gcc/config/nvptx/nvptx.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Comments

Jakub Jelinek Sept. 24, 2015, 7:24 a.m. UTC | #1
On Wed, Sep 23, 2015 at 08:22:15PM +0300, Alexander Monakov wrote:
> This patch makes one OpenACC-specific path in nvptx_record_offload_symbol
> optional.
> 
> 	* config/nvptx/nvptx.c (nvptx_record_offload_symbol): Allow missing
>         OpenACC attributes.

LGTM, but as it is a nvptx backend change, please check with the nvptx
maintainers (Bernd/Nathan), and for the whole patch series, please wait for
Thomas/Nathan if they are ok with having the stuff on their branch.

	Jakub
diff mbox

Patch

diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 53850a1..21c59ef 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -4026,19 +4026,22 @@  nvptx_record_offload_symbol (tree decl)
 
     case FUNCTION_DECL:
       {
-	tree attr = get_oacc_fn_attrib (decl);
-	tree dims = TREE_VALUE (attr);
-	unsigned ix;
-	
 	fprintf (asm_out_file, "//:FUNC_MAP \"%s\"",
 		 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
 
-	for (ix = 0; ix != GOMP_DIM_MAX; ix++, dims = TREE_CHAIN (dims))
+	tree attr = get_oacc_fn_attrib (decl);
+	if (attr)
 	  {
-	    int size = TREE_INT_CST_LOW (TREE_VALUE (dims));
+	    tree dims = TREE_VALUE (attr);
+	    unsigned ix;
 
-	    gcc_assert (!TREE_PURPOSE (dims));
-	    fprintf (asm_out_file, ", %#x", size);
+	    for (ix = 0; ix != GOMP_DIM_MAX; ix++, dims = TREE_CHAIN (dims))
+	    {
+	      int size = TREE_INT_CST_LOW (TREE_VALUE (dims));
+
+	      gcc_assert (!TREE_PURPOSE (dims));
+	      fprintf (asm_out_file, ", %#x", size);
+	    }
 	  }
 
 	fprintf (asm_out_file, "\n");