PIPS
hpfc-util.c File Reference
#include "defines-local.h"
#include "prettyprint.h"
#include "effects.h"
#include "effects-util.h"
#include "effects-generic.h"
#include "effects-simple.h"
+ Include dependency graph for hpfc-util.c:

Go to the source code of this file.

Macros

#define XDEBUG(msg)    pips_debug(6, "%s and %s: " msg "\n", entity_name(e1), entity_name(e2))
 

Functions

bool ref_to_dist_array_p (void *obj)
 this file describe a few functions usefull to the compiler to manage the hpfc data structures. More...
 
bool written_effect_p (entity var, list le)
 written_effects_to_dist_arrays_p More...
 
bool written_effects_to_dist_arrays_p (expression expr)
 
bool replicated_p (entity e)
 replicated_p More...
 
bool ith_dim_replicated_p (_UNUSED_ entity template, int i, list la, distribution dist)
 bool ith_dim_replicated_p(template, i, la, dist) More...
 
bool processors_dim_replicated_p (_UNUSED_ entity p, entity a, int i)
 true if array a is replicated on processors p i-th dimension. More...
 
bool ith_dim_distributed_p (entity array, int i, int *pprocdim)
 whether a dimension is distributed or not. More...
 
bool ith_dim_overlapable_p (entity array, int i)
 
statement MakeStatementLike (statement stat, int the_tag)
 creates a new statement for the given module that looks like the stat one, i.e. More...
 
static void stmt_rwt (statement s)
 
void kill_statement_number_and_ordering (statement s)
 
list DistArraysEffects (expression expr)
 effects' action in an expression are here supposed to be read one's but that may not be correct? More...
 
list FindRefToDistArrayFromList (list lexpr)
 FindRefToDistArrayFromList. More...
 
static void FindRefToDistArray_syntax_rewrite (syntax s)
 
list FindRefToDistArray (void *obj)
 
void AddEntityToHostAndNodeModules (entity e)
 AddEntityToHostAndNodeModules. More...
 
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. More...
 
void AddCommonToHostAndNodeModules (entity common)
 
alignment FindAlignmentOfDim (list lal, int dim)
 
alignment FindAlignmentOfTemplateDim (list lal, int dim)
 
distribution FindDistributionOfDim (list ldi, int dim, int *pdim)
 
distribution FindDistributionOfProcessorDim (list ldi, int dim, int *tdim)
 
int template_dimension_of_array_dimension (entity array, int dim)
 
int processor_dimension_of_template_dimension (entity template, int dim)
 
int DistributionParameterOfArrayDim (entity array, int dim, int *pprocdim)
 
int processor_number (entity template, int tdim, int tcell, int *pprocdim)
 int processor_number(template, tdim, tcell, pprocdim) More...
 
int template_cell_local_mapping (entity array, int dim, int tc)
 int template_cell_local_mapping(array, dim, tc) More...
 
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) More...
 
int HpfcExpressionToInt (expression e)
 HpfcExpressionToInt(e) More...
 
void get_alignment (entity array, int dim, int *ptdim, int *pa, int *pb)
 
void get_distribution (entity template, int dim, int *ppdim, int *pn)
 
void get_entity_dimensions (entity e, int dim, int *plow, int *pup)
 
bool alignments_compatible_p (entity e1, int dim1, entity e2, int dim2)
 bool alignments_compatible_p(entity e1, int dim1, entity e2, int dim2) More...
 
static int expression_number_for_index (entity index, list le)
 bool references_aligned_p(reference r1, reference r2) More...
 
bool references_aligned_p (reference r1, reference r2)
 
void hpfc_util_error_handler ()
 removes IF (.TRUE.) THEN and DO X=n, n More...
 
static void test_rewrite (test t)
 
static void loop_rewrite (loop l)
 
void statement_structural_cleaning (statement s)
 

Variables

static list found_syntaxes = NIL
 

Macro Definition Documentation

◆ XDEBUG

#define XDEBUG (   msg)     pips_debug(6, "%s and %s: " msg "\n", entity_name(e1), entity_name(e2))

Definition at line 722 of file hpfc-util.c.

Function Documentation

◆ AddCommonToHostAndNodeModules()

void AddCommonToHostAndNodeModules ( entity  common)
Parameters
commonommon

Definition at line 371 of file hpfc-util.c.

