Lines 17-24
Link Here
|
17 |
#include <assert.h> |
17 |
#include <assert.h> |
18 |
#include "ap_generic.h" |
18 |
#include "ap_generic.h" |
19 |
#include "ap_ppl.h" |
19 |
#include "ap_ppl.h" |
20 |
#include "ppl_grid.hh" |
|
|
21 |
#include "ppl_user.hh" |
20 |
#include "ppl_user.hh" |
|
|
21 |
#include "ppl_grid.hh" |
22 |
|
22 |
|
23 |
#include <ppl.hh> |
23 |
#include <ppl.hh> |
24 |
using namespace std; |
24 |
using namespace std; |
Lines 60-72
Link Here
|
60 |
void PPL_Grid::reduce() |
60 |
void PPL_Grid::reduce() |
61 |
{ |
61 |
{ |
62 |
for (size_t i=0;i<intdim;i++) |
62 |
for (size_t i=0;i<intdim;i++) |
63 |
p->add_congruence_and_minimize((Variable(i) %=0) / 1); |
63 |
p->add_congruence((Variable(i) %=0) / 1); |
64 |
} |
64 |
} |
65 |
|
65 |
|
66 |
void PPL_Grid::forget_dim(size_t dim) |
66 |
void PPL_Grid::forget_dim(size_t dim) |
67 |
{ |
67 |
{ |
68 |
if (intdim>dim) p->add_generator_and_minimize(Grid_Generator::parameter(Variable(dim))); |
68 |
#ifndef PPL_0_9 |
69 |
else p->add_generator_and_minimize(Grid_Generator::line(Variable(dim))); |
69 |
if (intdim>dim) p->add_grid_generator(Grid_Generator::parameter(Variable(dim))); |
|
|
70 |
else p->add_grid_generator(Grid_Generator::grid_line(Variable(dim))); |
71 |
#else |
72 |
if (intdim>dim) p->add_generator(Grid_Generator::parameter(Variable(dim))); |
73 |
else p->add_generator(Grid_Generator::line(Variable(dim))); |
74 |
#endif |
70 |
} |
75 |
} |
71 |
|
76 |
|
72 |
PPL_Grid::~PPL_Grid() { delete p; } |
77 |
PPL_Grid::~PPL_Grid() { delete p; } |
Lines 221-227
Link Here
|
221 |
((PPL_Grid*)a)->reduce(); |
226 |
((PPL_Grid*)a)->reduce(); |
222 |
/* the calls force in-place minimisation */ |
227 |
/* the calls force in-place minimisation */ |
223 |
(void)a->p->minimized_congruences(); |
228 |
(void)a->p->minimized_congruences(); |
|
|
229 |
#ifndef PPL_0_9 |
230 |
(void)a->p->minimized_grid_generators(); |
231 |
#else |
224 |
(void)a->p->minimized_generators(); |
232 |
(void)a->p->minimized_generators(); |
|
|
233 |
#endif |
225 |
} |
234 |
} |
226 |
CATCH_WITH_VOID(AP_FUNID_MINIMIZE); |
235 |
CATCH_WITH_VOID(AP_FUNID_MINIMIZE); |
227 |
} |
236 |
} |
Lines 235-241
Link Here
|
235 |
((PPL_Grid*)a)->reduce(); |
244 |
((PPL_Grid*)a)->reduce(); |
236 |
/* the calls force in-place minimisation */ |
245 |
/* the calls force in-place minimisation */ |
237 |
(void)a->p->minimized_congruences(); |
246 |
(void)a->p->minimized_congruences(); |
|
|
247 |
#ifndef PPL_0_9 |
248 |
(void)a->p->minimized_grid_generators(); |
249 |
#else |
238 |
(void)a->p->minimized_generators(); |
250 |
(void)a->p->minimized_generators(); |
|
|
251 |
#endif |
239 |
} |
252 |
} |
240 |
CATCH_WITH_VOID(AP_FUNID_CANONICALIZE); |
253 |
CATCH_WITH_VOID(AP_FUNID_CANONICALIZE); |
241 |
} |
254 |
} |
Lines 244-249
Link Here
|
244 |
{ |
257 |
{ |
245 |
man->result.flag_exact = man->result.flag_best = true; |
258 |
man->result.flag_exact = man->result.flag_best = true; |
246 |
try { |
259 |
try { |
|
|
260 |
((PPL_Grid*)a)->reduce(); |
261 |
/* the calls force in-place minimisation */ |
262 |
(void)a->p->minimized_congruences(); |
263 |
#ifndef PPL_0_9 |
264 |
(void)a->p->minimized_grid_generators(); |
265 |
#else |
266 |
(void)a->p->minimized_generators(); |
267 |
#endif |
247 |
return a->p->total_memory_in_bytes(); |
268 |
return a->p->total_memory_in_bytes(); |
248 |
} |
269 |
} |
249 |
CATCH_WITH_VAL(AP_FUNID_HASH,0); |
270 |
CATCH_WITH_VAL(AP_FUNID_HASH,0); |
Lines 305-311
Link Here
|
305 |
ap_lincons0_array_clear(&ar); |
326 |
ap_lincons0_array_clear(&ar); |
306 |
/* dump generators */ |
327 |
/* dump generators */ |
307 |
fprintf(stream,"generators: "); |
328 |
fprintf(stream,"generators: "); |
|
|
329 |
#ifndef PPL_0_9 |
330 |
ap_generator0_array_t ar2 = ap_ppl_to_generator_array(a->p->grid_generators()); |
331 |
#else |
308 |
ap_generator0_array_t ar2 = ap_ppl_to_generator_array(a->p->generators()); |
332 |
ap_generator0_array_t ar2 = ap_ppl_to_generator_array(a->p->generators()); |
|
|
333 |
#endif |
309 |
ap_generator0_array_fprint(stream,&ar2,NULL); |
334 |
ap_generator0_array_fprint(stream,&ar2,NULL); |
310 |
ap_generator0_array_clear(&ar2); |
335 |
ap_generator0_array_clear(&ar2); |
311 |
} |
336 |
} |
Lines 371-377
Link Here
|
371 |
Congruence_System c; |
396 |
Congruence_System c; |
372 |
if (!ap_ppl_of_box(c,tinterval,intdim,realdim)) |
397 |
if (!ap_ppl_of_box(c,tinterval,intdim,realdim)) |
373 |
man->result.flag_exact = man->result.flag_best = false; |
398 |
man->result.flag_exact = man->result.flag_best = false; |
374 |
r->p->add_recycled_congruences_and_minimize(c); |
399 |
r->p->add_recycled_congruences(c); |
375 |
return r; |
400 |
return r; |
376 |
} |
401 |
} |
377 |
CATCH_WITH_DIM(AP_FUNID_OF_BOX,intdim,realdim); |
402 |
CATCH_WITH_DIM(AP_FUNID_OF_BOX,intdim,realdim); |
Lines 520-526
Link Here
|
520 |
{ |
545 |
{ |
521 |
man->result.flag_exact = man->result.flag_best = true; |
546 |
man->result.flag_exact = man->result.flag_best = true; |
522 |
try { |
547 |
try { |
|
|
548 |
#ifndef PPL_0_9 |
549 |
Grid_Generator g = Grid_Generator::grid_line(Variable(dim)); |
550 |
#else |
523 |
Grid_Generator g = Grid_Generator::line(Variable(dim)); |
551 |
Grid_Generator g = Grid_Generator::line(Variable(dim)); |
|
|
552 |
#endif |
524 |
return a->p->relation_with(g) == Poly_Gen_Relation::subsumes(); |
553 |
return a->p->relation_with(g) == Poly_Gen_Relation::subsumes(); |
525 |
} |
554 |
} |
526 |
CATCH_WITH_VAL(AP_FUNID_IS_DIMENSION_UNCONSTRAINED,false); |
555 |
CATCH_WITH_VAL(AP_FUNID_IS_DIMENSION_UNCONSTRAINED,false); |
Lines 671-677
Link Here
|
671 |
{ |
700 |
{ |
672 |
man->result.flag_exact = man->result.flag_best = true; |
701 |
man->result.flag_exact = man->result.flag_best = true; |
673 |
try { |
702 |
try { |
|
|
703 |
#ifndef PPL_0_9 |
704 |
return ap_ppl_to_generator_array(a->p->grid_generators()); |
705 |
#else |
674 |
return ap_ppl_to_generator_array(a->p->generators()); |
706 |
return ap_ppl_to_generator_array(a->p->generators()); |
|
|
707 |
#endif |
675 |
} |
708 |
} |
676 |
CATCH_WITH_VAL(AP_FUNID_TO_GENERATOR_ARRAY,ap_ppl_generator_universe(a->p->space_dimension())); |
709 |
CATCH_WITH_VAL(AP_FUNID_TO_GENERATOR_ARRAY,ap_ppl_generator_universe(a->p->space_dimension())); |
677 |
} |
710 |
} |
Lines 706-712
Link Here
|
706 |
try { |
739 |
try { |
707 |
PPL_Grid* r = destructive ? a1 : new PPL_Grid(*a1); |
740 |
PPL_Grid* r = destructive ? a1 : new PPL_Grid(*a1); |
708 |
/* TODO: should we use join_assign_if_exact? */ |
741 |
/* TODO: should we use join_assign_if_exact? */ |
|
|
742 |
#ifndef PPL_0_9 |
743 |
r->p->upper_bound_assign(*a2->p); |
744 |
#else |
709 |
r->p->join_assign(*a2->p); |
745 |
r->p->join_assign(*a2->p); |
|
|
746 |
#endif |
710 |
return r; |
747 |
return r; |
711 |
} |
748 |
} |
712 |
CATCH_WITH_GRID(AP_FUNID_JOIN,a1); |
749 |
CATCH_WITH_GRID(AP_FUNID_JOIN,a1); |
Lines 738-744
Link Here
|
738 |
PPL_Grid* r = new PPL_Grid(*tab[0]); |
775 |
PPL_Grid* r = new PPL_Grid(*tab[0]); |
739 |
for (size_t i=1;i<size;i++) |
776 |
for (size_t i=1;i<size;i++) |
740 |
/* TODO: should we use join_assign_if_exact? */ |
777 |
/* TODO: should we use join_assign_if_exact? */ |
|
|
778 |
#ifndef PPL_0_9 |
779 |
r->p->upper_bound_assign(*tab[i]->p); |
780 |
#else |
741 |
r->p->join_assign(*tab[i]->p); |
781 |
r->p->join_assign(*tab[i]->p); |
|
|
782 |
#endif |
742 |
return r; |
783 |
return r; |
743 |
} |
784 |
} |
744 |
CATCH_WITH_GRID(AP_FUNID_JOIN_ARRAY,tab[0]); |
785 |
CATCH_WITH_GRID(AP_FUNID_JOIN_ARRAY,tab[0]); |
Lines 757-763
Link Here
|
757 |
Congruence_System c; |
798 |
Congruence_System c; |
758 |
if (!ap_ppl_of_lincons_array(intern->itv,c,array)) |
799 |
if (!ap_ppl_of_lincons_array(intern->itv,c,array)) |
759 |
man->result.flag_exact = man->result.flag_best = false; |
800 |
man->result.flag_exact = man->result.flag_best = false; |
760 |
r->p->add_recycled_congruences_and_minimize(c); |
801 |
r->p->add_recycled_congruences(c); |
761 |
return r; |
802 |
return r; |
762 |
} |
803 |
} |
763 |
CATCH_WITH_GRID(AP_FUNID_MEET_LINCONS_ARRAY,a); |
804 |
CATCH_WITH_GRID(AP_FUNID_MEET_LINCONS_ARRAY,a); |
Lines 790-796
Link Here
|
790 |
Grid_Generator_System c; |
831 |
Grid_Generator_System c; |
791 |
if (!ap_ppl_of_generator_array(intern->itv,c,array)) |
832 |
if (!ap_ppl_of_generator_array(intern->itv,c,array)) |
792 |
man->result.flag_exact = man->result.flag_best = false; |
833 |
man->result.flag_exact = man->result.flag_best = false; |
793 |
r->p->add_recycled_generators_and_minimize(c); |
834 |
#ifndef PPL_0_9 |
|
|
835 |
r->p->add_recycled_grid_generators(c); |
836 |
#else |
837 |
r->p->add_recycled_generators(c); |
838 |
#endif |
794 |
r->reduce(); |
839 |
r->reduce(); |
795 |
} |
840 |
} |
796 |
return r; |
841 |
return r; |
Lines 949-955
Link Here
|
949 |
r->forget_dim(tdim[i]); |
994 |
r->forget_dim(tdim[i]); |
950 |
if (project) { |
995 |
if (project) { |
951 |
for (size_t i=0;i<size;i++) |
996 |
for (size_t i=0;i<size;i++) |
952 |
r->p->add_constraint_and_minimize(Variable(tdim[i])==0); |
997 |
r->p->add_constraint(Variable(tdim[i])==0); |
953 |
} |
998 |
} |
954 |
else { |
999 |
else { |
955 |
r->reduce(); |
1000 |
r->reduce(); |