public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Roman Gareev <gareevroman@gmail.com>
To: Tobias Grosser <tobias@grosser.es>
Cc: Mircea Namolaru <mircea.namolaru@inria.fr>, gcc-patches@gcc.gnu.org
Subject: [GSoC] generation of Gimple code from isl_ast_node_block
Date: Tue, 22 Jul 2014 16:04:00 -0000	[thread overview]
Message-ID: <CABGF_gcGzThs5+R4ki8pCsF5hwWasbKEStjPT+7trC00b=MwYA@mail.gmail.com> (raw)

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

I've attached the patch, which contains generation of Gimple code from
isl_ast_node_block. Is it fine for trunk?

--
                                   Cheers, Roman Gareev.

[-- Attachment #2: ChangeLog_entry.txt --]
[-- Type: text/plain, Size: 319 bytes --]

2014-07-22  Roman Gareev  <gareevroman@gmail.com>

	gcc/
	* graphite-isl-ast-to-gimple.c:
	(translate_isl_ast_node_block): New function.
	(translate_isl_ast): Add calling of translate_isl_ast_node_block.

	gcc/testsuite/gcc.dg/graphite/
	* isl-ast-gen-blocks-1.c: New testcase.
	* isl-ast-gen-blocks-2.c: New testcase.

[-- Attachment #3: patch.txt --]
[-- Type: text/plain, Size: 2627 bytes --]

Index: gcc/graphite-isl-ast-to-gimple.c
===================================================================
--- gcc/graphite-isl-ast-to-gimple.c	(revision 212913)
+++ gcc/graphite-isl-ast-to-gimple.c	(working copy)
@@ -616,6 +616,26 @@
   return next_e;
 }
 
+/* Translates an isl_ast_node_block to Gimple. */
+
+static edge
+translate_isl_ast_node_block (loop_p context_loop,
+			      __isl_keep isl_ast_node *node,
+			      edge next_e, ivs_params &ip)
+{
+  gcc_assert (isl_ast_node_get_type (node) == isl_ast_node_block);
+  isl_ast_node_list *node_list = isl_ast_node_block_get_children (node);
+  int i;
+  for (i = 0; i < isl_ast_node_list_n_ast_node (node_list); i++)
+    {
+      isl_ast_node *tmp_node = isl_ast_node_list_get_ast_node (node_list, i);
+      next_e = translate_isl_ast (context_loop, tmp_node, next_e, ip);
+      isl_ast_node_free (tmp_node);
+    }
+  isl_ast_node_list_free (node_list);
+  return next_e;
+}
+
 /* Translates an ISL AST node NODE to GCC representation in the
    context of a SESE.  */
 
@@ -639,7 +659,8 @@
       return translate_isl_ast_node_user (node, next_e, ip);
 
     case isl_ast_node_block:
-      return next_e;
+      return translate_isl_ast_node_block (context_loop, node,
+					   next_e, ip);
 
     default:
       gcc_unreachable ();
Index: gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c	(working copy)
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fgraphite-identity -fgraphite-code-generator=isl" } */
+
+int n = 50;
+static int __attribute__((noinline))
+foo ()
+{
+  int i, res;
+  for (i = 0, res = 0; i < n; i++)
+    res += i;
+
+  return res;
+}
+
+extern void abort ();
+
+int
+main (void)
+{ 
+  int res = foo ();
+
+
+  if (res != 1225)
+    abort ();
+
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c	(working copy)
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fgraphite-identity -fgraphite-code-generator=isl" } */
+
+int k = 50;
+static int __attribute__((noinline))
+foo ()
+{
+  int i, res;
+  for (i = 0, res = 0; i < k; i++)
+    res += i;
+
+  return res;
+}
+
+extern void abort ();
+
+int
+main (void)
+{ 
+  int res = foo ();
+
+
+  if (res != 1225)
+    abort ();
+
+  return 0;
+}

             reply	other threads:[~2014-07-22 16:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-22 16:04 Roman Gareev [this message]
2014-07-22 16:56 ` Tobias Grosser
2014-07-23  9:16 ` Rainer Orth
2014-07-23  9:37   ` Tobias Grosser
2014-07-23 15:09     ` Roman Gareev

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='CABGF_gcGzThs5+R4ki8pCsF5hwWasbKEStjPT+7trC00b=MwYA@mail.gmail.com' \
    --to=gareevroman@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mircea.namolaru@inria.fr \
    --cc=tobias@grosser.es \
    /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).