372 {
375 }
entity host_module
HPFC - Fabien Coelho, May 1993 and later...
Definition: compiler.c:47
entity node_module
Definition: compiler.c:47
void store_new_node_variable(entity new, entity old)
void store_new_host_variable(entity new, entity old)
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
#define NODE_NAME
#define HOST_NAME
Constants.

References AddCommonToModule(), host_module, HOST_NAME, node_module, NODE_NAME, store_new_host_variable(), and store_new_node_variable().

Referenced by init_host_and_node_entities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddCommonToModule()

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.

The layout list must be updated to the right entities

!!! not in current

Definition at line 328 of file hpfc-util.c.

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 }
void free(void *)
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#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
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
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
#define HPFC_PACKAGE
local definitions
Definition: hpfc-local.h:27
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
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
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
void AddEntityToDeclarations(entity, entity)
END_EOLE.
Definition: variable.c:108
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_undefined
Definition: ri.h:2761
#define area_layout(x)
Definition: ri.h:546
#define type_area(x)
Definition: ri.h:2946
#define entity_type(x)
Definition: ri.h:2792
char * strdup()
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References AddEntityToDeclarations(), AddEntityToModule(), area_layout, concatenate(), CONS, ENTITY, entity_local_name(), entity_type, entity_undefined, FindOrCreateEntityLikeModel(), free(), gen_find_eq(), gen_nconc(), gen_nreverse(), HPFC_PACKAGE, local_entity_of_module_p(), MAP, module, NIL, strdup(), and type_area.

Referenced by AddCommonToHostAndNodeModules().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddEntityToHostAndNodeModules()

void AddEntityToHostAndNodeModules ( entity  e)

AddEntityToHostAndNodeModules.

added because of some entity errors.

Definition at line 298 of file hpfc-util.c.

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 }
bool bound_new_host_p(entity)
entity load_new_node(entity)
void store_new_node(entity, entity)
bool bound_new_node_p(entity)
entity load_new_host(entity)
void store_new_host(entity, entity)
bool array_distributed_p(entity)

References AddEntityToDeclarations(), AddEntityToModule(), array_distributed_p(), bound_new_host_p(), bound_new_node_p(), entity_undefined, host_module, load_new_host(), load_new_node(), node_module, store_new_host(), store_new_host_variable(), store_new_node(), and store_new_node_variable().

Referenced by generate_parallel_body(), generate_read_of_ref_for_all(), generate_read_of_ref_for_computer(), generate_update_distributed_value_from_host(), and init_host_and_node_entities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alignments_compatible_p()

bool alignments_compatible_p ( entity  e1,
int  dim1,
entity  e2,
int  dim2 
)

bool alignments_compatible_p(entity e1, int dim1, entity e2, int dim2)

what: whether e1 and e2 dimensions dim1 and dim2 are aligned. how: basic low level comparison input: entities and dimension numbers output: the bool result side effects:

  • uses alignment internal descriptions bugs or features:
  • ??? should be relative to a reference, instead of assuming mere indexes
Parameters
e11
dim1im1
e22
dim2im2

Definition at line 678 of file hpfc-util.c.

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 }
void get_alignment(entity array, int dim, int *ptdim, int *pa, int *pb)
Definition: hpfc-util.c:606

References get_alignment().

Referenced by references_aligned_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DistArraysEffects()

list DistArraysEffects ( expression  expr)

effects' action in an expression are here supposed to be read one's but that may not be correct?

Parameters
exprxpr

Definition at line 241 of file hpfc-util.c.

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 }
list proper_effects_of_expression(expression)
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
bool store_effect_p(effect)
Definition: effects.c:1062
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
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

References array_distributed_p(), CONS, EFFECT, effect_variable, FOREACH, gen_free_list(), NIL, proper_effects_of_expression(), and store_effect_p().

Referenced by written_effects_to_dist_arrays_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DistributionParameterOfArrayDim()

int DistributionParameterOfArrayDim ( entity  array,
int  dim,
int pprocdim 
)
Parameters
arrayrray
dimim
pprocdimprocdim

Definition at line 472 of file hpfc-util.c.

476 {
477  entity template = array_to_template(array);
478  distribute d = load_hpf_distribution(template);
483  pprocdim);
484 
486 }
#define alignment_templatedim(x)
Definition: hpf.h:136
#define distribute_distribution(x)
Definition: hpf.h:174
#define distribution_parameter(x)
Definition: hpf.h:212
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
Definition: hpfc-util.c:569
distribution FindDistributionOfDim(list ldi, int dim, int *pdim)
Definition: hpfc-util.c:401
#define FindArrayDimAlignmentOfArray(array, dim)
#define array_to_template(array)
distribute load_hpf_distribution(entity)
static entity array

