Home | History | Annotate | Download | only in cloog
      1 
      2    /**-------------------------------------------------------------------**
      3     **                              CLooG                                **
      4     **-------------------------------------------------------------------**
      5     **                             loop.h                                **
      6     **-------------------------------------------------------------------**
      7     **                 First version: october 26th 2001                  **
      8     **-------------------------------------------------------------------**/
      9 
     10 
     11 /******************************************************************************
     12  *               CLooG : the Chunky Loop Generator (experimental)             *
     13  ******************************************************************************
     14  *                                                                            *
     15  * Copyright (C) 2001-2005 Cedric Bastoul                                     *
     16  *                                                                            *
     17  * This library is free software; you can redistribute it and/or              *
     18  * modify it under the terms of the GNU Lesser General Public                 *
     19  * License as published by the Free Software Foundation; either               *
     20  * version 2.1 of the License, or (at your option) any later version.         *
     21  *                                                                            *
     22  * This library is distributed in the hope that it will be useful,            *
     23  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
     24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          *
     25  * Lesser General Public License for more details.                            *
     26  *                                                                            *
     27  * You should have received a copy of the GNU Lesser General Public           *
     28  * License along with this library; if not, write to the Free Software        *
     29  * Foundation, Inc., 51 Franklin Street, Fifth Floor,                         *
     30  * Boston, MA  02110-1301  USA                                                *
     31  *                                                                            *
     32  * CLooG, the Chunky Loop Generator                                           *
     33  * Written by Cedric Bastoul, Cedric.Bastoul (at) inria.fr                         *
     34  *                                                                            *
     35  ******************************************************************************/
     36 
     37 
     38 #ifndef CLOOG_LOOP_H
     39 #define CLOOG_LOOP_H
     40 #if defined(__cplusplus)
     41 extern "C"
     42   {
     43 #endif
     44 
     45 /**
     46  * CloogLoop structure:
     47  * this structure contains all the informations of a loop generated or to be
     48  * generated.
     49  * - if the loop has not been processed yet (it is not a result of a call to
     50  *   cloog_loop_generate), the domain is the whole iteration domain of a given
     51  *   block, the stride is 1 (i.e. there is no stride), block is necessarily not
     52  *   NULL and inner is NULL.
     53  * - if the loop comes as a result of a cloog_loop_generate call, the domain
     54  *   describes the constraints (guards and loop bounds) for only one dimension
     55  *   (the last one: outer dimensions being considered as parameters), the stride
     56  *   may differ from one (this means that on the considered dimension, a step of
     57  *   'stride' must be considered between integral point, the first integral
     58  *   point to be considered being the lower bound of the loop), inner may differ
     59  *   from NULL, meaning that there are further dimensions and nesting levels in
     60  *   the loop.
     61  */
     62 struct cloogloop
     63 {
     64   CloogState *state;          /**< State. */
     65   CloogDomain * domain ;      /**< The iteration domain. */
     66   CloogDomain *unsimplified;  /**< Unsimplified version of domain. */
     67   int otl;                    /**< Loop is executed at most once. */
     68   CloogStride *stride;        /**< If not NULL, stride information on iterator
     69                                *   (filled only after loop generation).
     70                                */
     71   CloogBlock * block ;        /**< The included statement block, NULL if none.*/
     72   void * usr;		      /**< User field, for library user convenience.
     73 			       *   This pointer is not freed when the
     74 			       *   CloogLoop structure is freed.
     75 			       */
     76   struct cloogloop * inner ;  /**< Loops at the next level. */
     77   struct cloogloop * next ;   /**< Next loop at the same level. */
     78 } ;
     79 typedef struct cloogloop CloogLoop ;
     80 
     81 
     82 /******************************************************************************
     83  *                          Structure display function                        *
     84  ******************************************************************************/
     85 void cloog_loop_print_structure(FILE *, CloogLoop *, int) ;
     86 void cloog_loop_print(FILE *, CloogLoop *) ;
     87 
     88 
     89 /******************************************************************************
     90  *                         Memory deallocation function                       *
     91  ******************************************************************************/
     92 void cloog_loop_free(CloogLoop *) ;
     93 
     94 
     95 /******************************************************************************
     96  *                              Reading functions                             *
     97  ******************************************************************************/
     98 CloogLoop *cloog_loop_from_domain(CloogState *state, CloogDomain *domain,
     99 				  int number);
    100 CloogLoop * cloog_loop_read(CloogState *state,
    101 			    FILE * foo, int number, int nb_parameters);
    102 
    103 
    104 /******************************************************************************
    105  *                            Processing functions                            *
    106  ******************************************************************************/
    107 CloogLoop * cloog_loop_block(CloogLoop *loop, int *scaldims, int nb_scattdims);
    108 CloogLoop * cloog_loop_malloc(CloogState *state);
    109 CloogLoop *cloog_loop_generate(CloogLoop *loop, CloogDomain *context,
    110 	int level, int scalar, int *scaldims, int nb_scattdims,
    111 	CloogOptions *options);
    112 CloogLoop *cloog_loop_simplify(CloogLoop *loop, CloogDomain *context, int level,
    113 	int nb_scattdims, CloogOptions *options);
    114 void cloog_loop_scatter(CloogLoop *, CloogScattering *);
    115 
    116 
    117 #if defined(__cplusplus)
    118   }
    119 #endif
    120 #endif /* define _H */
    121