Home | History | Annotate | Download | only in cloog
      1 
      2    /**-------------------------------------------------------------------**
      3     **                               CLooG                               **
      4     **-------------------------------------------------------------------**
      5     **                           constraints.h                           **
      6     **-------------------------------------------------------------------**
      7     **                    First version: april 17th 2005                 **
      8     **-------------------------------------------------------------------**/
      9 
     10 
     11 /******************************************************************************
     12  *               CLooG : the Chunky Loop Generator (experimental)             *
     13  ******************************************************************************
     14  *                                                                            *
     15  * Copyright (C) 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_CONSTRAINTS_H
     39 #define CLOOG_CONSTRAINTS_H
     40 
     41 struct cloogconstraint;
     42 typedef struct cloogconstraint CloogConstraint;
     43 struct cloogconstraintset;
     44 typedef struct cloogconstraintset CloogConstraintSet;
     45 struct cloogequalities;
     46 typedef struct cloogequalities CloogEqualities;
     47 
     48 #if defined(__cplusplus)
     49 extern "C"
     50   {
     51 #endif
     52 
     53 /******************************************************************************
     54  *                        Equalities spreading functions                      *
     55  ******************************************************************************/
     56 CloogEqualities *cloog_equal_alloc(int n, int nb_levels,
     57 			int nb_parameters);
     58 void		 cloog_equal_free(CloogEqualities *equal);
     59 int              cloog_equal_count(CloogEqualities *equal);
     60 int              cloog_equal_type(CloogEqualities *equal, int level);
     61 void             cloog_equal_del(CloogEqualities *equal, int level);
     62 int              cloog_equal_total_dimension(CloogEqualities *equal);
     63 
     64 /******************************************************************************
     65  *                            Processing functions                            *
     66  ******************************************************************************/
     67 void          cloog_constraint_set_normalize(CloogConstraintSet *, int);
     68 void          cloog_constraint_set_free(CloogConstraintSet *);
     69 int           cloog_constraint_set_contains_level(CloogConstraintSet *constraints,
     70 			int level, int nb_parameters);
     71 int           cloog_constraint_set_total_dimension(CloogConstraintSet *constraints);
     72 int           cloog_constraint_set_n_iterators(CloogConstraintSet *constraints,
     73 			int nb_parameters);
     74 CloogConstraintSet *cloog_constraint_set_copy(CloogConstraintSet *);
     75 CloogConstraintSet *cloog_constraint_set_simplify(CloogConstraintSet *, CloogEqualities *, int, int);
     76 
     77 int cloog_constraint_needs_reduction(CloogConstraint *upper, int level);
     78 CloogConstraintSet *cloog_constraint_set_for_reduction(CloogConstraint *upper,
     79 	       CloogConstraint *lower);
     80 CloogConstraintSet *cloog_constraint_set_reduce(CloogConstraintSet *constraints,
     81 	int level, CloogEqualities *equal, int nb_par, cloog_int_t *bound);
     82 int cloog_constraint_set_foreach_constraint(CloogConstraintSet *constraints,
     83 	int (*fn)(CloogConstraint *constraint, void *user), void *user);
     84 int              cloog_constraint_is_valid(CloogConstraint *constraint);
     85 CloogConstraint *cloog_constraint_copy(CloogConstraint *constraint);
     86 void             cloog_constraint_release(CloogConstraint *constraint);
     87 CloogConstraint *cloog_constraint_invalid(void);
     88 int              cloog_constraint_total_dimension(CloogConstraint *constraint);
     89 
     90 CloogConstraint *cloog_equal_constraint(CloogEqualities *equal, int j);
     91 void             cloog_equal_add(CloogEqualities *equal,
     92 				  CloogConstraintSet *constraints,
     93 				  int level, CloogConstraint *line, int nb_par);
     94 
     95 CloogConstraint *cloog_constraint_set_defining_equality(
     96 			CloogConstraintSet *constraints, int level);
     97 CloogConstraint *cloog_constraint_set_defining_inequalities(
     98 			CloogConstraintSet *constraints,
     99 			int level, CloogConstraint **lower, int nb_parameters);
    100 int           cloog_constraint_involves(CloogConstraint *constraint, int v);
    101 int           cloog_constraint_is_lower_bound(CloogConstraint *constraint, int v);
    102 int           cloog_constraint_is_upper_bound(CloogConstraint *constraint, int v);
    103 int           cloog_constraint_is_equality(CloogConstraint *constraint);
    104 void          cloog_constraint_constant_get(CloogConstraint *constraint,
    105 			cloog_int_t *val);
    106 void          cloog_constraint_coefficient_get(CloogConstraint *constraint,
    107 			int var, cloog_int_t *val);
    108 void          cloog_constraint_coefficient_set(CloogConstraint *constraint,
    109 			int var, cloog_int_t val);
    110 void          cloog_constraint_copy_coefficients(CloogConstraint *constraint,
    111 			cloog_int_t *dst);
    112 CloogConstraintSet *cloog_constraint_set_drop_constraint(
    113 	CloogConstraintSet *constraints, CloogConstraint *constraint);
    114 
    115 struct clast_expr *cloog_constraint_variable_expr(CloogConstraint *constraint,
    116 			int level, CloogNames *names);
    117 
    118 #if defined(__cplusplus)
    119   }
    120 #endif
    121 #endif /* define _H */
    122