From 2220488a2d17ad46249eff86a52508eade0ed0d8 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 10 May 2009 17:39:40 +0200 Subject: [PATCH] update docs to introduction of CloogScattering and CloogScatteringList Also change name of element field of CloogScatteringList to reflect the fact that it is now a list of scattering functions and not a list of domains. Signed-off-by: Sven Verdoolaege --- doc/cloog.texi | 50 +++++++++++++++++++++++++++++++++---------------- include/cloog/domain.h | 2 +- source/isl/domain.c | 4 ++-- source/polylib/domain.c | 6 +++--- source/program.c | 36 +++++++++++++++++------------------ 5 files changed, 57 insertions(+), 41 deletions(-) diff --git a/doc/cloog.texi b/doc/cloog.texi index 25f1a63..c7b4683 100644 --- a/doc/cloog.texi +++ b/doc/cloog.texi @@ -1460,7 +1460,8 @@ generator to represent and to process a code generation problem. @menu * CloogMatrix:: * CloogDomain:: -* CloogDomainList:: +* CloogScattering:: +* CloogScatteringList:: * CloogStatement:: * CloogBlock:: * CloogBlockList:: @@ -1599,20 +1600,37 @@ For a better understanding of the dual ray representation, the user may refer to the PolyLib documentation. -@node CloogDomainList -@subsection CloogDomainList +@node CloogScattering +@subsection CloogScattering @example @group -struct cloogdomainlist -@{ CloogDomain * domain ; - struct cloogdomainlist * next ; -@} ; -typedef struct cloogdomainlist CloogDomainList ; +CloogScattering *cloog_scattering_read(FILE *foo, + CloogDomain *domain, CloogOptions *options); +void cloog_scattering_free(CloogScattering *); @end group @end example -@noindent The CloogDomainList structure represents a @code{NULL} terminated linked list -of domains. +@noindent +The @code{CloogScattering} type represents a scattering function. +A @code{CloogScattering} for a given @code{CloogDomain} can be read +from a file using @code{cloog_scattering_read}. +It can be freed using @code{cloog_scattering_free}. + + +@node CloogScatteringList +@subsection CloogScatteringList +@example +@group +struct cloogscatteringlist @{ + CloogScattering *scatt; + struct cloogscatteringlist *next; +@}; +typedef struct cloogscatteringlist CloogScatteringList; +@end group +@end example + +@noindent The CloogScatteringList structure represents +a @code{NULL} terminated linked list of scattering functions. @node CloogStatement @@ -2073,10 +2091,10 @@ options pointed by @code{options}. @subsection cloog_program_scatter @example @group -void cloog_program_scatter -( CloogProgram * program, /* Input program. */ - CloogDomainList * scattering, /* Additional scattering functions. */ - char ** names ; /* Additional dimension names. */ +void cloog_program_scatter( + CloogProgram *program, /* Input program. */ + CloogScatteringList *scatt, /* Additional scattering functions. */ + CloogOptions *options /* Options. */ ) ; @end group @end example @@ -2084,8 +2102,8 @@ void cloog_program_scatter @noindent The function @code{cloog_program_scatter} applies scattering functions to the @code{CloogProgram} structure pointed by @code{program}. Original domains of @code{program} are freed. Scattering functions -are inside the @code{CloogDomainList} structure pointed by @code{scattering}. -There must be as many scattering functions in the @code{CloogDomainList} +are inside the @code{CloogScatteringList} structure pointed by @code{scattering}. +There must be as many scattering functions in the @code{CloogScatteringList} structure as loops (i.e. iteration domains) in the @code{CloogProgram} structure. The first scattering function of the list will be applied to the iteration domain of the first loop in the program, and so on. diff --git a/include/cloog/domain.h b/include/cloog/domain.h index e3532ed..6e8944e 100644 --- a/include/cloog/domain.h +++ b/include/cloog/domain.h @@ -59,7 +59,7 @@ typedef struct cloogscattering CloogScattering; * this structure reprensents a node of a linked list of CloogScattering structures. */ struct cloogscatteringlist { - CloogScattering *domain; /**< An element of the list. */ + CloogScattering *scatt; /**< An element of the list. */ struct cloogscatteringlist *next;/**< Pointer to the next element of the list.*/ } ; typedef struct cloogscatteringlist CloogScatteringList; diff --git a/source/isl/domain.c b/source/isl/domain.c index ead8e63..dd7be6d 100644 --- a/source/isl/domain.c +++ b/source/isl/domain.c @@ -301,7 +301,7 @@ void cloog_scattering_list_free(CloogScatteringList *list) { while (list != NULL) { CloogScatteringList *temp = list->next; - isl_map_free(list->domain); + isl_map_free(list->scatt); free(list); list = temp; } @@ -599,7 +599,7 @@ int cloog_scattering_list_lazy_same(CloogScatteringList *list) for (one = list; one; one = one->next) for (other = one->next; other; other = other->next) - if (isl_map_fast_is_equal(one->domain, other->domain)) + if (isl_map_fast_is_equal(one->scatt, other->scatt)) return 1; return 0; } diff --git a/source/polylib/domain.c b/source/polylib/domain.c index c544f22..bf118af 100644 --- a/source/polylib/domain.c +++ b/source/polylib/domain.c @@ -625,7 +625,7 @@ void cloog_domain_print_structure(FILE *file, CloogDomain *domain, int level, */ void cloog_scattering_list_print(FILE * foo, CloogScatteringList * list) { while (list != NULL) - { cloog_domain_print(foo,list->domain) ; + { cloog_domain_print(foo, list->scatt); list = list->next ; } } @@ -646,7 +646,7 @@ void cloog_scattering_list_free(CloogScatteringList * list) while (list != NULL) { temp = list->next ; - cloog_domain_free(list->domain) ; + cloog_scattering_free(list->scatt); free(list) ; list = temp ; } @@ -1343,7 +1343,7 @@ int cloog_scattering_list_lazy_same(CloogScatteringList * list) { next = current->next ; /*j=i+1;*/ while (next != NULL) - { if (cloog_domain_lazy_equal(current->domain,next->domain)) + { if (cloog_domain_lazy_equal(current->scatt, next->scatt)) { /*printf("Same domains: %d and %d\n",i,j) ;*/ return 1 ; } diff --git a/source/program.c b/source/program.c index 3963b9d..52b1725 100644 --- a/source/program.c +++ b/source/program.c @@ -529,7 +529,7 @@ static CloogScatteringList *cloog_scattering_list_read(FILE * foo, while (nb_scat--) { *next = (CloogScatteringList *)malloc(sizeof(CloogScatteringList)); - (*next)->domain = cloog_scattering_read(foo, loop->domain, options); + (*next)->scatt = cloog_scattering_read(foo, loop->domain, options); (*next)->next = NULL; next = &(*next)->next; @@ -627,7 +627,7 @@ CloogProgram * cloog_program_read(FILE * file, CloogOptions * options) cloog_msg(options, CLOOG_WARNING, "some scattering functions are similar.\n"); - p->nb_scattdims = cloog_scattering_dimension(scatteringl->domain, + p->nb_scattdims = cloog_scattering_dimension(scatteringl->scatt, p->loop->domain); nb_scattering = p->nb_scattdims ; scattering = cloog_names_read_strings(file, p->nb_scattdims, prefix, -1); @@ -865,7 +865,7 @@ void cloog_program_block(CloogProgram *program, while (loop != NULL) { if (cloog_domain_lazy_equal(reference->domain,loop->domain) && - cloog_scattering_lazy_block(scatt_reference->domain,scatt_loop->domain, + cloog_scattering_lazy_block(scatt_reference->scatt, scatt_loop->scatt, scattering,program->nb_scattdims)) { /* If we find a block we update the links: * +---------------+ @@ -898,7 +898,7 @@ void cloog_program_block(CloogProgram *program, if (blocked_reference) { reference->next = NULL ; cloog_loop_free(reference) ; - cloog_scattering_free(scatt_reference->domain); + cloog_scattering_free(scatt_reference->scatt); free(scatt_reference) ; } @@ -929,7 +929,7 @@ void cloog_program_block(CloogProgram *program, if (blocked_reference) { reference->next = NULL ; cloog_loop_free(reference) ; - cloog_scattering_free(scatt_reference->domain); + cloog_scattering_free(scatt_reference->scatt); free(scatt_reference) ; } @@ -966,7 +966,7 @@ void cloog_program_extract_scalars(CloogProgram *program, { scalar = 1 ; scattering = start ; while (scattering != NULL) - { if (!cloog_scattering_lazy_isscalar(scattering->domain, i, NULL)) + { if (!cloog_scattering_lazy_isscalar(scattering->scatt, i, NULL)) { scalar = 0 ; break ; } @@ -1006,7 +1006,7 @@ void cloog_program_extract_scalars(CloogProgram *program, scattering = start ; for (loop = program->loop; loop; loop = loop->next) { block = loop->block; - if (!cloog_scattering_lazy_isscalar(scattering->domain, i, + if (!cloog_scattering_lazy_isscalar(scattering->scatt, i, &block->scaldims[current])) { /* We should have found a scalar value: if not, there is an error. */ cloog_die("dimension %d is not scalar as expected.\n", i); @@ -1015,9 +1015,9 @@ void cloog_program_extract_scalars(CloogProgram *program, } scattering = start ; - while (scattering != NULL) - { old = scattering->domain ; - scattering->domain = cloog_scattering_erase_dimension(old, i); + while (scattering != NULL) { + old = scattering->scatt; + scattering->scatt = cloog_scattering_erase_dimension(old, i); cloog_scattering_free(old); scattering = scattering->next ; } @@ -1060,31 +1060,29 @@ void cloog_program_scatter(CloogProgram *program, { loop = program->loop ; /* We compute the scattering dimension and check it is >=0. */ - scattering_dim = cloog_scattering_dimension(scattering->domain, - loop->domain); + scattering_dim = cloog_scattering_dimension(scattering->scatt, loop->domain); if (scattering_dim < 0) cloog_die("scattering has not enough dimensions.\n"); - if (!cloog_scattering_fully_specified(scattering->domain, loop->domain)) + if (!cloog_scattering_fully_specified(scattering->scatt, loop->domain)) not_enough_constraints ++ ; /* The scattering dimension may have been modified by scalar extraction. */ - scattering_dim = cloog_scattering_dimension(scattering->domain, - loop->domain); + scattering_dim = cloog_scattering_dimension(scattering->scatt, loop->domain); /* Finally we scatter all loops. */ - cloog_loop_scatter(loop,scattering->domain) ; + cloog_loop_scatter(loop, scattering->scatt); loop = loop->next ; scattering = scattering->next ; while ((loop != NULL) && (scattering != NULL)) - { scattering_dim2 = cloog_scattering_dimension(scattering->domain, + { scattering_dim2 = cloog_scattering_dimension(scattering->scatt, loop->domain); if (scattering_dim2 != scattering_dim) cloog_die("scattering dimensions are not the same.\n") ; - if (!cloog_scattering_fully_specified(scattering->domain, loop->domain)) + if (!cloog_scattering_fully_specified(scattering->scatt, loop->domain)) not_enough_constraints ++ ; - cloog_loop_scatter(loop,scattering->domain) ; + cloog_loop_scatter(loop, scattering->scatt); loop = loop->next ; scattering = scattering->next ; } -- 2.11.4.GIT