Merge branch 'maint'
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 30 May 2012 11:35:32 +0000 (13:35 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 30 May 2012 11:36:25 +0000 (13:36 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
1  2 
isl_schedule.c
isl_space.c

diff --cc isl_schedule.c
@@@ -485,6 -374,43 +487,43 @@@ static void graph_free(isl_ctx *ctx, st
        isl_basic_set_free(graph->lp);
  }
  
 - * we usually have one row, but it may be split by split_parallel),
+ /* For each "set" on which this function is called, increment
+  * graph->n by one and update graph->maxvar.
+  */
+ static int init_n_maxvar(__isl_take isl_set *set, void *user)
+ {
+       struct isl_sched_graph *graph = user;
+       int nvar = isl_set_dim(set, isl_dim_set);
+       graph->n++;
+       if (nvar > graph->maxvar)
+               graph->maxvar = nvar;
+       isl_set_free(set);
+       return 0;
+ }
+ /* Compute the number of rows that should be allocated for the schedule.
+  * The graph can be split at most "n - 1" times, there can be at most
+  * two rows for each dimension in the iteration domains (in particular,
++ * we usually have one row, but it may be split by split_scaled),
+  * and there can be one extra row for ordering the statements.
+  * Note that if we have actually split "n - 1" times, then no ordering
+  * is needed, so in principle we could use "graph->n + 2 * graph->maxvar - 1".
+  */
+ static int compute_max_row(struct isl_sched_graph *graph,
+       __isl_keep isl_union_set *domain)
+ {
+       graph->n = 0;
+       graph->maxvar = 0;
+       if (isl_union_set_foreach_set(domain, &init_n_maxvar, graph) < 0)
+               return -1;
+       graph->max_row = graph->n + 2 * graph->maxvar;
+       return 0;
+ }
  /* Add a new node to the graph representing the given set.
   */
  static int extract_node(__isl_take isl_set *set, void *user)
diff --cc isl_space.c
Simple merge