PIPS
basis.c
Go to the documentation of this file.
1 /*
2 
3  $Id: basis.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  /* Code Generation for Distributed Memory Machines
28  *
29  * Generation of indices for the different bases used in code generation
30  *
31  *
32  * PUMA, ESPRIT contract 2701
33  *
34  * Corinne Ancourt
35  * 1991
36  */
37 
38 #include <stdlib.h>
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 
43 #include "genC.h"
44 #include "misc.h"
45 
46 #include "linear.h"
47 #include "ri.h"
48 #include "effects.h"
49 #include "dg.h"
50 
53 #include "graph.h"
54 
55 #include "matrice.h"
56 #include "tiling.h"
57 #include "ri-util.h"
58 #include "effects-util.h"
59 #include "wp65.h"
60 
62 {
63  entity new_ind;
65  vecteur_var(pv)),
66  st,NULL));
67  if ((new_ind =
69  MODULE_SEP_STRING,name,NULL),
71  {
72  new_ind=make_scalar_integer_entity(name,
75  }
76  free(name);
77  return(new_ind);
78 }
79 
81 {
82  entity new_ind;
83  string name = strdup(concatenate(st,
85  NULL));
86  if ((new_ind=gen_find_tabulated(concatenate
88  MODULE_SEP_STRING,name,NULL),
90  new_ind=make_scalar_integer_entity(name,
92  module));
94  }
95  free(name);
96  return(new_ind);
97 }
98 ␌
99 
100 void create_tile_basis(initial_module,compute_module,memory_module,initial_basis,tile_basis_in_initial_basis,
101 tile_basis_in_tile_basis,local_tile_basis,tile_basis_in_tile_basis2,local_tile_basis2)
102 entity initial_module;
103 entity compute_module;
104 entity memory_module;
105 Pbase initial_basis;
106 Pbase *tile_basis_in_initial_basis;
107 Pbase *tile_basis_in_tile_basis;
108 Pbase *local_tile_basis;
109 Pbase *tile_basis_in_tile_basis2; /* idem que les precedentes mais pour la sousroutine compute_module*/
110 Pbase *local_tile_basis2;
111 {
112  string name;
113  entity new_ind;
114  Pvecteur pv;
115  Pbase tbib = BASE_NULLE;
116  Pbase tbtb = BASE_NULLE;
117  Pbase tbtbc = BASE_NULLE;
118  Pbase ltb = BASE_NULLE;
119  Pbase ltbc = BASE_NULLE;
120 
121  debug(8, "create_tile_basis", "begin initial_module_name=%s\n",
122  module_local_name(initial_module));
123  ifdebug(8) {
124  (void) fprintf(stderr, "initial_basis:\n");
125  vect_fprint(stderr, initial_basis, (string(*)(void*))entity_local_name);
126  }
127 
128  for (pv = initial_basis; !VECTEUR_NUL_P(pv); pv=pv->succ) {
129 
131  vecteur_var(pv)),
133  NULL));
134  if ((new_ind =
136  MODULE_SEP_STRING,name,NULL),
138  new_ind=make_scalar_integer_entity(name,
139  module_local_name(initial_module));
140 
141  free(name);
142  tbib = vect_add_variable (tbib,(char *)new_ind);
143 
144  new_ind = create_local_index(compute_module,
145  pv,
147  tbtbc = vect_add_variable (tbtbc,(char *) new_ind);
148 
149  new_ind= create_local_index(memory_module,
150  pv,
152  tbtb = vect_add_variable (tbtb,(char *) new_ind);
153 
154  new_ind = create_local_index2(compute_module, pv,
156  ltbc = vect_add_variable (ltbc,(char *) new_ind);
157 
158  new_ind = create_local_index2(memory_module, pv,
160  ltb = vect_add_variable (ltb,(char *) new_ind);
161  }
162 
163 
164  *tile_basis_in_initial_basis = base_reversal(tbib);
165  *tile_basis_in_tile_basis = base_reversal(tbtb);
166  *local_tile_basis = base_reversal(ltb);
167  *tile_basis_in_tile_basis2 = base_reversal(tbtbc);
168  *local_tile_basis2 = base_reversal(ltbc);
169 
170  ifdebug(8) {
171  (void) fprintf(stderr,"\nInitial basis:");
172  base_fprint(stderr, initial_basis, (string(*)(void*))entity_local_name);
173  (void) fprintf(stderr,"\nTile basis in initial basis:");
174  base_fprint(stderr, *tile_basis_in_initial_basis, (string(*)(void*))entity_local_name);
175  (void) fprintf(stderr,"\nTile basis in tile basis:");
176  base_fprint(stderr, *tile_basis_in_tile_basis, (string(*)(void*))entity_local_name);
177  (void) fprintf(stderr,"\nLocal basis:");
178  base_fprint(stderr, *local_tile_basis, (string(*)(void*))entity_local_name);
179  (void) fprintf(stderr,
180  "\nTile basis in tile basis for compute module:");
181  base_fprint(stderr, *tile_basis_in_tile_basis2, (string(*)(void*))entity_local_name);
182  (void) fprintf(stderr,"\nLocal basis for compute module:");
183  base_fprint(stderr, *local_tile_basis2, (string(*)(void*))entity_local_name);
184  }
185 
186  debug(8, "create_tile_basis", "end\n");
187 }
188 
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
Definition: base.c:221
Pbase vect_add_variable(Pbase b, Variable v)
package vecteur - routines sur les bases
Definition: base.c:61
entity create_local_index(entity module, Pvecteur pv, string st)
basis.c
Definition: basis.c:61
dg_vertex_label vertex_label
Definition: basis.c:52
dg_arc_label arc_label
Code Generation for Distributed Memory Machines.
Definition: basis.c:51
entity create_local_index2(entity module, Pvecteur pv, string st)
Definition: basis.c:80
void create_tile_basis(entity initial_module, entity compute_module, entity memory_module, Pbase initial_basis, Pbase *tile_basis_in_initial_basis, Pbase *tile_basis_in_tile_basis, Pbase *local_tile_basis, Pbase *tile_basis_in_tile_basis2, Pbase *local_tile_basis2)
Definition: basis.c:100
void free(void *)
void base_fprint(FILE *f, Pbase b, get_variable_name_t variable_name)
void base_fprint(FILE * f, Pbase b, char * (*variable_name)()): impression d'une base sur le fichier ...
Definition: io.c:342
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
Definition: io.c:124
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
#define MODULE_SEP_STRING
Definition: naming-local.h:30
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
static char * module
Definition: pips.c:74
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
void AddEntityToDeclarations(entity, entity)
END_EOLE.
Definition: variable.c:108
entity make_scalar_integer_entity(const char *, const char *)
Create an integer variable of name "name" in module of name "module_name".
Definition: variable.c:1068
#define entity_undefined
Definition: ri.h:2761
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
#define ifdebug(n)
Definition: sg.c:47
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct Svecteur * succ
Definition: vecteur-local.h:92
#define vecteur_var(v)
#define VECTEUR_NUL_P(v)
#define BASE_NULLE
MACROS SUR LES BASES.
#define SUFFIX_FOR_INDEX_TILE_IN_TILE_BASIS
Definition: wp65-local.h:47
#define PREFIX_FOR_LOCAL_TILE_BASIS
Definition: wp65-local.h:48
#define SUFFIX_FOR_INDEX_TILE_IN_INITIAL_BASIS
Definition: wp65-local.h:46