22 #ifndef GCC_GRAPHITE_POLY_H
23 #define GCC_GRAPHITE_POLY_H
188 #define PDR_ID(PDR) (PDR->id)
189 #define PDR_NB_REFS(PDR) (PDR->nb_refs)
190 #define PDR_CDR(PDR) (PDR->compiler_dr)
191 #define PDR_PBB(PDR) (PDR->pbb)
192 #define PDR_TYPE(PDR) (PDR->type)
193 #define PDR_ACCESSES(PDR) (NULL)
194 #define PDR_BASE_OBJECT_SET(PDR) (PDR->dr_base_object_set)
195 #define PDR_NB_SUBSCRIPTS(PDR) (PDR->nb_subscripts)
202 static inline scop_p
pdr_scop (poly_dr_p pdr);
225 poly_bb_p pbb = PDR_PBB (pdr);
235 poly_bb_p pbb = PDR_PBB (pdr);
253 poly_bb_p pbb = PDR_PBB (pdr);
288 return PDR_NB_SUBSCRIPTS (pdr1) == PDR_NB_SUBSCRIPTS (pdr2)
289 && PDR_BASE_OBJECT_SET (pdr1) == PDR_BASE_OBJECT_SET (pdr2);
356 #define PBB_BLACK_BOX(PBB) ((gimple_bb_p) PBB->black_box)
357 #define PBB_SCOP(PBB) (PBB->scop)
358 #define PBB_DOMAIN(PBB) (NULL)
359 #define PBB_DRS(PBB) (PBB->drs)
360 #define PBB_ORIGINAL(PBB) (PBB->_original)
361 #define PBB_ORIGINAL_SCATTERING(PBB) (NULL)
362 #define PBB_TRANSFORMED(PBB) (PBB->_transformed)
363 #define PBB_TRANSFORMED_SCATTERING(PBB) (NULL)
364 #define PBB_SAVED(PBB) (PBB->_saved)
368 #define PBB_NB_LOCAL_VARIABLES(PBB) (0)
369 #define PBB_NB_SCATTERING_TRANSFORM(PBB) (isl_map_n_out (PBB->transformed))
370 #define PBB_IS_REDUCTION(PBB) (PBB->is_reduction)
377 extern void print_pbb (FILE *, poly_bb_p,
int);
383 extern void print_pdrs (FILE *, poly_bb_p,
int);
419 for (i = 0; PBB_DRS (pbb).iterate (i, &pdr); i++)
436 static inline poly_bb_p
447 return GBB_BB (PBB_BLACK_BOX (pbb));
463 return gbb_loop (PBB_BLACK_BOX (pbb));
471 return PBB_SCOP (PDR_PBB (pdr));
488 return isl_set_dim (pbb->
domain, isl_dim_set);
496 scop_p
scop = PBB_SCOP (pbb);
515 return PBB_NB_SCATTERING_TRANSFORM (pbb);
525 gcc_assert (PBB_NB_SCATTERING_TRANSFORM (pbb) % 2);
526 return PBB_NB_SCATTERING_TRANSFORM (pbb) / 2;
537 return PBB_NB_LOCAL_VARIABLES (pbb);
690 #define LST_LOOP_P(LST) ((LST)->loop_p)
691 #define LST_LOOP_FATHER(LST) ((LST)->loop_father)
692 #define LST_PBB(LST) ((LST)->node.pbb)
693 #define LST_SEQ(LST) ((LST)->node.seq)
694 #define LST_LOOP_MEMORY_STRIDES(LST) ((LST)->memory_strides)
706 lst_p
lst = XNEW (
struct lst);
710 LST_LOOP_P (lst) =
true;
712 LST_LOOP_FATHER (lst) = NULL;
713 mpz_init (LST_LOOP_MEMORY_STRIDES (lst));
714 mpz_set_si (LST_LOOP_MEMORY_STRIDES (lst), -1);
716 for (i = 0; seq.iterate (i, &l); i++)
717 LST_LOOP_FATHER (l) = lst;
727 lst_p
lst = XNEW (
struct lst);
729 LST_LOOP_P (lst) =
false;
731 LST_LOOP_FATHER (lst) = NULL;
743 if (LST_LOOP_P (lst))
748 for (i = 0; LST_SEQ (lst).iterate (i, &l); i++)
751 mpz_clear (LST_LOOP_MEMORY_STRIDES (lst));
752 LST_SEQ (lst).release ();
766 if (LST_LOOP_P (lst))
773 for (i = 0; LST_SEQ (lst).iterate (i, &l); i++)
791 gcc_assert (LST_LOOP_P (lst));
793 LST_LOOP_FATHER (l) = lst;
809 if (!LST_LOOP_FATHER (lst))
812 return lst_depth (LST_LOOP_FATHER (lst)) + 1;
826 if (!LST_LOOP_FATHER (lst))
829 FOR_EACH_VEC_ELT (LST_SEQ (LST_LOOP_FATHER (lst)), i, l)
841 gcc_assert (lst && depth >= 0 &&
lst_depth (lst) <= depth);
858 if (!lst || !LST_LOOP_FATHER (lst))
865 father = LST_LOOP_FATHER (lst);
866 return LST_SEQ (father)[dewey - 1];
878 if (!lst || !LST_LOOP_FATHER (lst))
882 father = LST_LOOP_FATHER (lst);
884 if (LST_SEQ (father).length () == (
unsigned) dewey + 1)
887 return LST_SEQ (father)[dewey + 1];
902 if (!LST_LOOP_P (lst))
903 return (pbb == LST_PBB (lst)) ? lst : NULL;
905 for (i = 0; LST_SEQ (lst).iterate (i, &l); i++)
921 lst_p
loop = LST_LOOP_FATHER (stmt);
923 gcc_assert (loop_depth >= 0);
926 loop = LST_LOOP_FATHER (loop);
942 if (!LST_LOOP_P (lst))
945 for (i = 0; LST_SEQ (lst).iterate (i, &l); i++)
975 if (!LST_LOOP_P (lst))
978 for (i = 0; LST_SEQ (lst).iterate (i, &l); i++)
996 if (!loop || !lst || !LST_LOOP_P (loop))
1027 seq.quick_push (loop);
1029 LST_LOOP_FATHER (loop) = res;
1039 lst_p father = LST_LOOP_FATHER (lst);
1042 gcc_assert (lst && father && dewey >= 0);
1044 LST_SEQ (father).ordered_remove (dewey);
1045 LST_LOOP_FATHER (lst) = NULL;
1053 lst_p l, father = LST_LOOP_FATHER (lst);
1056 gcc_assert (lst && father && dewey >= 0);
1058 LST_SEQ (father).ordered_remove (dewey);
1059 LST_LOOP_FATHER (lst) = NULL;
1061 FOR_EACH_VEC_ELT (LST_SEQ (lst), i, l)
1063 LST_SEQ (father).safe_insert (dewey + i, l);
1064 LST_LOOP_FATHER (l) = father;
1077 gcc_assert (LST_LOOP_P (lst));
1088 isl_space *d = isl_map_get_space (pbb->
transformed);
1089 isl_space *
d1 = isl_space_range (d);
1090 unsigned i, n = isl_space_dim (d1, isl_dim_out);
1091 isl_space *
d2 = isl_space_add_dims (d1, isl_dim_in, n);
1092 isl_map *x = isl_map_universe (d2);
1094 x = isl_map_fix_si (x, isl_dim_out, sched, dewey);
1096 for (i = 0; i < n; i++)
1098 x = isl_map_equate (x, isl_dim_in, i, isl_dim_out, i);
1112 gcc_assert (lst && level >= 0 && dewey >= 0);
1114 if (LST_LOOP_P (lst))
1115 for (i = 0; LST_SEQ (lst).iterate (i, &l); i++)
1133 if (LST_LOOP_FATHER (lst))
1135 lst_p father = LST_LOOP_FATHER (lst);
1139 gcc_assert (lst && father && dewey >= 0 && level >= 0);
1141 for (i = dewey; LST_SEQ (father).iterate (i, &l); i++)
1145 if (LST_LOOP_P (lst))
1146 for (i = 0; LST_SEQ (lst).iterate (i, &l); i++)
1163 father = LST_LOOP_FATHER (lst2);
1166 gcc_assert (lst2 && father && dewey >= 0);
1168 LST_SEQ (father).safe_insert (before ? dewey : dewey + 1, lst1);
1169 LST_LOOP_FATHER (lst1) = father;
1183 father = LST_LOOP_FATHER (lst1);
1185 LST_LOOP_FATHER (lst2) = father;
1186 LST_SEQ (father)[dewey] = lst2;
1202 gcc_assert (lst && root != lst);
1204 if (!LST_LOOP_P (root))
1209 for (i = 0; LST_SEQ (root).iterate (i, &l); i++)
1235 gcc_assert (lst && loop && LST_LOOP_P (loop) && nb_loops > 0);
1251 if (!loop || !LST_LOOP_P (loop))
1254 for (i = 0; LST_SEQ (loop).iterate (i, &l);)
1259 if (LST_SEQ (l).length () == 0)
1261 LST_SEQ (loop).ordered_remove (i);
1271 if (LST_PBB (l) == pbb)
1274 LST_SEQ (loop).ordered_remove (i);
1277 else if (LST_PBB (l) == pbb)
1280 LST_SEQ (loop).ordered_remove (i);
1300 if (!loop || !LST_LOOP_P (loop))
1303 for (i = 0; LST_SEQ (loop).iterate (i, &l);)
1308 if (LST_SEQ (l).length () == 0)
1310 LST_SEQ (loop).ordered_remove (i);
1319 if (before && LST_PBB (l) != pbb)
1321 LST_SEQ (loop).ordered_remove (i);
1328 if (LST_PBB (l) == pbb)
1329 before = before ?
false :
true;
1384 #define SCOP_BBS(S) (S->bbs)
1385 #define SCOP_REGION(S) ((sese) S->region)
1386 #define SCOP_CONTEXT(S) (NULL)
1387 #define SCOP_ORIGINAL_SCHEDULE(S) (S->original_schedule)
1388 #define SCOP_TRANSFORMED_SCHEDULE(S) (S->transformed_schedule)
1389 #define SCOP_SAVED_SCHEDULE(S) (S->saved_schedule)
1390 #define POLY_SCOP_P(S) (S->poly_scop_p)
1433 static inline poly_scattering_p
1453 static inline poly_scattering_p
1468 isl_map_free (pbb->
saved);
1477 if (SCOP_SAVED_SCHEDULE (scop))
1478 free_lst (SCOP_SAVED_SCHEDULE (scop));
1480 SCOP_SAVED_SCHEDULE (scop) =
copy_lst (SCOP_TRANSFORMED_SCHEDULE (scop));
1488 if (SCOP_TRANSFORMED_SCHEDULE (scop))
1489 free_lst (SCOP_TRANSFORMED_SCHEDULE (scop));
1491 SCOP_TRANSFORMED_SCHEDULE (scop) =
copy_lst (SCOP_SAVED_SCHEDULE (scop));
1502 for (i = 0; SCOP_BBS (scop).iterate (i, &pbb); i++)
1513 gcc_assert (pbb->
saved);
1527 for (i = 0; SCOP_BBS (scop).iterate (i, &pbb); i++)
1536 __isl_give isl_union_map *
extend_schedule (__isl_take isl_union_map *);
1541 isl_union_map **must_raw,
1542 isl_union_map **may_raw,
1543 isl_union_map **must_raw_no_source,
1544 isl_union_map **may_raw_no_source,
1545 isl_union_map **must_war,
1546 isl_union_map **may_war,
1547 isl_union_map **must_war_no_source,
1548 isl_union_map **may_war_no_source,
1549 isl_union_map **must_waw,
1550 isl_union_map **may_waw,
1551 isl_union_map **must_waw_no_source,
1552 isl_union_map **may_waw_no_source);