OpenScop
0.9.0
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <osl/macros.h>
#include <osl/util.h>
#include <osl/relation.h>
#include <osl/relation_list.h>
Go to the source code of this file.
void osl_relation_list_add | ( | osl_relation_list_p * | l1, |
osl_relation_list_p | l2 | ||
) |
osl_relation_list_add function: this function adds a relation list at the end of the relation list pointed by l1. No new list is created: this functions links the two input lists. If the first relation list is NULL, it is set to the second relation list.
[in,out] | l1 | Pointer to the first relation list. |
[in] | l2 | The second relation list. |
Definition at line 520 of file relation_list.c.
osl_relation_list_clone function: This functions builds and returns a quasi-"hard copy" (not a pointer copy) of a osl_relation_list_t data structure provided as parameter.
list | The pointer to the relation list we want to copy. |
Definition at line 456 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, osl_relation_clone(), and osl_relation_list_malloc().
Referenced by osl_relation_list_concat(), osl_relation_list_dup(), osl_relation_list_filter(), and osl_statement_nclone().
osl_relation_list_concat function: this function builds a new relation list as the concatenation of the two lists sent as parameters.
l1 | The first relation list. |
l2 | The second relation list. |
Definition at line 491 of file relation_list.c.
References osl_relation_list::next, and osl_relation_list_clone().
size_t osl_relation_list_count | ( | osl_relation_list_p | list | ) |
osl_relation_list_count function: this function returns the number of elements with non-NULL content in a relation list.
list | The relation list to count the number of elements. |
Definition at line 747 of file relation_list.c.
References osl_relation_list::elt, and osl_relation_list::next.
Referenced by osl_relation_list_pprint(), osl_relation_list_pprint_access_array_scoplib(), osl_relation_list_pprint_elts(), osl_statement_dispatch(), and osl_statement_pprint().
void osl_relation_list_destroy | ( | osl_relation_list_p * | head | ) |
osl_relation_list_destroy function: this function sees a list of relations as a stack of relations and performs the destroy operation onto this stack, i.e., it completely free it.
[in,out] | head | Pointer to the head of the relation stack. Updated to NULL. |
Definition at line 605 of file relation_list.c.
References osl_relation_list_drop().
void osl_relation_list_drop | ( | osl_relation_list_p * | head | ) |
osl_relation_list_drop function: this function sees a list of relations as a stack of relations and performs the drop operation (pop and destroy popped element) onto this stack.
[in,out] | head | Pointer to the head of the relation stack. It is updated to the previous element in the stack (NULL if there is none). |
Definition at line 591 of file relation_list.c.
References osl_relation_list_free(), and osl_relation_list_pop().
Referenced by osl_relation_list_destroy().
void osl_relation_list_dump | ( | FILE * | file, |
osl_relation_list_p | list | ||
) |
osl_relation_dump function: This function prints the content of a osl_relation_list_t into a file (file, possibly stdout).
file | File where informations are printed. |
list | The relation whose information has to be printed. |
Definition at line 143 of file relation_list.c.
References osl_relation_list_idump().
void osl_relation_list_dup | ( | osl_relation_list_p * | head | ) |
osl_relation_list_dup function: this function sees a list of relations as a stack of relations and performs the dup operation (duplicate the top element) onto this stack.
[in,out] | head | Pointer to the head of the relation stack. It is updated to the new element after duplication. |
Definition at line 575 of file relation_list.c.
References osl_relation_list_clone(), osl_relation_list_pop(), and osl_relation_list_push().
int osl_relation_list_equal | ( | osl_relation_list_p | l1, |
osl_relation_list_p | l2 | ||
) |
osl_relation_list_equal function: This function returns true if the two relation lists are the same, false otherwise..
l1 | The first relation list. |
l2 | The second relation list. |
Definition at line 620 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, and osl_relation_equal().
Referenced by osl_statement_equal().
osl_relation_list_p osl_relation_list_filter | ( | osl_relation_list_p | list, |
int | type | ||
) |
osl_relation_list_filter function: this function returns a copy of the input relation list, restricted to the relations of a given type. The special type OSL_TYPE_ACCESS filters any kind of access (read, write, rdwr etc.).
list | The relation list to copy/filter. |
type | The filtering type. |
Definition at line 703 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, osl_relation_is_access(), osl_relation_list_clone(), osl_relation_list_free(), OSL_TYPE_ACCESS, and osl_relation::type.
Referenced by osl_statement_dispatch().
void osl_relation_list_free | ( | osl_relation_list_p | list | ) |
osl_relation_list_free function: This function frees the allocated memory for a osl_relation_list_t structure, and all the relations stored in the list.
list | The pointer to the relation list we want to free. |
Definition at line 409 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, and osl_relation_free().
Referenced by osl_relation_list_drop(), osl_relation_list_filter(), osl_statement_dispatch(), and osl_statement_free().
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 | ||
) |
osl_relation_list_get_attributes function: this function returns, through its parameters, the maximum values of the relation attributes (nb_iterators, nb_parameters etc) in the relation list, depending on its type. HOWEVER, it updates the parameter value iff the attribute is greater than the input parameter value. Hence it may be used to get the attributes as well as to find the maximum attributes for several relation lists. The array identifier 0 is used when there is no array identifier (AND this is OK), OSL_UNDEFINED is used to report it is impossible to provide the property while it should. This function is not intended for checking, the input relation list should be correct.
[in] | list | The relation list to extract attribute values. |
[in,out] | nb_parameters | Number of parameter attribute. |
[in,out] | nb_iterators | Number of iterators attribute. |
[in,out] | nb_scattdims | Number of scattering dimensions attribute. |
[in,out] | nb_localdims | Number of local dimensions attribute. |
[in,out] | array_id | Maximum array identifier attribute. |
Definition at line 778 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, OSL_max, osl_relation_get_attributes(), and OSL_UNDEFINED.
Referenced by osl_statement_get_attributes().
void osl_relation_list_idump | ( | FILE * | file, |
osl_relation_list_p | l, | ||
int | level | ||
) |
osl_relation_list_idump function: Displays a osl_relation_list_t structure (a list of relations) into a file (file, possibly stdout). See osl_relation_print_structure for more details.
file | File where informations are printed. |
l | The list of relations whose information has to be printed. |
level | Number of spaces before printing, for each line. |
Definition at line 89 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, and osl_relation_idump().
Referenced by osl_relation_list_dump(), and osl_statement_idump().
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_integrity_check function: This function checks that a list of relation is "well formed" according to some expected properties (setting an expected value to OSL_UNDEFINED means that we do not expect a specific value) and what the relations are supposed to represent (all relations of a list are supposed to have the same semantics). It returns 0 if the check failed or 1 if no problem has been detected.
list | The relation list we want to check. |
type | Semantics about this relation (domain, access...). |
expected_nb_output_dims | Expected number of output dimensions. |
expected_nb_input_dims | Expected number of input dimensions. |
expected_nb_parameters | Expected number of parameters. |
Definition at line 654 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, and osl_relation_integrity_check().
Referenced by osl_statement_integrity_check().
osl_relation_list_malloc function: This function allocates the memory space for a osl_relation_list_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.
Definition at line 391 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, and OSL_malloc.
Referenced by osl_relation_list_clone(), osl_relation_list_node(), and osl_relation_list_pread().
osl_relation_list_node function: This function builds an osl_relation_list_t node and sets its relation element as a copy of the one provided as parameter. If the relation provided as an argument is NULL, NULL is returned.
r | The pointer to the relation to copy/paste in a list node. |
Definition at line 438 of file relation_list.c.
References osl_relation_clone(), and osl_relation_list_malloc().
osl_relation_list_pop function: this function sees a list of relations as a stack of relations and performs the pop operation onto this stack.
[in,out] | head | Pointer to the head of the relation stack. It is updated to the previous element in the stack (NULL if there is none). |
Definition at line 554 of file relation_list.c.
References osl_relation_list::next.
Referenced by osl_relation_list_drop(), and osl_relation_list_dup().
void osl_relation_list_pprint | ( | FILE * | file, |
osl_relation_list_p | list, | ||
osl_names_p | names | ||
) |
osl_relation_list_pprint function: This function pretty-prints the content of a osl_relation_list_t structure into a file (file, possibly stdout) in the OpenScop format. It prints an element of the list only if it is not NULL.
[in] | file | File where informations are printed. |
[in] | list | The relation list whose information has to be printed. |
[in] | names | Array of constraint columns names. |
Definition at line 296 of file relation_list.c.
References osl_relation_list_count(), and osl_relation_list_pprint_elts().
Referenced by osl_relation_list_print().
void osl_relation_list_pprint_access_array_scoplib | ( | FILE * | file, |
osl_relation_list_p | list, | ||
osl_names_p | names, | ||
int | add_fakeiter | ||
) |
osl_relation_list_pprint_access_array_scoplib function: This function pretty-prints the elements of a osl_relation_list_t structure into a file (file, possibly stdout) in the SCoPLib format. I.e., it prints only the elements and not the number of elements. It prints an element of the list only if it is not NULL.
file | File where informations are printed. | |
list | The relation list whose information has to be printed. | |
[in] | names | Array of constraint columns names. |
[in] | add_fakeiter | True of False |
Definition at line 196 of file relation_list.c.
References osl_relation_list::elt, osl_relation::nb_columns, osl_relation::nb_output_dims, osl_relation::nb_rows, osl_relation_list::next, osl_relation_list_count(), osl_relation_pprint_scoplib(), OSL_TYPE_MAY_WRITE, OSL_TYPE_READ, OSL_TYPE_WRITE, and osl_relation::type.
Referenced by osl_statement_pprint_scoplib().
void osl_relation_list_pprint_elts | ( | FILE * | file, |
osl_relation_list_p | list, | ||
osl_names_p | names | ||
) |
osl_relation_list_pprint_elts function: This function pretty-prints the elements of a osl_relation_list_t structure into a file (file, possibly stdout) in the OpenScop format. I.e., it prints only the elements and not the number of elements. It prints an element of the list only if it is not NULL.
file | File where informations are printed. | |
list | The relation list whose information has to be printed. | |
[in] | names | Array of constraint columns names. |
Definition at line 158 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, osl_relation_list_count(), and osl_relation_pprint().
Referenced by osl_relation_list_pprint(), and osl_statement_pprint().
osl_relation_list_p osl_relation_list_pread | ( | FILE * | file, |
int | precision | ||
) |
osl_relation_list_pread function ("precision read"): this function reads a list of relations into a file (foo, posibly stdin) and returns a pointer this relation list.
[in] | file | The input stream. |
[in] | precision | The precision of the relation elements. |
Definition at line 340 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, OSL_error, osl_relation_list_malloc(), osl_relation_pread(), and osl_util_read_int().
Referenced by osl_relation_list_read(), and osl_statement_pread().
void osl_relation_list_print | ( | FILE * | file, |
osl_relation_list_p | list | ||
) |
osl_relation_list_print function: This function prints the content of a osl_relation_list_t structure into a file (file, possibly stdout) in the OpenScop format. It prints an element of the list only if it is not NULL.
file | File where informations are printed. |
list | The relation list whose information has to be printed. |
Definition at line 322 of file relation_list.c.
References osl_relation_list_pprint().
void osl_relation_list_push | ( | osl_relation_list_p * | head, |
osl_relation_list_p | node | ||
) |
osl_relation_list_push function: this function sees a list of relations as a stack of relations and performs the push operation onto this stack.
[in,out] | head | Pointer to the head of the relation stack. |
[in,out] | node | Relation node to add to the stack. Its next field is updated to the previous head of the stack. |
Definition at line 536 of file relation_list.c.
References osl_relation_list::next.
Referenced by osl_relation_list_dup().
osl_relation_list_p osl_relation_list_read | ( | FILE * | foo | ) |
osl_relation_list_read function: this function is equivalent to osl_relation_list_pread() except that the precision corresponds to the precision environment variable or to the highest available precision if it is not defined.
Definition at line 372 of file relation_list.c.
References osl_relation_list_pread(), osl_util_get_precision(), and osl_relation::precision.
void osl_relation_list_set_type | ( | osl_relation_list_p | list, |
int | type | ||
) |
osl_relation_list_set_type function: this function sets the type of each relation in the relation list to the one provided as parameter.
list | The list of relations to set the type. |
type | The type. |
Definition at line 683 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, and osl_relation::type.