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");
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);
561 *location = statement;
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;
634 if (relation == NULL)
657 domain = statement->
domain;
668 statement_ptr = new_statement;
669 result = new_statement;
671 statement_ptr->
next = new_statement;
672 statement_ptr = statement_ptr->
next;
674 if (scattering == NULL || scattering->
next == NULL)
676 scattering = scattering->
next;
678 if (domain == NULL || domain->
next == NULL)
680 domain = domain->
next;
701 if (((s1->
next != NULL) && (s2->
next == NULL)) ||
702 ((s1->
next == NULL) && (s2->
next != NULL))) {
703 OSL_info(
"statements are not the same");
707 if ((s1->
next != NULL) && (s2->
next != NULL)) {
709 OSL_info(
"number of statements is not the same");
715 OSL_info(
"statement domains are not the same");
720 OSL_info(
"statement scatterings are not the same");
725 OSL_info(
"statement accesses are not the same");
730 OSL_info(
"statement bodies are not the same");
749 int expected_nb_parameters) {
750 int expected_nb_iterators;
753 while (statement != NULL) {
759 expected_nb_parameters)) {
764 if (statement->
domain != NULL)
773 expected_nb_iterators,
774 expected_nb_parameters)) {
782 expected_nb_iterators,
783 expected_nb_parameters)) {
792 OSL_warning(
"unexpected number of original iterators");
796 statement = statement->
next;
812 if (statement->
domain == NULL) {
813 OSL_warning(
"no statement domain, assuming 0 iterators");
852 while (statement != NULL) {
854 &local_nb_parameters,
861 &local_nb_parameters,
868 &local_nb_parameters,
874 *nb_parameters =
OSL_max(*nb_parameters, local_nb_parameters);
875 *nb_iterators =
OSL_max(*nb_iterators, local_nb_iterators);
876 *nb_scattdims =
OSL_max(*nb_scattdims, local_nb_scattdims);
877 *nb_localdims =
OSL_max(*nb_localdims, local_nb_localdims);
878 *array_id =
OSL_max(*array_id, local_array_id);
879 statement = statement->
next;
894 if (statement == NULL || statement->
extension == NULL) {
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_util_read_int(FILE *file, char **str)
void * osl_generic_lookup(osl_generic_p x, char const *const URI)
osl_generic_p osl_generic_read_one(FILE *file, osl_interface_p registry)
struct osl_statement * next
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)
int osl_statement_number(osl_statement_p statement)
osl_relation_p scattering
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_relation_free(osl_relation_p relation)
void osl_interface_free(osl_interface_p interface)
void osl_relation_idump(FILE *file, osl_relation_p relation, int level)
void osl_statement_print(FILE *file, osl_statement_p statement)
void osl_body_print_scoplib(FILE *file, osl_body_p body)
void osl_statement_free(osl_statement_p statement)
osl_generic_p osl_generic_clone(osl_generic_p generic)
void osl_relation_pprint_scoplib(FILE *file, osl_relation_p relation, osl_names_p names, int print_nth_part, int add_fakeiter)
osl_relation_list_p access
osl_relation_list_p osl_relation_list_filter(osl_relation_list_p list, int type)
void osl_relation_pprint(FILE *file, osl_relation_p relation, osl_names_p names)
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)
osl_statement_p osl_statement_malloc(void)
static osl_relation_p osl_relation_clone_one_safe(osl_relation_p relation)
Clone first part of the union, return NULL if input is NULL.
static osl_names_p osl_statement_names(osl_statement_p statement)
int osl_generic_equal(osl_generic_p x1, osl_generic_p x2)
osl_relation_p osl_relation_clone(osl_relation_p relation)
int osl_relation_equal(osl_relation_p r1, osl_relation_p r2)
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_statement_p osl_statement_remove_unions(osl_statement_p statement)
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)
osl_relation_list_p osl_relation_list_clone(osl_relation_list_p list)
void osl_relation_list_pprint_access_array_scoplib(FILE *file, osl_relation_list_p list, osl_names_p names, int add_fakeiter)
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)
struct osl_body * osl_body_p
void osl_names_free(osl_names_p names)
struct osl_extbody * osl_extbody_p
void osl_generic_idump(FILE *file, osl_generic_p generic, int level)
int osl_generic_number(osl_generic_p generic)
void osl_generic_print(FILE *file, osl_generic_p generic)
void osl_statement_dump(FILE *file, osl_statement_p statement)
void osl_generic_free(osl_generic_p generic)
size_t osl_strings_size(osl_const_strings_const_p strings)
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)
void osl_relation_get_attributes(osl_relation_p relation, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
osl_relation_list_p osl_relation_list_pread(FILE *file, int precision)
int osl_util_get_precision(void)
void osl_relation_list_idump(FILE *file, osl_relation_list_p l, int level)
osl_interface_p osl_interface_get_default_registry(void)
osl_body_p osl_statement_get_body(osl_statement_p statement)
void osl_statement_idump(FILE *file, osl_statement_p statement, int level)
size_t osl_relation_list_count(osl_relation_list_p list)
void osl_generic_add(osl_generic_p *list, osl_generic_p generic)
struct osl_relation * next
osl_relation_p osl_relation_nclone(osl_relation_p relation, int n)
#define OSL_TYPE_SCATTERING
#define OSL_malloc(ptr, type, size)