References alignment_templatedim, array, array_to_template, distribute_distribution, distribution_parameter, FindArrayDimAlignmentOfArray, FindDistributionOfDim(), HpfcExpressionToInt(), and load_hpf_distribution().

Referenced by generate_one_message(), message_manageable_p(), shape_one_message(), and template_cell_local_mapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expression_number_for_index()

static int expression_number_for_index ( entity  index,
list  le 
)
static

bool references_aligned_p(reference r1, reference r2)

what: tells whether the references are aligned or not how: quite basic and low level input: both references output: the returned boolean side effects:

  • uses alignment internal descriptions bugs or features:
  • assumes that both references are in the same store.
  • ??? indices must be simple references to indexes. returns 0 if not found
Parameters
leof expression

Definition at line 706 of file hpfc-util.c.

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 }
bool expression_reference_p(expression e)
Test if an expression is a reference.
Definition: expression.c:528
#define syntax_reference(x)
Definition: ri.h:2730
#define reference_variable(x)
Definition: ri.h:2326
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define expression_syntax(x)
Definition: ri.h:1247

References EXPRESSION, expression_reference_p(), expression_syntax, MAP, reference_variable, and syntax_reference.

Referenced by references_aligned_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindAlignmentOfDim()

alignment FindAlignmentOfDim ( list  lal,
int  dim 
)
Parameters
lalal
dimim

Definition at line 377 of file hpfc-util.c.

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 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define alignment_undefined
Definition: hpf.h:108
#define ALIGNMENT(x)
ALIGNMENT.
Definition: hpf.h:102
#define alignment_arraydim(x)
Definition: hpf.h:134

References ALIGNMENT, alignment_arraydim, alignment_undefined, CAR, ENDP, NIL, and POP.

Referenced by ComputeNewSizeOfIthDimension(), create_init_common_param_for_arrays(), expr_compute_local_index(), ith_dim_distributed_p(), ith_dim_overlapable_p(), and template_dimension_of_array_dimension().

+ Here is the caller graph for this function:

◆ FindAlignmentOfTemplateDim()

alignment FindAlignmentOfTemplateDim ( list  lal,
int  dim 
)
Parameters
lalal
dimim

Definition at line 389 of file hpfc-util.c.

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 }

References ALIGNMENT, alignment_templatedim, alignment_undefined, CAR, ENDP, and POP.

Referenced by array_distribution_similar_p(), array_ranges_to_template_ranges(), create_init_common_param_for_arrays(), get_alignment(), hpfc_compute_align_constraints(), hpfc_compute_unicity_constraints(), and processors_dim_replicated_p().

+ Here is the caller graph for this function:

◆ FindDistributionOfDim()

distribution FindDistributionOfDim ( list  ldi,
int  dim,
int pdim 
)
Parameters
ldidi
dimim
pdimdim

Definition at line 401 of file hpfc-util.c.

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 }
size_t gen_length(const list l)
Definition: list.c:150
#define style_none_p(x)
Definition: hpf.h:259
#define DISTRIBUTION(x)
DISTRIBUTION.
Definition: hpf.h:180
#define distribution_style(x)
Definition: hpf.h:210
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172

References CAR, DISTRIBUTION, distribution_style, gen_length(), pips_assert, POP, and style_none_p.

Referenced by ComputeNewSizeOfIthDimension(), create_init_common_param_for_arrays(), DistributionParameterOfArrayDim(), expr_compute_local_index(), get_distribution(), ith_dim_distributed_p(), ith_dim_overlapable_p(), and processor_number().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindDistributionOfProcessorDim()

distribution FindDistributionOfProcessorDim ( list  ldi,
int  dim,
int tdim 
)
Parameters
ldidi
dimim
tdimdim

Definition at line 421 of file hpfc-util.c.

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 }
#define distribution_undefined
Definition: hpf.h:186
#define pips_internal_error
Definition: misc-local.h:149

References DISTRIBUTION, distribution_style, distribution_undefined, MAP, pips_internal_error, and style_none_p.

Referenced by array_distribution_similar_p(), hpfc_compute_distribute_constraints(), processors_dim_replicated_p(), and template_ranges_to_processors_ranges().

