OpenScop
0.9.1
|
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <osl/macros.h>
#include <osl/util.h>
#include <osl/extensions/arrays.h>
#include <osl/extensions/textual.h>
#include <osl/strings.h>
#include <osl/relation.h>
#include <osl/interface.h>
#include <osl/generic.h>
#include <osl/statement.h>
#include <osl/scop.h>
Go to the source code of this file.
Functions | |
void | osl_scop_idump (FILE *file, osl_scop_p scop, int level) |
void | osl_scop_dump (FILE *file, osl_scop_p scop) |
osl_names_p | osl_scop_names (osl_scop_p scop) |
void | osl_scop_print (FILE *file, osl_scop_p scop) |
void | osl_scop_print_scoplib (FILE *file, osl_scop_p scop) |
osl_scop_p | osl_scop_pread (FILE *file, osl_interface_p registry, int precision) |
osl_scop_p | osl_scop_read (FILE *foo) |
osl_scop_p | osl_scop_malloc (void) |
void | osl_scop_free (osl_scop_p scop) |
void | osl_scop_add (osl_scop_p *location, osl_scop_p scop) |
size_t | osl_scop_number (osl_scop_p scop) |
osl_scop_p | osl_scop_clone (osl_scop_p scop) |
osl_scop_p | osl_scop_remove_unions (osl_scop_p scop) |
int | osl_scop_equal (osl_scop_p s1, osl_scop_p s2) |
int | osl_scop_integrity_check (osl_scop_p scop) |
int | osl_scop_check_compatible_scoplib (osl_scop_p scop) |
int | osl_scop_get_nb_parameters (osl_scop_p scop) |
void | osl_scop_register_extension (osl_scop_p scop, osl_interface_p interface) |
void | osl_scop_get_attributes (osl_scop_p scop, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id) |
void | osl_scop_normalize_scattering (osl_scop_p scop) |
void osl_scop_add | ( | osl_scop_p * | location, |
osl_scop_p | scop | ||
) |
int osl_scop_check_compatible_scoplib | ( | osl_scop_p | scop | ) |
osl_scop_check_compatible_scoplib function: This function checks that a scop is "well formed". It returns 0 if the check failed or 1 if no problem has been detected.
scop | The scop we want to check. |
Definition at line 828 of file scop.c.
References osl_statement::domain, osl_relation::m, osl_relation::nb_local_dims, osl_relation::nb_output_dims, osl_relation::nb_rows, osl_statement::next, osl_relation::next, OSL_error, osl_int_mone(), osl_int_zero(), osl_scop_integrity_check(), osl_relation::precision, and osl_statement::scattering.
Referenced by osl_scop_print_scoplib().
osl_scop_p osl_scop_clone | ( | osl_scop_p | scop | ) |
osl_scop_clone function: This functions builds and returns a "hard copy" (not a pointer copy) of a osl_statement_t data structure provided as parameter. Note that the usr field is not touched by this function.
scop | The pointer to the scop we want to clone. |
Definition at line 635 of file scop.c.
References osl_generic_clone(), osl_interface_clone(), osl_relation_clone(), osl_scop_malloc(), osl_statement_clone(), and OSL_strdup.
void osl_scop_dump | ( | FILE * | file, |
osl_scop_p | scop | ||
) |
osl_scop_dump function: this function prints the content of an osl_scop_t structure (*scop) into a file (file, possibly stdout).
file | The file where the information has to be printed. |
scop | The scop structure whose information has to be printed. |
Definition at line 181 of file scop.c.
References osl_scop_idump().
int osl_scop_equal | ( | osl_scop_p | s1, |
osl_scop_p | s2 | ||
) |
osl_scop_equal function: this function returns true if the two scops are the same, false otherwise (the usr field is not tested).
s1 | The first scop. |
s2 | The second scop. |
Definition at line 724 of file scop.c.
References osl_generic_equal(), OSL_info, osl_interface_equal(), osl_relation_equal(), and osl_statement_equal().
void osl_scop_free | ( | osl_scop_p | scop | ) |
osl_scop_free function: This function frees the allocated memory for a osl_scop_t structure.
scop | The pointer to the scop we want to free. |
Definition at line 570 of file scop.c.
References osl_generic_free(), osl_interface_free(), osl_relation_free(), and osl_statement_free().
void osl_scop_get_attributes | ( | osl_scop_p | scop, |
int * | nb_parameters, | ||
int * | nb_iterators, | ||
int * | nb_scattdims, | ||
int * | nb_localdims, | ||
int * | array_id | ||
) |
osl_scop_get_attributes function: this function returns, through its parameters, the maximum values of the relation attributes (nb_iterators, nb_parameters etc) in the scop. 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 scop 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 scop should be correct.
[in] | scop | The scop to extract attributes 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 948 of file scop.c.
References OSL_max, osl_relation_get_attributes(), osl_statement_get_attributes(), and OSL_UNDEFINED.
Referenced by osl_scop_names().
int osl_scop_get_nb_parameters | ( | osl_scop_p | scop | ) |
void osl_scop_idump | ( | FILE * | file, |
osl_scop_p | scop, | ||
int | level | ||
) |
osl_scop_idump function: this function displays an osl_scop_t structure (*scop) 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.
file | The file where the information has to be printed. |
scop | The scop structure whose information has to be printed. |
level | Number of spaces before printing, for each line. |
Definition at line 95 of file scop.c.
References osl_generic_idump(), osl_interface_idump(), osl_relation_idump(), and osl_statement_idump().
Referenced by osl_scop_dump().
int osl_scop_integrity_check | ( | osl_scop_p | scop | ) |
osl_scop_integrity_check function: This function checks that a scop is "well formed". It returns 0 if the check failed or 1 if no problem has been detected.
scop | The scop we want to check. |
Definition at line 783 of file scop.c.
References osl_relation_integrity_check(), osl_statement_integrity_check(), OSL_TYPE_CONTEXT, and OSL_UNDEFINED.
Referenced by osl_scop_check_compatible_scoplib(), osl_scop_pread(), and osl_scop_print().
osl_scop_p osl_scop_malloc | ( | void | ) |
osl_scop_malloc function: this function allocates the memory space for a osl_scop_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.
Definition at line 547 of file scop.c.
References OSL_malloc.
Referenced by osl_scop_clone(), osl_scop_pread(), and osl_scop_remove_unions().
osl_names_p osl_scop_names | ( | osl_scop_p | scop | ) |
osl_scop_names function: this function generates as set of names for all the dimensions involved in a given scop.
[in] | scop | The scop (list) we have to generate names for. |
Definition at line 193 of file scop.c.
References osl_names_generate(), osl_scop_get_attributes(), and OSL_UNDEFINED.
Referenced by osl_scop_print(), and osl_scop_print_scoplib().
void osl_scop_normalize_scattering | ( | osl_scop_p | scop | ) |
osl_scop_normalize_scattering function: this function modifies a scop such that all scattering relation have the same number of output dimensions (additional output dimensions are set as being equal to zero).
[in,out] | scop | The scop to nomalize the scattering functions. |
Definition at line 992 of file scop.c.
References osl_relation::nb_output_dims, osl_statement::next, OSL_max, osl_relation_extend_output(), osl_relation_free(), and osl_statement::scattering.
size_t osl_scop_number | ( | osl_scop_p | scop | ) |
osl_scop_p osl_scop_pread | ( | FILE * | file, |
osl_interface_p | registry, | ||
int | precision | ||
) |
osl_scop_pread function ("precision read"): this function reads a list of scop structures from a file (possibly stdin) complying to the OpenScop textual format and returns a pointer to this scop list. If some relation properties (number of input/output/local dimensions and number of parameters) are undefined, it will define them according to the available information.
[in] | file | The file where the scop has to be read. |
[in] | registry | The list of known interfaces (others are ignored). |
[in] | precision | The precision of the relation elements. |
Definition at line 421 of file scop.c.
References osl_statement::extension, osl_statement::next, OSL_debug, OSL_error, osl_generic_read(), osl_generic_read_one(), osl_interface_clone(), osl_relation_pread(), osl_scop_integrity_check(), osl_scop_malloc(), osl_statement_pread(), OSL_strdup, osl_strings_free(), osl_strings_read(), osl_strings_size(), OSL_URI_SCOP, osl_util_read_int(), osl_util_read_uptotag(), OSL_warning, and osl_strings::string.
Referenced by osl_scop_read().
void osl_scop_print | ( | FILE * | file, |
osl_scop_p | scop | ||
) |
osl_scop_print function: this function prints the content of an osl_scop_t structure (*scop) into a file (file, possibly stdout) in the OpenScop textual format.
file | The file where the information has to be printed. |
scop | The scop structure whose information has to be printed. |
Definition at line 218 of file scop.c.
References osl_names::arrays, osl_scatnames::names, osl_arrays_to_strings(), osl_generic_has_URI(), osl_generic_lookup(), osl_generic_print(), osl_names_free(), osl_relation_pprint(), osl_scop_integrity_check(), osl_scop_names(), osl_statement_number(), osl_statement_pprint(), osl_strings_free(), OSL_URI_ARRAYS, OSL_URI_SCOP, OSL_URI_STRINGS, osl_util_print_provided(), OSL_warning, and osl_names::parameters.
void osl_scop_print_scoplib | ( | FILE * | file, |
osl_scop_p | scop | ||
) |
osl_scop_print_scoplib function: this function prints the content of an osl_scop_t structure (*scop) into a file (file, possibly stdout) in the ScopLib textual format.
file | The file where the information has to be printed. |
scop | The scop structure whose information has to be printed. |
Definition at line 311 of file scop.c.
References osl_names::arrays, osl_scatnames::names, osl_arrays_to_strings(), OSL_error, osl_generic_has_URI(), osl_generic_lookup(), osl_generic_print_options_scoplib(), osl_names_free(), osl_relation_pprint_scoplib(), osl_scop_check_compatible_scoplib(), osl_scop_names(), osl_statement_number(), osl_statement_pprint_scoplib(), osl_strings_free(), osl_strings_print(), OSL_URI_ARRAYS, OSL_URI_STRINGS, osl_util_print_provided(), and osl_names::parameters.
osl_scop_p osl_scop_read | ( | FILE * | foo | ) |
osl_scop_read function: this function is equivalent to osl_scop_pread() except that (1) the precision corresponds to the precision environment variable or to the highest available precision if it is not defined, and (2) the list of known interface is set to the default one.
Definition at line 525 of file scop.c.
References osl_interface_free(), osl_interface_get_default_registry(), osl_scop_pread(), and osl_util_get_precision().
void osl_scop_register_extension | ( | osl_scop_p | scop, |
osl_interface_p | interface | ||
) |
osl_scop_register_extension function: this function registers a list of extension interfaces to a scop, i.e., it adds them to the scop registry. In addition, it will extract extensions corresponding to those interfaces from the textual form of the extensions (if any) and add them to the scop extension list.
scop | The scop for which an extension has to be registered. |
interface | The extension interface to register within the scop. |
Definition at line 913 of file scop.c.
References osl_generic::data, osl_generic_add(), osl_generic_lookup(), osl_generic_sread(), osl_interface_add(), and osl_interface::URI.
osl_scop_p osl_scop_remove_unions | ( | osl_scop_p | scop | ) |
osl_scop_remove_unions function: Replace each statement having unions of relations by a list of statements, each of which has exactly one domain relation and one scattering relation.
[in] | scop | A SCoP with statements featuring unions of relations. |
Definition at line 673 of file scop.c.
References osl_statement::next, osl_generic_clone(), osl_interface_clone(), osl_relation_clone(), osl_scop_malloc(), and osl_statement_remove_unions().