PIPS
unary_operators.c
Go to the documentation of this file.
1 /*
2 
3  $Id: unary_operators.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 /* package convex effects : Be'atrice Creusillet 6/97
28  *
29  * File: unary_operators.c
30  * ~~~~~~~~~~~~~~~~~~~~~~~
31  *
32  * This File contains the intanciation of the generic functions necessary
33  * for the computation of all types of simple effects.
34  *
35  */
36 
37 #include <stdio.h>
38 #include <string.h>
39 
40 #include "genC.h"
41 #include "linear.h"
42 #include "ri.h"
43 #include "effects.h"
44 #include "ri-util.h"
45 #include "workspace-util.h"
46 #include "prettyprint.h"
47 #include "effects-util.h"
48 #include "misc.h"
49 
50 #include "preprocessor.h"
51 
52 #include "effects-generic.h"
53 #include "effects-convex.h"
54 
55 
56 effect
57 reference_to_convex_region(reference ref, action act /* action tag */ ,
58  bool __attribute__((unused)) use_preference_p)
59 {
60  return make_reference_region(ref, act);
61 }
62 
63 list
65  entity old_ent, entity new_ent)
66 {
67  all_regions_variable_rename(l_reg, old_ent, new_ent);
68  return(l_reg);
69 }
70 
73 {
74  descriptor loop_desc;
76 
77  loop_desc = make_descriptor(is_descriptor_convex, sc_loop);
78  return loop_desc;
79 }
80 
81 list
83  entity *new_index, descriptor d,
84  bool descriptor_normalize_p)
85 {
86  bool normalized_p;
87  Psysteme sc_loop = SC_UNDEFINED;
88 
89  pips_assert("descriptor must be initialized", !descriptor_undefined_p(d));
90 
91  if (descriptor_normalize_p)
92  sc_loop = descriptor_convex(d);
93 
94  *new_index = loop_regions_normalize(l_reg, index, r, &normalized_p,
95  descriptor_normalize_p, &sc_loop);
96  if (descriptor_normalize_p)
97  descriptor_convex_(d) = newgen_Psysteme(sc_loop);
98  return l_reg;
99 }
100 
101 list
103  descriptor d)
104 {
106  {
107  list l_var = CONS(ENTITY, index, NIL);
108  project_regions_along_variables(l_reg, l_var);
109  gen_free_list(l_var);
110  }
111  else if (descriptor_undefined_p(d))
112  {
113  project_regions_along_loop_index(l_reg, index, r);
114  }
115  else /* range information is included in descriptor */
116  {
117  Psysteme sc_range = descriptor_convex(d);
119  l_reg = all_regions_sc_append(l_reg, sc_range, false);
120  else
121  l_reg = array_regions_sc_append(l_reg, sc_range, false);
122  ifdebug(6){
123  pips_debug(6, "regions before elimination of index %s.\n",
124  entity_minimal_name(index));
125  (*effects_prettyprint_func)(l_reg);
126  }
127  project_regions_along_loop_index(l_reg, index, r);
128  ifdebug(6){
129  pips_debug(6, "regions after elimination of index.\n");
130  (*effects_prettyprint_func)(l_reg);
131  }
132  }
133 
134  return l_reg;
135 }
136 
137 
140 {
141  descriptor d;
142 
143  if (VECTEUR_UNDEFINED_P(v))
145  else
146  {
147  Psysteme sc = sc_new();
148  Pcontrainte contrainte = contrainte_make(v);
149  sc_add_inegalite(sc, contrainte);
150  sc->base = BASE_NULLE;
151  sc_creer_base(sc);
152  ifdebug(8){
153  pips_debug(8, "resulting system:\n");
154  sc_syst_debug(sc);
155  }
157  }
158 
159  return d;
160 
161 }
162 
164 {
165  FOREACH(REGION, eff, l_eff) {
166  if(store_effect_p(eff) && !ENDP(cell_indices(effect_cell(eff))))
167  region_system_(eff) =
169  }
170 }
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
Definition: 3dnow.h:3
descriptor make_descriptor(enum descriptor_utype tag, void *val)
Definition: effects.c:433
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
void sc_syst_debug(Psysteme s)
constraint_to_text.c
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
#define region_system_(reg)
#define region_system(reg)
#define REGION
list all_regions_sc_append(list, Psysteme, bool)
void all_regions_variable_rename(list, entity, entity)
effect make_reference_region(reference, action)
descriptor loop_convex_descriptor_make(loop)
entity loop_regions_normalize(list, entity, range, bool *, bool, Psysteme *)
FONCTIONS D'INTERFACE
list convex_regions_descriptor_variable_rename(list, entity, entity)
effect reference_to_convex_region(reference, action, bool)
unary_operators.c
Psysteme sc_loop_proper_precondition(loop)
bool add_precondition_to_scalar_convex_regions
void convex_effects_descriptor_normalize(list)
Psysteme region_sc_normalize(Psysteme, int)
descriptor vector_to_convex_descriptor(Pvecteur)
list convex_regions_loop_normalize(list, entity, range, entity *, descriptor, bool)
void project_regions_along_loop_index(list, entity, range)
void project_regions_along_loop_index(list l_reg, entity index, l_range) input : a list l_reg of regi...
list convex_regions_union_over_range(list, entity, range, descriptor)
list array_regions_sc_append(list, Psysteme, bool)
void project_regions_along_variables(list, list)
void project_regions_along_variables(list l_reg, list l_param) input : a list of regions to project,...
list cell_indices(cell)
Definition: effects.c:64
bool store_effect_p(effect)
Definition: effects.c:1062
#define descriptor_convex_(x)
Definition: effects.h:600
@ is_descriptor_convex
Definition: effects.h:575
#define descriptor_undefined
Definition: effects.h:559
#define descriptor_convex(x)
Definition: effects.h:601
#define descriptor_undefined_p(x)
Definition: effects.h:560
#define newgen_Psysteme(p)
Definition: effects.h:47
#define effect_cell(x)
Definition: effects.h:640
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
const char * entity_minimal_name(entity e)
Do preserve scope informations.
Definition: naming.c:214
#define range_undefined_p(x)
Definition: ri.h:2264
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
#define ifdebug(n)
Definition: sg.c:47
Pbase base
Definition: sc-local.h:75
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
#define BASE_NULLE
MACROS SUR LES BASES.
#define VECTEUR_UNDEFINED_P(v)