Clan  0.8.1
Functions
domain.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <osl/macros.h>
#include <osl/relation_list.h>
#include <clan/macros.h>
#include <clan/relation.h>
#include <clan/relation_list.h>
#include <clan/domain.h>
#include <clan/vector.h>
Include dependency graph for domain.c:

Go to the source code of this file.

Functions

void clan_domain_idump (FILE *file, clan_domain_p domain, int level)
 
void clan_domain_dump (FILE *file, clan_domain_p list)
 
clan_domain_p clan_domain_malloc ()
 
void clan_domain_free (clan_domain_p list)
 
clan_domain_p clan_domain_clone (clan_domain_p list)
 
void clan_domain_push (clan_domain_p *head, clan_domain_p node)
 
clan_domain_p clan_domain_pop (clan_domain_p *head)
 
void clan_domain_dup (clan_domain_p *head)
 
void clan_domain_drop (clan_domain_p *head)
 
void clan_domain_and (clan_domain_p domain, osl_relation_p new_constraints)
 
void clan_domain_stride (clan_domain_p domain, int depth, int stride)
 
void clan_domain_for (clan_domain_p domain, int depth, clan_symbol_p iterator, osl_relation_p initialization, osl_relation_p condition, int stride, clan_options_p options)
 
void clan_domain_xfor (clan_domain_p domain, int depth, clan_symbol_p iterator, osl_relation_list_p initialization, osl_relation_list_p condition, int *stride, clan_options_p options)
 

Function Documentation

◆ clan_domain_and()

void clan_domain_and ( clan_domain_p  domain,
osl_relation_p  new_constraints 
)

clan_domain_and function: this function adds new constraints to every set of constraint set of the domain.

Parameters
[in,out]domainThe set of constraint set to update.
[in]new_constraintsThe constraints to every constraint set.

Definition at line 276 of file domain.c.

References clan_relation_and(), and clan_domain::constraints.

Referenced by clan_domain_for().

◆ clan_domain_clone()

clan_domain_p clan_domain_clone ( clan_domain_p  list)

clan_domain_clone function: This functions builds and returns a quasi-"hard copy" (not a pointer copy) of a clan_domain_t data structure provided as parameter.

Parameters
[in]listThe pointer to the domain list we want to copy.
Returns
A pointer to the full copy of the domain list in parameter.

Definition at line 178 of file domain.c.

References clan_domain_malloc(), clan_domain::constraints, and clan_domain::next.

Referenced by clan_domain_dup().

◆ clan_domain_drop()

void clan_domain_drop ( clan_domain_p head)

clan_domain_drop function: this function sees a list of domains as a stack of domains and performs the drop operation (pop and destroy popped element) onto this stack.

Parameters
[in,out]headPointer to the head of the domain stack. It is updated to the previous element in the stack (NULL if there is none).

Definition at line 263 of file domain.c.

References clan_domain_free(), and clan_domain_pop().

◆ clan_domain_dump()

void clan_domain_dump ( FILE *  file,
clan_domain_p  list 
)

clan_domain_dump function: This function prints the content of a clan_domain_t into a file (file, possibly stdout).

Parameters
[in]fileFile where informations are printed.
[in]listThe relation whose information has to be printed.

Definition at line 117 of file domain.c.

References clan_domain_idump().

◆ clan_domain_dup()

void clan_domain_dup ( clan_domain_p head)

clan_domain_dup function: this function sees a list of domains as a stack of domains and performs the dup operation (duplicate the top element) onto this stack.

Parameters
[in,out]headPointer to the head of the domain stack. It is updated to the new element after duplication.

Definition at line 247 of file domain.c.

References clan_domain_clone(), clan_domain_pop(), and clan_domain_push().

◆ clan_domain_for()

void clan_domain_for ( clan_domain_p  domain,
int  depth,
clan_symbol_p  iterator,
osl_relation_p  initialization,
osl_relation_p  condition,
int  stride,
clan_options_p  options 
)

clan_domain_for function: this function adds the contribution of a for loop to a domain.

