OpenScop  0.9.0
Functions
scop.c File Reference
#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>
Include dependency graph for scop.c:

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 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)
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)

Function Documentation

void osl_scop_add ( osl_scop_p location,
osl_scop_p  scop 
)

osl_scop_add function: this function adds a scop "scop" at the end of the scop list pointed by "location".

Parameters:
[in,out]locationAddress of the first element of the scop list.
[in]scopThe scop to add to the list.

Definition at line 601 of file scop.c.

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.

Parameters:
scopThe scop we want to check.
Returns:
0 if the integrity check fails, 1 otherwise.

Definition at line 779 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_scop::next, osl_relation::next, OSL_error, osl_int_mone(), osl_int_zero(), osl_scop_integrity_check(), osl_relation::precision, osl_statement::scattering, and osl_scop::statement.

Referenced by osl_scop_print_scoplib().

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.

Parameters:
scopThe pointer to the scop we want to clone.
Returns:
A pointer to the full clone of the scop provided as parameter.

Definition at line 635 of file scop.c.

References osl_scop::context, osl_scop::extension, osl_scop::language, osl_scop::next, osl_generic_clone(), osl_interface_clone(), osl_relation_clone(), osl_scop_malloc(), osl_statement_clone(), OSL_strdup, osl_scop::parameters, osl_scop::registry, osl_scop::statement, and osl_scop::version.

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).

Parameters:
fileThe file where the information has to be printed.
scopThe 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).

Parameters:
s1The first scop.
s2The second scop.
Returns:
1 if s1 and s2 are the same (content-wise), 0 otherwise.

Definition at line 675 of file scop.c.

References osl_scop::context, osl_scop::extension, osl_scop::language, osl_scop::next, osl_generic_equal(), OSL_info, osl_interface_equal(), osl_relation_equal(), osl_statement_equal(), osl_scop::parameters, osl_scop::registry, osl_scop::statement, and osl_scop::version.

void osl_scop_free ( osl_scop_p  scop)

osl_scop_free function: This function frees the allocated memory for a osl_scop_t structure.

Parameters:
scopThe pointer to the scop we want to free.

Definition at line 570 of file scop.c.

References osl_scop::context, osl_scop::extension, osl_scop::language, osl_scop::next, osl_generic_free(), osl_interface_free(), osl_relation_free(), osl_statement_free(), osl_scop::parameters, osl_scop::registry, and osl_scop::statement.

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.

Parameters:
[in]scopThe scop to extract attributes values.
[in,out]nb_parametersNumber of parameter attribute.
[in,out]nb_iteratorsNumber of iterators attribute.
[in,out]nb_scattdimsNumber of scattering dimensions attribute.
[in,out]nb_localdimsNumber of local dimensions attribute.
[in,out]array_idMaximum array identifier attribute.

Definition at line 899 of file scop.c.

References osl_scop::context, osl_scop::next, OSL_max, osl_relation_get_attributes(), osl_statement_get_attributes(), OSL_UNDEFINED, and osl_scop::statement.

Referenced by osl_scop_names().

osl_scop_get_nb_parameters function: this function returns the number of global parameters of a given SCoP.

Parameters:
scopThe scop we want to know the number of global parameters.
Returns:
The number of global parameters in the scop.

Definition at line 843 of file scop.c.

References osl_scop::context, osl_relation::nb_parameters, and OSL_debug.

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.

Parameters:
fileThe file where the information has to be printed.
scopThe scop structure whose information has to be printed.
levelNumber of spaces before printing, for each line.

Definition at line 95 of file scop.c.

References osl_scop::context, osl_scop::extension, osl_scop::language, osl_scop::next, osl_generic_idump(), osl_interface_idump(), osl_relation_idump(), osl_statement_idump(), osl_scop::parameters, osl_scop::registry, osl_scop::statement, and osl_scop::version.

Referenced by osl_scop_dump().

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.

Parameters:
scopThe scop we want to check.
Returns:
0 if the integrity check fails, 1 otherwise.

Definition at line 734 of file scop.c.

References osl_scop::context, osl_scop::language, osl_relation::nb_parameters, osl_scop::next, osl_relation_integrity_check(), osl_statement_integrity_check(), OSL_TYPE_CONTEXT, OSL_UNDEFINED, and osl_scop::statement.

Referenced by osl_scop_check_compatible_scoplib(), osl_scop_pread(), and osl_scop_print().

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.

Returns:
A pointer to an empty scop with fields set to default values.

Definition at line 547 of file scop.c.

References osl_scop::context, osl_scop::extension, osl_scop::language, osl_scop::next, OSL_malloc, osl_scop::parameters, osl_scop::registry, osl_scop::statement, osl_scop::usr, and osl_scop::version.

Referenced by osl_scop_clone(), and osl_scop_pread().

osl_scop_names function: this function generates as set of names for all the dimensions involved in a given scop.

Parameters:
[in]scopThe scop (list) we have to generate names for.
Returns:
A set of generated names for the input scop dimensions.

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().

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).

Parameters:
[in,out]scopThe scop to nomalize the scattering functions.

Definition at line 943 of file scop.c.

References osl_relation::nb_output_dims, osl_statement::next, OSL_max, osl_relation_extend_output(), osl_relation_free(), osl_statement::scattering, and osl_scop::statement.

size_t osl_scop_number ( osl_scop_p  scop)

osl_scop_number function: this function returns the number of scops in the scop list provided as parameter.

Parameters:
[in]scopThe first element of the scop list.
Returns:
The number of scops in the scop list.

Definition at line 616 of file scop.c.

References osl_scop::next.

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.

Parameters:
[in]fileThe file where the scop has to be read.
[in]registryThe list of known interfaces (others are ignored).
[in]precisionThe precision of the relation elements.
Returns:
A pointer to the scop structure that has been read.

Definition at line 421 of file scop.c.

References osl_statement::extension, osl_statement::next, osl_scop::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.

Parameters:
fileThe file where the information has to be printed.
scopThe scop structure whose information has to be printed.

Definition at line 218 of file scop.c.

References osl_names::arrays, osl_scop::context, osl_generic::data, osl_scop::extension, osl_scop::language, osl_scatnames::names, osl_scop::next, osl_arrays_to_strings(), osl_generic_has_URI(), osl_generic_lookup(), osl_generic_print(), osl_names_free(), osl_relation_pprint(), OSL_RELEASE, 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, osl_names::parameters, osl_scop::parameters, and osl_scop::statement.

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.

Parameters:
fileThe file where the information has to be printed.
scopThe scop structure whose information has to be printed.

Definition at line 311 of file scop.c.

References osl_names::arrays, osl_scop::context, osl_generic::data, osl_scop::extension, osl_scop::language, osl_scatnames::names, osl_scop::next, 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_RELEASE, 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(), osl_names::parameters, osl_scop::parameters, and osl_scop::statement.

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.

See also:
{osl_scop_pread}

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.

Parameters:
scopThe scop for which an extension has to be registered.
interfaceThe extension interface to register within the scop.

Definition at line 864 of file scop.c.

References osl_generic::data, osl_scop::extension, osl_generic_add(), osl_generic_lookup(), osl_generic_sread(), osl_interface_add(), osl_scop::registry, and osl_interface::URI.