OpenScop  0.9.0
scop.c
Go to the documentation of this file.
1 
2  /*+-----------------------------------------------------------------**
3  ** OpenScop Library **
4  **-----------------------------------------------------------------**
5  ** scop.c **
6  **-----------------------------------------------------------------**
7  ** First version: 30/04/2008 **
8  **-----------------------------------------------------------------**
9 
10 
11  *****************************************************************************
12  * OpenScop: Structures and formats for polyhedral tools to talk together *
13  *****************************************************************************
14  * ,___,,_,__,,__,,__,,__,,_,__,,_,__,,__,,___,_,__,,_,__, *
15  * / / / // // // // / / / // // / / // / /|,_, *
16  * / / / // // // // / / / // // / / // / / / /\ *
17  * |~~~|~|~~~|~~~|~~~|~~~|~|~~~|~|~~~|~~~|~~~|~|~~~|~|~~~|/_/ \ *
18  * | G |C| P | = | L | P |=| = |C| = | = | = |=| = |=| C |\ \ /\ *
19  * | R |l| o | = | e | l |=| = |a| = | = | = |=| = |=| L | \# \ /\ *
20  * | A |a| l | = | t | u |=| = |n| = | = | = |=| = |=| o | |\# \ \ *
21  * | P |n| l | = | s | t |=| = |d| = | = | = | | |=| o | | \# \ \ *
22  * | H | | y | | e | o | | = |l| | | = | | | | G | | \ \ \ *
23  * | I | | | | e | | | | | | | | | | | | | \ \ \ *
24  * | T | | | | | | | | | | | | | | | | | \ \ \ *
25  * | E | | | | | | | | | | | | | | | | | \ \ \ *
26  * | * |*| * | * | * | * |*| * |*| * | * | * |*| * |*| * | / \* \ \ *
27  * | O |p| e | n | S | c |o| p |-| L | i | b |r| a |r| y |/ \ \ / *
28  * '---'-'---'---'---'---'-'---'-'---'---'---'-'---'-'---' '--' *
29  * *
30  * Copyright (C) 2008 University Paris-Sud 11 and INRIA *
31  * *
32  * (3-clause BSD license) *
33  * Redistribution and use in source and binary forms, with or without *
34  * modification, are permitted provided that the following conditions *
35  * are met: *
36  * *
37  * 1. Redistributions of source code must retain the above copyright notice, *
38  * this list of conditions and the following disclaimer. *
39  * 2. Redistributions in binary form must reproduce the above copyright *
40  * notice, this list of conditions and the following disclaimer in the *
41  * documentation and/or other materials provided with the distribution. *
42  * 3. The name of the author may not be used to endorse or promote products *
43  * derived from this software without specific prior written permission. *
44  * *
45  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
46  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
47  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
48  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
49  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
50  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
51  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
52  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
53  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
54  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
55  * *
56  * OpenScop Library, a library to manipulate OpenScop formats and data *
57  * structures. Written by: *
58  * Cedric Bastoul <Cedric.Bastoul@u-psud.fr> and *
59  * Louis-Noel Pouchet <Louis-Noel.pouchet@inria.fr> *
60  * *
61  *****************************************************************************/
62 
63 # include <stdlib.h>
64 # include <stdio.h>
65 # include <ctype.h>
66 # include <string.h>
67 
68 #include <osl/macros.h>
69 #include <osl/util.h>
70 #include <osl/extensions/arrays.h>
71 #include <osl/extensions/textual.h>
72 #include <osl/strings.h>
73 #include <osl/relation.h>
74 #include <osl/interface.h>
75 #include <osl/generic.h>
76 #include <osl/statement.h>
77 #include <osl/scop.h>
78 
79 
80 /*+***************************************************************************
81  * Structure display functions *
82  *****************************************************************************/
83 
84 
95 void osl_scop_idump(FILE * file, osl_scop_p scop, int level) {
96  int j, first = 1;
97 
98  // Go to the right level.
99  for (j = 0; j < level; j++)
100  fprintf(file, "|\t");
101 
102  if (scop != NULL)
103  fprintf(file, "+-- osl_scop_t\n");
104  else
105  fprintf(file, "+-- NULL scop\n");
106 
107  while (scop != NULL) {
108  if (!first) {
109  // Go to the right level.
110  for (j = 0; j < level; j++)
111  fprintf(file, "|\t");
112  fprintf(file, "| osl_scop_t\n");
113  }
114  else
115  first = 0;
116 
117  // A blank line.
118  for (j = 0; j <= level+1; j++)
119  fprintf(file, "|\t");
120  fprintf(file, "\n");
121 
122  // Print the version.
123  for (j = 0; j < level; j++)
124  fprintf(file, "|\t");
125  fprintf(file, "|\tVersion: %d\n", scop->version);
126 
127  // A blank line.
128  for (j = 0; j <= level+1; j++)
129  fprintf(file, "|\t");
130  fprintf(file, "\n");
131 
132  // Print the language.
133  for (j = 0; j < level; j++)
134  fprintf(file, "|\t");
135  fprintf(file, "|\tLanguage: %s\n", scop->language);
136 
137  // A blank line.
138  for (j = 0; j <= level+1; j++)
139  fprintf(file, "|\t");
140  fprintf(file, "\n");
141 
142  // Print the context of the scop.
143  osl_relation_idump(file, scop->context, level+1);
144 
145  // Print the parameters.
146  osl_generic_idump(file, scop->parameters, level+1);
147 
148  // Print the statements.
149  osl_statement_idump(file, scop->statement, level+1);
150 
151  // Print the registered extension interfaces.
152  osl_interface_idump(file, scop->registry, level+1);
153 
154  // Print the extensions.
155  osl_generic_idump(file, scop->extension, level+1);
156 
157  scop = scop->next;
158 
159  // Next line.
160  if (scop != NULL) {
161  for (j = 0; j <= level; j++)
162  fprintf(file, "|\t");
163  fprintf(file, "V\n");
164  }
165  }
166 
167  // The last line.
168  for (j = 0; j <= level; j++)
169  fprintf(file, "|\t");
170  fprintf(file, "\n");
171 }
172 
173 
181 void osl_scop_dump(FILE * file, osl_scop_p scop) {
182  osl_scop_idump(file, scop, 0);
183 }
184 
185 
194  int nb_parameters = OSL_UNDEFINED;
195  int nb_iterators = OSL_UNDEFINED;
196  int nb_scattdims = OSL_UNDEFINED;
197  int nb_localdims = OSL_UNDEFINED;
198  int array_id = OSL_UNDEFINED;
199 
200  osl_scop_get_attributes(scop, &nb_parameters, &nb_iterators,
201  &nb_scattdims, &nb_localdims, &array_id);
202 
203  return osl_names_generate("P", nb_parameters,
204  "i", nb_iterators,
205  "c", nb_scattdims,
206  "l", nb_localdims,
207  "A", array_id);
208 }
209 
210 
218 void osl_scop_print(FILE * file, osl_scop_p scop) {
219  int parameters_backedup = 0;
220  int arrays_backedup = 0;
221  osl_strings_p parameters_backup = NULL;
222  osl_strings_p arrays_backup = NULL;
224  osl_arrays_p arrays;
225 
226  if (scop == NULL) {
227  fprintf(file, "# NULL scop\n");
228  return;
229  }
230  else {
231  fprintf(file, "# [File generated by the OpenScop Library %s]\n",
232  OSL_RELEASE);
233  }
234 
235  if (osl_scop_integrity_check(scop) == 0)
236  OSL_warning("OpenScop integrity check failed. Something may go wrong.");
237 
238  // Generate the names for the various dimensions.
239  names = osl_scop_names(scop);
240 
241  while (scop != NULL) {
242  // If possible, replace parameter names with scop parameter names.
243  if (osl_generic_has_URI(scop->parameters, OSL_URI_STRINGS)) {
244  parameters_backedup = 1;
245  parameters_backup = names->parameters;
246  names->parameters = scop->parameters->data;
247  }
248 
249  // If possible, replace array names with arrays extension names.
250  arrays = osl_generic_lookup(scop->extension, OSL_URI_ARRAYS);
251  if (arrays != NULL) {
252  arrays_backedup = 1;
253  arrays_backup = names->arrays;
254  names->arrays = osl_arrays_to_strings(arrays);
255  }
256 
257  fprintf(file, "\n<"OSL_URI_SCOP">\n\n");
258  fprintf(file, "# =============================================== "
259  "Global\n");
260  fprintf(file, "# Language\n");
261  fprintf(file, "%s\n\n", scop->language);
262 
263  fprintf(file, "# Context\n");
264  osl_relation_pprint(file, scop->context, names);
265  fprintf(file, "\n");
266 
268  osl_generic_has_URI(scop->parameters, OSL_URI_STRINGS),
269  "Parameters are");
270  osl_generic_print(file, scop->parameters);
271 
272  fprintf(file, "\n# Number of statements\n");
273  fprintf(file, "%d\n\n",osl_statement_number(scop->statement));
274 
275  osl_statement_pprint(file, scop->statement, names);
276 
277  if (scop->extension) {
278  fprintf(file, "# =============================================== "
279  "Extensions\n");
280  osl_generic_print(file, scop->extension);
281  }
282  fprintf(file, "\n</"OSL_URI_SCOP">\n\n");
283 
284  // If necessary, switch back parameter names.
285  if (parameters_backedup) {
286  parameters_backedup = 0;
287  names->parameters = parameters_backup;
288  }
289 
290  // If necessary, switch back array names.
291  if (arrays_backedup) {
292  arrays_backedup = 0;
293  osl_strings_free(names->arrays);
294  names->arrays = arrays_backup;
295  }
296 
297  scop = scop->next;
298  }
299 
300  osl_names_free(names);
301 }
302 
303 
311 void osl_scop_print_scoplib(FILE * file, osl_scop_p scop) {
312  int parameters_backedup = 0;
313  int arrays_backedup = 0;
314  osl_strings_p parameters_backup = NULL;
315  osl_strings_p arrays_backup = NULL;
317  osl_arrays_p arrays;
318 
319  if (scop == NULL) {
320  fprintf(file, "# NULL scop\n");
321  return;
322  }
323  else {
324  fprintf(file, "# [File generated by the OpenScop Library %s]\n"
325  "# [SCoPLib format]\n",
326  OSL_RELEASE);
327  }
328 
329  if (osl_scop_check_compatible_scoplib(scop) == 0) {
330  OSL_error("SCoP integrity check failed. Something may go wrong.");
331  exit(1);
332  }
333 
334  // Generate the names for the various dimensions.
335  names = osl_scop_names(scop);
336 
337  while (scop != NULL) {
338  // If possible, replace parameter names with scop parameter names.
339  if (osl_generic_has_URI(scop->parameters, OSL_URI_STRINGS)) {
340  parameters_backedup = 1;
341  parameters_backup = names->parameters;
342  names->parameters = scop->parameters->data;
343  }
344 
345  // If possible, replace array names with arrays extension names.
346  arrays = osl_generic_lookup(scop->extension, OSL_URI_ARRAYS);
347  if (arrays != NULL) {
348  arrays_backedup = 1;
349  arrays_backup = names->arrays;
350  names->arrays = osl_arrays_to_strings(arrays);
351  }
352 
353  fprintf(file, "\nSCoP\n\n");
354  fprintf(file, "# =============================================== "
355  "Global\n");
356  fprintf(file, "# Language\n");
357  fprintf(file, "%s\n\n", scop->language);
358 
359  fprintf(file, "# Context\n");
360 
361  osl_relation_pprint_scoplib(file, scop->context, names, 0, 0);
362  fprintf(file, "\n");
363 
365  osl_generic_has_URI(scop->parameters, OSL_URI_STRINGS),
366  "Parameters are");
367 
368  if (scop->parameters) {
369  fprintf(file, "# Parameter names\n");
370  osl_strings_print(file, scop->parameters->data);
371  }
372 
373  fprintf(file, "\n# Number of statements\n");
374  fprintf(file, "%d\n\n",osl_statement_number(scop->statement));
375 
376  osl_statement_pprint_scoplib(file, scop->statement, names);
377 
378  if (scop->extension) {
379  fprintf(file, "# =============================================== "
380  "Options\n");
382  }
383 
384  // If necessary, switch back parameter names.
385  if (parameters_backedup) {
386  parameters_backedup = 0;
387  names->parameters = parameters_backup;
388  }
389 
390  // If necessary, switch back array names.
391  if (arrays_backedup) {
392  arrays_backedup = 0;
393  osl_strings_free(names->arrays);
394  names->arrays = arrays_backup;
395  }
396 
397  scop = scop->next;
398  }
399 
400  osl_names_free(names);
401 }
402 
403 
404 /*****************************************************************************
405  * Reading function *
406  *****************************************************************************/
407 
408 
422  int precision) {
423  osl_scop_p list = NULL, current = NULL, scop;
424  osl_statement_p stmt = NULL;
425  osl_statement_p prev = NULL;
426  osl_strings_p language;
427  int nb_statements;
428  char * tmp;
429  int first = 1;
430  int i;
431 
432  if (file == NULL)
433  return NULL;
434 
435  while(1) {
436  //
437  // I. START TAG
438  //
439  tmp = osl_util_read_uptotag(file, NULL, OSL_URI_SCOP);
440  if (tmp == NULL) {
441  OSL_debug("no more scop in the file");
442  break;
443  }
444  else {
445  free(tmp);
446  }
447 
448  scop = osl_scop_malloc();
449  scop->registry = osl_interface_clone(registry);
450 
451  //
452  // II. CONTEXT PART
453  //
454 
455  // Read the language.
456  language = osl_strings_read(file);
457  if (osl_strings_size(language) == 0)
458  OSL_error("no language (backend) specified");
459 
460  if (osl_strings_size(language) > 1)
461  OSL_warning("uninterpreted information (after language)");
462 
463  if (language != NULL) {
464  OSL_strdup(scop->language, language->string[0]);
465  osl_strings_free(language);
466  }
467 
468  // Read the context domain.
469  scop->context = osl_relation_pread(file, precision);
470 
471  // Read the parameters.
472  if (osl_util_read_int(file, NULL) > 0)
473  scop->parameters = osl_generic_read_one(file, scop->registry);
474 
475  //
476  // III. STATEMENT PART
477  //
478 
479  // Read the number of statements.
480  nb_statements = osl_util_read_int(file, NULL);
481 
482  for (i = 0; i < nb_statements; i++) {
483  // Read each statement.
484  stmt = osl_statement_pread(file, scop->registry, precision);
485  if (scop->statement == NULL)
486  scop->statement = stmt;
487  else
488  prev->next = stmt;
489  prev = stmt;
490  }
491 
492  //
493  // IV. EXTENSION PART (TO THE END TAG)
494  //
495 
496  // Read up the end tag (if any), and store extensions.
497  scop->extension = osl_generic_read(file, scop->registry);
498 
499  // Add the new scop to the list.
500  if (first) {
501  list = scop;
502  first = 0;
503  }
504  else {
505  current->next = scop;
506  }
507  current = scop;
508  }
509 
510  if (!osl_scop_integrity_check(list))
511  OSL_warning("scop integrity check failed");
512 
513  return list;
514 }
515 
516 
526  int precision = osl_util_get_precision();
528  osl_scop_p scop = osl_scop_pread(foo, registry, precision);
529 
530  osl_interface_free(registry);
531  return scop;
532 }
533 
534 
535 /*+***************************************************************************
536  * Memory allocation/deallocation functions *
537  *****************************************************************************/
538 
539 
548  osl_scop_p scop;
549 
550  OSL_malloc(scop, osl_scop_p, sizeof(osl_scop_t));
551  scop->version = 1;
552  scop->language = NULL;
553  scop->context = NULL;
554  scop->parameters = NULL;
555  scop->statement = NULL;
556  scop->registry = NULL;
557  scop->extension = NULL;
558  scop->usr = NULL;
559  scop->next = NULL;
560 
561  return scop;
562 }
563 
564 
571  osl_scop_p tmp;
572 
573  while (scop != NULL) {
574  if (scop->language != NULL)
575  free(scop->language);
577  osl_relation_free(scop->context);
581 
582  tmp = scop->next;
583  free(scop);
584  scop = tmp;
585  }
586 }
587 
588 
589 /*+***************************************************************************
590  * Processing functions *
591  *****************************************************************************/
592 
593 
601 void osl_scop_add(osl_scop_p * location, osl_scop_p scop) {
602  while (*location != NULL)
603  location = &((*location)->next);
604 
605  *location = scop;
606 }
607 
608 
617  size_t number = 0;
618 
619  while (scop != NULL) {
620  number++;
621  scop = scop->next;
622  }
623  return number;
624 }
625 
626 
636  osl_scop_p clone = NULL, node, previous = NULL;
637  int first = 1;
638 
639  while (scop != NULL) {
640  node = osl_scop_malloc();
641  node->version = scop->version;
642  if (scop->language != NULL)
643  OSL_strdup(node->language, scop->language);
644  node->context = osl_relation_clone(scop->context);
645  node->parameters = osl_generic_clone(scop->parameters);
646  node->statement = osl_statement_clone(scop->statement);
647  node->registry = osl_interface_clone(scop->registry);
648  node->extension = osl_generic_clone(scop->extension);
649 
650  if (first) {
651  first = 0;
652  clone = node;
653  previous = node;
654  }
655  else {
656  previous->next = node;
657  previous = previous->next;
658  }
659 
660  scop = scop->next;
661  }
662 
663  return clone;
664 }
665 
666 
676 
677  while ((s1 != NULL) && (s2 != NULL)) {
678  if (s1 == s2)
679  return 1;
680 
681  if (s1->version != s2->version) {
682  OSL_info("versions are not the same");
683  return 0;
684  }
685 
686  if (strcmp(s1->language, s2->language) != 0) {
687  OSL_info("languages are not the same");
688  return 0;
689  }
690 
691  if (!osl_relation_equal(s1->context, s2->context)) {
692  OSL_info("contexts are not the same");
693  return 0;
694  }
695 
696  if (!osl_generic_equal(s1->parameters, s2->parameters)) {
697  OSL_info("parameters are not the same");
698  return 0;
699  }
700 
701  if (!osl_statement_equal(s1->statement, s2->statement)) {
702  OSL_info("statements are not the same");
703  return 0;
704  }
705 
706  if (!osl_interface_equal(s1->registry, s2->registry)) {
707  OSL_info("registries are not the same");
708  return 0;
709  }
710 
711  if (!osl_generic_equal(s1->extension, s2->extension)) {
712  OSL_info("extensions are not the same");
713  return 0;
714  }
715 
716  s1 = s1->next;
717  s2 = s2->next;
718  }
719 
720  if (((s1 == NULL) && (s2 != NULL)) || ((s1 != NULL) && (s2 == NULL)))
721  return 0;
722 
723  return 1;
724 }
725 
726 
735  int expected_nb_parameters;
736 
737 
738  while (scop != NULL) {
739  // Check the language.
740  if ((scop->language != NULL) &&
741  (!strcmp(scop->language, "caml") || !strcmp(scop->language, "Caml") ||
742  !strcmp(scop->language, "ocaml") || !strcmp(scop->language, "OCaml")))
743  fprintf(stderr, "[OpenScop] Alert: What ?! Caml ?! Are you sure ?!?!\n");
744 
745  // Check the context.
747  OSL_TYPE_CONTEXT,
748  OSL_UNDEFINED,
749  OSL_UNDEFINED,
750  OSL_UNDEFINED))
751  return 0;
752 
753  // Get the number of parameters.
754  if (scop->context != NULL)
755  expected_nb_parameters = scop->context->nb_parameters;
756  else
757  expected_nb_parameters = OSL_UNDEFINED;
758 
759  // TODO : check the number of parameter strings.
760 
762  expected_nb_parameters))
763  return 0;
764 
765  scop = scop->next;
766  }
767 
768  return 1;
769 }
770 
771 
780 
781  if (!osl_scop_integrity_check(scop))
782  return 0;
783  if (scop->next != NULL)
784  return 0;
785  if (scop == NULL || scop->statement == NULL)
786  return 1;
787 
788  osl_relation_p domain;
789  osl_statement_p statement;
790  osl_relation_p scattering;
791  int precision = scop->statement->scattering->precision;
792  int i, j;
793 
794  statement = scop->statement;
795  while (statement != NULL) {
796  scattering = statement->scattering;
797 
798  if (scattering->nb_local_dims != 0) {
799  OSL_error("Local dims in scattering matrix");
800  return 0;
801  }
802 
803  domain = statement->domain;
804  while (domain != NULL) {
805  if (domain->nb_local_dims != 0) {
806  OSL_error("Local dims in domain matrix");
807  return 0;
808  }
809  domain = domain->next;
810  }
811 
812  // Check if there is only the -Identity in the output_dims
813  // and the lines MUST be in the right order
814  for (i = 0 ; i < scattering->nb_rows ; i++) {
815  for (j = 0 ; j < scattering->nb_output_dims ; j++) {
816  if (i == j) { // -1
817  if (!osl_int_mone(precision, scattering->m[i][j+1])) {
818  OSL_error("Wrong -Identity");
819  return 0;
820  }
821  } else { // 0
822  if (!osl_int_zero(precision, scattering->m[i][j+1])) {
823  OSL_error("Wrong -Identity");
824  return 0;
825  }
826  }
827  }
828  }
829 
830  statement = statement->next;
831  }
832 
833  return 1;
834 }
835 
836 
844 
845  if (scop->context == NULL) {
846  OSL_debug("no context domain, assuming 0 parameters");
847  return 0;
848  }
849  else {
850  return scop->context->nb_parameters;
851  }
852 }
853 
854 
865  osl_generic_p textual, new;
866  char * extension_string;
867 
868  if ((interface != NULL) && (scop != NULL)) {
869  osl_interface_add(&scop->registry, interface);
870 
871  textual = osl_generic_lookup(scop->extension, interface->URI);
872  if (textual != NULL) {
873  extension_string = ((osl_textual_p)textual->data)->textual;
874  new = osl_generic_sread(&extension_string, interface);
875  osl_generic_add(&scop->extension, new);
876  }
877  }
878 }
879 
880 
900  int * nb_parameters,
901  int * nb_iterators,
902  int * nb_scattdims,
903  int * nb_localdims,
904  int * array_id) {
905  int local_nb_parameters = OSL_UNDEFINED;
906  int local_nb_iterators = OSL_UNDEFINED;
907  int local_nb_scattdims = OSL_UNDEFINED;
908  int local_nb_localdims = OSL_UNDEFINED;
909  int local_array_id = OSL_UNDEFINED;
910 
911  while (scop != NULL) {
913  &local_nb_parameters,
914  &local_nb_iterators,
915  &local_nb_scattdims,
916  &local_nb_localdims,
917  &local_array_id);
918 
920  &local_nb_parameters,
921  &local_nb_iterators,
922  &local_nb_scattdims,
923  &local_nb_localdims,
924  &local_array_id);
925  // Update.
926  *nb_parameters = OSL_max(*nb_parameters, local_nb_parameters);
927  *nb_iterators = OSL_max(*nb_iterators, local_nb_iterators);
928  *nb_scattdims = OSL_max(*nb_scattdims, local_nb_scattdims);
929  *nb_localdims = OSL_max(*nb_localdims, local_nb_localdims);
930  *array_id = OSL_max(*array_id, local_array_id);
931  scop = scop->next;
932  }
933 }
934 
935 
944  int max_scattering_dims = 0;
945  osl_statement_p statement;
946  osl_relation_p extended;
947 
948  if ((scop != NULL) && (scop->statement != NULL)) {
949  // Get the max number of scattering dimensions.
950  statement = scop->statement;
951  while (statement != NULL) {
952  if (statement->scattering != NULL) {
953  max_scattering_dims = OSL_max(max_scattering_dims,
954  statement->scattering->nb_output_dims);
955  }
956  statement = statement->next;
957  }
958 
959  // Normalize.
960  statement = scop->statement;
961  while (statement != NULL) {
962  if (statement->scattering != NULL) {
963  extended = osl_relation_extend_output(statement->scattering,
964  max_scattering_dims);
965  osl_relation_free(statement->scattering);
966  statement->scattering = extended;
967  }
968  statement = statement->next;
969  }
970  }
971 }
972 
osl_relation_p context
Definition: scop.h:100
osl_strings_p osl_arrays_to_strings(osl_arrays_p arrays)
Definition: arrays.c:360
void osl_relation_free(osl_relation_p relation)
Definition: relation.c:1731
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)
Definition: names.c:206
int osl_interface_equal(osl_interface_p interface1, osl_interface_p interface2)
Definition: interface.c:328
int osl_scop_equal(osl_scop_p s1, osl_scop_p s2)
Definition: scop.c:675
int osl_scop_integrity_check(osl_scop_p scop)
Definition: scop.c:734
void osl_scop_free(osl_scop_p scop)
Definition: scop.c:570
void osl_scop_dump(FILE *file, osl_scop_p scop)
Definition: scop.c:181
void osl_scop_add(osl_scop_p *location, osl_scop_p scop)
Definition: scop.c:601
void osl_interface_free(osl_interface_p interface)
Definition: interface.c:237
char ** string
Definition: strings.h:82
void osl_scop_print(FILE *file, osl_scop_p scop)
Definition: scop.c:218
int osl_scop_get_nb_parameters(osl_scop_p scop)
Definition: scop.c:843
int osl_statement_number(osl_statement_p statement)
Definition: statement.c:572
void * usr
Definition: scop.h:105
struct osl_relation * next
Definition: relation.h:117
osl_statement_p osl_statement_pread(FILE *file, osl_interface_p registry, int precision)
Definition: statement.c:452
osl_interface_p registry
Definition: scop.h:103
int osl_statement_equal(osl_statement_p s1, osl_statement_p s2)
Definition: statement.c:641
osl_statement_p osl_statement_clone(osl_statement_p statement)
Definition: statement.c:628
int osl_int_mone(int precision, osl_const_int_t value)
value == -1
Definition: int.c:1249
size_t osl_scop_number(osl_scop_p scop)
Definition: scop.c:616
osl_interface_p osl_interface_clone(osl_interface_p interface)
Definition: interface.c:314
int nb_local_dims
Definition: relation.h:111
void osl_statement_free(osl_statement_p statement)
Definition: statement.c:528
osl_generic_p extension
Definition: statement.h:92
int nb_parameters
Definition: relation.h:113
void * osl_generic_lookup(osl_generic_p x, char const *const URI)
Definition: generic.c:669
char * language
Definition: scop.h:99
int nb_output_dims
Definition: relation.h:109
struct osl_textual * osl_textual_p
Definition: textual.h:88
void osl_generic_add(osl_generic_p *list, osl_generic_p generic)
Definition: generic.c:375
void osl_interface_idump(FILE *file, osl_interface_p interface, int level)
Definition: interface.c:100
void osl_interface_add(osl_interface_p *list, osl_interface_p interface)
Definition: interface.c:177
void osl_scop_print_scoplib(FILE *file, osl_scop_p scop)
Definition: scop.c:311
osl_relation_p domain
Definition: statement.h:89
void osl_statement_pprint_scoplib(FILE *file, osl_statement_p statement, osl_names_p names)
Definition: statement.c:288
void osl_relation_pprint(FILE *file, osl_relation_p relation, osl_names_p names)
Definition: relation.c:1242
void osl_scop_register_extension(osl_scop_p scop, osl_interface_p interface)
Definition: scop.c:864
osl_int_t ** m
Definition: relation.h:114
int osl_generic_has_URI(osl_const_generic_const_p x, char const *const URI)
Definition: generic.c:648
void * data
Definition: generic.h:82
osl_relation_p scattering
Definition: statement.h:90
int osl_relation_equal(osl_relation_p r1, osl_relation_p r2)
Definition: relation.c:2435
void osl_relation_idump(FILE *file, osl_relation_p relation, int level)
Definition: relation.c:164
osl_generic_p osl_generic_read(FILE *file, osl_interface_p registry)
Definition: generic.c:350
int osl_util_get_precision()
Definition: util.c:518
int precision
Definition: relation.h:106
osl_strings_p osl_strings_read(FILE *file)
Definition: strings.c:259
void osl_relation_pprint_scoplib(FILE *file, osl_relation_p relation, osl_names_p names, int print_nth_part, int add_fakeiter)
Definition: relation.c:1260
int osl_scop_check_compatible_scoplib(osl_scop_p scop)
Definition: scop.c:779
osl_generic_p osl_generic_read_one(FILE *file, osl_interface_p registry)
Definition: generic.c:309
size_t osl_strings_size(osl_const_strings_const_p strings)
Definition: strings.c:413
osl_generic_p parameters
Definition: scop.h:101
void osl_statement_get_attributes(osl_statement_p statement, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
Definition: statement.c:785
osl_scop_p osl_scop_clone(osl_scop_p scop)
Definition: scop.c:635
void osl_relation_get_attributes(osl_relation_p relation, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
Definition: relation.c:2853
void osl_names_free(osl_names_p names)
Definition: names.c:172
osl_strings_p arrays
Definition: names.h:86
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)
Definition: relation.c:2540
int osl_statement_integrity_check(osl_statement_p statement, int expected_nb_parameters)
Definition: statement.c:693
osl_strings_p names
Definition: scatnames.h:88
void osl_generic_idump(FILE *file, osl_generic_p generic, int level)
Definition: generic.c:89
int osl_util_read_int(FILE *file, char **str)
Definition: util.c:140
osl_names_p osl_scop_names(osl_scop_p scop)
Definition: scop.c:193
void osl_strings_print(FILE *file, osl_strings_p strings)
Definition: strings.c:166
osl_generic_p osl_generic_sread(char **input, osl_interface_p registry)
Definition: generic.c:243
void osl_util_print_provided(FILE *file, int provided, char *title)
Definition: util.c:557
char * URI
Definition: interface.h:90
osl_relation_p osl_relation_clone(osl_relation_p relation)
Definition: relation.c:1863
void osl_statement_pprint(FILE *file, osl_statement_p statement, osl_names_p names)
Definition: statement.c:199
void osl_strings_free(osl_strings_p strings)
Definition: strings.c:299
osl_strings_p parameters
Definition: names.h:82
void osl_scop_idump(FILE *file, osl_scop_p scop, int level)
Definition: scop.c:95
int version
Definition: scop.h:98
osl_interface_p osl_interface_get_default_registry()
Definition: interface.c:386
void osl_generic_print_options_scoplib(FILE *file, osl_generic_p generic)
Definition: generic.c:214
int osl_generic_equal(osl_generic_p x1, osl_generic_p x2)
Definition: generic.c:592
osl_generic_p osl_generic_clone(osl_generic_p generic)
Definition: generic.c:540
int osl_int_zero(int precision, osl_const_int_t value)
value == 0
Definition: int.c:1199
struct osl_scop * next
Definition: scop.h:107
osl_relation_p osl_relation_extend_output(osl_relation_p relation, int dim)
Definition: relation.c:2936
void osl_scop_normalize_scattering(osl_scop_p scop)
Definition: scop.c:943
char * osl_util_read_uptotag(FILE *file, char **str, char *name)
Definition: util.c:392
osl_relation_p osl_relation_pread(FILE *foo, int precision)
Definition: relation.c:1382
void osl_statement_idump(FILE *file, osl_statement_p statement, int level)
Definition: statement.c:96
osl_statement_p statement
Definition: scop.h:102
osl_scop_p osl_scop_pread(FILE *file, osl_interface_p registry, int precision)
Definition: scop.c:421
void osl_scop_get_attributes(osl_scop_p scop, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
Definition: scop.c:899
void osl_generic_print(FILE *file, osl_generic_p generic)
Definition: generic.c:196
Definition: scop.h:97
struct osl_statement * next
Definition: statement.h:95
osl_scop_p osl_scop_read(FILE *foo)
Definition: scop.c:525
osl_generic_p extension
Definition: scop.h:104
void osl_generic_free(osl_generic_p generic)
Definition: generic.c:489
osl_scop_p osl_scop_malloc()
Definition: scop.c:547