+ Here is the caller graph for this function:

◆ FindRefToDistArray()

list FindRefToDistArray ( void *  obj)
Parameters
objbj

Definition at line 282 of file hpfc-util.c.

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 }
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
static list found_syntaxes
Definition: hpfc-util.c:270
static void FindRefToDistArray_syntax_rewrite(syntax s)
Definition: hpfc-util.c:272
#define syntax_domain
newgen_synchronization_domain_defined
Definition: ri.h:402

References FindRefToDistArray_syntax_rewrite(), found_syntaxes, gen_multi_recurse(), gen_true(), NIL, and syntax_domain.

Referenced by FindRefToDistArrayFromList(), FindRefToDistArrayInStatement_call_filter(), FindRefToDistArrayInStatement_expression_filter(), generate_c1_alpha(), and ref_to_dist_array_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindRefToDistArray_syntax_rewrite()

static void FindRefToDistArray_syntax_rewrite ( syntax  s)
static

Definition at line 272 of file hpfc-util.c.

274 {
275  if (syntax_reference_p(s))
278  found_syntaxes =
280 }
#define syntax_reference_p(x)
Definition: ri.h:2728
#define SYNTAX(x)
SYNTAX.
Definition: ri.h:2670

References array_distributed_p(), CONS, found_syntaxes, reference_variable, SYNTAX, syntax_reference, and syntax_reference_p.

Referenced by FindRefToDistArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindRefToDistArrayFromList()

list FindRefToDistArrayFromList ( list  lexpr)

FindRefToDistArrayFromList.

these functions compute the list of syntax that are references to a distributed variable.

Parameters
lexprexpr

Definition at line 262 of file hpfc-util.c.

264 {
265  list l=NIL;
266  MAP(EXPRESSION, e,{l=gen_nconc(FindRefToDistArray(e),l);},lexpr);
267  return(l);
268 }
list FindRefToDistArray(void *obj)
Definition: hpfc-util.c:282

References EXPRESSION, FindRefToDistArray(), gen_nconc(), MAP, and NIL.

Referenced by generate_c1_beta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_alignment()

void get_alignment ( entity  array,
int  dim,
int ptdim,
int pa,
int pb 
)

a nicer interface to extract the needed information. FC 29/03/94

replication

Parameters
arrayrray
dimim
ptdimtdim
paa
pbb

Definition at line 606 of file hpfc-util.c.

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 }
#define alignment_constant(x)
Definition: hpf.h:140
#define align_alignment(x)
Definition: hpf.h:96
#define alignment_rate(x)
Definition: hpf.h:138
alignment FindAlignmentOfTemplateDim(list lal, int dim)
Definition: hpfc-util.c:389
int template_dimension_of_array_dimension(entity array, int dim)
Definition: hpfc-util.c:448
align load_hpf_alignment(entity)

References align_alignment, alignment_constant, alignment_rate, alignment_undefined, array, array_distributed_p(), FindAlignmentOfTemplateDim(), HpfcExpressionToInt(), load_hpf_alignment(), pips_assert, and template_dimension_of_array_dimension().

Referenced by alignments_compatible_p(), and hpfc_compute_entity_to_new_declaration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_distribution()

void get_distribution ( entity  template,
int  dim,
int ppdim,
int pn 
)
Parameters
templateemplate
dimim
ppdimpdim
pnn

Definition at line 638 of file hpfc-util.c.

641 {
645  dim, ppdim);
646 
647  *pn = (distribution_undefined_p(d) ?
649 }
#define distribution_undefined_p(x)
Definition: hpf.h:187

References distribute_distribution, distribution_parameter, distribution_undefined_p, FindDistributionOfDim(), HpfcExpressionToInt(), and load_hpf_distribution().

Referenced by hpfc_compute_entity_to_new_declaration(), and processor_dimension_of_template_dimension().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_entity_dimensions()

void get_entity_dimensions ( entity  e,
int  dim,
int plow,
int pup 
)
Parameters
dimim
plowlow
pupup

Definition at line 651 of file hpfc-util.c.

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 }
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
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
int ExpressionToInt(expression)
this function computes the value of an integer constant expression and returns it to the calling func...
Definition: size.c:562
#define dimension_lower(x)
Definition: ri.h:980
#define dimension_upper(x)
Definition: ri.h:982
#define dimension_undefined
Definition: ri.h:955

