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)
static osl_names_p osl_scop_names (osl_scop_p scop)
void osl_scop_print (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)
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_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] location Address of the first element of the scop list.
[in] scop The scop to add to the list.

Definition at line 502 of file scop.c.

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.

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

Definition at line 518 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_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:
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).

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

Definition at line 558 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:
scop The pointer to the scop we want to free.

Definition at line 471 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] 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 717 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().

int osl_scop_get_nb_parameters ( osl_scop_p  scop  ) 

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

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

Definition at line 661 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:
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_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().

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.

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

Definition at line 617 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_pread(), and osl_scop_print().

osl_scop_p osl_scop_malloc (  ) 

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

static osl_names_p osl_scop_names ( osl_scop_p  scop  )  [static]

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

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

Definition at line 194 of file scop.c.

References osl_names_generate(), osl_scop_get_attributes(), and OSL_UNDEFINED.

Referenced by osl_scop_print().

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

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

Definition at line 761 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.

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] 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.
Returns:
A pointer to the scop structure that has been read.

Definition at line 322 of file scop.c.

References osl_scop::next, 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_strings_free(), osl_strings_read(), osl_strings_size(), OSL_TAG_START_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:
file The file where the information has to be printed.
scop The scop structure whose information has to be printed.

Definition at line 219 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_TAG_END_SCOP, OSL_TAG_START_SCOP, OSL_URI_ARRAYS, OSL_URI_STRINGS, osl_util_print_provided(), OSL_warning, 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 426 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:
scop The scop for which an extension has to be registered.
interface The extension interface to register within the scop.

Definition at line 682 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.

Generated on Fri Feb 17 15:26:47 2012 for OpenScop by  doxygen 1.6.3