PIPS
hpfc-util.c
Go to the documentation of this file.
1 /*
2 
3  $Id: hpfc-util.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 /* this file describe a few functions usefull to the compiler
28  * to manage the hpfc data structures.
29  *
30  * Fabien Coelho, May 1993.
31  */
32 
33 #include "defines-local.h"
34 #include "prettyprint.h" // for print_expression
35 #include "effects.h"
36 #include "effects-util.h"
37 #include "effects-generic.h"
38 #include "effects-simple.h"
39 
40 /* Predicates
41  */
42 
43 /* true if there is a reference to a distributed array within obj
44  *
45  * ??? not very intelligent, should use the regions, the problem is
46  * that I should normalize the code *before* the pips analysis...
47  */
48 bool ref_to_dist_array_p(void * obj)
49 {
50  list l = FindRefToDistArray(obj);
51  bool b = (l!=NIL);
52 
53  gen_free_list(l); return(b);
54 }
55 
56 /* written_effects_to_dist_arrays_p
57  */
59  list le)
60 {
61  FOREACH(EFFECT, e, le)
62  {
63  if(store_effect_p(e)) {
66  return true;
67  }
68  }
69 
70  return false;
71 }
72 
74 {
75  list l, leffects_to_dist_arrays = DistArraysEffects(expr);
76 
77  // FI: looks like a FOREACH to me...
78  for(l=leffects_to_dist_arrays; !ENDP(l); POP(l))
79  if(store_effect_p(EFFECT(CAR(l)))) {
81  {
82  gen_free_list(leffects_to_dist_arrays);
83  return true;
84  }
85  }
86 
87  gen_free_list(leffects_to_dist_arrays);
88  return false;
89 }
90 
91 /* replicated_p
92  *
93  * check whether the distributed array e
94  * is replicated or not.
95  */
97 {
98  int i, ntdim;
99  align a;
100  list la, ld;
101  entity template;
102  distribute d;
103 
104  pips_assert("distributed array", array_distributed_p(e));
105 
106  a = load_hpf_alignment(e);
107  la = align_alignment(a);
108  template = align_template(a);
109  d = load_hpf_distribution(template);
110  ld = distribute_distribution(d);
111  ntdim = NumberOfDimension(template);
112 
113  for(i=1; i<=ntdim; i++, POP(ld))
114  if (ith_dim_replicated_p(template, i, la, DISTRIBUTION(CAR(ld))))
115  return true;
116 
117  return false;
118 }
119 
120 /* bool ith_dim_replicated_p(template, i, la, dist)
121  *
122  * true if template dimension i distributed with dist leads to
123  * a replication for array align al.
124  */
126  _UNUSED_ entity template,
127  int i,
128  list la,
129  distribution dist)
130 {
131  if (style_none_p(distribution_style(dist))) return false;
132 
133  /* select the relevent alignment if exists.
134  * could be some kind of gen_find_if()...
135  */
136  MAP(ALIGNMENT, a, if (alignment_templatedim(a)==i) return false, la);
137 
138  return true;
139 }
140 
141 /* true if array a is replicated on processors p i-th dimension.
142  */
144 {
145  int tdim;
146  align al = load_hpf_alignment(a);
147  entity t = align_template(al);
149  distribution di =
151  alignment ali =
153 
154  return(!style_none_p(distribution_style(di)) &&
155  alignment_undefined_p(ali));
156 }
157 
158 /* whether a dimension is distributed or not.
159  */
160 bool ith_dim_distributed_p(array, i, pprocdim)
161 entity array;
162 int i, *pprocdim;
163 {
165  list lal = align_alignment(al);
166  alignment alt = FindAlignmentOfDim(lal, i);
167  entity template = align_template(al);
168  distribute dis = load_hpf_distribution(template);
169  list ld = distribute_distribution(dis);
170  distribution d;
171 
172  if (alignment_undefined_p(alt)) return(false);
173  d = FindDistributionOfDim(ld, alignment_templatedim(alt), pprocdim);
174  return(!style_none_p(distribution_style(d)));
175 }
176 
177 bool
179  entity array,
180  int i)
181 {
183  list lal = align_alignment(al);
184  alignment alt = FindAlignmentOfDim(lal, i);
185  entity template = align_template(al);
186  distribute dis = load_hpf_distribution(template);
187  list ld = distribute_distribution(dis);
188  distribution d;
189  int p;
190 
191  if (alignment_undefined_p(alt)) return false;
193 
195 }
196 
197 
198 /* creates a new statement for the given module
199  * that looks like the stat one, i.e. same comment, same
200  * label, and so on. The goto table is updated. The instruction
201  * is also created. (is that really a good idea?)
202  */
204 statement stat;
205 int the_tag;
206 {
207  void* x = loop_undefined;
208  string c = statement_comments(stat);
209  statement new_s;
210 
211  if (the_tag==is_instruction_sequence)
212  x = make_sequence(NIL);
213 
214 
215  new_s = make_statement(statement_label(stat),
218  string_undefined_p(c)? c: strdup(c),
219  make_instruction(the_tag, x),NIL,NULL,
222  return new_s;
223 }
224 
225 static void stmt_rwt(s)
226 statement s;
227 {
230 }
231 
233 statement s;
234 {
236 }
237 
238 /* effects' action in an expression are here supposed to be read one's
239  * but that may not be correct?
240  */
242 expression expr;
243 {
244  list le = proper_effects_of_expression(expr), lde = NIL;
245 
246  FOREACH(EFFECT, e, le) {
247  if(store_effect_p(e)) {
249  lde=CONS(EFFECT,e,lde);
250  }
251  }
252 
253  gen_free_list(le);
254  return(lde);
255 }
256 
257 /* FindRefToDistArrayFromList
258  *
259  * these functions compute the list of syntax that are
260  * references to a distributed variable.
261  */
263 list lexpr;
264 {
265  list l=NIL;
266  MAP(EXPRESSION, e,{l=gen_nconc(FindRefToDistArray(e),l);},lexpr);
267  return(l);
268 }
269 
271 
273 syntax s;
274 {
275  if (syntax_reference_p(s))
278  found_syntaxes =
280 }
281 
283 {
284  list result = NIL, saved = found_syntaxes;
286  gen_multi_recurse(obj,
288  gen_true,
290 
291  result = found_syntaxes, found_syntaxes = saved;
292 
293  return result;
294 }
295 
296 /* AddEntityToHostAndNodeModules
297  */
299 entity e;
300 {
301  entity new_node = AddEntityToModule(e, node_module),
302  new_host = entity_undefined;
303 
304  if (!bound_new_node_p(e))
305  store_new_node_variable(new_node, e);
306  else
308 
309  if (!array_distributed_p(e))
310  {
311  new_host = AddEntityToModule(e, host_module);
312 
313  if (!bound_new_host_p(e))
314  store_new_host_variable(new_host, e),
315  /*
316  * added because of some entity errors.
317  */
318  store_new_host(new_node, new_host),
319  store_new_node(new_host, new_node);
320  else
322  }
323 }
324 
325 /* The common name is changed to distinguish the current, host and
326  * node instances of the common.
327  */
328 void AddCommonToModule(common, module, update, suffix)
329 entity common, module;
330 void (*update)();
331 string suffix;
332 {
333  string name = strdup(concatenate(entity_local_name(common),
334  "_", suffix, NULL));
335  entity new_common =
337  list
338  lref = area_layout(type_area(entity_type(common))),
339  lold = area_layout(type_area(entity_type(new_common))),
340  lnew = NIL;
341 
342  free(name);
343  update(new_common, common);
344 
345  /* The layout list must be updated to the right entities
346  */
347 
348  MAP(ENTITY, e,
349  {
350  entity new_e;
351 
352  if (local_entity_of_module_p(e, common)) /* !!! not in current */
353  {
354  new_e = AddEntityToModule(e, new_common);
355 
356  if (gen_find_eq(new_e, lold)==entity_undefined)
357  {
358  lnew = CONS(ENTITY, new_e, lnew);
359  update(new_e, e);
360  }
361  }
362  },
363  lref);
364 
365  AddEntityToDeclarations(new_common, module);
366 
367  area_layout(type_area(entity_type(new_common))) =
368  gen_nconc(gen_nreverse(lnew), lold);
369 }
370 
372 {
375 }
376 
378 list lal;
379 int dim;
380 {
381  list l=lal;
382 
383  while ((!ENDP(l)) && (alignment_arraydim(ALIGNMENT(CAR(l))) != dim))
384  POP(l);
385 
386  return (l==NIL) ? alignment_undefined : ALIGNMENT(CAR(l));
387 }
388 
390 list lal;
391 int dim;
392 {
393  list l=lal;
394 
395  while ((!ENDP(l)) && (alignment_templatedim(ALIGNMENT(CAR(l))) != dim))
396  POP(l);
397 
398  return ((l==NULL)?(alignment_undefined):(ALIGNMENT(CAR(l))));
399 }
400 
402 list ldi;
403 int dim, *pdim;
404 {
405  list l = ldi;
406  int i, procdim = 1;
407 
408  pips_assert("valid dimension", dim>=1 && dim<=(int)gen_length(ldi));
409 
410  for (i=1; i<dim; i++)
411  {
413  procdim++;
414  POP(l);
415  }
416 
417  (*pdim) = procdim;
418  return(DISTRIBUTION(CAR(l)));
419 }
420 
422 list ldi;
423 int dim, *tdim;
424 {
425  int i = 1, procdim = 0;
426 
427  MAP(DISTRIBUTION, d,
428  {
430  procdim++;
431 
432  if (procdim==dim)
433  {
434  (*tdim) = i;
435  return(d);
436  }
437 
438  i++;
439  },
440  ldi);
441 
442  pips_internal_error("dimension %d not found", dim);
443 
444  return(distribution_undefined);
445 }
446 
447 int
449  entity array,
450  int dim)
451 {
452  align a;
453  alignment al;
454 
456  al = FindAlignmentOfDim(align_alignment(a), dim);
457 
458  return (al==alignment_undefined) ? -1 : alignment_templatedim(al);
459 }
460 
461 int
463  entity template,
464  int dim)
465 {
466  int pdim = 0, n;
467  if (dim>=0) get_distribution(template, dim, &pdim, &n);
468  return pdim;
469 }
470 
471 int
473  entity array,
474  int dim,
475  int *pprocdim)
476 {
477  entity template = array_to_template(array);
478  distribute d = load_hpf_distribution(template);
483  pprocdim);
484 
486 }
487 
488 /* int processor_number(template, tdim, tcell, pprocdim)
489  *
490  * the processor number of a template cell, on dimension *pprocdim
491  */
492 int processor_number(template, tdim, tcell, pprocdim)
493 entity template;
494 int tdim, tcell, *pprocdim; /* template dimension, template cell */
495 {
496  distribute d = load_hpf_distribution(template);
498  entity procs = distribute_processors(d);
499  distribution di = FindDistributionOfDim(ld, tdim, pprocdim);
500  style st = distribution_style(di);
501  int n, tmin, pmin, psiz;
502 
503  if (style_none_p(st))
504  {
505  *pprocdim = -1;
506  return -1;
507  }
508 
509  tmin = HpfcExpressionToInt
510  (dimension_lower(FindIthDimension(template, tdim)));
511  pmin = HpfcExpressionToInt
512  (dimension_lower(FindIthDimension(procs, *pprocdim)));
513  psiz = SizeOfIthDimension(procs, *pprocdim);
515 
516  if (style_block_p(st))
517  return ((tcell-tmin)/n)+pmin;
518 
519  if (style_cyclic_p(st))
520  return (((tcell-tmin)/n)%psiz)+pmin;
521 
522  *pprocdim = -1; /* just to avoid a gcc warning */
523  return -1;
524 }
525 
526 
527 /* int template_cell_local_mapping(array, dim, tc)
528  *
529  * ??? should check that it is indeed block distributed !
530  * or should implement all the formulas...
531  */
533 entity array;
534 int dim, tc;
535 {
537  int p, tmin, n = DistributionParameterOfArrayDim(array, dim, &p);
540 
542 
543  return (tc-tmin)%n+1;
544 }
545 
546 /* int global_array_cell_to_local_array_cell(array, dim, acell)
547  *
548  * ??? not enough general a function
549  */
551 entity array;
552 int dim, acell;
553 {
555  int rate, constant;
556 
557  pips_assert("aligned", a!=alignment_undefined);
558 
561 
562  return template_cell_local_mapping(array, dim, rate*acell+constant);
563 }
564 
565 /* HpfcExpressionToInt(e)
566  *
567  * uses the normalized value if possible.
568  */
570 expression e;
571 {
573  intptr_t val = 0;
574 
576 
577  if ((n!=normalized_undefined) && (normalized_linear_p(n)))
578  {
580  int s = vect_size(v), val;
581  Value vval = vect_coeff(TCST, v);
582 
583  val = VALUE_TO_INT(vval);
584  if (s==0) return 0;
585  if ((s==1) && (val!=0)) return val;
586  }
587 
588  /*
589  if (expression_integer_constant_p(e))
590  return ExpressionToInt(e);
591  */
592  if(expression_integer_value(e, &val))
593  return val;
594  else
595  pips_internal_error("can't return anything, sorry");
596 
597  return -1; /* just to avoid a gcc warning */
598 }
599 
600 /* -------------------------------------------------------
601  *
602  * a nicer interface to extract the needed information. FC 29/03/94
603  *
604  */
605 
606 void get_alignment(array, dim, ptdim, pa, pb)
607 entity array;
608 int dim, *ptdim, *pa, *pb;
609 {
611  alignment a;
612 
613  pips_assert("distributed array", array_distributed_p(array));
614 
616 
617  if (*ptdim==-1) /* replication */
618  {
619  *pa=0, *pb=0;
620  return;
621  }
622 
624 
625  if (a==alignment_undefined)
626  {
627  pips_assert("not aligned", *ptdim==0);
628  *pa = 0; *pb = 0;
629  }
630  else
631  {
632  pips_assert("aligned", *ptdim>=1);
635  }
636 }
637 
638 void get_distribution(template, dim, ppdim, pn)
639 entity template;
640 int dim, *ppdim, *pn;
641 {
645  dim, ppdim);
646 
647  *pn = (distribution_undefined_p(d) ?
649 }
650 
651 void get_entity_dimensions(e, dim, plow, pup)
652 entity e;
653 int dim, *plow, *pup;
654 {
656 
657  pips_assert("valid variable and dimension",
658  entity_variable_p(e) && dim>0 && dim<=7);
659 
660  d = entity_ith_dimension(e, dim),
661  *plow = ExpressionToInt(dimension_lower(d)),
662  *pup = ExpressionToInt(dimension_upper(d));
663 }
664 
665 /* bool alignments_compatible_p(entity e1, int dim1,
666  * entity e2, int dim2)
667  *
668  * what: whether e1 and e2 dimensions dim1 and dim2 are aligned.
669  * how: basic low level comparison
670  * input: entities and dimension numbers
671  * output: the bool result
672  * side effects:
673  * - uses alignment internal descriptions
674  * bugs or features:
675  * - ??? should be relative to a reference, instead of assuming mere indexes
676  */
677 bool
679  entity e2, int dim2)
680 {
681  int tdim1, rate1, shift1, tdim2, rate2, shift2;
682 
683  get_alignment(e1, dim1, &tdim1, &rate1, &shift1);
684  get_alignment(e2, dim2, &tdim2, &rate2, &shift2);
685 
686  if (tdim1!=tdim2) return false;
687  if (!tdim1 && !tdim2) return true;
688 
689  return rate1==rate2 && shift1==shift2;
690 }
691 
692 /* bool references_aligned_p(reference r1, reference r2)
693  *
694  * what: tells whether the references are aligned or not
695  * how: quite basic and low level
696  * input: both references
697  * output: the returned boolean
698  * side effects:
699  * - uses alignment internal descriptions
700  * bugs or features:
701  * - assumes that both references are in the same store.
702  * - ??? indices must be simple references to indexes.
703  */
704 /* returns 0 if not found */
705 static int
706 expression_number_for_index(entity index, list /* of expression */ le)
707 {
708  int dim=1;
709 
710  MAP(EXPRESSION, e,
711  {
712  if (expression_reference_p(e) &&
714  return dim;
715  dim++;
716  },
717  le);
718 
719  return 0;
720 }
721 
722 #define XDEBUG(msg) \
723  pips_debug(6, "%s and %s: " msg "\n", entity_name(e1), entity_name(e2))
724 
725 bool
727 {
728  entity e1 = reference_variable(r1),
729  e2 = reference_variable(r2);
730  list /* of expression */ le1 = reference_indices(r1),
731  le2 = reference_indices(r2);
732  int dim1 = 1, dim2;
733  entity index;
734  align a1, a2;
735 
736  if (!array_distributed_p(e1) || !array_distributed_p(e2))
737  {
738  XDEBUG("not distributed"); return false;
739  }
740 
741  a1 = load_hpf_alignment(e1);
742  a2 = load_hpf_alignment(e2);
743 
744  /* both references must be aligned to the same template
745  * and be of the same arity.
746  */
747  if (align_template(a1)!=align_template(a2))
748  {
749  XDEBUG("template is different"); return false;
750  }
751 
752  if (gen_length(le1)!=gen_length(le2))
753  {
754  XDEBUG("arities are different"); return false;
755  }
756 
757  MAP(EXPRESSION, ind,
758  {
759  if (!expression_reference_p(ind))
760  return false;
761 
763  dim2 = expression_number_for_index(index, le2);
764 
765  if (!alignments_compatible_p(e1, dim1, e2, dim2))
766  {
767  XDEBUG("alignments are incompatible"); return false;
768  }
769 
770  dim1++;
771  },
772  le1);
773 
774  XDEBUG("aligned!"); return true;
775 }
776 
777 /*************************************************** IR STRUCTURAL cleaning */
778 
779 /* removes IF (.TRUE.) THEN
780  * and DO X=n, n
781  */
782 
784 
786 {
787  error_reset_current_stmt_stack();
788 }
789 
790 static void test_rewrite(test t)
791 {
793 
794  if (ENTITY_TRUE_P(e))
795  {
797  /* instruction i = statement_instruction(s); */
798  pips_debug(5, "true test simplified\n");
799 
801  /* Fix attributes if it is a sequence: */
803 
805  /* free_instruction(i); */ /* ??? */
806  }
807  else if (ENTITY_FALSE_P(e))
808  {
810  /* instruction i = statement_instruction(s); */
811  pips_debug(5, "false test simplified\n");
812 
814  /* Fix attributes if it is a sequence: */
816 
818  /* free_instruction(i); */ /* ??? */
819  }
820 }
821 
822 static void loop_rewrite(loop l)
823 {
824  range r = loop_range(l);
826  {
828  /* instruction i = statement_instruction(s); */
829  pips_debug(5, "loop on %s simplified\n", entity_name(loop_index(l)));
830 
836  CONS(STATEMENT, loop_body(l), NIL)));
837  /* Do not forget to move forbidden information associated with
838  block: */
840 
842  /* free_instruction(i); */ /* ??? memory leak, cores on AIX */
843  }
844 }
845 
846 void
848 {
849  make_current_stmt_stack();
850 
852  statement_domain, current_stmt_filter, current_stmt_rewrite,
855  NULL);
856 
857  free_current_stmt_stack();
858 }
859 
860 /* that is all
861  */
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
Definition: ri.c:2222
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
synchronization make_synchronization_none(void)
Definition: ri.c:2424
sequence make_sequence(list a)
Definition: ri.c:2125
extensions copy_extensions(extensions p)
EXTENSIONS.
Definition: ri.c:947
#define VALUE_TO_INT(val)
int Value
entity host_module
HPFC - Fabien Coelho, May 1993 and later...
Definition: compiler.c:47
entity node_module
Definition: compiler.c:47
static statement current_stmt
list proper_effects_of_expression(expression)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
bool store_effect_p(effect)
Definition: effects.c:1062
#define effect_action(x)
Definition: effects.h:642
#define action_write_p(x)
Definition: effects.h:314
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
void free(void *)
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
Definition: genClib.c:3428
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
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
void * gen_find_eq(const void *item, const list seq)
Definition: list.c:422
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
statement make_assign_statement(expression, expression)
Definition: statement.c:583
void fix_statement_attributes_if_sequence(statement)
Apply fix_sequence_statement_attributes() on the statement only if it really a sequence.
Definition: statement.c:2078
void fix_sequence_statement_attributes(statement)
Since blocks are not represented in Fortran, they cannot carry a label.
Definition: statement.c:2016
void store_new_node_variable(entity new, entity old)
void store_new_host_variable(entity new, entity old)
#define style_none_p(x)
Definition: hpf.h:259
#define alignment_templatedim(x)
Definition: hpf.h:136
#define alignment_undefined
Definition: hpf.h:108
#define DISTRIBUTION(x)
DISTRIBUTION.
Definition: hpf.h:180
#define distribution_style(x)
Definition: hpf.h:210
#define alignment_constant(x)
Definition: hpf.h:140
#define align_template(x)
Definition: hpf.h:98
#define align_alignment(x)
Definition: hpf.h:96
#define distribute_distribution(x)
Definition: hpf.h:174
#define ALIGNMENT(x)
ALIGNMENT.
Definition: hpf.h:102
#define alignment_rate(x)
Definition: hpf.h:138
#define alignment_undefined_p(x)
Definition: hpf.h:109
#define alignment_arraydim(x)
Definition: hpf.h:134
#define distribute_processors(x)
Definition: hpf.h:176
#define distribution_parameter(x)
Definition: hpf.h:212
#define style_block_p(x)
Definition: hpf.h:262
#define style_cyclic_p(x)
Definition: hpf.h:265
#define distribution_undefined_p(x)
Definition: hpf.h:187
#define distribution_undefined
Definition: hpf.h:186
#define HPFC_PACKAGE
local definitions
Definition: hpfc-local.h:27
void kill_statement_number_and_ordering(statement s)
Definition: hpfc-util.c:232
void AddCommonToModule(entity common, entity module, void(*update)(), string suffix)
The common name is changed to distinguish the current, host and node instances of the common.
Definition: hpfc-util.c:328
static list found_syntaxes
Definition: hpfc-util.c:270
void AddEntityToHostAndNodeModules(entity e)
AddEntityToHostAndNodeModules.
Definition: hpfc-util.c:298
int template_cell_local_mapping(entity array, int dim, int tc)
int template_cell_local_mapping(array, dim, tc)
Definition: hpfc-util.c:532
int DistributionParameterOfArrayDim(entity array, int dim, int *pprocdim)
Definition: hpfc-util.c:472
int processor_dimension_of_template_dimension(entity template, int dim)
Definition: hpfc-util.c:462
void get_entity_dimensions(entity e, int dim, int *plow, int *pup)
Definition: hpfc-util.c:651
void get_alignment(entity array, int dim, int *ptdim, int *pa, int *pb)
Definition: hpfc-util.c:606
static void loop_rewrite(loop l)
Definition: hpfc-util.c:822
void hpfc_util_error_handler()
removes IF (.TRUE.) THEN and DO X=n, n
Definition: hpfc-util.c:785
void AddCommonToHostAndNodeModules(entity common)
Definition: hpfc-util.c:371
#define XDEBUG(msg)
Definition: hpfc-util.c:722
list FindRefToDistArrayFromList(list lexpr)
FindRefToDistArrayFromList.
Definition: hpfc-util.c:262
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
Definition: hpfc-util.c:569
bool ith_dim_replicated_p(_UNUSED_ entity template, int i, list la, distribution dist)
bool ith_dim_replicated_p(template, i, la, dist)
Definition: hpfc-util.c:125
bool written_effects_to_dist_arrays_p(expression expr)
Definition: hpfc-util.c:73
statement MakeStatementLike(statement stat, int the_tag)
creates a new statement for the given module that looks like the stat one, i.e.
Definition: hpfc-util.c:203
distribution FindDistributionOfProcessorDim(list ldi, int dim, int *tdim)
Definition: hpfc-util.c:421
bool ith_dim_distributed_p(entity array, int i, int *pprocdim)
whether a dimension is distributed or not.
Definition: hpfc-util.c:160
bool alignments_compatible_p(entity e1, int dim1, entity e2, int dim2)
bool alignments_compatible_p(entity e1, int dim1, entity e2, int dim2)
Definition: hpfc-util.c:678
static int expression_number_for_index(entity index, list le)
bool references_aligned_p(reference r1, reference r2)
Definition: hpfc-util.c:706
void get_distribution(entity template, int dim, int *ppdim, int *pn)
Definition: hpfc-util.c:638
bool replicated_p(entity e)
replicated_p
Definition: hpfc-util.c:96
static void FindRefToDistArray_syntax_rewrite(syntax s)
Definition: hpfc-util.c:272
static void stmt_rwt(statement s)
Definition: hpfc-util.c:225
alignment FindAlignmentOfTemplateDim(list lal, int dim)
Definition: hpfc-util.c:389
void statement_structural_cleaning(statement s)
Definition: hpfc-util.c:847
list FindRefToDistArray(void *obj)
Definition: hpfc-util.c:282
int processor_number(entity template, int tdim, int tcell, int *pprocdim)
int processor_number(template, tdim, tcell, pprocdim)
Definition: hpfc-util.c:492
alignment FindAlignmentOfDim(list lal, int dim)
Definition: hpfc-util.c:377
bool ref_to_dist_array_p(void *obj)
this file describe a few functions usefull to the compiler to manage the hpfc data structures.
Definition: hpfc-util.c:48
bool references_aligned_p(reference r1, reference r2)
Definition: hpfc-util.c:726
distribution FindDistributionOfDim(list ldi, int dim, int *pdim)
Definition: hpfc-util.c:401
int global_array_cell_to_local_array_cell(entity array, int dim, int acell)
int global_array_cell_to_local_array_cell(array, dim, acell)
Definition: hpfc-util.c:550
list DistArraysEffects(expression expr)
effects' action in an expression are here supposed to be read one's but that may not be correct?
Definition: hpfc-util.c:241
static void test_rewrite(test t)
Definition: hpfc-util.c:790
bool ith_dim_overlapable_p(entity array, int i)
Definition: hpfc-util.c:178
bool processors_dim_replicated_p(_UNUSED_ entity p, entity a, int i)
true if array a is replicated on processors p i-th dimension.
Definition: hpfc-util.c:143
bool written_effect_p(entity var, list le)
written_effects_to_dist_arrays_p
Definition: hpfc-util.c:58
int template_dimension_of_array_dimension(entity array, int dim)
Definition: hpfc-util.c:448
#define FindArrayDimAlignmentOfArray(array, dim)
#define array_to_template(array)
#define NODE_NAME
#define HOST_NAME
Constants.
bool bound_new_host_p(entity)
entity load_new_node(entity)
distribute load_hpf_distribution(entity)
void store_new_node(entity, entity)
bool bound_new_node_p(entity)
align load_hpf_alignment(entity)
entity load_new_host(entity)
void store_new_host(entity, entity)
bool array_distributed_p(entity)
#define current_stmt_head()
We want to keep track of the current statement inside the recurse.
Definition: icfg_scan.c:76
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
#define _UNUSED_
Definition: misc-local.h:232
#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
#define pips_internal_error
Definition: misc-local.h:149
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define DEFINE_LOCAL_STACK(name, type)
#define string_undefined_p(s)
Definition: newgen_types.h:41
struct _newgen_struct_constant_ * constant
static char * module
Definition: pips.c:74
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
static int tc
Internal variables
Definition: reindexing.c:107
#define ENTITY_TRUE_P(e)
#define STATEMENT_NUMBER_UNDEFINED
default values
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#define ENTITY_FALSE_P(e)
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
bool local_entity_of_module_p(entity e, entity module)
This test shows that "e" has been declared in "module".
Definition: entity.c:1069
entity AddEntityToModule(entity e, entity module)
!!! caution, it may not be a module, but a common...
Definition: entity.c:3171
entity FindOrCreateEntityLikeModel(const char *package, const char *name, entity model)
hmmm...
Definition: entity.c:3136
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
Definition: expression.c:1347
bool expression_reference_p(expression e)
Test if an expression is a reference.
Definition: expression.c:528
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
Definition: expression.c:3140
dimension entity_ith_dimension(entity, int)
Another semantics would be: is this reference r to e a kill for e? In general, this cannot be answere...
Definition: variable.c:1228
dimension FindIthDimension(entity, int)
Definition: type.c:1180
int ExpressionToInt(expression)
this function computes the value of an integer constant expression and returns it to the calling func...
Definition: size.c:562
void AddEntityToDeclarations(entity, entity)
END_EOLE.
Definition: variable.c:108
int SizeOfIthDimension(entity, int)
this function returns the size of the ith dimension of a variable e.
Definition: size.c:453
int NumberOfDimension(entity)
Definition: size.c:588
#define loop_body(x)
Definition: ri.h:1644
#define test_domain
newgen_entity_domain_defined
Definition: ri.h:418
#define normalized_undefined
Definition: ri.h:1745
#define syntax_reference_p(x)
Definition: ri.h:2728
#define loop_undefined
Definition: ri.h:1612
#define syntax_reference(x)
Definition: ri.h:2730
#define normalized_linear_p(x)
Definition: ri.h:1779
#define reference_variable(x)
Definition: ri.h:2326
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define range_upper(x)
Definition: ri.h:2290
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define statement_ordering(x)
Definition: ri.h:2454
#define test_false(x)
Definition: ri.h:2837
#define dimension_lower(x)
Definition: ri.h:980
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define instruction_undefined
Definition: ri.h:1454
#define statement_label(x)
Definition: ri.h:2450
#define entity_undefined
Definition: ri.h:2761
@ is_instruction_sequence
Definition: ri.h:1469
#define entity_name(x)
Definition: ri.h:2790
#define area_layout(x)
Definition: ri.h:546
#define expression_normalized(x)
Definition: ri.h:1249
#define test_true(x)
Definition: ri.h:2835
#define dimension_upper(x)
Definition: ri.h:982
#define reference_indices(x)
Definition: ri.h:2328
#define statement_extensions(x)
Definition: ri.h:2464
#define dimension_undefined
Definition: ri.h:955
#define type_area(x)
Definition: ri.h:2946
#define test_condition(x)
Definition: ri.h:2833
#define range_lower(x)
Definition: ri.h:2288
#define statement_instruction(x)
Definition: ri.h:2458
#define statement_comments(x)
Definition: ri.h:2456
#define loop_range(x)
Definition: ri.h:1642
#define entity_type(x)
Definition: ri.h:2792
#define statement_number(x)
Definition: ri.h:2452
#define normalized_linear(x)
Definition: ri.h:1781
#define expression_syntax(x)
Definition: ri.h:1247
#define loop_index(x)
Definition: ri.h:1640
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
#define syntax_domain
newgen_synchronization_domain_defined
Definition: ri.h:402
#define SYNTAX(x)
SYNTAX.
Definition: ri.h:2670
char * strdup()
#define ifdebug(n)
Definition: sg.c:47
static entity array
static char * x
Definition: split_file.c:159
#define intptr_t
Definition: stdint.in.h:294
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 TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228