References dimension_lower, dimension_undefined, dimension_upper, entity_ith_dimension(), entity_variable_p, ExpressionToInt(), and pips_assert.

Referenced by conformant_entities_p(), extract_the_align(), full_linearization(), hpfc_compute_entity_to_new_declaration(), hpfc_compute_lid(), partial_linearization(), and safe_static_domain_bound().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ global_array_cell_to_local_array_cell()

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)

??? not enough general a function

Parameters
arrayrray
dimim
acellcell

Definition at line 550 of file hpfc-util.c.

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 }
int template_cell_local_mapping(entity array, int dim, int tc)
int template_cell_local_mapping(array, dim, tc)
Definition: hpfc-util.c:532
struct _newgen_struct_constant_ * constant

References alignment_constant, alignment_rate, alignment_undefined, array, FindArrayDimAlignmentOfArray, HpfcExpressionToInt(), pips_assert, and template_cell_local_mapping().

Referenced by shape_one_message().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hpfc_util_error_handler()

void hpfc_util_error_handler ( void  )

removes IF (.TRUE.) THEN and DO X=n, n

Definition at line 785 of file hpfc-util.c.

786 {
787  error_reset_current_stmt_stack();
788 }

Referenced by hpfc_error_handler().

+ Here is the caller graph for this function:

◆ HpfcExpressionToInt()

int HpfcExpressionToInt ( expression  e)

HpfcExpressionToInt(e)

uses the normalized value if possible.

just to avoid a gcc warning

Definition at line 569 of file hpfc-util.c.

571 {
573  intptr_t val = 0;
574 
576 
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 }
#define VALUE_TO_INT(val)
int Value
if(!(yy_init))
Definition: genread_lex.c:1029
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792
#define normalized_undefined
Definition: ri.h:1745
#define normalized_linear_p(x)
Definition: ri.h:1779
#define expression_normalized(x)
Definition: ri.h:1249
#define normalized_linear(x)
Definition: ri.h:1781
#define ifdebug(n)
Definition: sg.c:47
#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
#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

References expression_integer_value(), expression_normalized, ifdebug, intptr_t, normalized_linear, normalized_linear_p, normalized_undefined, pips_internal_error, print_expression(), TCST, VALUE_TO_INT, vect_coeff(), and vect_size().

Referenced by align_check(), array_access_to_array_ranges(), array_ranges_to_template_ranges(), complementary_range(), compute_receive_content(), compute_receive_domain(), ComputeNewSizeOfIthDimension(), create_init_common_param_for_arrays(), create_init_common_param_for_processors(), create_init_common_param_for_templates(), create_parameters_h(), DistributionParameterOfArrayDim(), expr_compute_local_index(), generate_one_message(), get_alignment(), get_distribution(), get_ith_dim_new_declaration(), global_array_cell_to_local_array_cell(), handle_set_directive(), hpfc_compute_align_constraints(), hpfc_compute_distribute_constraints(), hpfc_compute_unicity_constraints(), loop_filter(), make_guard_expression(), NormalizeOneTemplateDistribution(), overlap_redefine_expression(), processor_number(), same_alignment_p(), shape_one_message(), simple_indices_p(), template_cell_local_mapping(), and template_ranges_to_processors_ranges().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ith_dim_distributed_p()

bool ith_dim_distributed_p ( entity  array,
int  i,
int pprocdim 
)

whether a dimension is distributed or not.

Parameters
arrayrray
pprocdimprocdim

Definition at line 160 of file hpfc-util.c.

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 }
#define align_template(x)
Definition: hpf.h:98
#define alignment_undefined_p(x)
Definition: hpf.h:109
alignment FindAlignmentOfDim(list lal, int dim)
Definition: hpfc-util.c:377

References align_alignment, align_template, alignment_templatedim, alignment_undefined_p, array, distribute_distribution, distribution_style, FindAlignmentOfDim(), FindDistributionOfDim(), load_hpf_alignment(), load_hpf_distribution(), and style_none_p.

Referenced by align_check(), atomize_one_message(), compute_receive_content(), generate_optimized_code_for_loop_nest(), loop_flt(), NewDeclarationOfDistributedArray(), number_of_distributed_dimensions(), shape_one_message(), simple_indices_p(), and subarray_shift_assignment_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ith_dim_overlapable_p()

bool ith_dim_overlapable_p ( entity  array,
int  i 
)
Parameters
arrayrray

