OpenScop
0.9.0
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <osl/macros.h>
#include <osl/int.h>
#include <osl/util.h>
#include <osl/vector.h>
#include <osl/strings.h>
#include <osl/names.h>
#include <osl/relation.h>
Go to the source code of this file.
void osl_relation_add | ( | osl_relation_p * | r1, |
osl_relation_p | r2 | ||
) |
osl_relation_add function: this function adds a relation (union) at the end of the relation (union) pointed by r1. No new relation is created: this functions links the two input unions. If the first relation is NULL, it is set to the second relation.
[in,out] | r1 | Pointer to the first relation (union). |
[in] | r2 | The second relation (union). |
Definition at line 1850 of file relation.c.
Referenced by osl_relation_union().
void osl_relation_add_vector | ( | osl_relation_p | relation, |
osl_vector_p | vector, | ||
int | row | ||
) |
osl_relation_add_vector function: this function adds (meaning, +) a vector to the "row"^th row of a relation "relation". It directly updates the relation union part pointed by "relation" and this part only.
[in,out] | relation | The relation we want to add a vector to a row. |
[in] | vector | The vector that will replace a row of the relation. |
[in] | row | The row of the relation to add the vector. |
Definition at line 1915 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_add(), osl_int_assign(), osl_int_get_si(), osl_vector::precision, osl_relation::precision, osl_vector::size, and osl_vector::v.
static int osl_relation_check_attribute | ( | int * | expected, |
int | actual | ||
) | [static] |
osl_relation_check_attribute internal function: This function checks whether an "actual" value is the same as an "expected" value or not. If the expected value is set to OSL_UNDEFINED, this function sets it to the "actual" value and do not report a difference has been detected. It returns 0 if a difference has been detected, 1 otherwise.
[in,out] | expected | Pointer to the expected value (the value is modified if it was set to OSL_UNDEFINED). |
[in] | actual | Value we want to check. |
Definition at line 2435 of file relation.c.
References OSL_UNDEFINED, and OSL_warning.
Referenced by osl_relation_integrity_check().
static int osl_relation_check_nb_columns | ( | osl_relation_p | relation, |
int | expected_nb_output_dims, | ||
int | expected_nb_input_dims, | ||
int | expected_nb_parameters | ||
) | [static] |
osl_relation_check_nb_columns internal function: This function checks that the number of columns of a relation corresponds to some expected properties (setting an expected property to OSL_UNDEFINED makes this function unable to detect a problem). It returns 0 if the number of columns seems incorrect or 1 if no problem has been detected.
[in] | relation | The relation we want to check the number of columns. |
[in] | expected_nb_output_dims | Expected number of output dimensions. |
[in] | expected_nb_input_dims | Expected number of input dimensions. |
[in] | expected_nb_parameters | Expected number of parameters. |
Definition at line 2465 of file relation.c.
References osl_relation::nb_columns, osl_relation::nb_local_dims, OSL_UNDEFINED, and OSL_warning.
Referenced by osl_relation_integrity_check().
osl_relation_p osl_relation_clone | ( | osl_relation_p | relation | ) |
osl_relation_clone function: this function builds and returns a "hard copy" (not a pointer copy) of an osl_relation_t data structure (the full union of relation).
[in] | relation | The pointer to the relation we want to clone. |
Definition at line 1833 of file relation.c.
References osl_relation_nclone().
Referenced by osl_dependence_nclone(), osl_relation_concat_constraints(), osl_relation_interface(), osl_relation_list_clone(), osl_relation_list_node(), osl_relation_union(), osl_scop_clone(), and osl_statement_nclone().
osl_relation_p osl_relation_clone_nconstraints | ( | osl_relation_p | relation, |
int | n | ||
) |
osl_relation_clone_nconstraints function: this functions builds and returns a "hard copy" (not a pointer copy) of a osl_relation_t data structure such that the clone is restricted to the "n" first rows of the relation. This applies to all the parts in the case of a relation union.
[in] | relation | The pointer to the relation we want to clone. |
[in] | n | The number of row of the relation we want to clone (the special value -1 means "all the rows"). |
Definition at line 1781 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, OSL_error, osl_int_assign(), osl_relation_pmalloc(), osl_relation::precision, and osl_relation::type.
static char* osl_relation_column_string | ( | osl_relation_p | relation, |
char ** | strings | ||
) | [static] |
osl_relation_column_string function: this function returns an OpenScop comment string showing all column names. It is designed to nicely fit a constraint matrix that would be printed just below this line.
[in] | relation | The relation related to the comment line to build. |
[in] | strings | Array of textual names of the various elements. |
Definition at line 614 of file relation.c.
References osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, OSL_FMT_LENGTH, OSL_malloc, and OSL_MAX_STRING.
Referenced by osl_relation_spprint_polylib().
static char* osl_relation_column_string_scoplib | ( | osl_relation_p | relation, |
char ** | strings | ||
) | [static] |
osl_relation_column_string_scoplib function: this function returns an OpenScop comment string showing all column names. It is designed to nicely fit a constraint matrix that would be printed just below this line.
[in] | relation | The relation related to the comment line to build. |
[in] | strings | Array of textual names of the various elements. |
Definition at line 690 of file relation.c.
References osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, OSL_FMT_LENGTH, OSL_malloc, OSL_MAX_STRING, OSL_TYPE_DOMAIN, and osl_relation::type.
Referenced by osl_relation_spprint_polylib_scoplib().
osl_relation_concat_constraints function: this function builds a new relation from two relations sent as parameters. The new set of constraints is built as the concatenation of the rows of the first elements of the two relation unions r1 and r2. This means, there is no next field in the result.
[in] | r1 | The first relation. |
[in] | r2 | The second relation. |
Definition at line 2332 of file relation.c.
References osl_relation::nb_columns, osl_relation::nb_rows, osl_relation::next, OSL_error, osl_relation_clone(), osl_relation_pmalloc(), osl_relation_replace_constraints(), OSL_warning, and osl_relation::precision.
Referenced by osl_relation_concat_vector().
osl_relation_p osl_relation_concat_vector | ( | osl_relation_p | relation, |
osl_vector_p | vector | ||
) |
osl_relation_concat_vector function: this function builds a new relation from one relation and a vector sent as parameters. The new set of constraints is built as the concatenation of the rows of the first part of the relation and of the vector constraint. This means, there is no next field in the result.
[in] | r | The input relation. |
[in] | v | The input vector. |
Definition at line 1996 of file relation.c.
References osl_relation_concat_constraints(), osl_relation_free(), and osl_relation_from_vector().
void osl_relation_dump | ( | FILE * | file, |
osl_relation_p | relation | ||
) |
osl_relation_dump function: this function prints the content of a osl_relation_t structure (*relation) into a file (file, possibly stdout).
[in] | file | File where informations are printed. |
[in] | relation | The relation whose information have to be printed. |
Definition at line 246 of file relation.c.
References osl_relation_idump().
Referenced by osl_relation_integrity_check().
int osl_relation_equal | ( | osl_relation_p | r1, |
osl_relation_p | r2 | ||
) |
osl_relation_equal function: this function returns true if the two relations provided as parameters are the same, false otherwise.
[in] | r1 | The first relation. |
[in] | r2 | The second relation. |
Definition at line 2405 of file relation.c.
References osl_relation::next, and osl_relation_part_equal().
Referenced by osl_dependence_equal(), osl_relation_interface(), osl_relation_list_equal(), osl_scop_equal(), and osl_statement_equal().
char* osl_relation_expression | ( | osl_relation_p | relation, |
int | row, | ||
char ** | strings | ||
) |
osl_relation_expression function: this function returns a string corresponding to an affine expression stored at the "row"^th row of the relation pointed by "relation".
[in] | relation | A set of linear expressions. |
[in] | row | The row corresponding to the expression. |
[in] | strings | Array of textual names of the various elements. |
Definition at line 466 of file relation.c.
References osl_relation::nb_columns, and osl_relation_subexpression().
Referenced by osl_relation_sprint_comment().
static char* osl_relation_expression_element | ( | osl_int_t | val, |
int | precision, | ||
int * | first, | ||
int | cst, | ||
char * | name | ||
) | [static] |
osl_relation_expression_element function: this function returns a string containing the printing of a value (e.g., an iterator with its coefficient or a constant).
[in] | val | Coefficient or constant value. |
[in] | precision | The precision of the value. |
[in,out] | first | Pointer to a boolean set to 1 if the current value is the first of an expresion, 0 otherwise (maybe updated). |
[in] | cst | A boolean set to 1 if the value is a constant, 0 otherwise. |
[in] | name | String containing the name of the element. |
Definition at line 266 of file relation.c.
References osl_int_mone(), osl_int_neg(), osl_int_one(), osl_int_pos(), osl_int_sprint_txt(), osl_int_zero(), OSL_malloc, and OSL_MAX_STRING.
Referenced by osl_relation_subexpression().
osl_relation_p osl_relation_extend_output | ( | osl_relation_p | relation, |
int | dim | ||
) |
osl_relation_extend_output function: this function extends the number of output dimensions of a given relation. It returns a copy of the input relation with a number of output dimensions extended to "dim" for all its union components. The new output dimensions are simply set equal to 0. The extended number of dimensions must be higher than or equal to the original one (an error will be raised otherwise).
[in] | relation | The input relation to extend. |
[in] | dim | The number of output dimension to reach. |
Definition at line 2906 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, OSL_error, osl_int_assign(), osl_int_set_si(), OSL_max, osl_relation_pmalloc(), osl_relation::precision, and osl_relation::type.
Referenced by osl_scop_normalize_scattering().
void osl_relation_free | ( | osl_relation_p | relation | ) |
osl_relation_free function: this function frees the allocated memory for an osl_relation_t structure.
[in] | relation | The pointer to the relation we want to free. |
Definition at line 1701 of file relation.c.
References osl_relation::next, and osl_relation_free_inside().
Referenced by osl_dependence_free(), osl_relation_concat_vector(), osl_relation_insert_vector(), osl_relation_interface(), osl_relation_list_free(), osl_scop_free(), osl_scop_normalize_scattering(), and osl_statement_free().
void osl_relation_free_inside | ( | osl_relation_p | relation | ) |
osl_relation_free_inside function: this function frees the allocated memory for the inside of a osl_relation_t structure, i.e. only m.
[in] | relation | The pointer to the relation we want to free internals. |
Definition at line 1676 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, osl_int_clear(), and osl_relation::precision.
Referenced by osl_relation_free(), osl_relation_insert_blank_column(), osl_relation_insert_columns(), osl_relation_insert_constraints(), osl_relation_remove_column(), and osl_relation_remove_row().
osl_relation_from_vector function: this function converts a vector "vector" to a relation with a single row and returns a pointer to that relation.
[in] | vector | The vector to convert to a relation. |
Definition at line 2074 of file relation.c.
References osl_relation_pmalloc(), osl_relation_replace_vector(), osl_vector::precision, and osl_vector::size.
Referenced by osl_relation_concat_vector(), and osl_relation_insert_vector().
int osl_relation_get_array_id | ( | osl_relation_p | relation | ) |
osl_relation_get_array_id function: this function returns the array identifier in a relation with access type It returns OSL_UNDEFINED if it is not able to find it (in particular if there are irregularities in the relation).
[in] | relation | The relation where to find an array identifier. |
Definition at line 2695 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, osl_relation::next, osl_int_divisible(), osl_int_get_si(), osl_int_zero(), osl_relation_is_access(), OSL_UNDEFINED, OSL_warning, and osl_relation::precision.
Referenced by osl_relation_get_attributes(), osl_relation_integrity_check(), and osl_relation_sprint_comment().
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_get_attributes function: this function returns, through its parameters, the maximum values of the relation attributes (nb_iterators, nb_parameters etc), 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 relations. 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 should be correct.
[in] | relation | The relation 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 2823 of file relation.c.
References osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::next, OSL_max, osl_relation_get_array_id(), osl_relation_is_access(), OSL_TYPE_ACCESS, OSL_TYPE_CONTEXT, OSL_TYPE_DOMAIN, OSL_TYPE_SCATTERING, OSL_UNDEFINED, and osl_relation::type.
Referenced by osl_relation_list_get_attributes(), osl_relation_names(), osl_scop_get_attributes(), and osl_statement_get_attributes().
void osl_relation_idump | ( | FILE * | file, |
osl_relation_p | relation, | ||
int | level | ||
) |
osl_relation_idump function: this function displays a osl_relation_t structure (*relation) into a file (file, possibly stdout) in a way that trends to be understandable. It includes an indentation level (level) in order to work with others idump functions.
[in] | file | File where informations are printed. |
[in] | relation | The relation whose information has to be printed. |
[in] | level | Number of spaces before printing, for each line. |
Definition at line 164 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, osl_int_dump_precision(), osl_int_print(), osl_relation_print_type(), and osl_relation::precision.
Referenced by osl_dependence_idump(), osl_relation_dump(), osl_relation_interface(), osl_relation_list_idump(), osl_scop_idump(), and osl_statement_idump().
void osl_relation_insert_blank_column | ( | osl_relation_p | relation, |
int | column | ||
) |
osl_relation_insert_blank_column function: this function inserts a new column filled with zeros to an existing relation union part (it only affects the first union part). WARNING: this function does not update the relation attributes.
[in,out] | relation | The relation to add a column in. |
[in] | column | The column where to insert the blank column. |
Definition at line 2033 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_assign(), osl_relation_free_inside(), osl_relation_pmalloc(), and osl_relation::precision.
void osl_relation_insert_blank_row | ( | osl_relation_p | relation, |
int | row | ||
) |
osl_relation_insert_blank_row function: this function inserts a new row filled with zeros o an existing relation union part (it only affects the first union part).
[in,out] | relation | The relation to add a row in. |
[in] | row | The row where to insert the blank row. |
Definition at line 2014 of file relation.c.
References osl_relation::nb_columns, osl_relation_insert_vector(), osl_vector_free(), osl_vector_pmalloc(), and osl_relation::precision.
void osl_relation_insert_columns | ( | osl_relation_p | relation, |
osl_relation_p | insert, | ||
int | column | ||
) |
osl_relation_insert_columns function: this function inserts new columns to an existing relation union part (it only affects the first union part). The columns are copied out from the matrix of an input relation which must have the convenient number of rows. All columns of the input matrix are copied. WARNING: this function does not update the relation attributes of the modified matrix.
[in,out] | relation | The relation to add columns in. |
[in] | insert | The relation containing the columns to add. |
[in] | column | The column where to insert the new columns. |
Definition at line 2279 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_assign(), osl_relation_free_inside(), osl_relation_pmalloc(), and osl_relation::precision.
void osl_relation_insert_constraints | ( | osl_relation_p | r1, |
osl_relation_p | r2, | ||
int | row | ||
) |
osl_relation_insert_constraints function: this function inserts the rows of the relation "r2" to the relation "r1", starting from the "row"^th row of "r1" (-1 is a shortcut to insert the "r2" constraints after the constraints of r1). It directly updates the relation union part pointed by "r1" and this part only. If "r2" (or "r1") is NULL, the relation is left unmodified.
[in,out] | r1 | The relation we want to extend. |
[in] | r2 | The relation to be inserted. |
[in] | row | The row where to insert the constraints (-1 to insert them after those of "r1"). |
Definition at line 2123 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_assign(), osl_relation_free_inside(), osl_relation_pmalloc(), osl_relation_replace_constraints(), and osl_relation::precision.
Referenced by osl_relation_insert_vector().
void osl_relation_insert_vector | ( | osl_relation_p | relation, |
osl_vector_p | vector, | ||
int | row | ||
) |
osl_relation_insert_vector function: this function inserts a new row corresponding to the vector "vector" to the relation "relation" by inserting it at the "row"^th row of "relation" (-1 is a shortcut to insert the vector after the constraints of the relation). It directly updates the relation union part pointed by "relation" and this part only. If "vector" (or "relation") is NULL, the relation is left unmodified.
[in,out] | relation | The relation we want to extend. |
[in] | vector | The vector that will be added relation. |
[in] | row | The row where to insert the vector (-1 to insert it after the relation constraints). |
Definition at line 1975 of file relation.c.
References osl_relation_free(), osl_relation_from_vector(), and osl_relation_insert_constraints().
Referenced by osl_relation_insert_blank_row().
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_integrity_check function: this function checks that a 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 relation is supposed to represent. It returns 0 if the check failed or 1 if no problem has been detected.
[in] | relation | The relation we want to check. |
[in] | expected_type | Semantics about this relation (domain, access...). |
[in] | expected_nb_output_dims | Expected number of output dimensions. |
[in] | expected_nb_input_dims | Expected number of input dimensions. |
[in] | expected_nb_parameters | Expected number of parameters. |
Definition at line 2510 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, OSL_debug, osl_int_one(), osl_int_zero(), osl_relation_check_attribute(), osl_relation_check_nb_columns(), osl_relation_dump(), osl_relation_get_array_id(), osl_relation_is_access(), OSL_TYPE_ACCESS, OSL_TYPE_CONTEXT, OSL_TYPE_DOMAIN, OSL_UNDEFINED, OSL_warning, osl_relation::precision, and osl_relation::type.
Referenced by osl_relation_list_integrity_check(), osl_scop_integrity_check(), and osl_statement_integrity_check().
osl_relation_interface function: this function creates an interface structure corresponding to the relation and returns it.
Definition at line 2970 of file relation.c.
References osl_interface_malloc(), osl_relation_clone(), osl_relation_equal(), osl_relation_free(), osl_relation_idump(), osl_relation_malloc(), osl_relation_sprint(), osl_relation_sread(), OSL_strdup, and OSL_URI_RELATION.
Referenced by osl_interface_get_default_registry().
int osl_relation_is_access | ( | osl_relation_p | relation | ) |
osl_relation_is_access function: this function returns 1 if the relation corresponds to an access relation, whatever its precise type (read, write etc.), 0 otherwise.
relation | The relation to check wheter it is an access relation or not. |
Definition at line 2790 of file relation.c.
References OSL_TYPE_ACCESS, OSL_TYPE_MAY_WRITE, OSL_TYPE_READ, OSL_TYPE_WRITE, and osl_relation::type.
Referenced by osl_relation_get_array_id(), osl_relation_get_attributes(), osl_relation_integrity_check(), osl_relation_list_filter(), osl_relation_sprint_comment(), and osl_relation_strings().
static int osl_relation_is_simple_output | ( | osl_relation_p | relation, |
int | row | ||
) | [static] |
osl_relation_is_simple_output function: this function returns 1 or -1 if a given constraint row of a relation corresponds to an output, 0 otherwise. We call a simple output an equality constraint where exactly one output coefficient is not 0 and is either 1 (in this case the function returns 1) or -1 (in this case the function returns -1).
[in] | relation | The relation to test for simple output. |
[in] | row | The row corresponding to the constraint to test. |
Definition at line 487 of file relation.c.
References osl_relation::m, osl_relation::nb_output_dims, osl_relation::nb_rows, OSL_error, osl_int_mone(), osl_int_one(), osl_int_zero(), and osl_relation::precision.
Referenced by osl_relation_sprint_comment().
osl_relation_p osl_relation_malloc | ( | int | nb_rows, |
int | nb_columns | ||
) |
osl_relation_malloc function: this function is equivalent to osl_relation_pmalloc() except that the precision corresponds to the precision environment variable or to the highest available precision if it is not defined.
Definition at line 1664 of file relation.c.
References osl_relation_pmalloc(), and osl_util_get_precision().
Referenced by osl_relation_interface().
static osl_names_p osl_relation_names | ( | osl_relation_p | relation | ) | [static] |
osl_relation_names function: this function generates as set of names for all the dimensions involved in a given relation.
[in] | relation | The relation we have to generate names for. |
Definition at line 772 of file relation.c.
References osl_names_generate(), osl_relation_get_attributes(), and OSL_UNDEFINED.
Referenced by osl_relation_spprint_polylib(), and osl_relation_spprint_polylib_scoplib().
int osl_relation_nb_components | ( | osl_relation_p | relation | ) |
osl_relation_nb_components function: this function returns the number of component in the union of relations provided as parameter.
[in] | relation | The input union of relations. |
Definition at line 797 of file relation.c.
References osl_relation::next.
Referenced by osl_relation_nclone(), osl_relation_spprint(), osl_relation_spprint_polylib(), and osl_relation_spprint_polylib_scoplib().
osl_relation_p osl_relation_nclone | ( | osl_relation_p | relation, |
int | n | ||
) |
osl_relation_nclone function: this functions builds and returns a "hard copy" (not a pointer copy) of the first n parts of a relation union.
[in] | relation | The pointer to the relation we want to clone. |
[in] | n | The number of union parts of the relation we want to clone (the special value -1 means "all the parts"). |
Definition at line 1728 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, OSL_error, osl_int_assign(), osl_relation_nb_components(), osl_relation_pmalloc(), osl_relation::precision, and osl_relation::type.
Referenced by osl_relation_clone().
int osl_relation_part_equal | ( | osl_relation_p | r1, |
osl_relation_p | r2 | ||
) |
osl_relation_part_equal function: this function returns true if the two relations parts provided as parameters are the same, false otherwise. In the case of relation unions, only the first part of the two relations are tested.
[in] | r1 | The first relation. |
[in] | r2 | The second relation. |
Definition at line 2368 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_int_ne(), osl_relation::precision, and osl_relation::type.
Referenced by osl_relation_equal().
osl_relation_p osl_relation_pmalloc | ( | int | precision, |
int | nb_rows, | ||
int | nb_columns | ||
) |
osl_relation_pmalloc function: (precision malloc) this function allocates the memory space for an osl_relation_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.
[in] | precision | The precision of the constraint matrix. |
[in] | nb_rows | The number of row of the relation to allocate. |
[in] | nb_columns | The number of columns of the relation to allocate. |
Definition at line 1612 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, OSL_error, osl_int_init_set_si(), OSL_malloc, OSL_PRECISION_DP, OSL_PRECISION_MP, OSL_PRECISION_SP, OSL_UNDEFINED, osl_relation::precision, and osl_relation::type.
Referenced by osl_relation_clone_nconstraints(), osl_relation_concat_constraints(), osl_relation_extend_output(), osl_relation_from_vector(), osl_relation_insert_blank_column(), osl_relation_insert_columns(), osl_relation_insert_constraints(), osl_relation_malloc(), osl_relation_nclone(), osl_relation_pread(), osl_relation_psread(), osl_relation_remove_column(), and osl_relation_remove_row().
void osl_relation_pprint | ( | FILE * | file, |
osl_relation_p | relation, | ||
osl_names_p | names | ||
) |
osl_relation_pprint function: this function pretty-prints the content of an osl_relation_t structure (*relation) into a file (file, possibly stdout) in the OpenScop format.
[in] | file | File where informations are printed. |
[in] | relation | The relation whose information has to be printed. |
[in] | names | The names of the constraint columns for comments. |
Definition at line 1242 of file relation.c.
References osl_relation_spprint().
Referenced by osl_relation_list_pprint_elts(), osl_relation_print(), osl_scop_print(), and osl_statement_pprint().
void osl_relation_pprint_scoplib | ( | FILE * | file, |
osl_relation_p | relation, | ||
osl_names_p | names, | ||
int | print_nth_part, | ||
int | add_fakeiter | ||
) |
osl_relation_pprint_scoplib function: this function pretty-prints the content of an osl_relation_t structure (*relation) into a file (file, possibly stdout) in the SCoPLibformat.
[in] | file | File where informations are printed. |
[in] | relation | The relation whose information has to be printed. |
[in] | names | The names of the constraint columns for comments. |
[in] | print_nth_part | |
[in] | add_fakeiter |
Definition at line 1260 of file relation.c.
References osl_relation_spprint_scoplib().
Referenced by osl_relation_list_pprint_access_array_scoplib(), osl_scop_print_scoplib(), and osl_statement_pprint_scoplib().
osl_relation_p osl_relation_pread | ( | FILE * | foo, |
int | precision | ||
) |
osl_relation_pread function ("precision read"): this function reads a relation into a file (foo, posibly stdin) and returns a pointer this relation.
[in] | foo | The input stream. |
[in] | precision | The precision of the relation elements. |
Definition at line 1382 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, OSL_error, osl_int_sread(), OSL_MAX_STRING, osl_relation_pmalloc(), osl_relation_read_type(), osl_util_skip_blank_and_comments(), and osl_relation::type.
Referenced by osl_relation_list_pread(), osl_relation_read(), and osl_scop_pread().
void osl_relation_print | ( | FILE * | file, |
osl_relation_p | relation | ||
) |
osl_relation_print function: this function prints the content of an osl_relation_t structure (*relation) into a file (file, possibly stdout) in the OpenScop format.
[in] | file | File where informations are printed. |
[in] | relation | The relation whose information has to be printed. |
Definition at line 1290 of file relation.c.
References osl_relation_pprint().
static void osl_relation_print_type | ( | FILE * | file, |
osl_relation_p | relation | ||
) | [static] |
osl_relation_print_type function: this function displays the textual type of an osl_relation_t structure into a file (file, possibly stdout), according to the OpenScop specification.
[in] | file | File where informations are printed. |
[in] | relation | The relation whose type has to be printed. |
Definition at line 147 of file relation.c.
References osl_relation_sprint_type().
Referenced by osl_relation_idump().
osl_relation_p osl_relation_psread | ( | char ** | input, |
int | precision | ||
) |
osl_relation_psread function ("precision read"): this function reads a relation from a string complying to the OpenScop textual format and returns a pointer this relation. The input parameter is updated to the position in the input string this function reach right after reading the generic structure.
[in,out] | input | The input string where to find a relation. Updated to the position after what has been read. |
[in] | precision | The precision of the relation elements. |
Definition at line 1480 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, OSL_error, osl_int_sread(), OSL_MAX_STRING, osl_relation_pmalloc(), osl_relation_read_type(), osl_util_sskip_blank_and_comments(), and osl_relation::type.
Referenced by osl_dependence_read_one_dep(), and osl_relation_sread().
osl_relation_p osl_relation_read | ( | FILE * | foo | ) |
osl_relation_read function: this function is equivalent to osl_relation_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 1590 of file relation.c.
References osl_relation_pread(), and osl_util_get_precision().
static int osl_relation_read_type | ( | FILE * | file, |
char ** | str | ||
) | [static] |
osl_relation_read_type function: this function reads a textual relation type on the input 'file' or the input string 'str' depending on which one is not NULL (exactly one of them must not be NULL). It returns its integer counterpart.
[in] | file | The file where to read a relation type (if not NULL). |
[in,out] | str | The string where to read a relation type (if not NULL). This pointer is updated to reflect the read and points after the tag in the input string. |
Definition at line 1313 of file relation.c.
References OSL_error, OSL_STRING_CONTEXT, OSL_STRING_DOMAIN, OSL_STRING_MAY_WRITE, OSL_STRING_READ, OSL_STRING_SCATTERING, OSL_STRING_UNDEFINED, OSL_STRING_WRITE, osl_strings_free(), osl_strings_read(), osl_strings_size(), osl_strings_sread(), OSL_TYPE_CONTEXT, OSL_TYPE_DOMAIN, OSL_TYPE_MAY_WRITE, OSL_TYPE_READ, OSL_TYPE_SCATTERING, OSL_TYPE_WRITE, OSL_UNDEFINED, OSL_warning, and osl_strings::string.
Referenced by osl_relation_pread(), and osl_relation_psread().
void osl_relation_remove_column | ( | osl_relation_p | r, |
int | column | ||
) |
osl_relation_remove_column function: this function removes a given column to the relation "r". It directly updates the relation union part pointed by "r" and this part only.
[in,out] | r | The relation to remove a column. |
[in] | column | The column number to remove. |
Definition at line 2235 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_assign(), osl_relation_free_inside(), osl_relation_pmalloc(), and osl_relation::precision.
void osl_relation_remove_row | ( | osl_relation_p | r, |
int | row | ||
) |
osl_relation_remove_row function: this function removes a given row to the relation "r". It directly updates the relation union part pointed by "r" and this part only.
[in,out] | r | The relation to remove a row. |
[in] | row | The row number to remove. |
Definition at line 2195 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_assign(), osl_relation_free_inside(), osl_relation_pmalloc(), and osl_relation::precision.
void osl_relation_replace_constraints | ( | osl_relation_p | r1, |
osl_relation_p | r2, | ||
int | row | ||
) |
osl_relation_replace_constraints function: this function replaces some rows of a relation "r1" with the rows of the relation "r2". It begins at the "row"^th row of "r1". It directly updates the relation union part pointed by "r1" and this part only.
[in,out] | r1 | The relation we want to change some rows. |
[in] | r2 | The relation containing the new rows. |
[in] | row | The first row of the relation r1 to be replaced. |
Definition at line 2095 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_assign(), and osl_relation::precision.
Referenced by osl_relation_concat_constraints(), and osl_relation_insert_constraints().
void osl_relation_replace_vector | ( | osl_relation_p | relation, |
osl_vector_p | vector, | ||
int | row | ||
) |
osl_relation_replace_vector function: this function replaces the "row"^th row of a relation "relation" with the vector "vector". It directly updates the relation union part pointed by "relation" and this part only.
[in,out] | relation | The relation we want to replace a row. |
[in] | vector | The vector that will replace a row of the relation. |
[in] | row | The row of the relation to be replaced. |
Definition at line 1891 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_assign(), osl_vector::precision, osl_relation::precision, osl_vector::size, and osl_vector::v.
Referenced by osl_relation_from_vector().
void osl_relation_set_attributes | ( | osl_relation_p | relation, |
int | nb_output_dims, | ||
int | nb_input_dims, | ||
int | nb_local_dims, | ||
int | nb_parameters | ||
) |
osl_relation_set_attributes function: this functions sets the attributes of a relation (union) provided as a parameter. It updates the relation directly.
[in,out] | relation | The relation (union) to set the attributes. |
[in] | nb_output_dims | Number of output dimensions. |
[in] | nb_input_dims | Number of input dimensions. |
[in] | nb_local_dims | Number of local dimensions. |
[in] | nb_parameters | Number of parameters. |
Definition at line 2659 of file relation.c.
References osl_relation::next, and osl_relation_set_attributes_one().
void osl_relation_set_attributes_one | ( | osl_relation_p | relation, |
int | nb_output_dims, | ||
int | nb_input_dims, | ||
int | nb_local_dims, | ||
int | nb_parameters | ||
) |
osl_relation_set_attributes_one function: this functions sets the attributes of a relation part provided as a parameter. It updates the relation directly.
[in,out] | relation | The relation (union part) to set the attributes. |
[in] | nb_output_dims | Number of output dimensions. |
[in] | nb_input_dims | Number of input dimensions. |
[in] | nb_local_dims | Number of local dimensions. |
[in] | nb_parameters | Number of parameters. |
Definition at line 2637 of file relation.c.
References osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, and osl_relation::nb_parameters.
Referenced by osl_relation_set_attributes().
void osl_relation_set_type | ( | osl_relation_p | relation, |
int | type | ||
) |
osl_relation_set_type function: this function sets the type of each relation union part in the relation to the one provided as parameter.
relation | The relation to set the type. |
type | The type. |
Definition at line 2678 of file relation.c.
References osl_relation::next, and osl_relation::type.
char* osl_relation_spprint | ( | osl_relation_p | relation, |
osl_names_p | names | ||
) |
osl_relation_spprint function: this function pretty-prints the content of an osl_relation_t structure (*relation) into a string in the OpenScop format, and returns this string.
[in] | relation | The relation whose information has to be printed. |
[in] | names | The names of the constraint columns for comments. |
Definition at line 1180 of file relation.c.
References OSL_malloc, OSL_MAX_STRING, osl_relation_nb_components(), osl_relation_spprint_polylib(), osl_relation_sprint_type(), and osl_util_safe_strcat().
Referenced by osl_relation_pprint(), and osl_relation_sprint().
char* osl_relation_spprint_polylib | ( | osl_relation_p | relation, |
osl_names_p | names | ||
) |
osl_relation_spprint_polylib function: this function pretty-prints the content of an osl_relation_t structure (*relation) into a string in the extended polylib format, and returns this string. This format is the same as OpenScop's, minus the type.
[in] | relation | The relation whose information has to be printed. |
[in] | names | The names of the constraint columns for comments. |
Definition at line 818 of file relation.c.
References osl_names::arrays, osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, osl_int_sprint(), OSL_malloc, OSL_MAX_STRING, osl_names_free(), osl_relation_column_string(), osl_relation_names(), osl_relation_nb_components(), osl_relation_sprint_comment(), osl_relation_strings(), osl_util_safe_strcat(), osl_util_strdup(), osl_relation::precision, and osl_strings::string.
Referenced by osl_relation_spprint().
char* osl_relation_spprint_polylib_scoplib | ( | osl_relation_p | relation, |
osl_names_p | names, | ||
int | print_nth_part, | ||
int | add_fakeiter | ||
) |
osl_relation_spprint_polylib_scoplib function: this function pretty-prints the content of an osl_relation_t structure (*relation) into a string in the extended polylib format, and returns this string.
[in] | relation | The relation whose information has to be printed. |
[in] | names | The names of the constraint columns for comments. |
[in] | print_nth_part | Print the value of `n' (used for domain union) |
[in] | add_fakeiter |
Definition at line 919 of file relation.c.
References osl_names::arrays, osl_relation::m, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, osl_relation::nb_rows, osl_relation::next, osl_int_sprint(), OSL_malloc, OSL_MAX_STRING, osl_names_free(), osl_relation_column_string_scoplib(), osl_relation_names(), osl_relation_nb_components(), osl_relation_sprint_comment(), osl_relation_strings(), OSL_TYPE_DOMAIN, OSL_TYPE_READ, OSL_TYPE_SCATTERING, OSL_TYPE_WRITE, osl_util_safe_strcat(), osl_util_strdup(), osl_relation::precision, osl_strings::string, and osl_relation::type.
Referenced by osl_relation_spprint_scoplib().
char* osl_relation_spprint_scoplib | ( | osl_relation_p | relation, |
osl_names_p | names, | ||
int | print_nth_part, | ||
int | add_fakeiter | ||
) |
osl_relation_spprint_scoplib function: this function pretty-prints the content of an osl_relation_t structure (*relation) into a string in the SCoPLib format, and returns this string.
[in] | relation | The relation whose information has to be printed. |
[in] | names | The names of the constraint columns for comments. |
[in] | print_nth_part | Print the value of `n' (used for domain union) |
[in] | add_fakeiter |
Definition at line 1215 of file relation.c.
References OSL_malloc, OSL_MAX_STRING, osl_relation_spprint_polylib_scoplib(), and osl_util_safe_strcat().
Referenced by osl_relation_pprint_scoplib().
char* osl_relation_sprint | ( | osl_relation_p | relation | ) |
osl_relation_sprint function: this function prints the content of an osl_relation_t structure (*relation) into a string (returned) in the OpenScop textual format.
[in] | relation | The relation structure to print. |
Definition at line 1277 of file relation.c.
References osl_relation_spprint().
Referenced by osl_dependence_sprint(), and osl_relation_interface().
static char* osl_relation_sprint_comment | ( | osl_relation_p | relation, |
int | row, | ||
char ** | strings, | ||
char ** | arrays | ||
) | [static] |
osl_relation_sprint_comment function: this function prints into a string a comment corresponding to a constraint of a relation, according to its type, then it returns this string. This function does not check that printing the comment is possible (i.e., are there enough names ?), hence it is the responsibility of the user to ensure he/she can call this function safely.
[in] | relation | The relation for which a comment has to be printed. |
[in] | row | The constrain row for which a comment has to be printed. |
[in] | strings | Array of textual names of the various elements. |
[in] | arrays | Array of textual identifiers of the arrays. |
Definition at line 540 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_output_dims, OSL_debug, osl_int_zero(), OSL_malloc, OSL_MAX_STRING, osl_relation_expression(), osl_relation_get_array_id(), osl_relation_is_access(), osl_relation_is_simple_output(), osl_relation_subexpression(), osl_util_safe_strcat(), and osl_relation::precision.
Referenced by osl_relation_spprint_polylib(), and osl_relation_spprint_polylib_scoplib().
static char* osl_relation_sprint_type | ( | osl_relation_p | relation | ) | [static] |
osl_relation_sprint_type function: this function prints the textual type of an osl_relation_t structure into a string, according to the OpenScop specification, and returns that string.
[in] | relation | The relation whose type has to be printed. |
Definition at line 91 of file relation.c.
References OSL_malloc, OSL_MAX_STRING, OSL_STRING_CONTEXT, OSL_STRING_DOMAIN, OSL_STRING_MAY_WRITE, OSL_STRING_READ, OSL_STRING_SCATTERING, OSL_STRING_UNDEFINED, OSL_STRING_WRITE, OSL_TYPE_CONTEXT, OSL_TYPE_DOMAIN, OSL_TYPE_MAY_WRITE, OSL_TYPE_READ, OSL_TYPE_SCATTERING, OSL_TYPE_WRITE, OSL_UNDEFINED, OSL_warning, and osl_relation::type.
Referenced by osl_relation_print_type(), and osl_relation_spprint().
osl_relation_p osl_relation_sread | ( | char ** | input | ) |
osl_relation_sread function: this function is equivalent to osl_relation_psread() except that the precision corresponds to the precision environment variable or to the highest available precision if it is not defined.
Definition at line 1577 of file relation.c.
References osl_relation_psread(), and osl_util_get_precision().
Referenced by osl_relation_interface().
static char** osl_relation_strings | ( | osl_relation_p | relation, |
osl_names_p | names | ||
) | [static] |
osl_relation_strings function: this function creates a NULL-terminated array of strings from an osl_names_t structure in such a way that the ith string is the "name" corresponding to the ith column of the constraint matrix.
[in] | relation | The relation for which we need an array of names. |
[in] | names | The set of names for each element. |
Definition at line 343 of file relation.c.
References osl_names::iterators, osl_names::local_dims, osl_relation::nb_columns, osl_relation::nb_input_dims, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_parameters, OSL_debug, OSL_malloc, OSL_MAX_STRING, osl_relation_is_access(), OSL_strdup, OSL_TYPE_CONTEXT, OSL_TYPE_DOMAIN, osl_names::parameters, osl_names::scatt_dims, osl_strings::string, and osl_relation::type.
Referenced by osl_relation_spprint_polylib(), and osl_relation_spprint_polylib_scoplib().
void osl_relation_sub_vector | ( | osl_relation_p | relation, |
osl_vector_p | vector, | ||
int | row | ||
) |
osl_relation_sub_vector function: this function subtracts the vector "vector" to the "row"^th row of a relation "relation. It directly updates the relation union part pointed by "relation" and this part only.
[in,out] | relation | The relation where to subtract a vector to a row. |
[in] | vector | The vector to subtract to a relation row. |
[in] | row | The row of the relation to subtract the vector. |
Definition at line 1943 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_assign(), osl_int_get_si(), osl_int_sub(), osl_vector::precision, osl_relation::precision, osl_vector::size, and osl_vector::v.
static char* osl_relation_subexpression | ( | osl_relation_p | relation, |
int | row, | ||
int | start, | ||
int | stop, | ||
int | oppose, | ||
char ** | strings | ||
) | [static] |
osl_relation_subexpression function: this function returns a string corresponding to an affine (sub-)expression stored at the "row"^th row of the relation pointed by "relation" between the start and stop columns. Optionally it may oppose the whole expression.
[in] | relation | A set of linear expressions. |
[in] | row | The row corresponding to the expression. |
[in] | start | The first column for the expression (inclusive). |
[in] | stop | The last column for the expression (inclusive). |
[in] | oppose | Boolean set to 1 to negate the expression, 0 otherwise. |
[in] | strings | Array of textual names of the various elements. |
Definition at line 420 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_int_oppose(), OSL_malloc, OSL_MAX_STRING, osl_relation_expression_element(), and osl_relation::precision.
Referenced by osl_relation_expression(), and osl_relation_sprint_comment().
void osl_relation_swap_constraints | ( | osl_relation_p | relation, |
int | c1, | ||
int | c2 | ||
) |
osl_relation_swap_constraints function: this function swaps two constraints (i.e., rows) of the relation matrix. This function updates the relation directly.
[in,out] | relation | The relation to swap two rows (modified). |
[in] | c1 | The row corresponding to the first constraint. |
[in] | c2 | The row corresponding to the second constraint. |
Definition at line 2172 of file relation.c.
References osl_relation::m, osl_relation::nb_columns, osl_relation::nb_rows, OSL_error, osl_int_swap(), and osl_relation::precision.
osl_relation_union function: this function builds a new relation from two relations provided as parameters. The new relation is built as an union of the two relations: the list of constraint sets are linked together.
[in] | r1 | The first relation. |
[in] | r2 | The second relation. |
Definition at line 1867 of file relation.c.
References osl_relation_add(), and osl_relation_clone().