/* Gimple Represented as Polyhedra.
- Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2006-2013 Free Software Foundation, Inc.
Contributed by Sebastian Pop <sebastian.pop@inria.fr>.
This file is part of GCC.
the functions that are used for transforming the code. */
#include "config.h"
+
+#ifdef HAVE_cloog
+#include <isl/set.h>
+#include <isl/map.h>
+#include <isl/options.h>
+#include <isl/union_map.h>
+#include <cloog/cloog.h>
+#include <cloog/isl/domain.h>
+#include <cloog/isl/cloog.h>
+#endif
+
#include "system.h"
#include "coretypes.h"
#include "diagnostic-core.h"
#ifdef HAVE_cloog
-#include "ppl_c.h"
-#include "graphite-ppl.h"
#include "graphite-poly.h"
#include "graphite-scop-detection.h"
#include "graphite-clast-to-gimple.h"
n_p_loops += bb->count;
}
- if (VEC_length (edge, bb->succs) > 1)
+ if (EDGE_COUNT (bb->succs) > 1)
{
n_conditions++;
n_p_conditions += bb->count;
n_bbs++;
n_p_bbs += bb->count;
- if (VEC_length (edge, bb->succs) > 1)
+ if (EDGE_COUNT (bb->succs) > 1)
{
n_conditions++;
n_p_conditions += bb->count;
/* Print statistics for SCOPS to FILE. */
static void
-print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
+print_graphite_statistics (FILE* file, vec<scop_p> scops)
{
int i;
scop_p scop;
- FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
+ FOR_EACH_VEC_ELT (scops, i, scop)
print_graphite_scop_statistics (file, scop);
}
/* Initialize graphite: when there are no loops returns false. */
static bool
-graphite_initialize (void)
+graphite_initialize (isl_ctx *ctx)
{
- int ppl_initialized;
-
if (number_of_loops () <= 1
/* FIXME: This limit on the number of basic blocks of a function
should be removed when the SCOP detection is faster. */
if (dump_file && (dump_flags & TDF_DETAILS))
print_global_statistics (dump_file);
+ isl_ctx_free (ctx);
return false;
}
recompute_all_dominators ();
initialize_original_copy_tables ();
- ppl_initialized = ppl_initialize ();
- gcc_assert (ppl_initialized == 0);
-
- cloog_state = cloog_state_malloc ();
- cloog_initialize ();
+ cloog_state = cloog_isl_state_malloc (ctx);
if (dump_file && dump_flags)
dump_function_to_file (current_function_decl, dump_file, dump_flags);
}
cloog_state_free (cloog_state);
- cloog_finalize ();
- ppl_finalize ();
free_original_copy_tables ();
if (dump_file && dump_flags)
print_loops (dump_file, 3);
}
+isl_ctx *the_isl_ctx;
+
/* Perform a set of linear transforms on the loops of the current
function. */
int i;
scop_p scop;
bool need_cfg_cleanup_p = false;
- VEC (scop_p, heap) *scops = NULL;
+ vec<scop_p> scops = vNULL;
htab_t bb_pbb_mapping;
+ isl_ctx *ctx;
+
+ /* If a function is parallel it was most probably already run through graphite
+ once. No need to run again. */
+ if (parallelized_function_p (cfun->decl))
+ return;
- if (!graphite_initialize ())
+ ctx = isl_ctx_alloc ();
+ isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT);
+ if (!graphite_initialize (ctx))
return;
+ the_isl_ctx = ctx;
build_scops (&scops);
if (dump_file && (dump_flags & TDF_DETAILS))
bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free);
- FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
+ FOR_EACH_VEC_ELT (scops, i, scop)
if (dbg_cnt (graphite_scop))
{
+ scop->ctx = ctx;
build_poly_scop (scop);
if (POLY_SCOP_P (scop)
htab_delete (bb_pbb_mapping);
free_scops (scops);
graphite_finalize (need_cfg_cleanup_p);
+ the_isl_ctx = NULL;
+ isl_ctx_free (ctx);
}
#else /* If Cloog is not available: #ifndef HAVE_cloog. */