2 /*+-----------------------------------------------------------------**
4 **-----------------------------------------------------------------**
6 **-----------------------------------------------------------------**
7 ** First version: 30/04/2008 **
8 **-----------------------------------------------------------------**
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 * '---'-'---'---'---'---'-'---'-'---'---'---'-'---'-'---' '--' *
30 * Copyright (C) 2008 University Paris-Sud 11 and INRIA *
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 *
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. *
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. *
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> *
61 *****************************************************************************/
67 # include <openscop/scop.h>
70 /*+***************************************************************************
71 * Structure display functions *
72 *****************************************************************************/
76 * openscop_scop_idump function:
77 * this function displays an openscop_scop_t structure (*scop) into a
78 * file (file, possibly stdout) in a way that trends to be understandable. It
79 * includes an indentation level (level) in order to work with others
80 * print_structure functions.
81 * \param file The file where the information has to be printed.
82 * \param scop The scop structure whose information has to be printed.
83 * \param level Number of spaces before printing, for each line.
85 void openscop_scop_idump(FILE * file
, openscop_scop_p scop
, int level
) {
88 // Go to the right level.
89 for (j
= 0; j
< level
; j
++)
93 fprintf(file
, "+-- openscop_scop_t\n");
96 for (j
= 0; j
<= level
+1; j
++)
100 // Print the language.
101 for (j
= 0; j
< level
; j
++)
102 fprintf(file
, "|\t");
103 fprintf(file
, "|\tLanguage: %s\n", scop
->language
);
106 for (j
= 0; j
<= level
+1; j
++)
107 fprintf(file
, "|\t");
110 // Print the context of the scop.
111 openscop_relation_idump(file
, scop
->context
, level
+1);
114 openscop_names_idump(file
, scop
->names
, level
+1);
116 // Print the statements.
117 openscop_statement_idump(file
, scop
->statement
, level
+1);
119 // Print the extensions.
120 openscop_extension_idump(file
, scop
->extension
, level
+1);
123 for (j
= 0; j
<= level
+1; j
++)
124 fprintf(file
, "|\t");
128 fprintf(file
, "+-- NULL scop\n");
132 for (j
= 0; j
<= level
; j
++)
133 fprintf(file
, "|\t");
139 * openscop_scop_dump function:
140 * this function prints the content of an openscop_scop_t structure (*scop)
141 * into a file (file, possibly stdout).
142 * \param file The file where the information has to be printed.
143 * \param scop The scop structure whose information has to be printed.
145 void openscop_scop_dump(FILE * file
, openscop_scop_p scop
) {
146 openscop_scop_idump(file
, scop
, 0);
151 * openscop_scop_name_limits function:
152 * this function finds the (maximum) number of various elements of a scop and
153 * return the values through parameters. To ensure the correctness of the
154 * results, an integrity check of the input scop should be run before calling
156 * \param scop The scop to analyse.
157 * \parem nb_parameters The number of parameters in the scop (output).
158 * \parem nb_iterators The number of iterators in the scop (output).
159 * \parem nb_scattdims The number of scattdims in the scop (output).
160 * \parem nb_localdims The number of local dimensions in the scop (output).
161 * \parem nb_arrays The number of arrays in the scop (output).
164 void openscop_scop_name_limits(openscop_scop_p scop
,
170 int k
, tmp
, array_id
;
171 openscop_statement_p statement
;
172 openscop_relation_list_p list
;
174 // * The number of parameters is collected from the context,
175 // - in matrix format we compute it from the context using #columns,
176 // - in relation format it corresponds to the #parameters field.
177 // * The numbers of local dimensions are collected from all relations
178 // in the corresponding field, it is 0 for matrix format.
181 if (scop
->context
!= NULL
) {
182 if (openscop_relation_is_matrix(scop
->context
)) {
183 *nb_parameters
= scop
->context
->nb_columns
- 2;
186 *nb_parameters
= scop
->context
->nb_parameters
;
187 *nb_localdims
= scop
->context
->nb_local_dims
;
194 statement
= scop
->statement
;
195 while (statement
!= NULL
) {
196 // * The number of iterators are defined by iteration domains,
197 // - in matrix format we compute it using #columns and #parameters,
198 // - in relation format it corresponds to the #output_dims.
199 if (statement
->domain
!= NULL
) {
200 if (openscop_relation_is_matrix(statement
->domain
)) {
201 tmp
= statement
->domain
->nb_columns
- *nb_parameters
- 2;
202 if (tmp
> *nb_iterators
)
206 if (statement
->domain
->nb_output_dims
> *nb_iterators
)
207 *nb_iterators
= statement
->domain
->nb_output_dims
;
209 if (statement
->domain
->nb_local_dims
> *nb_localdims
)
210 *nb_localdims
= statement
->domain
->nb_local_dims
;
214 // * The number of scattdims are defined by scattering,
215 // - in matrix format it corresponds to the number of rows,
216 // - in relation format it corresponds to the #input_dims.
217 if (statement
->scattering
!= NULL
) {
218 if (openscop_relation_is_matrix(statement
->scattering
)) {
219 if (statement
->domain
->nb_rows
> *nb_scattdims
)
220 *nb_scattdims
= statement
->scattering
->nb_rows
;
223 if (statement
->scattering
->nb_input_dims
> *nb_scattdims
)
224 *nb_scattdims
= statement
->scattering
->nb_input_dims
;
226 if (statement
->scattering
->nb_local_dims
> *nb_localdims
)
227 *nb_localdims
= statement
->scattering
->nb_local_dims
;
231 // * The number of arrays are defined by accesses,
232 for (k
= 0; k
< 2; k
++) {
234 list
= statement
->read
;
236 list
= statement
->write
;
238 while (list
!= NULL
) {
239 array_id
= openscop_relation_get_array_id(list
->elt
);
240 if (array_id
> *nb_arrays
)
241 *nb_arrays
= array_id
;
247 statement
= statement
->next
;
253 * openscop_scop_full_names function:
254 * this function generates an openscop_names_p structure which contains
255 * enough names for the scop provided as parameter, for each kind of names.
256 * If the names contained in the input scop are not sufficient, this function
257 * generated the missing names.
258 * \param scop The scop we need a name for each element.
259 * \return A set of names for the scop.
262 openscop_names_p
openscop_scop_full_names(openscop_scop_p scop
) {
268 openscop_arrays_p arrays
;
269 openscop_names_p names
;
271 names
= openscop_names_copy(scop
->names
);
273 // Extract array names information from extensions.
274 openscop_util_strings_free(names
->arrays
, names
->nb_arrays
);
275 arrays
= (openscop_arrays_p
)openscop_extension_lookup(scop
->extension
,
276 OPENSCOP_EXTENSION_ARRAYS
);
277 names
->arrays
= openscop_arrays_generate_names(arrays
,
278 &(names
->nb_arrays
));
280 // Complete names if necessary.
281 openscop_scop_name_limits(scop
, &nb_parameters
,
287 openscop_util_strings_complete(&names
->parameters
, &names
->nb_parameters
,
288 "P_", nb_parameters
);
290 openscop_util_strings_complete(&names
->iterators
, &names
->nb_iterators
,
293 openscop_util_strings_complete(&names
->scattdims
, &names
->nb_scattdims
,
296 openscop_util_strings_complete(&names
->localdims
, &names
->nb_localdims
,
299 openscop_util_strings_complete(&names
->arrays
, &names
->nb_arrays
,
307 * openscop_scop_print function:
308 * this function prints the content of an openscop_scop_t structure (*scop)
309 * into a file (file, possibly stdout) in the OpenScop textual format.
310 * \param file The file where the information has to be printed.
311 * \param scop The scop structure whose information has to be printed.
313 void openscop_scop_print(FILE * file
, openscop_scop_p scop
) {
314 openscop_names_p names
;
315 int tmp_nb_iterators
= 0;
316 char ** tmp_iterators
= NULL
;
318 if (openscop_scop_integrity_check(scop
) == 0) {
319 fprintf(stderr
, "[OpenScop] Warning: OpenScop integrity check failed. "
320 " Something may go wrong\n");
323 // Build a name structure for pretty printing of relations.
324 names
= openscop_scop_full_names(scop
);
327 fprintf(file
, "# \n");
328 fprintf(file
, "# <| \n");
329 fprintf(file
, "# A \n");
330 fprintf(file
, "# /.\\ \n");
331 fprintf(file
, "# <| [\"\"M# \n");
332 fprintf(file
, "# A | # Clan McCloog Castle \n");
333 fprintf(file
, "# /.\\ [\"\"M# [Generated by the OpenScop ");
334 fprintf(file
, "Library %s %s bits]\n",OPENSCOP_RELEASE
, OPENSCOP_VERSION
);
335 fprintf(file
, "# [\"\"M# | # U\"U#U \n");
336 fprintf(file
, "# | # | # \\ .:/ \n");
337 fprintf(file
, "# | # | #___| # \n");
338 fprintf(file
, "# | \"--' .-\" \n");
339 fprintf(file
, "# |\"-\"-\"-\"-\"-#-#-## \n");
340 fprintf(file
, "# | # ## ###### \n");
341 fprintf(file
, "# \\ .::::'/ \n");
342 fprintf(file
, "# \\ ::::'/ \n");
343 fprintf(file
, "# :8a| # # ## \n");
344 fprintf(file
, "# ::88a ### \n");
345 fprintf(file
, "# ::::888a 8a ##::. \n");
346 fprintf(file
, "# ::::::888a88a[]:::: \n");
347 fprintf(file
, "# :::::::::SUNDOGa8a::::. .. \n");
348 fprintf(file
, "# :::::8::::888:Y8888:::::::::... \n");
349 fprintf(file
, "#::':::88::::888::Y88a______________________________");
350 fprintf(file
, "________________________\n");
351 fprintf(file
, "#:: ::::88a::::88a:Y88a ");
352 fprintf(file
, " __---__-- __\n");
353 fprintf(file
, "#' .: ::Y88a:::::8a:Y88a ");
354 fprintf(file
, "__----_-- -------_-__\n");
355 fprintf(file
, "# :' ::::8P::::::::::88aa. _ _- -");
356 fprintf(file
, "- --_ --- __ --- __--\n");
357 fprintf(file
, "#.:: :::::::::::::::::::Y88as88a...s88aa.\n");
360 fprintf(file
, "# [File generated by the OpenScop Library %s %s bits]\n",
361 OPENSCOP_RELEASE
,OPENSCOP_VERSION
);
364 fprintf(file
, "\nOpenScop\n\n");
365 fprintf(file
, "# =============================================== Global\n");
366 fprintf(file
, "# Language\n");
367 fprintf(file
, "%s\n\n", scop
->language
);
369 fprintf(file
, "# Context\n");
370 // Remove the iterators from the names structure to print comments, as
371 // this information is used to know the number of iterators.
372 // TODO: do this in openscop_relation_print_openscop
373 tmp_nb_iterators
= names
->nb_iterators
;
374 tmp_iterators
= names
->iterators
;
375 names
->nb_iterators
= 0;
376 names
->iterators
= NULL
;
377 openscop_relation_print(file
, scop
->context
, names
);
378 names
->nb_iterators
= tmp_nb_iterators
;
379 names
->iterators
= tmp_iterators
;
382 openscop_names_print(file
, scop
->names
);
384 fprintf(file
, "# Number of statements\n");
385 fprintf(file
, "%d\n\n",openscop_statement_number(scop
->statement
));
387 openscop_statement_print(file
, scop
->statement
, names
);
389 if (scop
->extension
) {
390 fprintf(file
, "# ==============================================="
392 openscop_extension_print(file
, scop
->extension
);
395 openscop_names_free(names
);
399 /*****************************************************************************
401 *****************************************************************************/
405 void openscop_scop_update_val(int * variable
, int value
) {
406 if ((*variable
== OPENSCOP_UNDEFINED
) || (*variable
== value
))
409 fprintf(stderr
, "[OpenScop] Warning: number of iterators and "
410 "parameters inconsistency.\n");
414 void openscop_scop_update_properties(openscop_relation_p relation
,
415 int nb_output_dims
, int nb_input_dims
,
417 if (relation
!= NULL
) {
418 openscop_scop_update_val(&(relation
->nb_output_dims
), nb_output_dims
);
419 openscop_scop_update_val(&(relation
->nb_input_dims
), nb_input_dims
);
420 openscop_scop_update_val(&(relation
->nb_parameters
), nb_parameters
);
426 * openscop_scop_propagate_properties internal function:
427 * This function tries to propagate information in all relations through the
428 * whole openscop representation. For instance, the number of parameters can
429 * be found in the context as well as in any relation: if it is undefined in
430 * the relation, this function defines it, if it is different than the
431 * expected value, it reports an error. This function does the same for
432 * the number of output and input dimensions.
433 * \param scop The SCoP we want to propagate properties.
436 void openscop_scop_propagate_properties(openscop_scop_p scop
) {
437 int i
, nb_parameters
;
438 openscop_statement_p statement
;
439 openscop_relation_p relation
;
440 openscop_relation_list_p list
;
442 // Context part: get the number of parameters.
443 if ((scop
->context
!= NULL
) &&
444 (openscop_relation_is_matrix(scop
->context
))) {
445 nb_parameters
= scop
->context
->nb_columns
- 2;
446 openscop_scop_update_properties(scop
->context
, 0, 0, nb_parameters
);
452 // For each statement:
453 statement
= scop
->statement
;
454 while (statement
!= NULL
) {
456 relation
= statement
->domain
;
457 if (openscop_relation_is_matrix(relation
)) {
458 while (relation
!= NULL
) {
459 openscop_scop_update_properties(
460 relation
, relation
->nb_columns
-nb_parameters
-2, 0, nb_parameters
);
461 relation
= relation
->next
;
465 // - Scattering part,
466 relation
= statement
->scattering
;
467 if (openscop_relation_is_matrix(relation
)) {
468 while (relation
!= NULL
) {
469 openscop_scop_update_properties(
470 relation
, 0, relation
->nb_columns
-nb_parameters
-2, nb_parameters
);
471 relation
= relation
->next
;
476 for (i
= 0; i
< 2; i
++) {
478 list
= statement
->read
;
480 list
= statement
->write
;
482 while (list
!= NULL
) {
483 relation
= list
->elt
;
484 if (openscop_relation_is_matrix(relation
)) {
485 while (relation
!= NULL
) {
486 openscop_scop_update_properties(
487 relation
, 0, relation
->nb_columns
- nb_parameters
- 2,
489 relation
= relation
->next
;
497 statement
= statement
->next
;
503 * openscop_scop_read function:
504 * this function reads a scop structure from a file (possibly stdin)
505 * complying to the OpenScop textual format and returns a pointer to this
506 * scop structure. If some relation properties (number of input/output/local
507 * dimensions and number of parameters) are undefined, it will define them
508 * according to the available information.
509 * \param file The file where the scop has to be read.
510 * \return A pointer to the scop structure that has been read.
512 openscop_scop_p
openscop_scop_read(FILE * file
) {
513 openscop_scop_p scop
= NULL
;
514 openscop_statement_p stmt
= NULL
;
515 openscop_statement_p prev
= NULL
;
525 scop
= openscop_scop_malloc();
531 // Ensure the file is a .scop.
532 tmp
= openscop_util_strings_read(file
, &max
);
533 if ((max
== 0) || (strcmp(*tmp
, "OpenScop"))) {
534 fprintf(stderr
, "[OpenScop] Error: not an OpenScop file "
535 "(type \"%s\".\n", *tmp
);
539 fprintf(stderr
, "[OpenScop] Warning: uninterpreted information "
540 "(after file type).\n");
544 // Read the language.
545 char ** language
= openscop_util_strings_read(file
, &max
);
547 fprintf(stderr
, "[OpenScop] Error: no language (backend) specified.\n");
551 fprintf(stderr
, "[OpenScop] Warning: uninterpreted information "
552 "(after language).\n");
553 scop
->language
= *language
;
557 scop
->context
= openscop_relation_read(file
);
558 scop
->names
= openscop_names_read(file
);
559 if (scop
->context
!= NULL
) {
560 if (openscop_relation_is_matrix(scop
->context
))
561 nb_parameters
= scop
->context
->nb_columns
- 2;
563 nb_parameters
= scop
->context
->nb_parameters
;
566 nb_parameters
= OPENSCOP_UNDEFINED
;
570 // II. STATEMENT PART
573 // Read the number of statements.
574 nb_statements
= openscop_util_read_int(file
, NULL
);
576 for (i
= 0; i
< nb_statements
; ++i
) {
577 // Read each statement.
578 stmt
= openscop_statement_read(file
, nb_parameters
);
579 if (scop
->statement
== NULL
)
580 scop
->statement
= stmt
;
590 // Read the remainder of the file, and store it in the extension field.
591 scop
->extension
= openscop_extension_read(file
);
594 // VI. FINALIZE AND CHECK
596 openscop_scop_propagate_properties(scop
);
598 if (!openscop_scop_integrity_check(scop
))
599 fprintf(stderr
, "[OpenScop] Warning: global integrity check failed.\n");
605 /*+***************************************************************************
606 * Memory allocation/deallocation functions *
607 *****************************************************************************/
611 * openscop_scop_malloc function:
612 * this function allocates the memory space for a openscop_scop_t structure and
613 * sets its fields with default values. Then it returns a pointer to the
615 * \return A pointer to an empty scop with fields set to default values.
617 openscop_scop_p
openscop_scop_malloc() {
618 openscop_scop_p scop
;
620 scop
= (openscop_scop_p
)malloc(sizeof(openscop_scop_t
));
622 fprintf(stderr
, "[OpenScop] Memory Overflow.\n");
627 scop
->language
= NULL
;
628 scop
->context
= NULL
;
630 scop
->statement
= NULL
;
631 scop
->extension
= NULL
;
639 * openscop_scop_free function:
640 * This function frees the allocated memory for a openscop_scop_t structure.
641 * \param scop The pointer to the scop we want to free.
643 void openscop_scop_free(openscop_scop_p scop
) {
645 if (scop
->language
!= NULL
)
646 free(scop
->language
);
648 openscop_relation_free(scop
->context
);
649 openscop_names_free(scop
->names
);
650 openscop_statement_free(scop
->statement
);
651 openscop_extension_free(scop
->extension
);
658 /*+***************************************************************************
659 * Processing functions *
660 *****************************************************************************/
664 * openscop_scop_copy function:
665 * This functions builds and returns a "hard copy" (not a pointer copy)
666 * of a openscop_statement_t data structure provided as parameter.
667 * Note that the usr field is not touched by this function.
668 * \param statement The pointer to the scop we want to copy.
669 * \return A pointer to the full copy of the scop provided as parameter.
671 openscop_scop_p
openscop_scop_copy(openscop_scop_p scop
) {
672 openscop_scop_p copy
;
674 copy
= openscop_scop_malloc();
675 copy
->version
= scop
->version
;
676 if (scop
->language
!= NULL
)
677 copy
->language
= strdup(scop
->language
);
678 copy
->context
= openscop_relation_copy(scop
->context
);
679 copy
->names
= openscop_names_copy(scop
->names
);
680 copy
->statement
= openscop_statement_copy(scop
->statement
);
681 copy
->extension
= openscop_extension_copy(scop
->extension
);
688 * openscop_scop_equal function:
689 * this function returns true if the two scops are the same, false
690 * otherwise (the usr field is not tested).
691 * \param s1 The first scop.
692 * \param s2 The second scop.
693 * \return 1 if s1 and s2 are the same (content-wise), 0 otherwise.
695 int openscop_scop_equal(openscop_scop_p s1
, openscop_scop_p s2
) {
700 if (s1
->version
!= s2
->version
) {
701 fprintf(stderr
, "[OpenScop] info: versions are not the same.\n");
705 if (strcmp(s1
->language
, s2
->language
) != 0) {
706 fprintf(stderr
, "[OpenScop] info: languages are not the same.\n");
710 if (!openscop_relation_equal(s1
->context
, s2
->context
)) {
711 fprintf(stderr
, "[OpenScop] info: contexts are not the same.\n");
715 if (!openscop_names_equal(s1
->names
, s2
->names
)) {
716 fprintf(stderr
, "[OpenScop] info: names are not the same.\n");
720 if (!openscop_statement_equal(s1
->statement
, s2
->statement
)) {
721 fprintf(stderr
, "[OpenScop] info: statements are not the same.\n");
725 if (!openscop_extension_equal(s1
->extension
, s2
->extension
)) {
726 fprintf(stderr
, "[OpenScop] info: extensions are not the same.\n");
735 * openscop_scop_integrity_check function:
736 * This function checks that a scop is "well formed". It returns 0 if the
737 * check failed or 1 if no problem has been detected.
738 * \param scop The scop we want to check.
739 * \return 0 if the integrity check fails, 1 otherwise.
741 int openscop_scop_integrity_check(openscop_scop_p scop
) {
742 int expected_nb_parameters
;
743 int max_nb_parameters
;
744 int max_nb_iterators
;
745 int max_nb_scattdims
;
746 int max_nb_localdims
;
749 // Check the language.
750 if ((scop
->language
!= NULL
) &&
751 (!strcmp(scop
->language
, "caml") || !strcmp(scop
->language
, "Caml") ||
752 !strcmp(scop
->language
, "ocaml") || !strcmp(scop
->language
, "OCaml")))
753 fprintf(stderr
, "[OpenScop] Alert: What ?! Caml ?! Are you sure ?!\n");
755 // Check the context.
756 if (!openscop_relation_integrity_check(scop
->context
,
757 OPENSCOP_TYPE_CONTEXT
,
763 // Get the number of parameters.
764 if (scop
->context
!= NULL
) {
765 if (openscop_relation_is_matrix(scop
->context
))
766 expected_nb_parameters
= scop
->context
->nb_columns
- 2;
768 expected_nb_parameters
= scop
->context
->nb_parameters
;
771 expected_nb_parameters
= OPENSCOP_UNDEFINED
;
773 if (!openscop_statement_integrity_check(scop
->statement
,
774 expected_nb_parameters
))
777 // Ensure we have enough names.
778 openscop_scop_name_limits(scop
, &max_nb_parameters
,
784 return openscop_names_integrity_check(scop
->names
, expected_nb_parameters
,
785 max_nb_iterators
, max_nb_scattdims
);