OpenScop 0.8.1
|
#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_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 1281 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 1646 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 1676 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 1240 of file relation.c.
References osl_relation_nclone().
Referenced by osl_relation_concat_constraints(), osl_relation_list_clone(), osl_relation_list_node(), osl_relation_union(), osl_scop_clone(), and osl_statement_clone().
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 609 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().
osl_relation_p osl_relation_concat_constraints | ( | osl_relation_p | r1, |
osl_relation_p | r2 | ||
) |
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 1564 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.
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 1599 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_ne(), osl_relation::precision, and osl_relation::type.
Referenced by 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 467 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 | ( | void * | 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 | Address of the 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(), 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 2123 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 1158 of file relation.c.
References osl_relation::next, and osl_relation_free_inside().
Referenced by osl_relation_insert_vector(), 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 1129 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(), and osl_relation_insert_constraints().
osl_relation_p osl_relation_from_vector | ( | osl_vector_p | vector | ) |
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 1415 of file relation.c.
References osl_relation_pmalloc(), osl_relation_replace_vector(), osl_vector::precision, and osl_vector::size.
Referenced by 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 1918 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_strings().
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 2047 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_relation_dump(), 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 1374 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 1355 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 1511 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 adds new rows corresponding to the relation "r1" to the relation "r2" by inserting it at the "row"^th row. 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 relation |
Definition at line 1462 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. 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. |
Definition at line 1338 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 1721 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().
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 2014 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 488 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 1117 of file relation.c.
References osl_relation_pmalloc(), and osl_util_get_precision().
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 683 of file relation.c.
References osl_names_generate(), osl_relation_get_attributes(), and OSL_UNDEFINED.
Referenced by osl_relation_spprint_polylib().
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 708 of file relation.c.
References osl_relation::next.
Referenced by osl_relation_spprint(), and osl_relation_spprint_polylib().
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 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 1190 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.
Referenced by osl_relation_clone().
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 1072 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_address(), osl_int_init_set_si(), osl_int_sizeof(), OSL_malloc, OSL_UNDEFINED, osl_relation::precision, and osl_relation::type.
Referenced by 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(), and osl_relation_pread().
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 859 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().
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. The relation is set to the maximum available precision.
[in] | foo | The input stream. |
[in] | precision | The precision of the relation elements. |
Definition at line 956 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 874 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_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 1050 of file relation.c.
References osl_relation_pread(), and osl_util_get_precision().
static int osl_relation_read_type | ( | FILE * | file | ) | [static] |
osl_relation_read_type function: this function reads a textual relation type and returns its integer counterpart.
[in] | file | The input stream. |
Definition at line 893 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_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().
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 1436 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 1257 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 provided as a parameter. It updates the relation directly.
[in,out] | relation | The relation 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 1882 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.
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 1901 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 826 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().
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 729 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_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(), and osl_relation::precision.
Referenced by osl_relation_spprint().
static char* osl_relation_sprint_comment | ( | osl_relation_p | relation, |
int | row, | ||
char ** | strings | ||
) | [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. |
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_is_access(), osl_relation_is_simple_output(), osl_relation_subexpression(), osl_util_safe_strcat(), and osl_relation::precision.
Referenced by osl_relation_spprint_polylib().
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().
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::arrays, 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_get_array_id(), osl_relation_is_access(), OSL_strdup, OSL_TYPE_SCATTERING, osl_names::parameters, osl_names::scatt_dims, osl_strings::string, and osl_relation::type.
Referenced by osl_relation_spprint_polylib().
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 1309 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. Optionnaly 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_address(), 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().
osl_relation_p osl_relation_union | ( | osl_relation_p | r1, |
osl_relation_p | r2 | ||
) |
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 1847 of file relation.c.
References osl_relation::next, and osl_relation_clone().