Definition at line 178 of file hpfc-util.c.

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 }
#define style_block_p(x)
Definition: hpf.h:262

References align_alignment, align_template, alignment_templatedim, alignment_undefined_p, array, distribute_distribution, distribution_style, FindAlignmentOfDim(), FindDistributionOfDim(), load_hpf_alignment(), load_hpf_distribution(), and style_block_p.

Referenced by add_bound_arguments(), caller_list_of_bounds(), create_parameters_h(), and declaration_with_overlaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ith_dim_replicated_p()

bool ith_dim_replicated_p ( _UNUSED_ entity  template,
int  i,
list  la,
distribution  dist 
)

bool ith_dim_replicated_p(template, i, la, dist)

true if template dimension i distributed with dist leads to a replication for array align al.

select the relevent alignment if exists. could be some kind of gen_find_if()...

Definition at line 125 of file hpfc-util.c.

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 }

References ALIGNMENT, alignment_templatedim, distribution_style, MAP, and style_none_p.

Referenced by replicated_p().

+ Here is the caller graph for this function:

◆ kill_statement_number_and_ordering()

void kill_statement_number_and_ordering ( statement  s)

Definition at line 232 of file hpfc-util.c.

234 {
236 }
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
static void stmt_rwt(statement s)
Definition: hpfc-util.c:225
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362

References gen_recurse, gen_true(), statement_domain, and stmt_rwt().

Referenced by compile_module().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loop_rewrite()

static void loop_rewrite ( loop  l)
static

instruction i = statement_instruction(s);

Do not forget to move forbidden information associated with block:

free_instruction(i);

??? memory leak, cores on AIX

Definition at line 822 of file hpfc-util.c.

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 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
statement make_assign_statement(expression, expression)
Definition: statement.c:583
void fix_sequence_statement_attributes(statement)
Since blocks are not represented in Fortran, they cannot carry a label.
Definition: statement.c:2016
#define current_stmt_head()
We want to keep track of the current statement inside the recurse.
Definition: icfg_scan.c:76
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
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
#define loop_body(x)
Definition: ri.h:1644
#define range_upper(x)
Definition: ri.h:2290
#define entity_name(x)
Definition: ri.h:2790
#define range_lower(x)
Definition: ri.h:2288
#define statement_instruction(x)
Definition: ri.h:2458
#define loop_range(x)
Definition: ri.h:1642
#define loop_index(x)
Definition: ri.h:1640
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CONS, copy_expression(), current_stmt_head, entity_name, entity_to_expression(), expression_equal_p(), fix_sequence_statement_attributes(), loop_body, loop_index, loop_range, make_assign_statement(), make_instruction_block(), NIL, pips_debug, range_lower, range_upper, STATEMENT, statement_instruction, and statement_undefined.

Referenced by statement_structural_cleaning().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeStatementLike()

statement MakeStatementLike ( statement  stat,
int  the_tag 
)

creates a new statement for the given module that looks like the stat one, i.e.

same comment, same label, and so on. The goto table is updated. The instruction is also created. (is that really a good idea?)

Parameters
stattat
the_taghe_tag

Definition at line 203 of file hpfc-util.c.

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 }
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
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
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define string_undefined_p(s)
Definition: newgen_types.h:41
#define STATEMENT_NUMBER_UNDEFINED
default values
#define loop_undefined
Definition: ri.h:1612
#define statement_label(x)
Definition: ri.h:2450
@ is_instruction_sequence
Definition: ri.h:1469
#define statement_extensions(x)
Definition: ri.h:2464
#define statement_comments(x)
Definition: ri.h:2456
static char * x
Definition: split_file.c:159

References copy_extensions(), fix_statement_attributes_if_sequence(), is_instruction_sequence, loop_undefined, make_instruction(), make_sequence(), make_statement(), make_synchronization_none(), NIL, statement_comments, statement_extensions, statement_label, STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, strdup(), string_undefined_p, and x.

Referenced by hpf_compile_block(), hpf_compile_call(), hpf_compile_parallel_loop(), hpf_compile_sequential_loop(), hpf_compile_test(), and hpf_compile_unstructured().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processor_dimension_of_template_dimension()

int processor_dimension_of_template_dimension ( entity  template,
int  dim 
)
Parameters
templateemplate
dimim

Definition at line 462 of file hpfc-util.c.

