OpenScop  0.9.0
Functions
statement.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <osl/macros.h>
#include <osl/util.h>
#include <osl/strings.h>
#include <osl/body.h>
#include <osl/relation.h>
#include <osl/relation_list.h>
#include <osl/names.h>
#include <osl/interface.h>
#include <osl/generic.h>
#include <osl/statement.h>
Include dependency graph for statement.c:

Go to the source code of this file.

Functions

void osl_statement_idump (FILE *file, osl_statement_p statement, int level)
void osl_statement_dump (FILE *file, osl_statement_p statement)
static osl_names_p osl_statement_names (osl_statement_p statement)
void osl_statement_pprint (FILE *file, osl_statement_p statement, osl_names_p names)
void osl_statement_pprint_scoplib (FILE *file, osl_statement_p statement, osl_names_p names)
void osl_statement_print (FILE *file, osl_statement_p statement)
static void osl_statement_dispatch (osl_statement_p stmt, osl_relation_list_p list)
osl_statement_p osl_statement_pread (FILE *file, osl_interface_p registry, int precision)
osl_statement_p osl_statement_read (FILE *foo)
osl_statement_p osl_statement_malloc ()
void osl_statement_free (osl_statement_p statement)
void osl_statement_add (osl_statement_p *location, osl_statement_p statement)
int osl_statement_number (osl_statement_p statement)
osl_statement_p osl_statement_nclone (osl_statement_p statement, int n)
osl_statement_p osl_statement_clone (osl_statement_p statement)
int osl_statement_equal (osl_statement_p s1, osl_statement_p s2)
int osl_statement_integrity_check (osl_statement_p statement, int expected_nb_parameters)
int osl_statement_get_nb_iterators (osl_statement_p statement)
void osl_statement_get_attributes (osl_statement_p statement, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
osl_body_p osl_statement_get_body (osl_statement_p statement)

Function Documentation

void osl_statement_add ( osl_statement_p location,
osl_statement_p  statement 
)

osl_statement_add function: this function adds a statement "statement" at the end of the statement list pointed by "location".

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

Definition at line 556 of file statement.c.

References osl_scop::statement.

osl_statement_clone function: This functions builds and returns a "hard copy" (not a pointer copy) of an osl_statement_t data structure provided as parameter.

Parameters:
[in]statementThe pointer to the statement we want to clone.
Returns:
A pointer to the clone of the statement provided as parameter.

Definition at line 628 of file statement.c.

References osl_statement_nclone().

Referenced by osl_scop_clone().

static void osl_statement_dispatch ( osl_statement_p  stmt,
osl_relation_list_p  list 
) [static]

osl_statement_dispatch function: this function dispatches the relations from a relation list to the convenient fields of a statement structure: it extracts the domain, the scattering and the access list and store them accordingly in the statement structure provided as a parameter.

Parameters:
[in,out]stmtThe statement where to dispatch the relations.
[in,out]listThe "brute" relation list to sort and dispatch (freed).

Definition at line 396 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_relation_list::elt, OSL_error, osl_relation_list_count(), osl_relation_list_filter(), osl_relation_list_free(), OSL_TYPE_ACCESS, OSL_TYPE_DOMAIN, OSL_TYPE_SCATTERING, and osl_statement::scattering.

Referenced by osl_statement_pread().

void osl_statement_dump ( FILE *  file,
osl_statement_p  statement 
)

osl_statement_dump function: this function prints the content of an osl_statement_t structure (*statement) into a file (file, possibly stdout).

Parameters:
[in]fileThe file where the information has to be printed.
[in]statementThe statement whose information has to be printed.

Definition at line 160 of file statement.c.

References osl_statement_idump().

osl_statement_equal function: this function returns true if the two statements provided as parameters are the same, false otherwise (the usr field is not tested).

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

Definition at line 641 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::extension, osl_statement::next, osl_generic_equal(), OSL_info, osl_relation_equal(), osl_relation_list_equal(), osl_statement_equal(), and osl_statement::scattering.

Referenced by osl_scop_equal(), and osl_statement_equal().

void osl_statement_free ( osl_statement_p  statement)

osl_statement_free function: this function frees the allocated memory for an osl_statement_t structure.

Parameters:
[in,out]statementThe pointer to the statement we want to free.

Definition at line 528 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::extension, osl_statement::next, osl_scop::next, osl_generic_free(), osl_relation_free(), osl_relation_list_free(), and osl_statement::scattering.

Referenced by osl_scop_free().

void osl_statement_get_attributes ( osl_statement_p  statement,
int *  nb_parameters,
int *  nb_iterators,
int *  nb_scattdims,
int *  nb_localdims,
int *  array_id 
)

osl_statement_get_attributes function: this function returns, through its parameters, the maximum values of the relation attributes (nb_iterators, nb_parameters etc) in the statement. 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 statement 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 statement should be correct.

Parameters:
[in]statementThe statement 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 785 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::next, OSL_max, osl_relation_get_attributes(), osl_relation_list_get_attributes(), OSL_UNDEFINED, and osl_statement::scattering.

Referenced by osl_scop_get_attributes(), and osl_statement_names().

osl_statement_get_body function: this function returns the body of the statement.

Parameters:
[in]statementThe statement to search the body.
Returns:
the body if found, NULL otherwise.

Definition at line 835 of file statement.c.

References osl_extbody::body, osl_statement::extension, osl_generic_lookup(), OSL_URI_BODY, and OSL_URI_EXTBODY.

osl_statement_get_nb_iterators function: this function returns the number of surroounding iterators of a given statement.

Parameters:
statementThe statement we want to know the number of iterators.
Returns:
The number of surrounding iterators for the statement.

Definition at line 755 of file statement.c.

References osl_statement::domain, osl_relation::nb_output_dims, and OSL_warning.

void osl_statement_idump ( FILE *  file,
osl_statement_p  statement,
int  level 
)

osl_statement_idump function: this function displays an osl_statement_t structure (*statement) 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 dumping functions.

Parameters:
[in]fileFile where the information has to be printed.
[in]statementThe statement whose information has to be printed.
[in]levelNumber of spaces before printing, for each line.

Definition at line 96 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::extension, osl_statement::next, osl_generic_idump(), osl_relation_idump(), osl_relation_list_idump(), and osl_statement::scattering.

Referenced by osl_dependence_idump(), osl_scop_idump(), and osl_statement_dump().

int osl_statement_integrity_check ( osl_statement_p  statement,
int  expected_nb_parameters 
)

osl_statement_integrity_check function: this function checks that a statement is "well formed" according to some expected properties (setting an expected value to OSL_UNDEFINED means that we do not expect a specific value). It returns 0 if the check failed or 1 if no problem has been detected.

Parameters:
[in]statementThe statement we want to check.
[in]expected_nb_parametersExpected number of parameters.
Returns:
0 if the integrity check fails, 1 otherwise.

Definition at line 693 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::extension, osl_body::iterators, osl_relation::nb_output_dims, osl_statement::next, osl_generic_lookup(), osl_relation_integrity_check(), osl_relation_list_integrity_check(), osl_strings_size(), OSL_TYPE_ACCESS, OSL_TYPE_DOMAIN, OSL_TYPE_SCATTERING, OSL_UNDEFINED, OSL_URI_BODY, OSL_warning, and osl_statement::scattering.

Referenced by osl_scop_integrity_check().

osl_statement_malloc function: this function allocates the memory space for an osl_statement_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.

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

Definition at line 508 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::extension, osl_statement::next, OSL_malloc, osl_statement::scattering, and osl_scop::statement.

Referenced by osl_statement_nclone(), and osl_statement_pread().

static osl_names_p osl_statement_names ( osl_statement_p  statement) [static]

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

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

Definition at line 173 of file statement.c.

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

Referenced by osl_statement_pprint(), and osl_statement_pprint_scoplib().

osl_statement_nclone function: This function builds and returns a "hard copy" (not a pointer copy) of the n first elements of an osl_statement_t list.

Parameters:
statementThe pointer to the statement structure we want to clone.
nThe number of nodes we want to copy (-1 for infinity).
Returns:
The clone of the n first nodes of the statement list.

Definition at line 591 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::extension, osl_statement::next, osl_generic_clone(), osl_relation_clone(), osl_relation_list_clone(), osl_statement_malloc(), and osl_statement::scattering.

Referenced by osl_statement_clone().

osl_statement_number function: this function returns the number of statements in the statement list provided as parameter.

Parameters:
[in]statementThe first element of the statement list.
Returns:
The number of statements in the statement list.

Definition at line 572 of file statement.c.

References osl_statement::next.

Referenced by osl_scop_print(), and osl_scop_print_scoplib().

void osl_statement_pprint ( FILE *  file,
osl_statement_p  statement,
osl_names_p  names 
)

osl_statement_pprint function: this function pretty-prints the content of an osl_statement_t structure (*statement) into a file (file, possibly stdout) in the OpenScop format.

Parameters:
[in]fileThe file where the information has to be printed.
[in]statementThe statement whose information has to be printed.
[in]namesThe names of the constraint columns for comments.

Definition at line 199 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::extension, osl_names::iterators, osl_body::iterators, osl_statement::next, osl_generic_lookup(), osl_generic_number(), osl_generic_print(), osl_names_free(), osl_relation_list_count(), osl_relation_list_pprint_elts(), osl_relation_pprint(), osl_statement_names(), OSL_URI_BODY, and osl_statement::scattering.

Referenced by osl_scop_print(), and osl_statement_print().

void osl_statement_pprint_scoplib ( FILE *  file,
osl_statement_p  statement,
osl_names_p  names 
)

osl_statement_pprint_scoplib function: this function pretty-prints the content of an osl_statement_t structure (*statement) into a file (file, possibly stdout) in the SCoPLib format.

Parameters:
[in]fileThe file where the information has to be printed.
[in]statementThe statement whose information has to be printed.
[in]namesThe names of the constraint columns for comments.

Definition at line 288 of file statement.c.

References osl_statement::access, osl_statement::domain, osl_statement::extension, osl_names::iterators, osl_body::iterators, osl_relation::nb_rows, osl_statement::next, osl_body_print_scoplib(), osl_generic_lookup(), osl_names_free(), osl_relation_list_pprint_access_array_scoplib(), osl_relation_pprint_scoplib(), osl_statement_names(), OSL_URI_BODY, and osl_statement::scattering.

Referenced by osl_scop_print_scoplib().

osl_statement_p osl_statement_pread ( FILE *  file,
osl_interface_p  registry,
int  precision 
)

osl_statement_pread function ("precision read"): this function reads an osl_statement_t structure from an input stream (possibly stdin).

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

Definition at line 452 of file statement.c.

References osl_statement::extension, osl_generic_add(), osl_generic_read_one(), osl_relation_list_pread(), osl_statement_dispatch(), osl_statement_malloc(), and osl_util_read_int().

Referenced by osl_scop_pread(), and osl_statement_read().

void osl_statement_print ( FILE *  file,
osl_statement_p  statement 
)

osl_statement_print function: this function prints the content of an osl_statement_t structure (*statement) into a file (file, possibly stdout) in the OpenScop format.

Parameters:
[in]fileThe file where the information has to be printed.
[in]statementThe statement whose information has to be printed.

Definition at line 375 of file statement.c.

References osl_statement_pprint().

osl_statement_read function: this function is equivalent to osl_statement_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_statement_pread}

Definition at line 486 of file statement.c.

References osl_interface_free(), osl_interface_get_default_registry(), osl_statement_pread(), osl_util_get_precision(), osl_scop::registry, and osl_scop::statement.