/* Gimple Represented as Polyhedra.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 Free Software Foundation, Inc.
Contributed by Sebastian Pop <sebastian.pop@inria.fr>.
This file is part of GCC.
#include "config.h"
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
#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"
-#include "tree-ssa.h"
+#include "tree.h"
+#include "predict.h"
+#include "vec.h"
+#include "hashtab.h"
+#include "hash-set.h"
+#include "machmode.h"
+#include "tm.h"
+#include "hard-reg-set.h"
+#include "input.h"
+#include "function.h"
+#include "dominance.h"
+#include "cfg.h"
+#include "basic-block.h"
+#include "tree-ssa-alias.h"
+#include "internal-fn.h"
+#include "gimple-expr.h"
+#include "is-a.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
+#include "tree-cfg.h"
+#include "tree-ssa-loop.h"
#include "tree-dump.h"
#include "cfgloop.h"
#include "tree-chrec.h"
#include "dbgcnt.h"
#include "tree-parloops.h"
#include "tree-pass.h"
+#include "tree-cfgcleanup.h"
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
#include "graphite-poly.h"
#include "graphite-scop-detection.h"
-#include "graphite-clast-to-gimple.h"
+#include "graphite-isl-ast-to-gimple.h"
#include "graphite-sese-to-poly.h"
-#include "graphite-htab.h"
-
-CloogState *cloog_state;
/* Print global statistics to FILE. */
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;
loop_p loop = bb->loop_father;
if (number_of_loops (cfun) <= 1
/* FIXME: This limit on the number of basic blocks of a function
should be removed when the SCOP detection is faster. */
- || n_basic_blocks > PARAM_VALUE (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION))
+ || (n_basic_blocks_for_fn (cfun) >
+ PARAM_VALUE (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
print_global_statistics (dump_file);
recompute_all_dominators ();
initialize_original_copy_tables ();
- cloog_state = cloog_isl_state_malloc (ctx);
-
if (dump_file && dump_flags)
dump_function_to_file (current_function_decl, dump_file, dump_flags);
{
scev_reset ();
cleanup_tree_cfg ();
- profile_status = PROFILE_ABSENT;
+ profile_status_for_fn (cfun) = PROFILE_ABSENT;
release_recorded_exits ();
tree_estimate_probability ();
}
- cloog_state_free (cloog_state);
free_original_copy_tables ();
if (dump_file && dump_flags)
scop_p scop;
bool need_cfg_cleanup_p = false;
vec<scop_p> scops = vNULL;
- bb_pbb_htab_type bb_pbb_mapping;
isl_ctx *ctx;
/* If a function is parallel it was most probably already run through graphite
print_global_statistics (dump_file);
}
- bb_pbb_mapping.create (10);
-
FOR_EACH_VEC_ELT (scops, i, scop)
if (dbg_cnt (graphite_scop))
{
if (POLY_SCOP_P (scop)
&& apply_poly_transforms (scop)
- && gloog (scop, bb_pbb_mapping))
+ && graphite_regenerate_ast_isl (scop))
need_cfg_cleanup_p = true;
+
}
- bb_pbb_mapping.dispose ();
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. */
+#else /* If ISL is not available: #ifndef HAVE_isl. */
static void
graphite_transform_loops (void)
{
- sorry ("Graphite loop optimizations cannot be used");
+ sorry ("Graphite loop optimizations cannot be used (ISL is not available).");
}
#endif
static unsigned int
-graphite_transforms (void)
+graphite_transforms (struct function *fun)
{
- if (!current_loops)
+ if (number_of_loops (fun) <= 1)
return 0;
graphite_transform_loops ();
|| flag_loop_strip_mine
|| flag_graphite_identity
|| flag_loop_parallelize_all
- || flag_loop_optimize_isl)
+ || flag_loop_optimize_isl
+ || flag_loop_unroll_jam)
flag_graphite = 1;
return flag_graphite != 0;
GIMPLE_PASS, /* type */
"graphite0", /* name */
OPTGROUP_LOOP, /* optinfo_flags */
- true, /* has_gate */
- false, /* has_execute */
TV_GRAPHITE, /* tv_id */
( PROP_cfg | PROP_ssa ), /* properties_required */
0, /* properties_provided */
{}
/* opt_pass methods: */
- bool gate () { return gate_graphite_transforms (); }
+ virtual bool gate (function *) { return gate_graphite_transforms (); }
}; // class pass_graphite
GIMPLE_PASS, /* type */
"graphite", /* name */
OPTGROUP_LOOP, /* optinfo_flags */
- true, /* has_gate */
- true, /* has_execute */
TV_GRAPHITE_TRANSFORMS, /* tv_id */
( PROP_cfg | PROP_ssa ), /* properties_required */
0, /* properties_provided */
{}
/* opt_pass methods: */
- bool gate () { return gate_graphite_transforms (); }
- unsigned int execute () { return graphite_transforms (); }
+ virtual bool gate (function *) { return gate_graphite_transforms (); }
+ virtual unsigned int execute (function *fun) { return graphite_transforms (fun); }
}; // class pass_graphite_transforms