PIPS
defines-local.h
Go to the documentation of this file.
1 /*
2 
3  $Id: defines-local.h 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 /*
25  * HPFC module by Fabien COELHO
26  */
27 
28 /* Most includes are centralized here.
29  */
30 
31 /* standard C includes
32  */
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <limits.h>
36 #include <float.h>
37 #include <ctype.h>
38 #include <string.h>
39 
40 /* C3/LINEAR
41  */
42 #include "linear.h"
43 
44 /* NEWGEN
45  */
46 #include "genC.h"
47 #include "text.h"
48 #include "ri.h"
49 #include "effects.h"
50 #include "database.h"
51 #include "hpf.h"
52 #include "hpf_private.h"
53 #include "reductions_private.h"
54 #include "message.h"
55 #include "properties.h"
56 
57 /* PIPS
58  */
59 #include "misc.h"
60 #include "text-util.h"
61 #include "ri-util.h"
62 #include "effects-util.h"
63 #include "hpfc.h"
64 
65 #include "prettyprint.h" // print_statement
66 
67 /* in paf-util.h:
68  */
70 void fprint_entity_list(FILE *fp, list l);
71 
72 #define PVECTOR(v) CHUNK(v)
73 #define VECTOR gen_chunk*
74 #define PVECTOR_NEWGEN_DOMAIN (-1)
75 #define gen_PVECTOR_cons gen_cons
76 
77 /* ??? very beurk!
78  */
79 #define DELTAV ((Variable) 12)
80 #define TEMPLATEV ((Variable) 13)
81 #define TSHIFTV ((Variable) 14)
82 
83 /* Newgen short sentences
84  */
85 #define function_mapping(f) (((f)+1)->h)
86 
87 /* list of variables...
88  */
89 #define add_to_list_of_vars(l, fun, n)\
90  l = gen_nconc(make_list_of_dummy_variables((entity(*)())fun, n), l);
91 
92 #define one_statement_unstructured(u) \
93  ((control_predecessors(unstructured_control(u)) == NIL) && \
94  (control_successors(unstructured_control(u)) == NIL))
95 
96 #define entity_functional(e) (type_functional(entity_type(e)))
97 
98 #define update_functional_as_model(e, model) \
99  free_functional(entity_functional(e)), \
100  entity_functional(e) = copy_functional(entity_functional(model));
101 
102 #define min(a,b) (((a)<(b))?(a):(b))
103 #define max(a,b) (((a)>(b))?(a):(b))
104 
105 /* integer ceiling function */
106 #define iceil(a,b) ((((a)-1)/(b))+1)
107 
108 #ifndef bool_undefined
109 #define bool_undefined ((bool) (-15))
110 #define bool_undefined_p(b) ((b)==bool_undefined)
111 #endif
112 
113 #ifndef int_undefined
114 #define int_undefined ((int) (-15))
115 #define int_undefined_p(i) ((i)==int_undefined)
116 #endif
117 
118 /* file names to be generated
119  */
120 #define GLOBAL_PARAMETERS_H "global_parameters.h"
121 #define GLOBAL_INIT_H "global_init.h"
122 
123 /* Constants
124  */
125 #define HOST_NAME "HOST"
126 #define NODE_NAME "NODE"
127 
128 /* Overlap
129  */
130 #define UPPER "UP"
131 #define LOWER "LO"
132 
133 #define SEND 1
134 #define RECEIVE 0
135 
136 /* debug macro
137  */
138 #define GEN_DEBUG(D, W, P) ifdebug(D) { pips_debug(D, "%s:\n", W); P;}
139 
140 #define DEBUG_MTRX(D, W, M) GEN_DEBUG(D, W, matrix_fprint(stderr, M))
141 #define DEBUG_STAT(D, W, S) GEN_DEBUG(D, W, print_statement(S))
142 #define DEBUG_CODE(D, W, M, S) GEN_DEBUG(D, W, hpfc_print_code(stderr, M, S))
143 #define DEBUG_SYST(D, W, S) GEN_DEBUG(D, W, sc_syst_debug(S))
144 #define DEBUG_ELST(D, W, L)\
145  GEN_DEBUG(D, W, fprint_entity_list(stderr, L); fprintf(stderr, "\n"))
146 #define DEBUG_BASE(D, W, B)\
147  GEN_DEBUG(D, W, base_fprint(stderr, B, (string(*)(Variable))entity_local_name);\
148  fprintf(stderr, "\n"))
149 
150 #define what_stat_debug(level, stat)\
151  ifdebug(level) \
152  { intptr_t so_ = statement_ordering(stat);\
153  pips_debug(level, "statement %p (%"PRIdPTR",%"PRIdPTR":%"PRIdPTR")\n",\
154  stat, ORDERING_NUMBER(so_), ORDERING_STATEMENT(so_), \
155  statement_number(stat));}
156 
157 /* Efficient I/O tags
158  */
159 #define is_movement_collect 0
160 #define is_movement_update 1
161 #define movement_collect_p(t) ((t)==(is_movement_collect))
162 #define movement_update_p(t) ((t)==(is_movement_update))
163 
164 /* Run-time support functions and subroutine names
165  */
166 #define SND_TO_C "HPFC SNDTO C"
167 #define SND_TO_H "HPFC SNDTO H"
168 #define SND_TO_A "HPFC SNDTO A"
169 #define SND_TO_A_BY_H "HPFC HSNDTO A"
170 #define SND_TO_O "HPFC SNDTO O"
171 #define SND_TO_OS "HPFC SNDTO OS"
172 #define SND_TO_OOS "HPFC SNDTO OOS"
173 /*#define SND_TO_HA "HPFC SNDTO HA"*/
174 #define SND_TO_HA "HPFC NSNDTO HA"
175 #define SND_TO_NO "HPFC SNDTO NO"
176 #define SND_TO_HNO "HPFC SNDTO HNO"
177 
178 #define RCV_FR_S "HPFC RCVFR S"
179 #define RCV_FR_H "HPFC RCVFR H"
180 #define RCV_FR_C "HPFC RCVFR C"
181 /*#define RCV_FR_mCS "HPFC RCVFR mCS"*/
182 #define RCV_FR_mCS "HPFC RCVFR HNBCAST S"
183 #define RCV_FR_mCH "HPFC RCVFR mCH"
184 
185 #define CMP_COMPUTER "HPFC CMPCOMPUTER"
186 #define CMP_OWNERS "HPFC CMPOWNERS"
187 #define CMP_NEIGHBOUR "HPFC CMPNEIGHBOUR"
188 #define CMP_LID "HPFC CMPLID"
189 
190 #define TWIN_P "HPFC TWIN P"
191 
192 #define CND_SENDERP "HPFC SENDERP"
193 #define CND_OWNERP "HPFC OWNERP"
194 #define CND_COMPUTERP "HPFC COMPUTERP"
195 #define CND_COMPINOWNP "HPFC COMPUTERINOWNERSP"
196 
197 #define LOCAL_IND "HPFC LOCALIND"
198 #define LOCAL_IND_GAMMA "HPFC LOCALINDGAMMA"
199 #define LOCAL_IND_DELTA "HPFC LOCALINDDELTA"
200 
201 #define INIT_NODE "HPFC INIT NODE"
202 #define INIT_HOST "HPFC INIT HOST"
203 #define NODE_END "HPFC NODE END"
204 #define HOST_END "HPFC HOST END"
205 
206 #define HPFC_STOP "HPFC STOP"
207 
208 #define LOOP_BOUNDS "HPFC LOOP BOUNDS"
209 #define SYNCHRO "HPFC SYNCHRO"
210 #define IDIVIDE "HPFC DIVIDE"
211 
212 #define SND_TO_N "HPFC SNDTO N"
213 #define RCV_FR_N "HPFC RCVFR N"
214 
215 /* hpfc packing and unpacking
216  */
217 #define BUFPCK " BUFPCK"
218 #define BUFUPK " BUFUPK"
219 
220 #define BROADCAST "HPFC BROADCAST "
221 #define GUARDED_BRD "HPFC REMAPBRD "
222 
223 /* host/node communications
224  */
225 #define HPFC_HCAST "HPFC HCAST"
226 #define HPFC_NCAST "HPFC NCAST"
227 #define HPFC_sN2H "HPFC SND TO HOST"
228 #define HPFC_sH2N "HPFC SND TO NODE"
229 #define HPFC_rH2N "HPFC RCV FROM HOST"
230 #define HPFC_rN2H "HPFC RCV FROM NODE"
231 
232 /* special FCD calls.
233  */
234 #define HOST_TIMEON "HPFC HTIMEON"
235 #define NODE_TIMEON "HPFC NTIMEON"
236 #define HOST_TIMEOFF "HPFC HTIMEOFF"
237 #define NODE_TIMEOFF "HPFC NTIMEOFF"
238 #define HPFC_HTELL "HPFC HTELL"
239 #define HPFC_NTELL "HPFC NTELL"
240 
241 #define RENAME_SUFFIX "_rename"
242 
243 /********************************************************************** PVM */
244 
245 /* PVM functions that may be called by the generated code
246  */
247 #define PVM_INITSEND "pvmfinitsend"
248 #define PVM_SEND "pvmfsend"
249 #define PVM_CAST "pvmfmcast"
250 #define PVM_RECV "pvmfrecv"
251 #define PVM_PACK "pvmfpack"
252 #define PVM_UNPACK "pvmfunpack"
253 
254 /* PVM types encoding for packing and unpacking
255  */
256 #define PVM_BYTE1 "HPFC BYTE1"
257 #define PVM_INTEGER2 "HPFC INTEGER2"
258 #define PVM_INTEGER4 "HPFC INTEGER4"
259 #define PVM_REAL4 "HPFC REAL4"
260 #define PVM_REAL8 "HPFC REAL8"
261 #define PVM_COMPLEX8 "HPFC COMPLEX8"
262 #define PVM_COMPLEX16 "HPFC COMPLEX16"
263 #define PVM_STRING "HPFC STRING"
264 
265 /********************************************************* COMMON VARIABLES */
266 
267 #define MYPOS "MY POS"
268 #define MYLID "MY LID"
269 #define MSTATUS "MSTATUS" /* remapping status */
270 #define LIVEMAPPING "LIVE MAPPING"
271 #define NODETIDS "NODE TIDS"
272 #define HOST_TID "HOST TID"
273 #define NBTASKS "MAX SIZE OF PROCS"
274 #define MCASTHOST "MCAST HOST"
275 #define SEND_CHANNELS "SEND CHANNELS"
276 #define RECV_CHANNELS "RECV CHANNELS"
277 #define HOST_SND_CHAN "HOST SND CHANNEL"
278 #define HOST_RCV_CHAN "HOST RCV CHANNEL"
279 
280 /* common /hpfc_buffers/
281  */
282 #define BUFFER " BUFF"
283 #define BUFSZ " BUFF SIZE"
284 #define BUFFER_INDEX "BUF INDEX"
285 #define BUFFER_SIZE "SIZE OF BUFFER"
286 #define BUFFER_RCV_SIZE "SIZE OF RECEIVED BUFFER"
287 #define LAZY_SEND "LAZY SEND"
288 #define LAZY_RECV "LAZY RECV"
289 #define SND_NOT_INIT "SEND NOT INITIALIZED"
290 #define RCV_NOT_PRF "RECEIVED NOT PERFORMED"
291 #define BUFFER_ENCODING "BUFFER ENCODING"
292 
293 /* Variables
294  */
295 #define T_LID "T LID"
296 #define T_LIDp "T LIDp"
297 #define INFO "HPFC INFO"
298 #define BUFID "HPFC BUFID"
299 
300 /*************************************************************** PROPERTY */
301 
302 #define LAZY_MESSAGES "HPFC_LAZY_MESSAGES"
303 #define USE_BUFFERS "HPFC_USE_BUFFERS"
304 
305 /***************************************************************** MACROS */
306 
307 /* Very Short and very local functions
308  * moved to macros, FC 17/05/94
309  */
310 #define set_integer(var, i) \
311  make_assign_statement(entity_to_expression(var), int_to_expression(i))
312 
313 #define set_logical(var, b) \
314  make_assign_statement(entity_to_expression(var),\
315  make_call_expression(MakeConstant \
316  (b ? ".TRUE." : ".FALSE.", is_basic_logical), NIL))
317 
318 #define set_expression(var, e) \
319  make_assign_statement(entity_to_expression(var), e)
320 
321 #define local_index_is_different_p(array, dim) \
322  (new_declaration_tag(array, dim)!=is_hpf_newdecl_none)
323 
324 #define FindArrayDimAlignmentOfArray(array, dim) \
325  (FindAlignmentOfDim(align_alignment(load_hpf_alignment(array)), dim))
326 
327 #define FindTemplateDimAlignmentOfArray(array, dim) \
328  (FindAlignmentOfTemplateDim(align_alignment(load_hpf_alignment(array)), dim))
329 
330 #define array_to_template(array) \
331  (align_template(load_hpf_alignment(array)))
332 
333 #define template_to_processors(template) \
334  (distribute_processors(load_hpf_distribution(template)))
335 
336 #define array_to_processors(array) \
337  (template_to_processors(array_to_template(array)))
338 
339 #define hpfc_name_to_expression(s) \
340  (MakeNullaryCall(hpfc_name_to_entity(s)))
341 
342 #define condition_computerp() \
343  hpfc_name_to_expression(CND_COMPUTERP)
344 
345 #define condition_senderp() \
346  hpfc_name_to_expression(CND_SENDERP)
347 
348 #define condition_ownerp() \
349  hpfc_name_to_expression(CND_OWNERP)
350 
351 #define condition_computer_in_owners() \
352  hpfc_name_to_expression(CND_COMPINOWNP)
353 
354 #define condition_not_computer_in_owners()\
355  (MakeUnaryCall(entity_intrinsic(NOT_OPERATOR_NAME), \
356  condition_computer_in_owners()))
357 
358 #define hpfc_name_to_stmt(s) \
359  (hpfc_make_call_statement(hpfc_name_to_entity(s), NIL))
360 
361 #define st_init_host() hpfc_name_to_stmt(INIT_HOST)
362 #define st_init_node() hpfc_name_to_stmt(INIT_NODE)
363 #define st_host_end() hpfc_name_to_stmt(HOST_END)
364 #define st_node_end() hpfc_name_to_stmt(NODE_END)
365 
366 #define hpfc_name_and_ref_to_stmt(s, val) \
367  st_call_send_or_receive(hpfc_name_to_entity(s), val)
368 
369 /* SND */
370 
371 #define st_send_to_computer(val) \
372  hpfc_name_and_ref_to_stmt(SND_TO_C, val)
373 
374 #define st_send_to_host(val) \
375  hpfc_name_and_ref_to_stmt(SND_TO_H, val)
376 
377 #define st_send_to_all_nodes(val) \
378  hpfc_name_and_ref_to_stmt(SND_TO_A, val)
379 
380 #define st_host_send_to_all_nodes(val) \
381  hpfc_name_and_ref_to_stmt(SND_TO_A_BY_H, val)
382 
383 #define st_send_to_neighbour() \
384  hpfc_make_call_statement(hpfc_name_to_entity(SND_TO_N), NIL)
385 
386 #define st_send_to_owner(val) \
387  hpfc_name_and_ref_to_stmt(SND_TO_O, val)
388 
389 #define st_send_to_owners(val) \
390  hpfc_name_and_ref_to_stmt(SND_TO_OS, val)
391 
392 #define st_send_to_other_owners(val) \
393  hpfc_name_and_ref_to_stmt(SND_TO_OOS, val)
394 
395 #define st_send_to_host_and_all_nodes(val) \
396  hpfc_name_and_ref_to_stmt(SND_TO_HA, val)
397 
398 #define st_send_to_not_owners(val) \
399  hpfc_name_and_ref_to_stmt(SND_TO_NO, val)
400 
401 #define st_send_to_host_and_not_owners(val) \
402  hpfc_name_and_ref_to_stmt(SND_TO_HNO, val)
403 
404 
405 /* RCV */
406 
407 #define st_receive_from_neighbour() \
408  hpfc_make_call_statement(hpfc_name_to_entity(RCV_FR_N), NIL)
409 
410 #define st_receive_from_sender(goal) \
411  hpfc_name_and_ref_to_stmt(RCV_FR_S, goal)
412 
413 #define st_receive_from_host(goal) \
414  hpfc_name_and_ref_to_stmt(RCV_FR_H, goal)
415 
416 #define st_receive_from_computer(goal) \
417  hpfc_name_and_ref_to_stmt(RCV_FR_C, goal)
418 
419 #define st_receive_mcast_from_sender(goal) \
420  hpfc_name_and_ref_to_stmt(RCV_FR_mCS, goal)
421 
422 #define st_receive_mcast_from_host(goal) \
423  hpfc_name_and_ref_to_stmt(RCV_FR_mCH, goal)
424 
425 
426 #define primary_entity_p(a) (a==load_primary_entity(a))
427 
428 /* WARNING
429  */
430 #define hpfc_warning \
431  if (!get_bool_property("HPFC_NO_WARNING")) pips_user_warning
432 
433 /* fake resources...
434  */
435 #define NO_FILE (strdup(""))
436 
437 /* File suffixes
438  */
439 
440 #define HOST_SUFFIX "_host.f"
441 #define NODE_SUFFIX "_node.f"
442 #define HINC_SUFFIX "_host.h"
443 #define NINC_SUFFIX "_node.h"
444 #define BOTH_SUFFIX "_both.f"
445 #define PARM_SUFFIX "_parameters.h"
446 #define INIT_SUFFIX "_init.h"
447 
448 /* that is all
449  */
bdt base
Current expression.
Definition: bdt_read_paf.c:100
void fprint_entity_list(FILE *fp, list l)
void fprint_entity_list(FILE *fp,list l): prints a list of entities on file fp.
Definition: entity.c:3188
list base_to_list(Pbase base)
Most includes are centralized here.
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