remove unused.
[cloog-ppl.git] / include / cloog / domain.h
blob8f6a415eb3c6dc301a8ad0f45474f1d7def56de8
2 /**-------------------------------------------------------------------**
3 ** CLooG **
4 **-------------------------------------------------------------------**
5 ** domain.h **
6 **-------------------------------------------------------------------**
7 ** First version: october 28th 2001 **
8 **-------------------------------------------------------------------**/
11 /******************************************************************************
12 * CLooG : the Chunky Loop Generator (experimental) *
13 ******************************************************************************
14 * *
15 * Copyright (C) 2001-2005 Cedric Bastoul *
16 * *
17 * This is free software; you can redistribute it and/or modify it under the *
18 * terms of the GNU General Public License as published by the Free Software *
19 * Foundation; either version 2 of the License, or (at your option) any later *
20 * version. *
21 * *
22 * This software is distributed in the hope that it will be useful, but *
23 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
24 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
25 * for more details. *
26 * *
27 * You should have received a copy of the GNU General Public License along *
28 * with software; if not, write to the Free Software Foundation, Inc., *
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
30 * *
31 * CLooG, the Chunky Loop Generator *
32 * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
33 * *
34 ******************************************************************************/
37 #ifndef CLOOG_DOMAIN_H
38 #define CLOOG_DOMAIN_H
39 #if defined(__cplusplus)
40 extern "C"
42 #endif
45 /* The Polyhedron structure comes directly from PolyLib (defined in
46 * polylib/types.h) here is how it looks like (at least in PolyLib 5.20.0
47 * version).
49 * typedef struct polyhedron {
50 * unsigned Dimension, // Dimension number (NbColumns-2 in Matrix).
51 * NbConstraints, // Number of constraints (NbRows in Matrix).
52 * NbRays, // Number of rays in dual representation.
53 * NbEq, // Number of vertices (?).
54 * NbBid; // Number of extremal rays (?).
55 * Value **Constraint; // The pointers to rows in matrix representation.
56 * Value **Ray; // The pointers to rays in dual representation.
57 * Value *p_Init; // The whole data, consecutive in memory.
58 * int p_Init_size; // To clear values in GMP mode.
59 * struct polyhedron *next; // Pointer to next component of the union.
60 * } Polyhedron;
61 */
64 /**
65 * CloogDomain structure:
66 * this structure contains a polyhedron in the PolyLib shape and the number of
67 * active references to this structure. Because CLooG uses many copies of
68 * domains there is no need to actually copy these domains but just to return
69 * a pointer to them and to increment the number of active references. Each time
70 * a CloogDomain will be freed, we will decrement the active reference counter
71 * and actually free it if its value is zero.
73 struct cloogdomain
74 { Polyhedron * polyhedron ; /**< The polyhedral domain. */
75 int references ; /**< Number of references to this structure. */
76 } ;
77 typedef struct cloogdomain CloogDomain ;
80 /**
81 * CloogDomainList structure:
82 * this structure reprensents a node of a linked list of CloogDomain structures.
84 struct cloogdomainlist
85 { CloogDomain * domain ; /**< An element of the list. */
86 struct cloogdomainlist * next ;/**< Pointer to the next element of the list.*/
87 } ;
88 typedef struct cloogdomainlist CloogDomainList ;
91 /******************************************************************************
92 * Memory leak hunt functions *
93 ******************************************************************************/
94 void cloog_value_leak_up(void);
95 void cloog_value_leak_down(void);
98 /******************************************************************************
99 * PolyLib interface *
100 ******************************************************************************/
101 CloogMatrix * cloog_simplify_domain_matrix_with_equalities (CloogDomain *, int,
102 CloogMatrix *, int);
103 void cloog_domain_print(FILE *, CloogDomain *) ;
104 void cloog_polyhedron_print(FILE *, Polyhedron *) ;
105 void cloog_domain_free(CloogDomain *) ;
106 CloogDomain * cloog_domain_copy(CloogDomain *) ;
107 CloogDomain * cloog_domain_image(CloogDomain *, Matrix *) ;
108 CloogDomain * cloog_domain_preimage(CloogDomain *, Matrix *) ;
109 CloogDomain * cloog_domain_convex(CloogDomain * Pol) ;
110 CloogDomain * cloog_domain_simple_convex(CloogDomain * domain, int nb_par);
111 CloogDomain * cloog_domain_simplify(CloogDomain *, CloogDomain *) ;
112 CloogDomain * cloog_domain_union(CloogDomain *, CloogDomain *) ;
113 CloogDomain * cloog_domain_intersection(CloogDomain *, CloogDomain *) ;
114 CloogDomain * cloog_domain_difference(CloogDomain *, CloogDomain *) ;
115 CloogDomain * cloog_domain_addconstraints(CloogDomain *, CloogDomain *) ;
116 void cloog_domain_sort(Polyhedron**,unsigned,unsigned,unsigned,int *);
117 CloogDomain * cloog_domain_empty(int) ;
120 /******************************************************************************
121 * Structure display function *
122 ******************************************************************************/
123 void cloog_domain_print_structure(FILE *, CloogDomain *, int) ;
124 void cloog_domain_list_print(FILE *, CloogDomainList *) ;
127 /******************************************************************************
128 * Memory deallocation function *
129 ******************************************************************************/
130 void cloog_domain_list_free(CloogDomainList *) ;
133 /*+****************************************************************************
134 * Reading function *
135 ******************************************************************************/
136 CloogDomain * cloog_domain_read(FILE *) ;
137 CloogDomain * cloog_domain_union_read(FILE *) ;
138 CloogDomainList * cloog_domain_list_read(FILE *) ;
141 /******************************************************************************
142 * Processing functions *
143 ******************************************************************************/
144 CloogDomain * cloog_domain_alloc(Polyhedron *) ;
145 int cloog_domain_isempty(CloogDomain *) ;
146 CloogDomain * cloog_domain_project(CloogDomain *, int, int) ;
147 CloogDomain * cloog_domain_extend(CloogDomain *, int, int) ;
148 int cloog_domain_never_integral(CloogDomain *) ;
149 void cloog_domain_stride(CloogDomain *, int, int, Value *, Value *) ;
150 int cloog_domain_integral_lowerbound(CloogDomain *, int, Value *) ;
151 void cloog_domain_lowerbound_update(CloogDomain *, int, Value) ;
152 int cloog_domain_lazy_disjoint(CloogDomain *, CloogDomain *) ;
153 int cloog_domain_lazy_equal(CloogDomain *, CloogDomain *) ;
154 int cloog_domain_lazy_block(CloogDomain *, CloogDomain *,
155 CloogDomainList *, int) ;
156 int cloog_domain_lazy_isscalar(CloogDomain *, int) ;
157 int cloog_domain_list_lazy_same(CloogDomainList *) ;
158 void cloog_domain_scalar(CloogDomain *, int, Value *) ;
159 CloogDomain * cloog_domain_cut_first(CloogDomain *) ;
160 CloogDomain * cloog_domain_erase_dimension(CloogDomain *, int) ;
162 #define cloog_domain_polyhedron(x) (x)->polyhedron
163 #define cloog_domain_dimension(x) (x)->polyhedron->Dimension
164 #define cloog_domain_nbconstraints(x) (x)->polyhedron->NbConstraints
165 #define cloog_domain_isconvex(x) ((x)->polyhedron->next == NULL)? 1 : 0
167 Polyhedron * cloog_domain_polyhedron(CloogDomain *) ;
168 int cloog_domain_dimension(CloogDomain *) ;
169 int cloog_domain_nbconstraints(CloogDomain *) ;
170 int cloog_domain_isconvex(CloogDomain *) ;
173 #if defined(__cplusplus)
175 #endif
176 #endif /* define _H */