@@ -1,5 +1,33 @@
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
type of NAME now depends on used CLooG version.
(clast_to_gcc_expression): Replace expr_* with clast_expr_*.
@@ -1206,7 +1206,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);
@@ -1218,7 +1219,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);
@@ -1228,6 +1230,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. */
@@ -1235,17 +1238,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;
}
@@ -1268,7 +1272,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);
@@ -1314,9 +1319,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
@@ -1365,10 +1370,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. */
@@ -1384,14 +1391,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);
@@ -1404,8 +1411,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);
@@ -1456,11 +1465,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))
{
@@ -1525,7 +1536,8 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
num_no_dependency);
}
+ cloog_state_free (state);
+
return !gloog_error;
}
-
#endif
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_GRAPHITE_CLAST_TO_GIMPLE_H
#define GCC_GRAPHITE_CLAST_TO_GIMPLE_H
+#include "graphite-cloog-util.h"
/* Data structure for CLooG program representation. */
typedef struct cloog_prog_clast {
@@ -37,7 +38,7 @@ typedef struct bb_pbb_def
}bb_pbb_def;
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 print_clast_stmt (FILE *, struct clast_stmt *);
@@ -32,7 +32,8 @@ typedef const char *clast_name_p;
#ifndef CLOOG_ORG
/* 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)\
cloog_program_extract_scalars (PROG, SCATT)
#define cloog_program_scatter(PROG, SCATT, OPT)\
@@ -44,6 +45,19 @@ typedef const char *clast_name_p;
#define clast_expr_bin expr_bin
#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
/* Adapt CLooG accessors from CLooG legacy to
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "ppl_c.h"
#include "cloog/cloog.h"
#include "graphite-cloog-util.h"
+#include "graphite-cloog-compat.h"
/* Counts the number of constraints in PCS. */
@@ -228,10 +229,11 @@ new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *ph,
/* Creates a CloogDomain from polyhedron PH. */
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);
- CloogDomain *res = cloog_domain_matrix2domain (mat);
+ CloogDomain *res = cloog_domain_from_cloog_matrix (state, mat, nb_params);
cloog_matrix_free (mat);
return res;
}
@@ -239,8 +241,9 @@ new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph)
/* Creates a CloogDomain from a pointset powerset PS. */
CloogDomain *
-new_Cloog_Domain_from_ppl_Pointset_Powerset (
- ppl_Pointset_Powerset_C_Polyhedron_t ps)
+new_Cloog_Domain_from_ppl_Pointset_Powerset
+ (ppl_Pointset_Powerset_C_Polyhedron_t ps, int nb_params,
+ CloogState *state ATTRIBUTE_UNUSED)
{
CloogDomain *res = NULL;
ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end;
@@ -257,7 +260,7 @@ new_Cloog_Domain_from_ppl_Pointset_Powerset (
CloogDomain *tmp;
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)
res = tmp;
@@ -25,9 +25,10 @@ along with GCC; see the file COPYING3. If not see
#include "graphite-cloog-compat.h"
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_Pointset_Powerset (
- ppl_Pointset_Powerset_C_Polyhedron_t);
+CloogDomain *new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t,
+ int, CloogState *);
+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 *);
#endif /* GRAPHITE_CLOOG_UTIL_H */