diff options
author | romangareev <romangareev@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-23 07:05:00 +0000 |
---|---|---|
committer | romangareev <romangareev@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-23 07:05:00 +0000 |
commit | 4b662581b13306167053cf76734d68db21ca2c62 (patch) | |
tree | eeeb6d1278bbd2c0f58a92972b91566d64620e87 | |
parent | 1d56dd2b80f2a6268e4d197894736449b2ca9453 (diff) | |
download | gcc-4b662581b13306167053cf76734d68db21ca2c62.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212922 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/graphite-isl-ast-to-gimple.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c | 27 |
4 files changed, 86 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4318cf85b54..96764719d27 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,16 @@ 2014-07-23 Roman Gareev <gareevroman@gmail.com> * graphite-isl-ast-to-gimple.c: + (translate_isl_ast_node_block): New function. + (translate_isl_ast): Add calling of translate_isl_ast_node_block. + + testsuite/gcc.dg/graphite/ + * isl-ast-gen-blocks-1.c: New testcase. + * isl-ast-gen-blocks-2.c: New testcase. + +2014-07-23 Roman Gareev <gareevroman@gmail.com> + + * graphite-isl-ast-to-gimple.c: (get_max_schedule_dimensions): New function. (extend_schedule): Likewise. (generate_isl_schedule): Add calling of extend_schedule and diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 75cbfb575d4..6f58c7c600f 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -616,6 +616,26 @@ translate_isl_ast_node_user (__isl_keep isl_ast_node *node, 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 @@ translate_isl_ast (loop_p context_loop, __isl_keep isl_ast_node *node, 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 (); diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c new file mode 100644 index 00000000000..e3e74f1cdfd --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c @@ -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; +} diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c new file mode 100644 index 00000000000..f6229cd7969 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c @@ -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; +} |