OpenScop  0.9.0
loop.h
Go to the documentation of this file.
00001 
00002     /*+-----------------------------------------------------------------**
00003      **                       OpenScop Library                          **
00004      **-----------------------------------------------------------------**
00005      **                      extensions/loop.h                          **
00006      **-----------------------------------------------------------------**
00007      **                   First version: 03/06/2013                     **
00008      **-----------------------------------------------------------------**
00009 
00010  
00011  *****************************************************************************
00012  * OpenScop: Structures and formats for polyhedral tools to talk together    *
00013  *****************************************************************************
00014  *    ,___,,_,__,,__,,__,,__,,_,__,,_,__,,__,,___,_,__,,_,__,                *
00015  *    /   / /  //  //  //  // /   / /  //  //   / /  // /  /|,_,             *
00016  *   /   / /  //  //  //  // /   / /  //  //   / /  // /  / / /\             *
00017  *  |~~~|~|~~~|~~~|~~~|~~~|~|~~~|~|~~~|~~~|~~~|~|~~~|~|~~~|/_/  \            *
00018  *  | G |C| P | = | L | P |=| = |C| = | = | = |=| = |=| C |\  \ /\           *
00019  *  | R |l| o | = | e | l |=| = |a| = | = | = |=| = |=| L | \# \ /\          *
00020  *  | A |a| l | = | t | u |=| = |n| = | = | = |=| = |=| o | |\# \  \         *
00021  *  | P |n| l | = | s | t |=| = |d| = | = | = | |   |=| o | | \# \  \        *
00022  *  | H | | y |   | e | o | | = |l|   |   | = | |   | | G | |  \  \  \       *
00023  *  | I | |   |   | e |   | |   | |   |   |   | |   | |   | |   \  \  \      *
00024  *  | T | |   |   |   |   | |   | |   |   |   | |   | |   | |    \  \  \     *
00025  *  | E | |   |   |   |   | |   | |   |   |   | |   | |   | |     \  \  \    *
00026  *  | * |*| * | * | * | * |*| * |*| * | * | * |*| * |*| * | /      \* \  \   *
00027  *  | O |p| e | n | S | c |o| p |-| L | i | b |r| a |r| y |/        \  \ /   *
00028  *  '---'-'---'---'---'---'-'---'-'---'---'---'-'---'-'---'          '--'    *
00029  *                                                                           *
00030  * Copyright (C) 2008 University Paris-Sud 11 and INRIA                      *
00031  *                                                                           *
00032  * (3-clause BSD license)                                                    *
00033  * Redistribution and use in source  and binary forms, with or without       *
00034  * modification, are permitted provided that the following conditions        *
00035  * are met:                                                                  *
00036  *                                                                           *
00037  * 1. Redistributions of source code must retain the above copyright notice, *
00038  *    this list of conditions and the following disclaimer.                  *
00039  * 2. Redistributions in binary form must reproduce the above copyright      *
00040  *    notice, this list of conditions and the following disclaimer in the    *
00041  *    documentation and/or other materials provided with the distribution.   *
00042  * 3. The name of the author may not be used to endorse or promote products  *
00043  *    derived from this software without specific prior written permission.  *
00044  *                                                                           *
00045  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR      *
00046  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
00047  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.   *
00048  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,          *
00049  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT  *
00050  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
00051  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY     *
00052  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT       *
00053  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF  *
00054  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.         *
00055  *                                                                           *
00056  * OpenScop Library, a library to manipulate OpenScop formats and data       *
00057  * structures. Written by:                                                   *
00058  * Cedric Bastoul     <Cedric.Bastoul@u-psud.fr> and                         *
00059  * Louis-Noel Pouchet <Louis-Noel.pouchet@inria.fr>                          *
00060  *                                                                           *
00061  *****************************************************************************/
00062 
00063 
00064 #ifndef OSL_LOOP_H
00065 # define OSL_LOOP_H
00066 
00067 # include <stdio.h>
00068 # include <osl/strings.h>
00069 # include <osl/interface.h>
00070 
00071 # if defined(__cplusplus)
00072 extern "C"
00073   {
00074 # endif
00075 
00076 
00077 # define OSL_URI_LOOP        "loop"
00078 
00079 //loop direcrives
00080 # define OSL_LOOP_DIRECTIVE_NONE     0
00081 # define OSL_LOOP_DIRECTIVE_PARALLEL 1
00082 # define OSL_LOOP_DIRECTIVE_MPI      2
00083 # define OSL_LOOP_DIRECTIVE_VECTOR   4 
00084 
00085 
00086 
00094 struct osl_loop {
00095   char * iter;              
00096   int    nb_stmts;          
00097   int  * stmt_ids;          
00098   char * private_vars;      
00099   int    directive;         
00100   struct osl_loop * next;
00101 };
00102 typedef struct osl_loop   osl_loop_t;
00103 typedef struct osl_loop * osl_loop_p;
00104 
00105 
00106 
00107 /*+***************************************************************************
00108  *                          Structure display function                       *
00109  *****************************************************************************/
00110 void            osl_loop_idump(FILE * file, osl_loop_p loop, int level);
00111 void            osl_loop_dump(FILE * file, osl_loop_p loop);
00112 char *          osl_loop_sprint(osl_loop_p loop);
00113 
00114 
00115 /*****************************************************************************
00116  *                               Reading function                            *
00117  *****************************************************************************/
00118 osl_loop_p      osl_loop_sread(char ** input);
00119 
00120 
00121 /*+***************************************************************************
00122  *                    Memory allocation/deallocation function                *
00123  *****************************************************************************/
00124 osl_loop_p      osl_loop_malloc();
00125 void            osl_loop_free(osl_loop_p loop);
00126 
00127 
00128 /*+***************************************************************************
00129  *                            Processing functions                           *
00130  *****************************************************************************/
00131 osl_loop_p      osl_loop_clone_one(osl_loop_p loop);
00132 osl_loop_p      osl_loop_clone(osl_loop_p loop);
00133 int             osl_loop_equal_one(osl_loop_p a1, osl_loop_p a2);
00134 int             osl_loop_equal(osl_loop_p a1, osl_loop_p a2);
00135 osl_strings_p   osl_loop_to_strings(osl_loop_p);
00136 osl_interface_p osl_loop_interface();
00137 
00138 void            osl_loop_add(osl_loop_p loop, osl_loop_p *ll);
00139 int             osl_loop_count(osl_loop_p ll);
00140 
00141 # if defined(__cplusplus)
00142   }
00143 # endif
00144 
00145 #endif /* define OSL_LOOP_H */