OpenScop  0.9.0
Functions
loop.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/interface.h>
#include <osl/extensions/loop.h>
Include dependency graph for loop.c:

Go to the source code of this file.

Functions

void osl_loop_idump (FILE *file, osl_loop_p loop, int level)
void osl_loop_dump (FILE *file, osl_loop_p loop)
char * osl_loop_sprint (osl_loop_p loop)
osl_loop_p osl_loop_sread (char **input)
osl_loop_p osl_loop_malloc ()
void osl_loop_free (osl_loop_p loop)
osl_loop_p osl_loop_clone_one (osl_loop_p loop)
osl_loop_p osl_loop_clone (osl_loop_p loop)
int osl_loop_equal_one (osl_loop_p a1, osl_loop_p a2)
int osl_loop_equal (osl_loop_p a1, osl_loop_p a2)
osl_interface_p osl_loop_interface ()
void osl_loop_add (osl_loop_p loop, osl_loop_p *ll)
int osl_loop_count (osl_loop_p ll)

Function Documentation

void osl_loop_add ( osl_loop_p  loop,
osl_loop_p ll 
)

osl_loop_add function: this function adds a loop structure at the end of the list

Parameters:
[in,out]llPointer to a list of loops.
[in]loopPointer to the loop structure to be added.

Definition at line 570 of file loop.c.

References osl_loop::next.

osl_loop_clone function: this function builds and returns a "hard copy" (not a pointer copy) of a list of osl_loop_t data structures.

Parameters:
[in]loopThe pointer to the list of loop structure to clone.
Returns:
A pointer to the clone of list of the loop structure.

Definition at line 402 of file loop.c.

References osl_loop::next, and osl_loop_clone_one().

Referenced by osl_loop_interface().

osl_loop_clone_one function: this function builds and returns a "hard copy" (not a pointer copy) of "one" (and not the whole list) osl_loop_t data structure.

Parameters:
[in]loopThe pointer to the loop structure to clone.
Returns:
A pointer to the clone of the loop structure.

Definition at line 370 of file loop.c.

References osl_loop::directive, osl_loop::iter, osl_loop::nb_stmts, osl_loop_malloc(), OSL_malloc, OSL_strdup, osl_loop::private_vars, and osl_loop::stmt_ids.

Referenced by osl_loop_clone().

osl_loop_count: this function returns the number of elements in the list

Parameters:
[in]llPointer to a list of loops.
Returns:
Number of elements in the list

Definition at line 586 of file loop.c.

References osl_loop::next.

Referenced by osl_loop_equal(), and osl_loop_sprint().

void osl_loop_dump ( FILE *  file,
osl_loop_p  loop 
)

osl_loop_dump function: this function prints the content of an osl_loop_t structure (*loop) into a file (file, possibly stdout).

Parameters:
[in]fileThe file where the information has to be printed.
[in]loopThe loop structure to print.

Definition at line 174 of file loop.c.

References osl_loop_idump().

int osl_loop_equal ( osl_loop_p  a1,
osl_loop_p  a2 
)

osl_loop_equal function: this function returns true if the two loop lists are the same (content-wise), false otherwise. Two lists are equal if one contains all the elements of the other and vice versa. The exact order of the nodes is not taken into account by this function.

Parameters:
[in]a1The first loop list.
[in]a2The second loop list.
Returns:
1 if a1 and a2 are the same (content-wise), 0 otherwise.

Definition at line 501 of file loop.c.

References osl_loop::next, OSL_info, osl_loop_count(), and osl_loop_equal_one().

Referenced by osl_loop_interface().

osl_loop_equal_one function: this function returns true if the two loop structures are the same (content-wise), false otherwise. This functions considers two loop structures as equal if the order of the array names differ, however the identifiers and names must be the same.

Parameters:
[in]a1The first loop structure.
[in]a2The second loop structure.
Returns:
1 if a1 and a2 are the same (content-wise), 0 otherwise.

Definition at line 436 of file loop.c.

References osl_loop::directive, osl_loop::iter, osl_loop::nb_stmts, osl_loop::private_vars, and osl_loop::stmt_ids.

Referenced by osl_loop_equal().

void osl_loop_free ( osl_loop_p  loop)

osl_loop_free function: this function frees the allocated memory for an loop structure.

Parameters:
[in,out]loopThe pointer to the loop structure we want to free.

Definition at line 341 of file loop.c.

References osl_loop::iter, osl_loop::next, osl_loop::private_vars, and osl_loop::stmt_ids.

Referenced by osl_loop_interface().

void osl_loop_idump ( FILE *  file,
osl_loop_p  loop,
int  level 
)

osl_loop_idump function: this function displays an osl_loop_t structure (loop) 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:
[in]fileThe file where the information has to be printed.
[in]loopThe loop structure to print.
[in]levelNumber of spaces before printing, for each line.

Definition at line 91 of file loop.c.

References osl_loop::directive, osl_loop::iter, osl_loop::nb_stmts, osl_loop::next, osl_loop::private_vars, and osl_loop::stmt_ids.

Referenced by osl_loop_dump(), and osl_loop_interface().

osl_loop_interface function: this function creates an interface structure corresponding to the loop extension and returns it.

Returns:
An interface structure for the loop extension.

Definition at line 547 of file loop.c.

References osl_interface_malloc(), osl_loop_clone(), osl_loop_equal(), osl_loop_free(), osl_loop_idump(), osl_loop_malloc(), osl_loop_sprint(), osl_loop_sread(), OSL_strdup, and OSL_URI_LOOP.

Referenced by osl_interface_get_default_registry().

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

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

Definition at line 320 of file loop.c.

References osl_loop::directive, osl_loop::iter, osl_loop::nb_stmts, osl_loop::next, OSL_malloc, osl_loop::private_vars, and osl_loop::stmt_ids.

Referenced by osl_loop_clone_one(), osl_loop_interface(), and osl_loop_sread().

char* osl_loop_sprint ( osl_loop_p  loop)

osl_loop_sprint function: this function prints the content of an osl_loop_t structure (*loop) into a string (returned) in the OpenScop textual format.

Parameters:
[in]loopThe loop structure to print.
Returns:
A string containing the OpenScop dump of the loop structure.

Definition at line 186 of file loop.c.

References osl_loop::directive, osl_loop::iter, osl_loop::nb_stmts, osl_loop::next, osl_loop_count(), OSL_malloc, OSL_MAX_STRING, OSL_realloc, osl_util_safe_strcat(), osl_loop::private_vars, and osl_loop::stmt_ids.

Referenced by osl_loop_interface().

osl_loop_p osl_loop_sread ( char **  input)

osl_loop_sread function: this function reads a loop structure from a string complying to the OpenScop textual format and returns a pointer to this loop structure. The input parameter is updated to the position in the input string this function reaches right after reading the comment structure.

Parameters:
[in,out]inputThe input string where to find an loop structure. Updated to the position after what has been read.
Returns:
A pointer to the loop structure that has been read.

Definition at line 259 of file loop.c.

References osl_loop::directive, osl_loop::iter, osl_loop::nb_stmts, osl_loop::next, OSL_debug, osl_loop_malloc(), OSL_malloc, osl_util_read_int(), osl_util_read_line(), osl_util_read_string(), osl_loop::private_vars, and osl_loop::stmt_ids.

Referenced by osl_loop_interface().