diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-27 19:07:04 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-27 19:07:04 +0000 |
commit | 4cc0f4e24a4686090e9803da8026c7dbd7b8c158 (patch) | |
tree | 880a7c9f5b8523640dba320e719c4decf87758ed /gcc/graphite-poly.h | |
parent | 8416894787605a641b2831f97e3830d848c2facf (diff) | |
download | gcc-4cc0f4e24a4686090e9803da8026c7dbd7b8c158.tar.gz |
remove -floop-* flags
2015-08-27 Sebastian Pop <s.pop@samsung.com>
* Makefile.in (OBJS): Remove graphite-blocking.o and
graphite-interchange.o.
* common.opt (floop-strip-mine, floop-interchange, floop-block):
Alias of floop-nest-optimize.
* doc/invoke.texi (floop-strip-mine, floop-interchange, floop-block):
Document as alias of -floop-nest-optimize.
* graphite-blocking.c: Remove.
* graphite-interchange.c: Remove.
* graphite-optimize-isl.c: Include dumpfile.h.
(getScheduleForBand): Add dump for tiled loops. Use
PARAM_LOOP_BLOCK_TILE_SIZE instead of hard coded constant.
* graphite-poly.c (scop_max_loop_depth): Remove.
(print_scattering_function_1): Remove.
(print_scattering_function): Remove.
(print_scattering_functions): Remove.
(debug_scattering_function): Remove.
(debug_scattering_functions): Remove.
(apply_poly_transforms): Remove use of flag_loop_block,
flag_loop_strip_mine, and flag_loop_interchange.
(new_poly_bb): Remove use of PBB_TRANSFORMED, PBB_SAVED, and
PBB_ORIGINAL.
(print_pdr_access_layout): Remove.
(print_pdr): Print ISL representation.
(new_scop): Remove use of SCOP_ORIGINAL_SCHEDULE,
SCOP_TRANSFORMED_SCHEDULE, and SCOP_SAVED_SCHEDULE.
(free_scop): Same.
(openscop_print_pbb_domain): Remove.
(print_pbb): Remove call to print_scattering_function.
(openscop_print_scop_context): Remove.
(print_scop_context): Do not print matrices anymore.
(print_scop): Do not print SCOP_ORIGINAL_SCHEDULE and
SCOP_TRANSFORMED_SCHEDULE.
(print_isl_set): Add printing of a new line.
(print_isl_map): Same.
(print_isl_aff): Same.
(print_isl_constraint): Same.
(loop_to_lst): Remove.
(scop_to_lst): Remove.
(lst_indent_to): Remove.
(print_lst): Remove.
(debug_lst): Remove.
(dot_lst_1): Remove.
(dot_lst): Remove.
(reverse_loop_at_level): Remove.
(reverse_loop_for_pbbs): Remove.
* graphite-poly.h (pdr_dim_iter_domain): Remove.
(pdr_nb_params): Remove.
(pdr_alias_set_dim): Remove.
(pdr_subscript_dim): Remove.
(pdr_iterator_dim): Remove.
(pdr_parameter_dim): Remove.
(same_pdr_p): Remove.
(struct poly_scattering): Remove.
(struct poly_bb): Remove _original, _transformed, _saved.
(PBB_DOMAIN, PBB_ORIGINAL, PBB_ORIGINAL_SCATTERING): Remove.
(PBB_TRANSFORMED, PBB_TRANSFORMED_SCATTERING, PBB_SAVED): Remove.
(PBB_NB_LOCAL_VARIABLES): Remove.
(PBB_NB_SCATTERING_TRANSFORM): Remove.
(schedule_to_scattering): Remove.
(number_of_write_pdrs): Remove.
(pbb_dim_iter_domain): Remove.
(pbb_nb_params): Remove.
(pbb_nb_scattering_orig): Remove.
(pbb_nb_scattering_transform): Remove.
(pbb_nb_dynamic_scattering_transform): Remove.
(pbb_nb_local_vars): Remove.
(pbb_iterator_dim): Remove.
(pbb_parameter_dim): Remove.
(psco_scattering_dim): Remove.
(psct_scattering_dim): Remove.
(psct_local_var_dim): Remove.
(psco_iterator_dim): Remove.
(psct_iterator_dim): Remove.
(psco_parameter_dim): Remove.
(psct_parameter_dim): Remove.
(psct_dynamic_dim): Remove.
(psct_static_dim): Remove.
(psct_add_local_variable): Remove.
(new_lst_loop): Remove.
(new_lst_stmt): Remove.
(free_lst): Remove.
(copy_lst): Remove.
(lst_add_loop_under_loop): Remove.
(lst_depth): Remove.
(lst_dewey_number): Remove.
(lst_dewey_number_at_depth): Remove.
(lst_pred): Remove.
(lst_succ): Remove.
(lst_find_pbb): Remove.
(find_lst_loop): Remove.
(lst_find_first_pbb): Remove.
(lst_empty_p): Remove.
(lst_find_last_pbb): Remove.
(lst_contains_p): Remove.
(lst_contains_pbb): Remove.
(lst_create_nest): Remove.
(lst_remove_from_sequence): Remove.
(lst_remove_loop_and_inline_stmts_in_loop_father): Remove.
(lst_niter_for_loop): Remove.
(pbb_update_scattering): Remove.
(lst_update_scattering_under): Remove.
(lst_update_scattering): Remove.
(lst_insert_in_sequence): Remove.
(lst_replace): Remove.
(lst_substitute_3): Remove.
(lst_distribute_lst): Remove.
(lst_remove_all_before_including_pbb): Remove.
(lst_remove_all_before_excluding_pbb): Remove.
(struct scop): Remove original_schedule, transformed_schedule, and
saved_schedule.
(SCOP_ORIGINAL_SCHEDULE, SCOP_TRANSFORMED_SCHEDULE): Remove.
(SCOP_SAVED_SCHEDULE): Remove.
(poly_scattering_new): Remove.
(poly_scattering_free): Remove.
(poly_scattering_copy): Remove.
(store_scattering_pbb): Remove.
(store_lst_schedule): Remove.
(restore_lst_schedule): Remove.
(store_scattering): Remove.
(restore_scattering_pbb): Remove.
(restore_scattering): Remove.
* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons):
Remove scattering_dimensions. Do not use pbb_dim_iter_domain:
compute the scattering polyhedron dimension from the dimension of
pbb->domain.
(build_scop_scattering): Update call to
build_pbb_scattering_polyhedrons.
(build_poly_scop): Remove call to scop_to_lst.
* graphite.c (graphite_transform_loops): Add call to print_scop.
(gate_graphite_transforms): Remove use of flag_loop_block,
flag_loop_interchange, and flag_loop_strip_mine.
testsuite/
* gcc.dg/graphite/graphite.exp (interchange_files, block_files):
Replaced by opt_files, compile with -floop-nest-optimize.
* g++.dg/graphite/graphite.exp: Same.
* gfortran.dg/graphite/graphite.exp: Same.
* gcc.dg/graphite/block-0.c: Adjust pattern.
* gcc.dg/graphite/block-1.c: Same.
* gcc.dg/graphite/block-3.c: Same.
* gcc.dg/graphite/block-4.c: Same.
* gcc.dg/graphite/block-5.c: Same.
* gcc.dg/graphite/block-6.c: Same.
* gcc.dg/graphite/block-7.c: Same.
* gcc.dg/graphite/block-8.c: Same.
* gcc.dg/graphite/block-pr47654.c: Same.
* gcc.dg/graphite/interchange-0.c: Same.
* gcc.dg/graphite/interchange-1.c: Same.
* gcc.dg/graphite/interchange-10.c: Same.
* gcc.dg/graphite/interchange-11.c: Same.
* gcc.dg/graphite/interchange-12.c: Same.
* gcc.dg/graphite/interchange-13.c: Same.
* gcc.dg/graphite/interchange-14.c: Same.
* gcc.dg/graphite/interchange-15.c: Same.
* gcc.dg/graphite/interchange-3.c: Same.
* gcc.dg/graphite/interchange-4.c: Same.
* gcc.dg/graphite/interchange-5.c: Same.
* gcc.dg/graphite/interchange-6.c: Same.
* gcc.dg/graphite/interchange-7.c: Same.
* gcc.dg/graphite/interchange-8.c: Same.
* gcc.dg/graphite/interchange-9.c: Same.
* gcc.dg/graphite/interchange-mvt.c: Same.
* gcc.dg/graphite/pr37485.c: Same.
* gcc.dg/graphite/uns-block-1.c: Same.
* gcc.dg/graphite/uns-interchange-12.c: Same.
* gcc.dg/graphite/uns-interchange-14.c: Same.
* gcc.dg/graphite/uns-interchange-15.c: Same.
* gcc.dg/graphite/uns-interchange-9.c: Same.
* gcc.dg/graphite/uns-interchange-mvt.c: Same.
* gfortran.dg/graphite/interchange-3.f90: Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227277 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-poly.h')
-rw-r--r-- | gcc/graphite-poly.h | 1082 |
1 files changed, 0 insertions, 1082 deletions
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h index 29813e0a6ec..3bd22f05ae8 100644 --- a/gcc/graphite-poly.h +++ b/gcc/graphite-poly.h @@ -37,8 +37,6 @@ typedef struct scop *scop_p; typedef unsigned graphite_dim_t; -static inline graphite_dim_t pbb_dim_iter_domain (const struct poly_bb *); -static inline graphite_dim_t pbb_nb_params (const struct poly_bb *); static inline graphite_dim_t scop_nb_params (scop_p); /* A data reference can write or read some memory or we @@ -206,63 +204,6 @@ void new_poly_dr (poly_bb_p, int, enum poly_dr_type, void *, void free_poly_dr (poly_dr_p); void debug_pdr (poly_dr_p, int); void print_pdr (FILE *, poly_dr_p, int); -static inline scop_p pdr_scop (poly_dr_p pdr); - -/* The dimension of the iteration domain of the scop of PDR. */ - -static inline graphite_dim_t -pdr_dim_iter_domain (poly_dr_p pdr) -{ - return pbb_dim_iter_domain (PDR_PBB (pdr)); -} - -/* The number of parameters of the scop of PDR. */ - -static inline graphite_dim_t -pdr_nb_params (poly_dr_p pdr) -{ - return scop_nb_params (pdr_scop (pdr)); -} - -/* The dimension of the alias set in PDR. */ - -static inline graphite_dim_t -pdr_alias_set_dim (poly_dr_p pdr) -{ - poly_bb_p pbb = PDR_PBB (pdr); - - return pbb_dim_iter_domain (pbb) + pbb_nb_params (pbb); -} - -/* The dimension in PDR containing subscript S. */ - -static inline graphite_dim_t -pdr_subscript_dim (poly_dr_p pdr, graphite_dim_t s) -{ - poly_bb_p pbb = PDR_PBB (pdr); - - return pbb_dim_iter_domain (pbb) + pbb_nb_params (pbb) + 1 + s; -} - -/* The dimension in PDR containing the loop iterator ITER. */ - -static inline graphite_dim_t -pdr_iterator_dim (poly_dr_p pdr ATTRIBUTE_UNUSED, graphite_dim_t iter) -{ - return iter; -} - -/* The dimension in PDR containing parameter PARAM. */ - -static inline graphite_dim_t -pdr_parameter_dim (poly_dr_p pdr, graphite_dim_t param) -{ - poly_bb_p pbb = PDR_PBB (pdr); - - return pbb_dim_iter_domain (pbb) + param; -} - -/* Returns true when PDR is a "read". */ static inline bool pdr_read_p (poly_dr_p pdr) @@ -286,27 +227,6 @@ pdr_may_write_p (poly_dr_p pdr) return PDR_TYPE (pdr) == PDR_MAY_WRITE; } -/* Return true when PDR1 and PDR2 are similar data accesses: they have - the same base array, and the same access functions. */ - -static inline bool -same_pdr_p (poly_dr_p pdr1, poly_dr_p pdr2) -{ - return PDR_NB_SUBSCRIPTS (pdr1) == PDR_NB_SUBSCRIPTS (pdr2) - && PDR_BASE_OBJECT_SET (pdr1) == PDR_BASE_OBJECT_SET (pdr2); -} - -typedef struct poly_scattering *poly_scattering_p; - -struct poly_scattering -{ - /* The number of local variables. */ - int nb_local_variables; - - /* The number of scattering dimensions. */ - int nb_scattering; -}; - /* POLY_BB represents a blackbox in the polyhedral model. */ struct poly_bb @@ -345,15 +265,12 @@ struct poly_bb vec<poly_dr_p> drs; /* The original scattering. */ - poly_scattering_p _original; isl_map *schedule; /* The transformed scattering. */ - poly_scattering_p _transformed; isl_map *transformed; /* A copy of the transformed scattering. */ - poly_scattering_p _saved; isl_map *saved; /* True when this PBB contains only a reduction statement. */ @@ -362,24 +279,12 @@ struct poly_bb #define PBB_BLACK_BOX(PBB) ((gimple_bb_p) PBB->black_box) #define PBB_SCOP(PBB) (PBB->scop) -#define PBB_DOMAIN(PBB) (NULL) #define PBB_DRS(PBB) (PBB->drs) -#define PBB_ORIGINAL(PBB) (PBB->_original) -#define PBB_ORIGINAL_SCATTERING(PBB) (NULL) -#define PBB_TRANSFORMED(PBB) (PBB->_transformed) -#define PBB_TRANSFORMED_SCATTERING(PBB) (NULL) -#define PBB_SAVED(PBB) (PBB->_saved) -/* XXX isl if we ever need local vars in the scatter, we can't use the - out dimension of transformed to count the scatterting transform dimension. - */ -#define PBB_NB_LOCAL_VARIABLES(PBB) (0) -#define PBB_NB_SCATTERING_TRANSFORM(PBB) (isl_map_n_out (PBB->transformed)) #define PBB_IS_REDUCTION(PBB) (PBB->is_reduction) extern poly_bb_p new_poly_bb (scop_p, void *); extern void free_poly_bb (poly_bb_p); extern void debug_loop_vec (poly_bb_p); -extern void schedule_to_scattering (poly_bb_p, int); extern void print_pbb_domain (FILE *, poly_bb_p, int); extern void print_pbb (FILE *, poly_bb_p, int); extern void print_scop_context (FILE *, scop_p, int); @@ -412,22 +317,6 @@ extern bool optimize_isl (scop_p); extern void pbb_number_of_iterations_at_time (poly_bb_p, graphite_dim_t, mpz_t); extern void debug_gmp_value (mpz_t); -/* Return the number of write data references in PBB. */ - -static inline int -number_of_write_pdrs (poly_bb_p pbb) -{ - int res = 0; - int i; - poly_dr_p pdr; - - for (i = 0; PBB_DRS (pbb).iterate (i, &pdr); i++) - if (PDR_TYPE (pdr) == PDR_WRITE) - res++; - - return res; -} - /* Returns a gimple_bb from BB. */ static inline gimple_bb_p @@ -452,8 +341,6 @@ pbb_bb (poly_bb_p pbb) return GBB_BB (PBB_BLACK_BOX (pbb)); } -/* The index of the PBB. */ - static inline int pbb_index (poly_bb_p pbb) { @@ -484,859 +371,6 @@ pbb_set_black_box (poly_bb_p pbb, void *black_box) pbb->black_box = black_box; } -/* The number of loops around PBB: the dimension of the iteration - domain. */ - -static inline graphite_dim_t -pbb_dim_iter_domain (const struct poly_bb *pbb) -{ - return isl_set_dim (pbb->domain, isl_dim_set); -} - -/* The number of params defined in PBB. */ - -static inline graphite_dim_t -pbb_nb_params (const struct poly_bb *pbb) -{ - scop_p scop = PBB_SCOP (pbb); - - return scop_nb_params (scop); -} - -/* The number of scattering dimensions in the SCATTERING polyhedron - of a PBB for a given SCOP. */ - -static inline graphite_dim_t -pbb_nb_scattering_orig (const struct poly_bb *pbb) -{ - return 2 * pbb_dim_iter_domain (pbb) + 1; -} - -/* The number of scattering dimensions in PBB. */ - -static inline graphite_dim_t -pbb_nb_scattering_transform (const struct poly_bb *pbb) -{ - return PBB_NB_SCATTERING_TRANSFORM (pbb); -} - -/* The number of dynamic scattering dimensions in PBB. */ - -static inline graphite_dim_t -pbb_nb_dynamic_scattering_transform (const struct poly_bb *pbb) -{ - /* This function requires the 2d + 1 scattering format to be - invariant during all transformations. */ - gcc_assert (PBB_NB_SCATTERING_TRANSFORM (pbb) % 2); - return PBB_NB_SCATTERING_TRANSFORM (pbb) / 2; -} - -/* Returns the number of local variables used in the transformed - scattering polyhedron of PBB. */ - -static inline graphite_dim_t -pbb_nb_local_vars (const struct poly_bb *pbb ATTRIBUTE_UNUSED) -{ - /* For now we do not have any local variables, as we do not do strip - mining for example. */ - return PBB_NB_LOCAL_VARIABLES (pbb); -} - -/* The dimension in the domain of PBB containing the iterator ITER. */ - -static inline graphite_dim_t -pbb_iterator_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t iter) -{ - return iter; -} - -/* The dimension in the domain of PBB containing the iterator ITER. */ - -static inline graphite_dim_t -pbb_parameter_dim (poly_bb_p pbb, graphite_dim_t param) -{ - return param - + pbb_dim_iter_domain (pbb); -} - -/* The dimension in the original scattering polyhedron of PBB - containing the scattering iterator SCATTER. */ - -static inline graphite_dim_t -psco_scattering_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t scatter) -{ - gcc_assert (scatter < pbb_nb_scattering_orig (pbb)); - return scatter; -} - -/* The dimension in the transformed scattering polyhedron of PBB - containing the scattering iterator SCATTER. */ - -static inline graphite_dim_t -psct_scattering_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t scatter) -{ - gcc_assert (scatter <= pbb_nb_scattering_transform (pbb)); - return scatter; -} - -/* The dimension in the transformed scattering polyhedron of PBB of - the local variable LV. */ - -static inline graphite_dim_t -psct_local_var_dim (poly_bb_p pbb, graphite_dim_t lv) -{ - gcc_assert (lv <= pbb_nb_local_vars (pbb)); - return lv + pbb_nb_scattering_transform (pbb); -} - -/* The dimension in the original scattering polyhedron of PBB - containing the loop iterator ITER. */ - -static inline graphite_dim_t -psco_iterator_dim (poly_bb_p pbb, graphite_dim_t iter) -{ - gcc_assert (iter < pbb_dim_iter_domain (pbb)); - return iter + pbb_nb_scattering_orig (pbb); -} - -/* The dimension in the transformed scattering polyhedron of PBB - containing the loop iterator ITER. */ - -static inline graphite_dim_t -psct_iterator_dim (poly_bb_p pbb, graphite_dim_t iter) -{ - gcc_assert (iter < pbb_dim_iter_domain (pbb)); - return iter - + pbb_nb_scattering_transform (pbb) - + pbb_nb_local_vars (pbb); -} - -/* The dimension in the original scattering polyhedron of PBB - containing parameter PARAM. */ - -static inline graphite_dim_t -psco_parameter_dim (poly_bb_p pbb, graphite_dim_t param) -{ - gcc_assert (param < pbb_nb_params (pbb)); - return param - + pbb_nb_scattering_orig (pbb) - + pbb_dim_iter_domain (pbb); -} - -/* The dimension in the transformed scattering polyhedron of PBB - containing parameter PARAM. */ - -static inline graphite_dim_t -psct_parameter_dim (poly_bb_p pbb, graphite_dim_t param) -{ - gcc_assert (param < pbb_nb_params (pbb)); - return param - + pbb_nb_scattering_transform (pbb) - + pbb_nb_local_vars (pbb) - + pbb_dim_iter_domain (pbb); -} - -/* The scattering dimension of PBB corresponding to the dynamic level - LEVEL. */ - -static inline graphite_dim_t -psct_dynamic_dim (poly_bb_p pbb, graphite_dim_t level) -{ - graphite_dim_t result = 1 + 2 * level; - - gcc_assert (result < pbb_nb_scattering_transform (pbb)); - return result; -} - -/* The scattering dimension of PBB corresponding to the static - sequence of the loop level LEVEL. */ - -static inline graphite_dim_t -psct_static_dim (poly_bb_p pbb, graphite_dim_t level) -{ - graphite_dim_t result = 2 * level; - - gcc_assert (result < pbb_nb_scattering_transform (pbb)); - return result; -} - -/* Adds to the transformed scattering polyhedron of PBB a new local - variable and returns its index. */ - -static inline graphite_dim_t -psct_add_local_variable (poly_bb_p pbb ATTRIBUTE_UNUSED) -{ - gcc_unreachable (); - return 0; -} - -typedef struct lst *lst_p; - -/* Loops and Statements Tree. */ -struct lst { - - /* LOOP_P is true when an LST node is a loop. */ - bool loop_p; - - /* A pointer to the loop that contains this node. */ - lst_p loop_father; - - /* The sum of all the memory strides for an LST loop. */ - mpz_t memory_strides; - - /* Loop nodes contain a sequence SEQ of LST nodes, statements - contain a pointer to their polyhedral representation PBB. */ - union { - poly_bb_p pbb; - vec<lst_p> seq; - } node; -}; - -#define LST_LOOP_P(LST) ((LST)->loop_p) -#define LST_LOOP_FATHER(LST) ((LST)->loop_father) -#define LST_PBB(LST) ((LST)->node.pbb) -#define LST_SEQ(LST) ((LST)->node.seq) -#define LST_LOOP_MEMORY_STRIDES(LST) ((LST)->memory_strides) - -void scop_to_lst (scop_p); -void print_lst (FILE *, lst_p, int); -void debug_lst (lst_p); -void dot_lst (lst_p); - -/* Creates a new LST loop with SEQ. */ - -static inline lst_p -new_lst_loop (vec<lst_p> seq) -{ - lst_p lst = XNEW (struct lst); - int i; - lst_p l; - - LST_LOOP_P (lst) = true; - LST_SEQ (lst) = seq; - LST_LOOP_FATHER (lst) = NULL; - mpz_init (LST_LOOP_MEMORY_STRIDES (lst)); - mpz_set_si (LST_LOOP_MEMORY_STRIDES (lst), -1); - - for (i = 0; seq.iterate (i, &l); i++) - LST_LOOP_FATHER (l) = lst; - - return lst; -} - -/* Creates a new LST statement with PBB. */ - -static inline lst_p -new_lst_stmt (poly_bb_p pbb) -{ - lst_p lst = XNEW (struct lst); - - LST_LOOP_P (lst) = false; - LST_PBB (lst) = pbb; - LST_LOOP_FATHER (lst) = NULL; - return lst; -} - -/* Frees the memory used by LST. */ - -static inline void -free_lst (lst_p lst) -{ - if (!lst) - return; - - if (LST_LOOP_P (lst)) - { - int i; - lst_p l; - - for (i = 0; LST_SEQ (lst).iterate (i, &l); i++) - free_lst (l); - - mpz_clear (LST_LOOP_MEMORY_STRIDES (lst)); - LST_SEQ (lst).release (); - } - - free (lst); -} - -/* Returns a copy of LST. */ - -static inline lst_p -copy_lst (lst_p lst) -{ - if (!lst) - return NULL; - - if (LST_LOOP_P (lst)) - { - int i; - lst_p l; - vec<lst_p> seq; - seq.create (5); - - for (i = 0; LST_SEQ (lst).iterate (i, &l); i++) - seq.safe_push (copy_lst (l)); - - return new_lst_loop (seq); - } - - return new_lst_stmt (LST_PBB (lst)); -} - -/* Adds a new loop under the loop LST. */ - -static inline void -lst_add_loop_under_loop (lst_p lst) -{ - vec<lst_p> seq; - seq.create (1); - lst_p l = new_lst_loop (LST_SEQ (lst)); - - gcc_assert (LST_LOOP_P (lst)); - - LST_LOOP_FATHER (l) = lst; - seq.quick_push (l); - LST_SEQ (lst) = seq; -} - -/* Returns the loop depth of LST. */ - -static inline int -lst_depth (lst_p lst) -{ - if (!lst) - return -2; - - /* The depth of the outermost "fake" loop is -1. This outermost - loop does not have a loop father and it is just a container, as - in the loop representation of GCC. */ - if (!LST_LOOP_FATHER (lst)) - return -1; - - return lst_depth (LST_LOOP_FATHER (lst)) + 1; -} - -/* Returns the Dewey number for LST. */ - -static inline int -lst_dewey_number (lst_p lst) -{ - int i; - lst_p l; - - if (!lst) - return -1; - - if (!LST_LOOP_FATHER (lst)) - return 0; - - FOR_EACH_VEC_ELT (LST_SEQ (LST_LOOP_FATHER (lst)), i, l) - if (l == lst) - return i; - - return -1; -} - -/* Returns the Dewey number of LST at depth DEPTH. */ - -static inline int -lst_dewey_number_at_depth (lst_p lst, int depth) -{ - gcc_assert (lst && depth >= 0 && lst_depth (lst) <= depth); - - if (lst_depth (lst) == depth) - return lst_dewey_number (lst); - - return lst_dewey_number_at_depth (LST_LOOP_FATHER (lst), depth); -} - -/* Returns the predecessor of LST in the sequence of its loop father. - Returns NULL if LST is the first statement in the sequence. */ - -static inline lst_p -lst_pred (lst_p lst) -{ - int dewey; - lst_p father; - - if (!lst || !LST_LOOP_FATHER (lst)) - return NULL; - - dewey = lst_dewey_number (lst); - if (dewey == 0) - return NULL; - - father = LST_LOOP_FATHER (lst); - return LST_SEQ (father)[dewey - 1]; -} - -/* Returns the successor of LST in the sequence of its loop father. - Returns NULL if there is none. */ - -static inline lst_p -lst_succ (lst_p lst) -{ - int dewey; - lst_p father; - - if (!lst || !LST_LOOP_FATHER (lst)) - return NULL; - - dewey = lst_dewey_number (lst); - father = LST_LOOP_FATHER (lst); - - if (LST_SEQ (father).length () == (unsigned) dewey + 1) - return NULL; - - return LST_SEQ (father)[dewey + 1]; -} - - -/* Return the LST node corresponding to PBB. */ - -static inline lst_p -lst_find_pbb (lst_p lst, poly_bb_p pbb) -{ - int i; - lst_p l; - - if (!lst) - return NULL; - - if (!LST_LOOP_P (lst)) - return (pbb == LST_PBB (lst)) ? lst : NULL; - - for (i = 0; LST_SEQ (lst).iterate (i, &l); i++) - { - lst_p res = lst_find_pbb (l, pbb); - if (res) - return res; - } - - return NULL; -} - -/* Return the LST node corresponding to the loop around STMT at depth - LOOP_DEPTH. */ - -static inline lst_p -find_lst_loop (lst_p stmt, int loop_depth) -{ - lst_p loop = LST_LOOP_FATHER (stmt); - - gcc_assert (loop_depth >= 0); - - while (loop_depth < lst_depth (loop)) - loop = LST_LOOP_FATHER (loop); - - return loop; -} - -/* Return the first LST representing a PBB statement in LST. */ - -static inline lst_p -lst_find_first_pbb (lst_p lst) -{ - int i; - lst_p l; - - if (!lst) - return NULL; - - if (!LST_LOOP_P (lst)) - return lst; - - for (i = 0; LST_SEQ (lst).iterate (i, &l); i++) - { - lst_p res = lst_find_first_pbb (l); - if (res) - return res; - } - - return NULL; -} - -/* Returns true when LST is a loop that does not contain - statements. */ - -static inline bool -lst_empty_p (lst_p lst) -{ - return !lst_find_first_pbb (lst); -} - -/* Return the last LST representing a PBB statement in LST. */ - -static inline lst_p -lst_find_last_pbb (lst_p lst) -{ - int i; - lst_p l, res = NULL; - - if (!lst) - return NULL; - - if (!LST_LOOP_P (lst)) - return lst; - - for (i = 0; LST_SEQ (lst).iterate (i, &l); i++) - { - lst_p last = lst_find_last_pbb (l); - - if (last) - res = last; - } - - gcc_assert (res); - return res; -} - -/* Returns true if LOOP contains LST, in other words, if LST is nested - in LOOP. */ - -static inline bool -lst_contains_p (lst_p loop, lst_p lst) -{ - if (!loop || !lst || !LST_LOOP_P (loop)) - return false; - - if (loop == lst) - return true; - - return lst_contains_p (loop, LST_LOOP_FATHER (lst)); -} - -/* Returns true if LOOP contains PBB, in other words, if PBB is nested - in LOOP. */ - -static inline bool -lst_contains_pbb (lst_p loop, poly_bb_p pbb) -{ - return lst_find_pbb (loop, pbb) ? true : false; -} - -/* Creates a loop nest of depth NB_LOOPS containing LST. */ - -static inline lst_p -lst_create_nest (int nb_loops, lst_p lst) -{ - lst_p res, loop; - vec<lst_p> seq; - - if (nb_loops == 0) - return lst; - - seq.create (1); - loop = lst_create_nest (nb_loops - 1, lst); - seq.quick_push (loop); - res = new_lst_loop (seq); - LST_LOOP_FATHER (loop) = res; - - return res; -} - -/* Removes LST from the sequence of statements of its loop father. */ - -static inline void -lst_remove_from_sequence (lst_p lst) -{ - lst_p father = LST_LOOP_FATHER (lst); - int dewey = lst_dewey_number (lst); - - gcc_assert (lst && father && dewey >= 0); - - LST_SEQ (father).ordered_remove (dewey); - LST_LOOP_FATHER (lst) = NULL; -} - -/* Removes the loop LST and inline its body in the father loop. */ - -static inline void -lst_remove_loop_and_inline_stmts_in_loop_father (lst_p lst) -{ - lst_p l, father = LST_LOOP_FATHER (lst); - int i, dewey = lst_dewey_number (lst); - - gcc_assert (lst && father && dewey >= 0); - - LST_SEQ (father).ordered_remove (dewey); - LST_LOOP_FATHER (lst) = NULL; - - FOR_EACH_VEC_ELT (LST_SEQ (lst), i, l) - { - LST_SEQ (father).safe_insert (dewey + i, l); - LST_LOOP_FATHER (l) = father; - } -} - -/* Sets NITER to the upper bound approximation of the number of - iterations of loop LST. */ - -static inline void -lst_niter_for_loop (lst_p lst, mpz_t niter) -{ - int depth = lst_depth (lst); - poly_bb_p pbb = LST_PBB (lst_find_first_pbb (lst)); - - gcc_assert (LST_LOOP_P (lst)); - pbb_number_of_iterations_at_time (pbb, psct_dynamic_dim (pbb, depth), niter); -} - -/* Updates the scattering of PBB to be at the DEWEY number in the loop - at depth LEVEL. */ - -static inline void -pbb_update_scattering (poly_bb_p pbb, graphite_dim_t level, int dewey) -{ - graphite_dim_t sched = psct_static_dim (pbb, level); - isl_space *d = isl_map_get_space (pbb->transformed); - isl_space *d1 = isl_space_range (d); - unsigned i, n = isl_space_dim (d1, isl_dim_out); - isl_space *d2 = isl_space_add_dims (d1, isl_dim_in, n); - isl_map *x = isl_map_universe (d2); - - x = isl_map_fix_si (x, isl_dim_out, sched, dewey); - - for (i = 0; i < n; i++) - if (i != sched) - x = isl_map_equate (x, isl_dim_in, i, isl_dim_out, i); - - pbb->transformed = isl_map_apply_range (pbb->transformed, x); -} - -/* Updates the scattering of all the PBBs under LST to be at the DEWEY - number in the loop at depth LEVEL. */ - -static inline void -lst_update_scattering_under (lst_p lst, int level, int dewey) -{ - int i; - lst_p l; - - gcc_assert (lst && level >= 0 && dewey >= 0); - - if (LST_LOOP_P (lst)) - for (i = 0; LST_SEQ (lst).iterate (i, &l); i++) - lst_update_scattering_under (l, level, dewey); - else - pbb_update_scattering (LST_PBB (lst), level, dewey); -} - -/* Updates the all the scattering levels of all the PBBs under - LST. */ - -static inline void -lst_update_scattering (lst_p lst) -{ - int i; - lst_p l; - - if (!lst) - return; - - if (LST_LOOP_FATHER (lst)) - { - lst_p father = LST_LOOP_FATHER (lst); - int dewey = lst_dewey_number (lst); - int level = lst_depth (lst); - - gcc_assert (lst && father && dewey >= 0 && level >= 0); - - for (i = dewey; LST_SEQ (father).iterate (i, &l); i++) - lst_update_scattering_under (l, level, i); - } - - if (LST_LOOP_P (lst)) - for (i = 0; LST_SEQ (lst).iterate (i, &l); i++) - lst_update_scattering (l); -} - -/* Inserts LST1 before LST2 if BEFORE is true; inserts LST1 after LST2 - if BEFORE is false. */ - -static inline void -lst_insert_in_sequence (lst_p lst1, lst_p lst2, bool before) -{ - lst_p father; - int dewey; - - /* Do not insert empty loops. */ - if (!lst1 || lst_empty_p (lst1)) - return; - - father = LST_LOOP_FATHER (lst2); - dewey = lst_dewey_number (lst2); - - gcc_assert (lst2 && father && dewey >= 0); - - LST_SEQ (father).safe_insert (before ? dewey : dewey + 1, lst1); - LST_LOOP_FATHER (lst1) = father; -} - -/* Replaces LST1 with LST2. */ - -static inline void -lst_replace (lst_p lst1, lst_p lst2) -{ - lst_p father; - int dewey; - - if (!lst2 || lst_empty_p (lst2)) - return; - - father = LST_LOOP_FATHER (lst1); - dewey = lst_dewey_number (lst1); - LST_LOOP_FATHER (lst2) = father; - LST_SEQ (father)[dewey] = lst2; -} - -/* Returns a copy of ROOT where LST has been replaced by a copy of the - LSTs A B C in this sequence. */ - -static inline lst_p -lst_substitute_3 (lst_p root, lst_p lst, lst_p a, lst_p b, lst_p c) -{ - int i; - lst_p l; - vec<lst_p> seq; - - if (!root) - return NULL; - - gcc_assert (lst && root != lst); - - if (!LST_LOOP_P (root)) - return new_lst_stmt (LST_PBB (root)); - - seq.create (5); - - for (i = 0; LST_SEQ (root).iterate (i, &l); i++) - if (l != lst) - seq.safe_push (lst_substitute_3 (l, lst, a, b, c)); - else - { - if (!lst_empty_p (a)) - seq.safe_push (copy_lst (a)); - if (!lst_empty_p (b)) - seq.safe_push (copy_lst (b)); - if (!lst_empty_p (c)) - seq.safe_push (copy_lst (c)); - } - - return new_lst_loop (seq); -} - -/* Moves LST before LOOP if BEFORE is true, and after the LOOP if - BEFORE is false. */ - -static inline void -lst_distribute_lst (lst_p loop, lst_p lst, bool before) -{ - int loop_depth = lst_depth (loop); - int depth = lst_depth (lst); - int nb_loops = depth - loop_depth; - - gcc_assert (lst && loop && LST_LOOP_P (loop) && nb_loops > 0); - - lst_remove_from_sequence (lst); - lst_insert_in_sequence (lst_create_nest (nb_loops, lst), loop, before); -} - -/* Removes from LOOP all the statements before/after and including PBB - if BEFORE is true/false. Returns the negation of BEFORE when the - statement PBB has been found. */ - -static inline bool -lst_remove_all_before_including_pbb (lst_p loop, poly_bb_p pbb, bool before) -{ - int i; - lst_p l; - - if (!loop || !LST_LOOP_P (loop)) - return before; - - for (i = 0; LST_SEQ (loop).iterate (i, &l);) - if (LST_LOOP_P (l)) - { - before = lst_remove_all_before_including_pbb (l, pbb, before); - - if (LST_SEQ (l).length () == 0) - { - LST_SEQ (loop).ordered_remove (i); - free_lst (l); - } - else - i++; - } - else - { - if (before) - { - if (LST_PBB (l) == pbb) - before = false; - - LST_SEQ (loop).ordered_remove (i); - free_lst (l); - } - else if (LST_PBB (l) == pbb) - { - before = true; - LST_SEQ (loop).ordered_remove (i); - free_lst (l); - } - else - i++; - } - - return before; -} - -/* Removes from LOOP all the statements before/after and excluding PBB - if BEFORE is true/false; Returns the negation of BEFORE when the - statement PBB has been found. */ - -static inline bool -lst_remove_all_before_excluding_pbb (lst_p loop, poly_bb_p pbb, bool before) -{ - int i; - lst_p l; - - if (!loop || !LST_LOOP_P (loop)) - return before; - - for (i = 0; LST_SEQ (loop).iterate (i, &l);) - if (LST_LOOP_P (l)) - { - before = lst_remove_all_before_excluding_pbb (l, pbb, before); - - if (LST_SEQ (l).length () == 0) - { - LST_SEQ (loop).ordered_remove (i); - free_lst (l); - continue; - } - - i++; - } - else - { - if (before && LST_PBB (l) != pbb) - { - LST_SEQ (loop).ordered_remove (i); - free_lst (l); - continue; - } - - i++; - - if (LST_PBB (l) == pbb) - before = before ? false : true; - } - - return before; -} - /* A SCOP is a Static Control Part of the program, simple enough to be represented in polyhedral form. */ struct scop @@ -1352,9 +386,6 @@ struct scop representation. */ vec<poly_bb_p> bbs; - /* Original, transformed and saved schedules. */ - lst_p original_schedule, transformed_schedule, saved_schedule; - /* The context describes known restrictions concerning the parameters and relations in between the parameters. @@ -1389,9 +420,6 @@ struct scop #define SCOP_BBS(S) (S->bbs) #define SCOP_REGION(S) (S->region) #define SCOP_CONTEXT(S) (NULL) -#define SCOP_ORIGINAL_SCHEDULE(S) (S->original_schedule) -#define SCOP_TRANSFORMED_SCHEDULE(S) (S->transformed_schedule) -#define SCOP_SAVED_SCHEDULE(S) (S->saved_schedule) #define POLY_SCOP_P(S) (S->poly_scop_p) extern scop_p new_scop (sese); @@ -1399,11 +427,6 @@ extern void free_scop (scop_p); extern void free_scops (vec<scop_p> ); extern void print_generated_program (FILE *, scop_p); extern void debug_generated_program (scop_p); -extern void print_scattering_function (FILE *, poly_bb_p, int); -extern void print_scattering_functions (FILE *, scop_p, int); -extern void debug_scattering_function (poly_bb_p, int); -extern void debug_scattering_functions (scop_p, int); -extern int scop_max_loop_depth (scop_p); extern int unify_scattering_dimensions (scop_p); extern bool apply_poly_transforms (scop_p); extern bool graphite_legal_transform (scop_p); @@ -1432,114 +455,9 @@ scop_set_nb_params (scop_p scop, graphite_dim_t nb_params) scop->nb_params = nb_params; } -/* Allocates a new empty poly_scattering structure. */ - -static inline poly_scattering_p -poly_scattering_new (void) -{ - poly_scattering_p res = XNEW (struct poly_scattering); - - res->nb_local_variables = 0; - res->nb_scattering = 0; - return res; -} - -/* Free a poly_scattering structure. */ - -static inline void -poly_scattering_free (poly_scattering_p s) -{ - free (s); -} - -/* Copies S and return a new scattering. */ - -static inline poly_scattering_p -poly_scattering_copy (poly_scattering_p s) -{ - poly_scattering_p res = poly_scattering_new (); - - res->nb_local_variables = s->nb_local_variables; - res->nb_scattering = s->nb_scattering; - return res; -} - -/* Saves the transformed scattering of PBB. */ - -static inline void -store_scattering_pbb (poly_bb_p pbb) -{ - isl_map_free (pbb->saved); - pbb->saved = isl_map_copy (pbb->transformed); -} - -/* Stores the SCOP_TRANSFORMED_SCHEDULE to SCOP_SAVED_SCHEDULE. */ - -static inline void -store_lst_schedule (scop_p scop) -{ - if (SCOP_SAVED_SCHEDULE (scop)) - free_lst (SCOP_SAVED_SCHEDULE (scop)); - - SCOP_SAVED_SCHEDULE (scop) = copy_lst (SCOP_TRANSFORMED_SCHEDULE (scop)); -} - -/* Restores the SCOP_TRANSFORMED_SCHEDULE from SCOP_SAVED_SCHEDULE. */ - -static inline void -restore_lst_schedule (scop_p scop) -{ - if (SCOP_TRANSFORMED_SCHEDULE (scop)) - free_lst (SCOP_TRANSFORMED_SCHEDULE (scop)); - - SCOP_TRANSFORMED_SCHEDULE (scop) = copy_lst (SCOP_SAVED_SCHEDULE (scop)); -} - -/* Saves the scattering for all the pbbs in the SCOP. */ - -static inline void -store_scattering (scop_p scop) -{ - int i; - poly_bb_p pbb; - - for (i = 0; SCOP_BBS (scop).iterate (i, &pbb); i++) - store_scattering_pbb (pbb); - - store_lst_schedule (scop); -} - -/* Restores the scattering of PBB. */ - -static inline void -restore_scattering_pbb (poly_bb_p pbb) -{ - gcc_assert (pbb->saved); - - isl_map_free (pbb->transformed); - pbb->transformed = isl_map_copy (pbb->saved); -} - -/* Restores the scattering for all the pbbs in the SCOP. */ - -static inline void -restore_scattering (scop_p scop) -{ - int i; - poly_bb_p pbb; - - for (i = 0; SCOP_BBS (scop).iterate (i, &pbb); i++) - restore_scattering_pbb (pbb); - - restore_lst_schedule (scop); -} - bool graphite_legal_transform (scop_p); -isl_map *reverse_loop_at_level (poly_bb_p, int); -isl_union_map *reverse_loop_for_pbbs (scop_p, vec<poly_bb_p> , int); __isl_give isl_union_map *extend_schedule (__isl_take isl_union_map *); - void compute_deps (scop_p scop, vec<poly_bb_p> pbbs, isl_union_map **must_raw, |