Commit 60f87855 by Andreas Simbuerger Committed by Sebastian Pop

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.

From-SVN: r163164
parent 4431102b
2010-08-02 Andreas Simbuerger <simbuerg@fim.uni-passau.de> 2010-08-02 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.
2010-08-02 Andreas Simbuerger <simbuerg@fim.uni-passau.de>
* graphite-clast-to-gimple.c (clast_name_to_gcc): Parameter * graphite-clast-to-gimple.c (clast_name_to_gcc): Parameter
type of NAME now depends on used CLooG version. type of NAME now depends on used CLooG version.
(clast_to_gcc_expression): Replace expr_* with clast_expr_*. (clast_to_gcc_expression): Replace expr_* with clast_expr_*.
......
2010-07-27 Andreas Simbuerger <simbuerg@fim.uni-passau.de> 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.
2010-07-27 Andreas Simbuerger <simbuerg@fim.uni-passau.de>
* graphite-clast-to-gimple.c (clast_name_to_gcc): Parameter * graphite-clast-to-gimple.c (clast_name_to_gcc): Parameter
type of NAME now depends on used CLooG version. type of NAME now depends on used CLooG version.
(clast_to_gcc_expression): Replace expr_* with clast_expr_*. (clast_to_gcc_expression): Replace expr_* with clast_expr_*.
......
...@@ -1204,7 +1204,8 @@ initialize_cloog_names (scop_p scop, CloogProgram *prog) ...@@ -1204,7 +1204,8 @@ initialize_cloog_names (scop_p scop, CloogProgram *prog)
/* Build cloog program for SCoP. */ /* Build cloog program for SCoP. */
static void 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 i;
int max_nb_loops = scop_max_loop_depth (scop); int max_nb_loops = scop_max_loop_depth (scop);
...@@ -1216,7 +1217,8 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options) ...@@ -1216,7 +1217,8 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
int *scaldims; int *scaldims;
cloog_program_set_context 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); nbs = unify_scattering_dimensions (scop);
scaldims = (int *) xmalloc (nbs * (sizeof (int))); scaldims = (int *) xmalloc (nbs * (sizeof (int)));
cloog_program_set_nb_scattdims (prog, nbs); cloog_program_set_nb_scattdims (prog, nbs);
...@@ -1226,6 +1228,7 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options) ...@@ -1226,6 +1228,7 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
{ {
CloogStatement *stmt; CloogStatement *stmt;
CloogBlock *block; CloogBlock *block;
CloogDomain *dom;
/* Dead code elimination: when the domain of a PBB is empty, /* Dead code elimination: when the domain of a PBB is empty,
don't generate code for the PBB. */ don't generate code for the PBB. */
...@@ -1233,17 +1236,18 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options) ...@@ -1233,17 +1236,18 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
continue; continue;
/* Build the new statement and its block. */ /* 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)); block = cloog_block_alloc (stmt, 0, NULL, pbb_dim_iter_domain (pbb));
cloog_statement_set_usr (stmt, pbb); cloog_statement_set_usr (stmt, pbb);
/* Build loop list. */ /* 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_next (new_loop_list, loop_list);
cloog_loop_set_domain cloog_loop_set_domain (new_loop_list, dom);
(new_loop_list,
new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb)));
cloog_loop_set_block (new_loop_list, block); cloog_loop_set_block (new_loop_list, block);
loop_list = new_loop_list; loop_list = new_loop_list;
} }
...@@ -1266,7 +1270,8 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options) ...@@ -1266,7 +1270,8 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
CloogDomain *dom; CloogDomain *dom;
scat = PBB_TRANSFORMED_SCATTERING (pbb); 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_next_domain (new_scattering, scattering);
cloog_set_domain (new_scattering, dom); cloog_set_domain (new_scattering, dom);
...@@ -1312,9 +1317,9 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options) ...@@ -1312,9 +1317,9 @@ build_cloog_prog (scop_p scop, CloogProgram *prog, CloogOptions *options)
/* Return the options that will be used in GLOOG. */ /* Return the options that will be used in GLOOG. */
static CloogOptions * 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 /* 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 will stop e.g. with "ERROR: unbounded loops not allowed in FORTRAN.", if
...@@ -1363,10 +1368,12 @@ set_cloog_options (void) ...@@ -1363,10 +1368,12 @@ set_cloog_options (void)
void void
print_clast_stmt (FILE *file, struct clast_stmt *stmt) 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); clast_pprint (file, stmt, 0, options);
cloog_options_free (options); cloog_options_free (options);
cloog_state_free (state);
} }
/* Prints STMT to STDERR. */ /* Prints STMT to STDERR. */
...@@ -1382,14 +1389,14 @@ debug_clast_stmt (struct clast_stmt *stmt) ...@@ -1382,14 +1389,14 @@ debug_clast_stmt (struct clast_stmt *stmt)
without a program. */ without a program. */
cloog_prog_clast 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; cloog_prog_clast pc;
/* Connect new cloog prog generation to graphite. */ /* Connect new cloog prog generation to graphite. */
pc.prog = cloog_program_malloc (); 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.prog = cloog_program_generate (pc.prog, options);
pc.stmt = cloog_clast_create (pc.prog, options); pc.stmt = cloog_clast_create (pc.prog, options);
...@@ -1402,8 +1409,10 @@ scop_to_clast (scop_p scop) ...@@ -1402,8 +1409,10 @@ scop_to_clast (scop_p scop)
void void
print_generated_program (FILE *file, scop_p scop) print_generated_program (FILE *file, scop_p scop)
{ {
CloogOptions *options = set_cloog_options (); CloogState *state = cloog_state_malloc ();
cloog_prog_clast pc = scop_to_clast (scop); CloogOptions *options = set_cloog_options (state);
cloog_prog_clast pc = scop_to_clast (scop, state);
fprintf (file, " (prog: \n"); fprintf (file, " (prog: \n");
cloog_program_print (file, pc.prog); cloog_program_print (file, pc.prog);
...@@ -1454,11 +1463,13 @@ gloog (scop_p scop, htab_t bb_pbb_mapping) ...@@ -1454,11 +1463,13 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
ifsese if_region = NULL; ifsese if_region = NULL;
htab_t newivs_index, params_index; htab_t newivs_index, params_index;
cloog_prog_clast pc; cloog_prog_clast pc;
CloogState *state;
state = cloog_state_malloc ();
timevar_push (TV_GRAPHITE_CODE_GEN); timevar_push (TV_GRAPHITE_CODE_GEN);
gloog_error = false; gloog_error = false;
pc = scop_to_clast (scop); pc = scop_to_clast (scop, state);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
...@@ -1523,7 +1534,8 @@ gloog (scop_p scop, htab_t bb_pbb_mapping) ...@@ -1523,7 +1534,8 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
num_no_dependency); num_no_dependency);
} }
cloog_state_free (state);
return !gloog_error; return !gloog_error;
} }
#endif #endif
...@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_GRAPHITE_CLAST_TO_GIMPLE_H #ifndef GCC_GRAPHITE_CLAST_TO_GIMPLE_H
#define GCC_GRAPHITE_CLAST_TO_GIMPLE_H #define GCC_GRAPHITE_CLAST_TO_GIMPLE_H
#include "graphite-cloog-util.h"
/* Data structure for CLooG program representation. */ /* Data structure for CLooG program representation. */
typedef struct cloog_prog_clast { typedef struct cloog_prog_clast {
...@@ -37,7 +38,7 @@ typedef struct bb_pbb_def ...@@ -37,7 +38,7 @@ typedef struct bb_pbb_def
}bb_pbb_def; }bb_pbb_def;
extern bool gloog (scop_p, htab_t); extern bool gloog (scop_p, htab_t);
extern cloog_prog_clast scop_to_clast (scop_p); extern cloog_prog_clast scop_to_clast (scop_p, CloogState *);
extern void debug_clast_stmt (struct clast_stmt *); extern void debug_clast_stmt (struct clast_stmt *);
extern void print_clast_stmt (FILE *, struct clast_stmt *); extern void print_clast_stmt (FILE *, struct clast_stmt *);
......
...@@ -32,7 +32,8 @@ typedef const char *clast_name_p; ...@@ -32,7 +32,8 @@ typedef const char *clast_name_p;
#ifndef CLOOG_ORG #ifndef CLOOG_ORG
/* CloogOptions compatibility. */ /* CloogOptions compatibility. */
#define build_cloog_prog(SCOP, PROG, OPT) build_cloog_prog (SCOP, PROG) #define build_cloog_prog(SCOP, PROG, OPT, STATE)\
build_cloog_prog (SCOP, PROG, STATE)
#define cloog_program_extract_scalars(PROG, SCATT, OPT)\ #define cloog_program_extract_scalars(PROG, SCATT, OPT)\
cloog_program_extract_scalars (PROG, SCATT) cloog_program_extract_scalars (PROG, SCATT)
#define cloog_program_scatter(PROG, SCATT, OPT)\ #define cloog_program_scatter(PROG, SCATT, OPT)\
...@@ -44,6 +45,19 @@ typedef const char *clast_name_p; ...@@ -44,6 +45,19 @@ typedef const char *clast_name_p;
#define clast_expr_bin expr_bin #define clast_expr_bin expr_bin
#define clast_pprint pprint #define clast_pprint pprint
/* CloogState compatibility. */
#define CloogState void
#define cloog_state_malloc() NULL
#define cloog_state_free(STATE)
#define cloog_loop_malloc(STATE) cloog_loop_malloc ()
#define cloog_options_malloc(STATE) cloog_options_malloc ()
#define cloog_statement_alloc(STATE, INDEX) cloog_statement_alloc (INDEX)
#define new_Cloog_Domain_from_ppl_Pointset_Powerset(PSPS, NB, STATE)\
new_Cloog_Domain_from_ppl_Pointset_Powerset (PSPS)
#define new_Cloog_Domain_from_ppl_Polyhedron(POLY, NB, STATE)\
new_Cloog_Domain_from_ppl_Polyhedron (POLY)
#define cloog_domain_from_cloog_matrix(STATE, MAT, NB)\
cloog_domain_matrix2domain (MAT)
#endif #endif
/* Adapt CLooG accessors from CLooG legacy to /* Adapt CLooG accessors from CLooG legacy to
......
...@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "ppl_c.h" #include "ppl_c.h"
#include "cloog/cloog.h" #include "cloog/cloog.h"
#include "graphite-cloog-util.h" #include "graphite-cloog-util.h"
#include "graphite-cloog-compat.h"
/* Counts the number of constraints in PCS. */ /* Counts the number of constraints in PCS. */
...@@ -228,10 +229,11 @@ new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *ph, ...@@ -228,10 +229,11 @@ new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *ph,
/* Creates a CloogDomain from polyhedron PH. */ /* Creates a CloogDomain from polyhedron PH. */
CloogDomain * CloogDomain *
new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph) new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph, int nb_params,
CloogState *state ATTRIBUTE_UNUSED)
{ {
CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph);
CloogDomain *res = cloog_domain_matrix2domain (mat); CloogDomain *res = cloog_domain_from_cloog_matrix (state, mat, nb_params);
cloog_matrix_free (mat); cloog_matrix_free (mat);
return res; return res;
} }
...@@ -239,8 +241,9 @@ new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph) ...@@ -239,8 +241,9 @@ new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph)
/* Creates a CloogDomain from a pointset powerset PS. */ /* Creates a CloogDomain from a pointset powerset PS. */
CloogDomain * CloogDomain *
new_Cloog_Domain_from_ppl_Pointset_Powerset ( new_Cloog_Domain_from_ppl_Pointset_Powerset
ppl_Pointset_Powerset_C_Polyhedron_t ps) (ppl_Pointset_Powerset_C_Polyhedron_t ps, int nb_params,
CloogState *state ATTRIBUTE_UNUSED)
{ {
CloogDomain *res = NULL; CloogDomain *res = NULL;
ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end; ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end;
...@@ -257,7 +260,7 @@ new_Cloog_Domain_from_ppl_Pointset_Powerset ( ...@@ -257,7 +260,7 @@ new_Cloog_Domain_from_ppl_Pointset_Powerset (
CloogDomain *tmp; CloogDomain *tmp;
ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph); ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph);
tmp = new_Cloog_Domain_from_ppl_Polyhedron (ph); tmp = new_Cloog_Domain_from_ppl_Polyhedron (ph, nb_params, state);
if (res == NULL) if (res == NULL)
res = tmp; res = tmp;
......
...@@ -25,9 +25,10 @@ along with GCC; see the file COPYING3. If not see ...@@ -25,9 +25,10 @@ along with GCC; see the file COPYING3. If not see
#include "graphite-cloog-compat.h" #include "graphite-cloog-compat.h"
CloogMatrix *new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t); CloogMatrix *new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t);
CloogDomain *new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t); CloogDomain *new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t,
CloogDomain * new_Cloog_Domain_from_ppl_Pointset_Powerset ( int, CloogState *);
ppl_Pointset_Powerset_C_Polyhedron_t); CloogDomain * new_Cloog_Domain_from_ppl_Pointset_Powerset
(ppl_Pointset_Powerset_C_Polyhedron_t, int, CloogState *);
void new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *, CloogMatrix *); void new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *, CloogMatrix *);
#endif /* GRAPHITE_CLOOG_UTIL_H */ #endif /* GRAPHITE_CLOOG_UTIL_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment