97 int j, first = 1, number = 1;
100 for (j = 0; j < level; j++)
101 fprintf(file,
"|\t");
103 if (statement != NULL)
104 fprintf(file,
"+-- osl_statement_t (S%d)\n", number);
106 fprintf(file,
"+-- NULL statement\n");
108 while (statement != NULL) {
111 for (j = 0; j < level; j++)
112 fprintf(file,
"|\t");
113 fprintf(file,
"| osl_statement_t (S%d)\n", number);
119 for (j = 0; j <= level + 1; j++)
120 fprintf(file,
"|\t");
135 statement = statement->
next;
139 if (statement != NULL) {
140 for (j = 0; j <= level; j++)
141 fprintf(file,
"|\t");
142 fprintf(file,
"V\n");
147 for (j = 0; j <= level; j++)
148 fprintf(file,
"|\t");
174 int nb_parameters = OSL_UNDEFINED;
175 int nb_iterators = OSL_UNDEFINED;
176 int nb_scattdims = OSL_UNDEFINED;
177 int nb_localdims = OSL_UNDEFINED;
178 int array_id = OSL_UNDEFINED;
181 &nb_scattdims, &nb_localdims, &array_id);
203 int generated_names = 0;
204 int iterators_backedup = 0;
216 while (statement != NULL) {
220 iterators_backedup = 1;
227 fprintf(file,
"# =============================================== ");
228 fprintf(file,
"Statement %d\n", number);
230 fprintf(file,
"# Number of relations describing the statement:\n");
232 if (statement->
domain != NULL)
238 fprintf(file,
"%lu\n\n", nb_relations);
240 fprintf(file,
"# ---------------------------------------------- ");
241 fprintf(file,
"%2d.1 Domain\n", number);
245 fprintf(file,
"# ---------------------------------------------- ");
246 fprintf(file,
"%2d.2 Scattering\n", number);
250 fprintf(file,
"# ---------------------------------------------- ");
251 fprintf(file,
"%2d.3 Access\n", number);
255 fprintf(file,
"# ---------------------------------------------- ");
256 fprintf(file,
"%2d.4 Statement Extensions\n", number);
257 fprintf(file,
"# Number of Statement Extensions\n");
259 fprintf(file,
"%d\n", nb_ext);
266 if (iterators_backedup) {
267 iterators_backedup = 0;
271 statement = statement->
next;
291 int generated_names = 0;
292 int iterators_backedup = 0;
304 while (statement != NULL) {
308 iterators_backedup = 1;
316 fprintf(file,
"# =============================================== ");
317 fprintf(file,
"Statement %d\n", number);
319 fprintf(file,
"# ---------------------------------------------- ");
320 fprintf(file,
"%2d.1 Domain\n", number);
321 fprintf(file,
"# Iteration domain\n");
325 fprintf(file,
"# ---------------------------------------------- ");
326 fprintf(file,
"%2d.2 Scattering\n", number);
327 fprintf(file,
"# Scattering function is provided\n1\n");
332 fprintf(file,
"# ---------------------------------------------- ");
333 fprintf(file,
"%2d.3 Access\n", number);
334 fprintf(file,
"# Access informations are provided\n1\n");
337 names, add_fakeiter);
340 fprintf(file,
"# ---------------------------------------------- ");
341 fprintf(file,
"%2d.4 Body\n", number);
343 fprintf(file,
"# Statement body is provided\n1\n");
348 fprintf(file,
"# Statement body is not provided\n0\n");
354 if (iterators_backedup) {
355 iterators_backedup = 0;
359 statement = statement->
next;
399 size_t nb_domains, nb_scattering, nb_accesses;
405 OSL_error(
"more than one domain for a statement");
407 if (domain_list != NULL) {
409 domain_list->
elt = NULL;
419 if (nb_scattering > 1)
420 OSL_error(
"more than one scattering relation for a statement");
422 if (scattering_list != NULL) {
424 scattering_list->
elt = NULL;
435 if ((nb_domains + nb_scattering + nb_accesses) !=
437 OSL_error(
"unexpected relation type to define a statement");
468 for (i=0; i<nb_ext; i++) {
516 statement->
next = NULL;
531 while (statement != NULL) {
532 next = statement->
next;
558 while (*location != NULL)
559 location = &((*location)->next);
575 while (statement != NULL) {
577 statement = statement->
next;
592 int first = 1, i = 0;
595 while ((statement != NULL) && ((n == -1) || (i < n))) {
609 previous->
next = node;
610 previous = previous->
next;
614 statement = statement->
next;
646 if (((s1->
next != NULL) && (s2->
next == NULL)) ||
647 ((s1->
next == NULL) && (s2->
next != NULL))) {
648 OSL_info(
"statements are not the same");
652 if ((s1->
next != NULL) && (s2->
next != NULL)) {
654 OSL_info(
"number of statements is not the same");
660 OSL_info(
"statement domains are not the same");
665 OSL_info(
"statement scatterings are not the same");
670 OSL_info(
"statement accesses are not the same");
675 OSL_info(
"statement bodies are not the same");
694 int expected_nb_parameters) {
695 int expected_nb_iterators;
698 while (statement != NULL) {
704 expected_nb_parameters)) {
709 if (statement->
domain != NULL)
712 expected_nb_iterators = OSL_UNDEFINED;
718 expected_nb_iterators,
719 expected_nb_parameters)) {
727 expected_nb_iterators,
728 expected_nb_parameters)) {
734 if ((expected_nb_iterators != OSL_UNDEFINED) &&
737 OSL_warning(
"unexpected number of original iterators");
741 statement = statement->
next;
757 if (statement->
domain == NULL) {
758 OSL_warning(
"no statement domain, assuming 0 iterators");
791 int local_nb_parameters = OSL_UNDEFINED;
792 int local_nb_iterators = OSL_UNDEFINED;
793 int local_nb_scattdims = OSL_UNDEFINED;
794 int local_nb_localdims = OSL_UNDEFINED;
795 int local_array_id = OSL_UNDEFINED;
797 while (statement != NULL) {
799 &local_nb_parameters,
806 &local_nb_parameters,
813 &local_nb_parameters,
819 *nb_parameters = OSL_max(*nb_parameters, local_nb_parameters);
820 *nb_iterators = OSL_max(*nb_iterators, local_nb_iterators);
821 *nb_scattdims = OSL_max(*nb_scattdims, local_nb_scattdims);
822 *nb_localdims = OSL_max(*nb_localdims, local_nb_localdims);
823 *array_id = OSL_max(*array_id, local_array_id);
824 statement = statement->
next;
839 if (statement == NULL || statement->
extension == NULL) {
void osl_relation_free(osl_relation_p relation)
osl_names_p osl_names_generate(char *parameter_prefix, int nb_parameters, char *iterator_prefix, int nb_iterators, char *scatt_dim_prefix, int nb_scatt_dims, char *local_dim_prefix, int nb_local_dims, char *array_prefix, int nb_arrays)
void osl_relation_list_pprint_elts(FILE *file, osl_relation_list_p list, osl_names_p names)
osl_statement_p osl_statement_read(FILE *foo)
int osl_generic_number(osl_generic_p generic)
void osl_interface_free(osl_interface_p interface)
struct osl_extbody * osl_extbody_p
osl_relation_list_p access
int osl_statement_number(osl_statement_p statement)
struct osl_body * osl_body_p
osl_statement_p osl_statement_pread(FILE *file, osl_interface_p registry, int precision)
int osl_statement_equal(osl_statement_p s1, osl_statement_p s2)
osl_statement_p osl_statement_clone(osl_statement_p statement)
void osl_statement_add(osl_statement_p *location, osl_statement_p statement)
void osl_relation_list_get_attributes(osl_relation_list_p list, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
static void osl_statement_dispatch(osl_statement_p stmt, osl_relation_list_p list)
void osl_statement_print(FILE *file, osl_statement_p statement)
void osl_statement_free(osl_statement_p statement)
void osl_body_print_scoplib(FILE *file, osl_body_p body)
void * osl_generic_lookup(osl_generic_p x, char const *const URI)
osl_relation_list_p osl_relation_list_filter(osl_relation_list_p list, int type)
void osl_generic_add(osl_generic_p *list, osl_generic_p generic)
int osl_statement_get_nb_iterators(osl_statement_p statement)
void osl_statement_pprint_scoplib(FILE *file, osl_statement_p statement, osl_names_p names)
void osl_relation_list_free(osl_relation_list_p list)
void osl_relation_pprint(FILE *file, osl_relation_p relation, osl_names_p names)
static osl_names_p osl_statement_names(osl_statement_p statement)
osl_relation_p scattering
int osl_relation_equal(osl_relation_p r1, osl_relation_p r2)
void osl_relation_idump(FILE *file, osl_relation_p relation, int level)
int osl_util_get_precision()
void osl_relation_pprint_scoplib(FILE *file, osl_relation_p relation, osl_names_p names, int print_nth_part, int add_fakeiter)
osl_generic_p osl_generic_read_one(FILE *file, osl_interface_p registry)
size_t osl_strings_size(osl_const_strings_const_p strings)
void osl_statement_get_attributes(osl_statement_p statement, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
osl_relation_list_p osl_relation_list_clone(osl_relation_list_p list)
void osl_relation_get_attributes(osl_relation_p relation, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
void osl_names_free(osl_names_p names)
void osl_relation_list_pprint_access_array_scoplib(FILE *file, osl_relation_list_p list, osl_names_p names, int add_fakeiter)
osl_statement_p osl_statement_malloc()
int osl_relation_integrity_check(osl_relation_p relation, int expected_type, int expected_nb_output_dims, int expected_nb_input_dims, int expected_nb_parameters)
int osl_statement_integrity_check(osl_statement_p statement, int expected_nb_parameters)
int osl_relation_list_equal(osl_relation_list_p l1, osl_relation_list_p l2)
osl_statement_p osl_statement_nclone(osl_statement_p statement, int n)
void osl_generic_idump(FILE *file, osl_generic_p generic, int level)
int osl_util_read_int(FILE *file, char **str)
osl_relation_p osl_relation_clone(osl_relation_p relation)
void osl_statement_dump(FILE *file, osl_statement_p statement)
void osl_statement_pprint(FILE *file, osl_statement_p statement, osl_names_p names)
int osl_relation_list_integrity_check(osl_relation_list_p list, int type, int expected_nb_output_dims, int expected_nb_input_dims, int expected_nb_parameters)
osl_relation_list_p osl_relation_list_pread(FILE *file, int precision)
osl_interface_p osl_interface_get_default_registry()
void osl_relation_list_idump(FILE *file, osl_relation_list_p l, int level)
int osl_generic_equal(osl_generic_p x1, osl_generic_p x2)
osl_generic_p osl_generic_clone(osl_generic_p generic)
osl_body_p osl_statement_get_body(osl_statement_p statement)
void osl_statement_idump(FILE *file, osl_statement_p statement, int level)
osl_statement_p statement
size_t osl_relation_list_count(osl_relation_list_p list)
void osl_generic_print(FILE *file, osl_generic_p generic)
struct osl_statement * next
void osl_generic_free(osl_generic_p generic)