465 {
466  int pdim = 0, n;
467  if (dim>=0) get_distribution(template, dim, &pdim, &n);
468  return pdim;
469 }
void get_distribution(entity template, int dim, int *ppdim, int *pn)
Definition: hpfc-util.c:638

References get_distribution().

+ Here is the call graph for this function:

◆ processor_number()

int processor_number ( entity  template,
int  tdim,
int  tcell,
int pprocdim 
)

int processor_number(template, tdim, tcell, pprocdim)

the processor number of a template cell, on dimension *pprocdim template dimension, template cell

just to avoid a gcc warning

Parameters
templateemplate
tdimdim
tcellcell
pprocdimprocdim

Definition at line 492 of file hpfc-util.c.

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 }
#define distribute_processors(x)
Definition: hpf.h:176
#define style_cyclic_p(x)
Definition: hpf.h:265
dimension FindIthDimension(entity, int)
Definition: type.c:1180
int SizeOfIthDimension(entity, int)
this function returns the size of the ith dimension of a variable e.
Definition: size.c:453

References dimension_lower, distribute_distribution, distribute_processors, distribution_parameter, distribution_style, FindDistributionOfDim(), FindIthDimension(), HpfcExpressionToInt(), load_hpf_distribution(), SizeOfIthDimension(), style_block_p, style_cyclic_p, and style_none_p.

Referenced by aligned_p(), on_same_proc_p(), and template_ranges_to_processors_ranges().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processors_dim_replicated_p()

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 at line 143 of file hpfc-util.c.

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 }
distribution FindDistributionOfProcessorDim(list ldi, int dim, int *tdim)
Definition: hpfc-util.c:421

References align_alignment, align_template, alignment_undefined_p, distribute_distribution, distribution_style, FindAlignmentOfTemplateDim(), FindDistributionOfProcessorDim(), load_hpf_alignment(), load_hpf_distribution(), and style_none_p.

Referenced by hpfc_broadcast_buffers(), hpfc_compute_lid(), partial_linearization(), and remapping_variables().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ref_to_dist_array_p()

bool ref_to_dist_array_p ( void *  obj)

this file describe a few functions usefull to the compiler to manage the hpfc data structures.

hpfc-util.c

Fabien Coelho, May 1993. Predicates true if there is a reference to a distributed array within obj

??? not very intelligent, should use the regions, the problem is that I should normalize the code before the pips analysis...

Parameters
objbj

Definition at line 48 of file hpfc-util.c.

49 {
50  list l = FindRefToDistArray(obj);
51  bool b = (l!=NIL);
52 
53  gen_free_list(l); return(b);
54 }

References FindRefToDistArray(), gen_free_list(), and NIL.

Referenced by call_filter(), hpf_compile_call(), and test_atomization().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ references_aligned_p()

bool references_aligned_p ( reference  r1,
reference  r2 
)

of expression

both references must be aligned to the same template and be of the same arity.

Parameters
r11
r22

Definition at line 726 of file hpfc-util.c.

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 }
#define XDEBUG(msg)
Definition: hpfc-util.c:722
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
#define reference_indices(x)
Definition: ri.h:2328

References align_template, alignments_compatible_p(), array_distributed_p(), EXPRESSION, expression_number_for_index(), expression_reference_p(), expression_syntax, gen_length(), load_hpf_alignment(), MAP, reference_indices, reference_variable, syntax_reference, and XDEBUG.

Referenced by full_copy_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replicated_p()

bool replicated_p ( entity  e)

replicated_p

check whether the distributed array e is replicated or not.

Definition at line 96 of file hpfc-util.c.

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 }
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
int NumberOfDimension(entity)
Definition: size.c:588

References align_alignment, align_template, array_distributed_p(), CAR, distribute_distribution, DISTRIBUTION, ith_dim_replicated_p(), load_hpf_alignment(), load_hpf_distribution(), NumberOfDimension(), pips_assert, and POP.

Referenced by generate_update_distributed_value_from_host(), generate_update_values_on_computer_and_nodes(), generate_update_values_on_nodes(), hpfc_broadcast_buffers(), if_different_pe_and_not_twin(), io_efficient_compile(), Overlap_Analysis(), st_receive_from(), st_send_to_computer_if_necessary(), and st_send_to_host_and_nodes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ statement_structural_cleaning()

void statement_structural_cleaning ( statement  s)