Parameters
[in,out]domainThe set of constraint set to update.
[in]depthThe loop depth.
[in]iteratorThe loop iterator symbol.
[in]initializationThe loop initialiation right part constraints.
[in]conditionThe loop condition part constraints.
[in]strideThe loop stride value.
[in]optionsClan's options.

Definition at line 320 of file domain.c.

References clan_domain_and(), clan_domain_stride(), clan_relation_greater(), clan_relation_loop_context(), clan_vector_term(), clan_options::noloopcontext, and clan_options::precision.

Referenced by clan_domain_xfor().

◆ clan_domain_free()

void clan_domain_free ( clan_domain_p  list)

clan_domain_free function: This function frees the allocated memory for a clan_domain_t structure, and all the domains stored in the list.

Parameters
[in,out]listThe pointer to the domain list we want to free.

Definition at line 151 of file domain.c.

References clan_domain::constraints, and clan_domain::next.

Referenced by clan_domain_drop(), and clan_domain_xfor().

◆ clan_domain_idump()

void clan_domain_idump ( FILE *  file,
clan_domain_p  domain,
int  level 
)

clan_domain_idump function: Displays a clan_domain_t structure into a file (file, possibly stdout).

Parameters
[in]fileFile where informations are printed.
[in]domainThe clan_domain whose information has to be printed.
[in]levelNumber of spaces before printing, for each line.

Definition at line 63 of file domain.c.

References clan_domain::constraints, and clan_domain::next.

Referenced by clan_domain_dump().

◆ clan_domain_malloc()

clan_domain_p clan_domain_malloc ( )

clan_domain_malloc function: This function allocates the memory space for a clan_domain_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.

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

Definition at line 134 of file domain.c.

References clan_domain::constraints, and clan_domain::next.

Referenced by clan_domain_clone(), and clan_domain_xfor().

◆ clan_domain_pop()

clan_domain_p clan_domain_pop ( clan_domain_p head)

clan_domain_pop function: this function sees a list of domains as a stack of domains and performs the pop operation onto this stack.

Parameters
[in,out]headPointer to the head of the domain stack. It is updated to the previous element in the stack (NULL if there is none).
Returns
The top element of the stack (detached from the list).

Definition at line 227 of file domain.c.

References clan_domain::next.

Referenced by clan_domain_drop(), and clan_domain_dup().

◆ clan_domain_push()

void clan_domain_push ( clan_domain_p head,
clan_domain_p  node 
)

clan_domain_push function: this function sees a list of domains as a stack of domains and performs the push operation onto this stack.

Parameters
[in,out]headPointer to the head of the domain stack.
[in,out]nodeDomain node to add to the stack. Its next field is updated to the previous head of the stack.

Definition at line 211 of file domain.c.

References clan_domain::next.

Referenced by clan_domain_dup().

◆ clan_domain_stride()

void clan_domain_stride ( clan_domain_p  domain,
int  depth,
int  stride 
)

clan_domain_stride function: this function applies the contribution of a loop stride to every set of constraint set of the domain.

Parameters
[in,out]domainThe set of constraint set to update.
[in]depthThe loop depth corresponding to the stride.
[in]strideThe loop stride value.

Definition at line 293 of file domain.c.

References clan_relation_stride(), and clan_domain::constraints.

Referenced by clan_domain_for().

◆ clan_domain_xfor()

void clan_domain_xfor ( clan_domain_p  domain,
int  depth,
clan_symbol_p  iterator,
osl_relation_list_p  initialization,
osl_relation_list_p  condition,
int *  stride,
clan_options_p  options 
)

clan_domain_xfor function: this function adds the contribution of a xfor loop to a domain.

Parameters
[in,out]domainThe set of constraint set to update.
[in]depthThe loop depth.
[in]iteratorThe loop iterator symbols.
[in]initializationThe loop initialiation right part constraints.
[in]conditionThe loop condition part constraints.
[in]strideThe loop stride values.
[in]optionsClan's options.

Definition at line 372 of file domain.c.

References clan_domain_for(), clan_domain_free(), clan_domain_malloc(), clan_relation_list_nb_elements(), clan_domain::constraints, and clan_symbol::next.