summaryrefslogtreecommitdiff
path: root/gcc/graphite-clast-to-gimple.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-11 20:30:41 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-11 20:30:41 +0000
commit08a88144982a21f7275eb430fe0448d75a2c580a (patch)
tree8fdd4580fc6fed6d76b15a494cf7d13bbc5bb58c /gcc/graphite-clast-to-gimple.c
parent2e6bc1c7d059dfa944bffddfeb92ed6d224cfc71 (diff)
downloadgcc-08a88144982a21f7275eb430fe0448d75a2c580a.tar.gz
Introduce compatibility to newer CLooG's CloogState and mask the use with macros where possible.
2010-07-27 Andreas Simbuerger <simbuerg@fim.uni-passau.de> * graphite-clast-to-gimple.c (build_cloog_prog): Extend with CloogState. (set_cloog_options): Same. (print_clast_stmt): Same. (scop_to_clast): Same. (print_generated_program): Same. (gloog): Same. * graphite-clast-to-gimple.h: Include graphite-cloog-util.h. (scop_to_clast): Extend with CloogState. * graphite-cloog-util.c: Include graphite-cloog-compat.h (new_Cloog_Domain_from_ppl_Polyhedron): Extend with CloogState. Use cloog_domain_from_cloog_matrix (CLOOG_ORG). (new_Cloog_Domain_from_ppl_Pointset_Powerset): Extend with CloogState. (new_Cloog_Domain_from_ppl_Polyhedron): Same. * graphite-cloog-util.h (build_cloog_prog): Same. * graphite-cloog-copat.h (build_cloog_prog): New. (CloogState): New. (cloog_state_malloc): New. (cloog_state_free): New. (cloog_loop_malloc): New. (cloog_options_malloc): New. (cloog_statement_alloc): New. (cloog_domain_from_cloog_matrix): New. (new_Cloog_Domain_from_ppl_Pointset_Powerset): New. (new_Cloog_Domain_from_ppl_Polyhedron): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163164 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-clast-to-gimple.c')
-rw-r--r--gcc/graphite-clast-to-gimple.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 29c8ffb5169..11867cfaf14 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1204,7 +1204,8 @@ initialize_cloog_names (scop_p scop, CloogProgram *prog)
/* Build cloog program for SCoP. */
static void
-build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
+build_cloog_prog (scop_p scop, CloogProgram *prog,
+ CloogOptions *options, CloogState *state ATTRIBUTE_UNUSED)
{
int i;
int max_nb_loops = scop_max_loop_depth (scop);
@@ -1216,7 +1217,8 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
int *scaldims;
cloog_program_set_context
- (prog, new_Cloog_Domain_from_ppl_Pointset_Powerset (SCOP_CONTEXT (scop)));
+ (prog, new_Cloog_Domain_from_ppl_Pointset_Powerset (SCOP_CONTEXT (scop),
+ scop_nb_params (scop), state));
nbs = unify_scattering_dimensions (scop);
scaldims = (int *) xmalloc (nbs * (sizeof (int)));
cloog_program_set_nb_scattdims (prog, nbs);
@@ -1226,6 +1228,7 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
{
CloogStatement *stmt;
CloogBlock *block;
+ CloogDomain *dom;
/* Dead code elimination: when the domain of a PBB is empty,
don't generate code for the PBB. */
@@ -1233,17 +1236,18 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
continue;
/* Build the new statement and its block. */
- stmt = cloog_statement_alloc (pbb_index (pbb));
+ stmt = cloog_statement_alloc (state, pbb_index (pbb));
+ dom = new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb),
+ scop_nb_params (scop),
+ state);
block = cloog_block_alloc (stmt, 0, NULL, pbb_dim_iter_domain (pbb));
cloog_statement_set_usr (stmt, pbb);
/* Build loop list. */
{
- CloogLoop *new_loop_list = cloog_loop_malloc ();
+ CloogLoop *new_loop_list = cloog_loop_malloc (state);
cloog_loop_set_next (new_loop_list, loop_list);
- cloog_loop_set_domain
- (new_loop_list,
- new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb)));
+ cloog_loop_set_domain (new_loop_list, dom);
cloog_loop_set_block (new_loop_list, block);
loop_list = new_loop_list;
}
@@ -1266,7 +1270,8 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
CloogDomain *dom;
scat = PBB_TRANSFORMED_SCATTERING (pbb);
- dom = new_Cloog_Domain_from_ppl_Polyhedron (scat);
+ dom = new_Cloog_Domain_from_ppl_Polyhedron (scat, scop_nb_params (scop),
+ state);
cloog_set_next_domain (new_scattering, scattering);
cloog_set_domain (new_scattering, dom);
@@ -1312,9 +1317,9 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
/* Return the options that will be used in GLOOG. */
static CloogOptions *
-set_cloog_options (void)
+set_cloog_options (CloogState *state ATTRIBUTE_UNUSED)
{
- CloogOptions *options = cloog_options_malloc ();
+ CloogOptions *options = cloog_options_malloc (state);
/* Change cloog output language to C. If we do use FORTRAN instead, cloog
will stop e.g. with "ERROR: unbounded loops not allowed in FORTRAN.", if
@@ -1363,10 +1368,12 @@ set_cloog_options (void)
void
print_clast_stmt (FILE *file, struct clast_stmt *stmt)
{
- CloogOptions *options = set_cloog_options ();
+ CloogState *state = cloog_state_malloc ();
+ CloogOptions *options = set_cloog_options (state);
clast_pprint (file, stmt, 0, options);
cloog_options_free (options);
+ cloog_state_free (state);
}
/* Prints STMT to STDERR. */
@@ -1382,14 +1389,14 @@ debug_clast_stmt (struct clast_stmt *stmt)
without a program. */
cloog_prog_clast
-scop_to_clast (scop_p scop)
+scop_to_clast (scop_p scop, CloogState *state)
{
- CloogOptions *options = set_cloog_options ();
+ CloogOptions *options = set_cloog_options (state);
cloog_prog_clast pc;
/* Connect new cloog prog generation to graphite. */
pc.prog = cloog_program_malloc ();
- build_cloog_prog (scop, pc.prog, options);
+ build_cloog_prog (scop, pc.prog, options, state);
pc.prog = cloog_program_generate (pc.prog, options);
pc.stmt = cloog_clast_create (pc.prog, options);
@@ -1402,8 +1409,10 @@ scop_to_clast (scop_p scop)
void
print_generated_program (FILE *file, scop_p scop)
{
- CloogOptions *options = set_cloog_options ();
- cloog_prog_clast pc = scop_to_clast (scop);
+ CloogState *state = cloog_state_malloc ();
+ CloogOptions *options = set_cloog_options (state);
+
+ cloog_prog_clast pc = scop_to_clast (scop, state);
fprintf (file, " (prog: \n");
cloog_program_print (file, pc.prog);
@@ -1454,11 +1463,13 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
ifsese if_region = NULL;
htab_t newivs_index, params_index;
cloog_prog_clast pc;
+ CloogState *state;
+ state = cloog_state_malloc ();
timevar_push (TV_GRAPHITE_CODE_GEN);
gloog_error = false;
- pc = scop_to_clast (scop);
+ pc = scop_to_clast (scop, state);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -1523,7 +1534,8 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
num_no_dependency);
}
+ cloog_state_free (state);
+
return !gloog_error;
}
-
#endif