Definition at line 847 of file hpfc-util.c.

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 }
static void loop_rewrite(loop l)
Definition: hpfc-util.c:822
static void test_rewrite(test t)
Definition: hpfc-util.c:790
#define test_domain
newgen_entity_domain_defined
Definition: ri.h:418
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218

References gen_multi_recurse(), gen_true(), loop_domain, loop_rewrite(), statement_domain, test_domain, and test_rewrite().

Referenced by compile_module().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stmt_rwt()

static void stmt_rwt ( statement  s)
static

Definition at line 225 of file hpfc-util.c.

227 {
230 }
#define statement_ordering(x)
Definition: ri.h:2454
#define statement_number(x)
Definition: ri.h:2452

References statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.

Referenced by kill_statement_number_and_ordering().

+ Here is the caller graph for this function:

◆ template_cell_local_mapping()

int template_cell_local_mapping ( entity  array,
int  dim,
int  tc 
)

int template_cell_local_mapping(array, dim, tc)

??? should check that it is indeed block distributed ! or should implement all the formulas...

Parameters
arrayrray
dimim
tcc

Definition at line 532 of file hpfc-util.c.

535 {
537  int p, tmin, n = DistributionParameterOfArrayDim(array, dim, &p);
540 
542 
543  return (tc-tmin)%n+1;
544 }
int DistributionParameterOfArrayDim(entity array, int dim, int *pprocdim)
Definition: hpfc-util.c:472
static int tc
Internal variables
Definition: reindexing.c:107

References alignment_templatedim, array, array_to_template, dimension_lower, DistributionParameterOfArrayDim(), FindArrayDimAlignmentOfArray, FindIthDimension(), HpfcExpressionToInt(), and tc.

Referenced by generate_one_message(), global_array_cell_to_local_array_cell(), and update_indices_for_local_computation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ template_dimension_of_array_dimension()

int template_dimension_of_array_dimension ( entity  array,
int  dim 
)
Parameters
arrayrray
dimim

Definition at line 448 of file hpfc-util.c.

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 }

References align_alignment, alignment_templatedim, alignment_undefined, array, FindAlignmentOfDim(), and load_hpf_alignment().

Referenced by aligned_p(), get_alignment(), and message_manageable_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_rewrite()

static void test_rewrite ( test  t)
static

instruction i = statement_instruction(s);

Fix attributes if it is a sequence:

free_instruction(i);

???

instruction i = statement_instruction(s);

Fix attributes if it is a sequence:

free_instruction(i);

???

Definition at line 790 of file hpfc-util.c.

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 }
#define ENTITY_TRUE_P(e)
#define ENTITY_FALSE_P(e)
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
Definition: expression.c:3140
#define test_false(x)
Definition: ri.h:2837
#define instruction_undefined
Definition: ri.h:1454
#define test_true(x)
Definition: ri.h:2835
#define test_condition(x)
Definition: ri.h:2833

References current_stmt_head, ENTITY_FALSE_P, ENTITY_TRUE_P, expression_to_entity(), fix_statement_attributes_if_sequence(), instruction_undefined, pips_debug, statement_instruction, test_condition, test_false, and test_true.

Referenced by statement_structural_cleaning().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ written_effect_p()

bool written_effect_p ( entity  var,
list  le 
)

written_effects_to_dist_arrays_p

Parameters
varar
lee

Definition at line 58 of file hpfc-util.c.

60 {
61  FOREACH(EFFECT, e, le)
62  {
63  if(store_effect_p(e)) {
66  return true;
67  }
68  }
69 
70  return false;
71 }
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_action(x)
Definition: effects.h:642
#define action_write_p(x)
Definition: effects.h:314

References action_write_p, EFFECT, effect_action, effect_any_reference, FOREACH, reference_variable, and store_effect_p().

Referenced by locally_constant_vector_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ written_effects_to_dist_arrays_p()

bool written_effects_to_dist_arrays_p ( expression  expr)
Parameters
exprxpr

Definition at line 73 of file hpfc-util.c.

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 }
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

References action_write_p, CAR, DistArraysEffects(), EFFECT, effect_action, ENDP, gen_free_list(), POP, and store_effect_p().

+ Here is the call graph for this function:

Variable Documentation

◆ found_syntaxes

list found_syntaxes = NIL
static

Definition at line 270 of file hpfc-util.c.

Referenced by FindRefToDistArray(), and FindRefToDistArray_syntax_rewrite().