PIPS
analyse.c File Reference
#include "defines-local.h"
#include "workspace-util.h"
#include "prettyprint.h"
#include "preprocessor.h"
#include "transformer.h"
#include "semantics.h"
#include "dg.h"
#include "graph.h"
#include "ricedg.h"
#include "bootstrap.h"
#include "STEP_RT_intrinsic.h"
#include "STEP_RT_bootstrap.h"
+ Include dependency graph for analyse.c:

Go to the source code of this file.

Typedefs

typedef dg_arc_label arc_label
 
typedef dg_vertex_label vertex_label
 

Functions

static bool step_statement_path_build (statement stmt, list *sp_current)
 
static void step_statement_path_unbuild (statement stmt, list *sp_current)
 
static void step_statement_path_init (statement body)
 
static void step_statement_path_finalize (void)
 
static list step_statement_path_get (statement stmt)
 
static statement step_statement_path_first_directive_statement (statement stmt)
 
static list step_statement_path_factorise (statement s1, statement s2, list *suffix_sp1, list *suffix_sp2)
 
bool step_interlaced_p (region reg)
 
bool step_partial_p (region reg)
 
bool step_analysed_module_p (const char *module_name)
 
void load_step_comm ()
 
void reset_step_comm ()
 
void store_step_comm ()
 
static void step_add_point_into_effect_path (effect new_eff, entity module, statement stmt, effect previous_eff)
 
static void step_print_effect_path (list path)
 
static list step_get_effect_path (effect start_eff)
 
static effect get_directive_statement_region (effect reg)
 
static void step_set_step_partial (effect send_region, bool partial_p)
 
static void step_set_communication_type_full (effect send_region)
 
static void step_set_communication_type_partial (effect send_region)
 
void debug_print_effects_list (list l, string txt)
 
bool step_analyse_init (const string module_name)
 
region rectangularization_region (region reg)
 
static list create_step_regions (statement stmt, list regions_l, enum action_utype action_tag)
 
static void step_init_effect_path (entity module, statement stmt, list regions_l)
 
static bool anymodule_anywhere_region_p (list regions_l)
 
static list compute_send_regions (list write_l, list out_l, statement stmt)
 
static list compute_recv_regions (list send_l, list in_l, statement stmt)
 
static bool interlaced_basic_workchunk_regions_p (region reg, list index_l)
 
static list step_send_regions_list_load (statement s)
 
static void step_send_regions_list_store (statement s, list l_regions)
 
static void step_send_regions_list_update (statement s, list l_regions)
 
static void step_send_regions_list_add (statement stmt, list l_regions)
 
static list step_recv_regions_list_load (statement s)
 
static void step_recv_regions_list_store (statement s, list l_regions)
 
static void step_recv_regions_list_update (statement s, list l_regions)
 
static void step_recv_regions_list_add (statement stmt, list l_regions)
 
static void step_print_directives_regions (step_directive d, list send_l, list recv_l)
 
static list summarize_and_map_step_regions (list effect_l, entity module, statement body)
 
static void step_summarize_and_map_step_regions (statement stmt)
 
static void step_initialize_step_partial (list send_l)
 
static void step_compute_step_interlaced (list send_l, step_directive d)
 
static bool compute_directive_regions (step_directive drt)
 
static list step_translate_and_map (statement stmt, list effects_called_l)
 
static bool step_translate_and_map_step_regions (statement stmt)
 
static bool compute_SENDRECV_regions (statement stmt, bool *exist_regions_p)
 
static bool concerned_entity_p (effect eff, list regions)
 
static void step_get_comparable_effects (list eff_list, effect eff, set *effects_set)
 
static void step_compute_CHAINS_DG_remove_summary_regions (successor su, list source_send_l, list sink_recv_l, set *remove_from_summary_send, set *remove_from_summary_recv)
 
static void step_compute_CHAINS_DG_SENDRECV_regions (statement s1, statement s2, list *s1_send_l, list *s2_recv_l)
 
static void step_analyse_CHAINS_DG (const char *module_name, set *remove_from_summary_send, set *remove_from_summary_recv)
 
static void update_SUMMARY_SENDRECV_regions (set remove_from_summary_regions, list tmp_summary_regions_l, list *final_summary_regions_l)
 
static void step_update_SUMMARY_SENDRECV_regions (set remove_from_summary_send, set remove_from_summary_recv, list *full_send_l, list *partial_send_l)
 
static void step_update_comm (list full_send_l, list partial_send_l)
 
static bool step_compute_SENDRECV_regions (entity module, statement body)
 
bool step_analyse (const char *module_name)
 

Variables

static hash_table step_statement_path = hash_table_undefined
 The step_analyse phase computes three main resources: More...
 

Typedef Documentation

◆ arc_label

Definition at line 13 of file analyse.c.

◆ vertex_label

Definition at line 14 of file analyse.c.

Function Documentation

◆ anymodule_anywhere_region_p()

static bool anymodule_anywhere_region_p ( list  regions_l)
static

Definition at line 479 of file analyse.c.

480 {
481  bool is_anymodule_anywhere = false;
482 
483  FOREACH(REGION, reg, regions_l)
484  {
485  if (anywhere_effect_p(reg))
486  {
487  is_anymodule_anywhere = true;
488  break;
489  }
490  }
491 
492  return is_anymodule_anywhere;
493 }
#define REGION
bool anywhere_effect_p(effect)
Is it an anywhere effect? ANYMMODULE:ANYWHERE
Definition: effects.c:346
#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 anywhere_effect_p(), FOREACH, and REGION.

Referenced by compute_directive_regions(), compute_recv_regions(), and compute_send_regions().

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

◆ compute_directive_regions()

static bool compute_directive_regions ( step_directive  drt)
static

TODO ajouter un test si tout est vide.

Store SEND/RECV directive statement regions

Initialization of step_effect_path for each send/recv regions

Initialization of step_interlaced and step_partial for each send region

Definition at line 888 of file analyse.c.

889 {
891 
892  pips_debug(1,"Begin\n");
893 
894  statement directive_stmt = step_directive_block(drt);
895  statement stmt_basic_workchunk = step_directive_basic_workchunk(drt);
896  assert(!statement_undefined_p(stmt_basic_workchunk));
897 
898  ifdebug(1)
899  {
901  }
902 
903  list rw_l = load_rw_effects_list(stmt_basic_workchunk);
904  list write_l = regions_write_regions(rw_l);
905  list in_l = load_in_effects_list(stmt_basic_workchunk);
906  list out_l = load_out_effects_list(stmt_basic_workchunk);
907 
908  /* TODO ajouter un test si tout est vide. */
909 
910  list send_l = compute_send_regions(write_l, out_l, directive_stmt);
911  list recv_l = compute_recv_regions(send_l, in_l, directive_stmt);
912 
913 
914  /* Store SEND/RECV directive statement regions */
915  step_send_regions_list_store(directive_stmt, send_l);
916  step_recv_regions_list_store(directive_stmt, recv_l);
917 
918 #ifdef FRED
919  pips_assert("ANYMODULE ANYWHERE SEND regions", !anymodule_anywhere_region_p(send_l));
920  pips_assert("ANYMODULE ANYWHERE RECV regions", !anymodule_anywhere_region_p(recv_l));
921 #endif
922 
923  /* Initialization of step_effect_path for each send/recv regions */
924  step_init_effect_path(module, directive_stmt, send_l);
925  step_init_effect_path(module, directive_stmt, recv_l);
926 
927  /* Initialization of step_interlaced and step_partial for each send region */
929  step_compute_step_interlaced(send_l, drt);
930 
931  ifdebug(3)
932  {
933  step_print_directives_regions(drt, send_l, recv_l);
934  }
935  pips_debug(1,"End\n");
936  return !(ENDP(recv_l) && ENDP(send_l));
937 }
static void step_print_directives_regions(step_directive d, list send_l, list recv_l)
Definition: analyse.c:757
static void step_initialize_step_partial(list send_l)
Definition: analyse.c:865
static void step_init_effect_path(entity module, statement stmt, list regions_l)
Definition: analyse.c:464
static bool anymodule_anywhere_region_p(list regions_l)
Definition: analyse.c:479
static void step_recv_regions_list_store(statement s, list l_regions)
Definition: analyse.c:723
static void step_compute_step_interlaced(list send_l, step_directive d)
Definition: analyse.c:875
static list compute_send_regions(list write_l, list out_l, statement stmt)
Definition: analyse.c:495
static list compute_recv_regions(list send_l, list in_l, statement stmt)
Definition: analyse.c:555
static void step_send_regions_list_store(statement s, list l_regions)
Definition: analyse.c:677
list regions_write_regions(list)
list load_out_effects_list(statement)
list load_in_effects_list(statement)
list load_rw_effects_list(statement)
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#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 assert(ex)
Definition: newgen_assert.h:41
static char * module
Definition: pips.c:74
#define statement_undefined_p(x)
Definition: ri.h:2420
#define ifdebug(n)
Definition: sg.c:47
void step_directive_print(step_directive d)
Definition: directives.c:362
statement step_directive_basic_workchunk(step_directive d)
Definition: directives.c:286
#define step_directive_block(x)
Definition: step_private.h:431
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References anymodule_anywhere_region_p(), assert, compute_recv_regions(), compute_send_regions(), ENDP, get_current_module_entity(), ifdebug, load_in_effects_list(), load_out_effects_list(), load_rw_effects_list(), module, pips_assert, pips_debug, regions_write_regions(), statement_undefined_p, step_compute_step_interlaced(), step_directive_basic_workchunk(), step_directive_block, step_directive_print(), step_init_effect_path(), step_initialize_step_partial(), step_print_directives_regions(), step_recv_regions_list_store(), and step_send_regions_list_store().

Referenced by compute_SENDRECV_regions().

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

◆ compute_recv_regions()

static list compute_recv_regions ( list  send_l,
list  in_l,
statement  stmt 
)
static

ANYMODULE ANYWHERE recv regions should cause FULL communications thus ANYMODULE ANYWHERE recv regions are removed from recv regions.

Definition at line 555 of file analyse.c.

556 {
557  pips_debug(2,"begin\n");
558  list recv_final = NIL;
559  list send_may_l = NIL;
560  list recv_l;
561 
562  /*
563  RECV = IN Union SEND-MAY
564 
565  Generally, for a given construct, SEND is not sur-approximated
566  then SEND-MAY is empty thus
567 
568  RECV = IN
569 
570  But, for a given construct, when SEND is sur-approximated (i.e. SEND
571  MAY), then the communication is interlaced and a diff is
572  necessary at the end to determine what data were updated.
573 
574  Thus data in the sur-approximation must have a correct value even
575  if they are not read (for the diff).
576 
577  Thus when SEND is sur-approximated: RECV = IN Union SEND-MAY
578  */
579 
580  FOREACH(REGION, reg, send_l)
581  {
582  if (region_may_p(reg))
583  send_may_l = CONS(REGION, region_dup(reg), send_may_l);
584  }
585 
586  ifdebug(2)
587  {
588  debug_print_effects_list(send_may_l, "SEND may :");
589  debug_print_effects_list(in_l, "IN :");
590  }
591 
592  recv_l = RegionsMustUnion(regions_dup(in_l), regions_dup(send_may_l), r_w_combinable_p);
593  gen_full_free_list(send_may_l);
594 
595  if (anymodule_anywhere_region_p(recv_l))
596  {
597  /* ANYMODULE ANYWHERE recv regions should cause FULL communications
598  thus ANYMODULE ANYWHERE recv regions are removed from recv regions.
599  */
600  pips_debug(2,"drop ANYMODULE ANYWHERE RECV regions\n");
601  recv_final = NIL;
602  gen_full_free_list(recv_l);
603  }
604  else
605  {
606  recv_final = create_step_regions(stmt, recv_l, is_action_read);
607  gen_full_free_list(recv_l);
608  }
609 
610  ifdebug(2)
611  debug_print_effects_list(recv_final, "RECV final :");
612 
613  pips_debug(2,"end\n");
614  return recv_final;
615 }
void debug_print_effects_list(list l, string txt)
Definition: analyse.c:334
static list create_step_regions(statement stmt, list regions_l, enum action_utype action_tag)
Definition: analyse.c:406
#define region_may_p(reg)
list RegionsMustUnion(list l1, list l2, bool(*union_combinable_p)(effect, effect))
list RegionsMustUnion(list l1, list l2, union_combinable_p) input : two lists of regions output : a l...
list regions_dup(list)
effect region_dup(effect)
bool r_w_combinable_p(effect, effect)
@ is_action_read
Definition: effects.h:292
void gen_full_free_list(list l)
Definition: genClib.c:1023
#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
char end
Definition: gtk_status.c:82
return(s1)
Definition: statement.c:54

References anymodule_anywhere_region_p(), CONS, create_step_regions(), debug_print_effects_list(), FOREACH, gen_full_free_list(), ifdebug, is_action_read, NIL, pips_debug, r_w_combinable_p(), REGION, region_dup(), region_may_p, regions_dup(), and RegionsMustUnion().

Referenced by compute_directive_regions().

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

◆ compute_send_regions()

static list compute_send_regions ( list  write_l,
list  out_l,
statement  stmt 
)
static

ANYMODULE ANYWHERE send regions are a big problem! FIXME.

Definition at line 495 of file analyse.c.

496 {
497  pips_debug(2,"begin\n");
498  list send_final = NIL;
499  list write_tmp_l = regions_dup(write_l);
500  list out_tmp_l = regions_dup(out_l);
501 
502  /*
503  SEND = OUT Inter WRITE
504 
505  Computation of the approximation (EXACT or MAY)
506 
507  1) OUT-MAY Inter WRITE-MAY -> SEND-MAY
508  2) OUT-EXACT Inter WRITE-MAY -> SEND-MAY
509  3) OUT-EXACT Inter WRITE-EXACT -> SEND-EXACT
510  4) OUT-MAY Inter WRITE-EXACT -> SEND-MAY
511 
512  Case 4 is a problem, we want OUT-MAY Inter WRITE-EXACT --> SEND-*EXACT*.
513 
514  Generally the approximation of the SEND region should be the
515  approximation of the WRITE region because OUT should be used only
516  to reduce region communication. Thus we artificially transform
517  the out approximation as EXACT so that the MAY approximation does
518  not impact the SEND approximation.
519  */
520 
521  FOREACH(REGION, reg, out_tmp_l)
522  {
525  }
526 
527  ifdebug(2)
528  {
529  debug_print_effects_list(out_tmp_l, "OUT :");
530  debug_print_effects_list(write_tmp_l, "WRITE :");
531  }
532 
533  list send_l = RegionsIntersection(out_tmp_l, write_tmp_l, w_w_combinable_p);
534 
535  if (anymodule_anywhere_region_p(send_l))
536  {
537  /* ANYMODULE ANYWHERE send regions are a big problem! FIXME.
538  */
539 
540  STEP_DEBUG_STATEMENT(0, "ANYWHERE effect on stmt", stmt);
541  pips_debug(0, "end stmt\n");
542  pips_user_warning("ANYWHERE effect in SEND regions\n");
543  }
544 
545  send_final = create_step_regions(stmt, send_l, is_action_write);
546  gen_full_free_list(send_l);
547 
548  ifdebug(2)
549  debug_print_effects_list(send_final, "SEND final :");
550 
551  pips_debug(2,"end\n");
552  return send_final;
553 }
approximation make_approximation_exact(void)
Definition: effects.c:185
void free_approximation(approximation p)
Definition: effects.c:135
#define region_approximation(reg)
list RegionsIntersection(list l1, list l2, bool(*intersection_combinable_p)(effect, effect))
list RegionsIntersection(list l1,l2, bool (*intersection_combinable_p)(effect, effect)) input : outpu...
bool w_w_combinable_p(effect, effect)
@ is_action_write
Definition: effects.h:293
#define SEND
#define pips_user_warning
Definition: misc-local.h:146
#define STEP_DEBUG_STATEMENT(D, W, S)
Definition: defines-local.h:42

References anymodule_anywhere_region_p(), create_step_regions(), debug_print_effects_list(), FOREACH, free_approximation(), gen_full_free_list(), ifdebug, is_action_write, make_approximation_exact(), NIL, pips_debug, pips_user_warning, REGION, region_approximation, regions_dup(), RegionsIntersection(), STEP_DEBUG_STATEMENT, and w_w_combinable_p().

Referenced by compute_directive_regions().

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

◆ compute_SENDRECV_regions()

static bool compute_SENDRECV_regions ( statement  stmt,
bool exist_regions_p 
)
static

default: SEND/RECV regions are summarized at the body level of the current module. This will be modified later using the DG

When module call, compute translated SEND and RECV regions

Note: all entities present in the field call_function are not a module ie it could also be a numerical constant, an intrinsics...

default: SEND/RECV regions are summarized at the body level of the current module. This will be modified later using the DG

Definition at line 1078 of file analyse.c.

1079 {
1081 
1082  STEP_DEBUG_STATEMENT(2, "begin on stmt", stmt);
1083 
1085  {
1088  *exist_regions_p |= compute_directive_regions(drt);
1089 
1090  /* default: SEND/RECV regions are summarized at the body level of the current module.
1091  This will be modified later using the DG
1092  */
1094  }
1095  else
1096  {
1097  /* When module call, compute translated SEND and RECV regions
1098 
1099  Note: all entities present in the field call_function are not
1100  a module ie it could also be a numerical constant, an
1101  intrinsics...
1102  */
1104  {
1105  *exist_regions_p |= step_translate_and_map_step_regions(stmt);
1106  /* default: SEND/RECV regions are summarized at the body level of the current module.
1107  This will be modified later using the DG
1108  */
1110  }
1111  else
1112  pips_debug(2, "no STEP region to compute\n");
1113  }
1114 
1115  pips_debug(2, "end\n");
1116  return true;
1117 }
static bool step_translate_and_map_step_regions(statement stmt)
Definition: analyse.c:1021
static void step_summarize_and_map_step_regions(statement stmt)
Definition: analyse.c:822
static bool compute_directive_regions(step_directive drt)
Definition: analyse.c:888
call statement_call(statement)
Get the call of a statement.
Definition: statement.c:1406
bool statement_call_p(statement)
Definition: statement.c:364
bool entity_module_p(entity e)
Definition: entity.c:683
#define call_function(x)
Definition: ri.h:709
bool step_directives_bound_p(statement stmt)
Definition: directives.c:121
step_directive step_directives_load(statement stmt)
Definition: directives.c:116

References assert, call_function, compute_directive_regions(), entity_module_p(), pips_debug, statement_call(), statement_call_p(), statement_undefined_p, STEP_DEBUG_STATEMENT, step_directive_block, step_directives_bound_p(), step_directives_load(), step_summarize_and_map_step_regions(), and step_translate_and_map_step_regions().

Referenced by step_compute_SENDRECV_regions().

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

◆ concerned_entity_p()

static bool concerned_entity_p ( effect  eff,
list  regions 
)
static

Definition at line 1119 of file analyse.c.

1120 {
1121  pips_debug(4, "begin\n");
1122  FOREACH(REGION, reg, regions)
1123  {
1124  pips_debug(5, "\n eff %s regions %s\n", text_to_string(text_region(eff)), text_to_string(text_region(reg)));
1125  if (effect_comparable_p(eff, reg))
1126  {
1127  pips_debug(4, "end TRUE\n");
1128  return true;
1129  }
1130  }
1131  pips_debug(4, "end FALSE\n");
1132  return false;
1133 }
text text_region(effect)
bool effect_comparable_p(effect, effect)
Can we merge these two effects because they are equal or because they only differ by their approximat...
Definition: effects.c:587
string text_to_string(text t)
SG: moved here from ricedg.
Definition: print.c:239

References effect_comparable_p(), FOREACH, pips_debug, REGION, text_region(), and text_to_string().

Referenced by step_compute_CHAINS_DG_remove_summary_regions().

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

◆ create_step_regions()

static list create_step_regions ( statement  stmt,
list  regions_l,
enum action_utype  action_tag 
)
static

remove omp private from send and recv regions

Remove precondition contrainte

Definition at line 406 of file analyse.c.

407 {
408  list regions_final = NIL;
409 
410  pips_debug(2,"begin\n");
411 
412  FOREACH(REGION, reg, regions_l)
413  {
415  {
416  /* remove omp private from send and recv regions */
417  pips_debug(2,"drop private entity %s\n", entity_name(region_entity(reg)));
418  continue;
419  }
420  if (io_effect_p(reg) || std_file_effect_p(reg))
421  {
422  pips_debug(2,"drop I/O effect on %s\n", entity_name(region_entity(reg)));
423  continue;
424  }
426  {
427  pips_debug(2,"drop effect on FILE * : %s\n", entity_name(region_entity(reg)));
428  continue;
429  }
430  if (entity_scalar_p(region_entity(reg)))
431  {
432  pips_debug(2,"drop scalar region %s\n", entity_name(region_entity(reg)));
433  continue;
434  }
435 
436  /* Remove precondition contrainte */
437  transformer stmt_precondition = load_statement_precondition(stmt);
438  Psysteme sc = predicate_system(transformer_relation(stmt_precondition));
440 
442 
444  switch (action_tag)
445  {
446  case is_action_read:
448  break;
449  case is_action_write:
451  break;
452  default:
453  pips_assert("unknown action_tag", 0);
454  }
455 
456  regions_final = CONS(REGION, r, regions_final);
457  }
459 
460  pips_debug(2,"end\n");
461  return regions_final;
462 }
void free_action(action p)
Definition: effects.c:80
region rectangularization_region(region reg)
Definition: analyse.c:395
int compare_effect_reference(effect *e1, effect *e2)
int compare_effect_reference(e1, e2):
Definition: compare.c:210
#define region_any_reference(reg)
To be avoided.
#define region_action(reg)
#define region_entity(reg)
#define region_system(reg)
#define region
simulation of the type region
action make_action_write_memory(void)
To ease the extension of action with action_kind.
Definition: effects.c:1011
bool FILE_star_effect_reference_p(reference)
Definition: effects.c:536
bool std_file_effect_p(effect)
Definition: effects.c:519
action make_action_read_memory(void)
Definition: effects.c:1017
bool io_effect_p(effect)
Definition: effects.c:501
#define action_tag(x)
Definition: effects.h:310
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
Definition: list.c:796
int(* gen_cmp_func_t)(const void *, const void *)
Definition: newgen_types.h:114
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
Definition: variable.c:1113
#define entity_name(x)
Definition: ri.h:2790
#define transformer_relation(x)
Definition: ri.h:2873
#define predicate_system(x)
Definition: ri.h:2069
Psysteme extract_nredund_subsystem(Psysteme s1, Psysteme s2)
Psysteme extract_nredund_subsystem(s1, s2) Psysteme s1, s2;.
transformer load_statement_precondition(statement)
bool step_private_p(statement stmt, entity e)
Definition: directives.c:424

References action_tag, compare_effect_reference(), CONS, entity_name, entity_scalar_p(), extract_nredund_subsystem(), FILE_star_effect_reference_p(), FOREACH, free_action(), gen_sort_list(), io_effect_p(), is_action_read, is_action_write, load_statement_precondition(), make_action_read_memory(), make_action_write_memory(), NIL, pips_assert, pips_debug, predicate_system, rectangularization_region(), region, REGION, region_action, region_any_reference, region_dup(), region_entity, region_system, std_file_effect_p(), step_private_p(), and transformer_relation.

Referenced by compute_recv_regions(), and compute_send_regions().

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

◆ debug_print_effects_list()

void debug_print_effects_list ( list  l,
string  txt 
)
Parameters
txtxt

Definition at line 334 of file analyse.c.

335 {
336  if(ENDP(l))
337  pips_debug(1, "%s empty\n", txt);
338  else
339  {
340  bool property_prettyprint_scalar_regions = get_bool_property("PRETTYPRINT_SCALAR_REGIONS");
341  set_bool_property("PRETTYPRINT_SCALAR_REGIONS", true);
342 
343  FOREACH(EFFECT, eff, l)
344  {
345  string str_reg = text_to_string(text_rw_array_regions(CONS(EFFECT, eff, NIL)));
346  pips_debug(1, "%s %p : %s\n", txt, eff, str_reg); free(str_reg);
347  }
348  set_bool_property("PRETTYPRINT_SCALAR_REGIONS", property_prettyprint_scalar_regions);
349  }
350 }
text text_rw_array_regions(list)
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void free(void *)
void set_bool_property(const char *, bool)

References CONS, EFFECT, ENDP, FOREACH, free(), get_bool_property(), NIL, pips_debug, set_bool_property(), text_rw_array_regions(), and text_to_string().

Referenced by compute_recv_regions(), compute_send_regions(), step_analyse_CHAINS_DG(), step_print_directives_regions(), step_print_effect_path(), step_translate_and_map_step_regions(), step_update_comm(), and step_update_SUMMARY_SENDRECV_regions().

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

◆ get_directive_statement_region()

static effect get_directive_statement_region ( effect  reg)
static

Definition at line 289 of file analyse.c.

290 {
291  effect directive_statement_region;
292  pips_debug(4, "begin\n");
293 
295  assert(!ENDP(path));
296  directive_statement_region = step_point_data(STEP_POINT(CAR(path)));
297 
298  pips_debug(4, "end\n");
299  return directive_statement_region;
300 }
static list step_get_effect_path(effect start_eff)
Definition: analyse.c:262
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define step_point_data(x)
Definition: step_private.h:472
#define STEP_POINT(x)
STEP_POINT.
Definition: step_private.h:437

References assert, CAR, ENDP, pips_debug, step_get_effect_path(), STEP_POINT, and step_point_data.

Referenced by step_set_step_partial().

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

◆ interlaced_basic_workchunk_regions_p()

static bool interlaced_basic_workchunk_regions_p ( region  reg,
list  index_l 
)
static

Definition at line 622 of file analyse.c.

623 {
624  if(ENDP(index_l))
625  return false;
626 
627  bool interlaced_p;
628  Psysteme s = sc_copy(region_system(reg));
629  Psysteme s_prime = sc_copy(s);
630 
631  FOREACH(ENTITY, index, index_l)
632  {
633  add_intermediate_value(index);
634  entity index_prime = entity_to_intermediate_value(index);
635  s_prime = sc_variable_rename(s_prime, (Variable)index, (Variable)index_prime);
636 
637  // contrainte I<I' qui s'ecrit : I-I'+1 <= 0
639  (Variable) index, VALUE_ONE,
640  (Variable) index_prime, VALUE_MONE,
641  TCST, VALUE_ONE));
642  sc_add_inegalite(s, c);
643  }
644 
645  s = sc_append(s, s_prime);
646  sc_rm(s_prime);
647 
648  s->base = BASE_NULLE;
649  sc_creer_base(s);
650 
651  interlaced_p = sc_integer_feasibility_ofl_ctrl(s, NO_OFL_CTRL, true);
652 
653  sc_rm(s);
654  pips_debug(2,"check interlaced %s : %s\n", entity_name(region_entity(reg)), interlaced_p?"true":"false");
655  return interlaced_p;
656 }
#define VALUE_MONE
#define VALUE_ONE
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
Psysteme sc_variable_rename(Psysteme s, Variable v_old, Variable v_new)
Psysteme sc_variable_rename(Psysteme s, Variable v_old, Variable v_new): reecriture du systeme s remp...
Definition: sc.c:157
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Definition: sc_alloc.c:277
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
Psysteme sc_copy(Psysteme ps)
Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans...
Definition: sc_alloc.c:230
bool sc_integer_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
Pbase base
Definition: sc-local.h:75
entity entity_to_intermediate_value(entity)
Definition: value.c:879
void add_intermediate_value(entity)
Definition: value.c:1476
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define NO_OFL_CTRL
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
#define BASE_NULLE
MACROS SUR LES BASES.
Pvecteur vect_make(Pvecteur v, Variable var, Value val,...)
Pvecteur vect_make(v, [var, val,]* 0, val) Pvecteur v; // may be NULL, use assigne anyway Variable va...
Definition: alloc.c:165

References add_intermediate_value(), Ssysteme::base, BASE_NULLE, contrainte_make(), ENDP, ENTITY, entity_name, entity_to_intermediate_value(), FOREACH, NO_OFL_CTRL, pips_debug, region_entity, region_system, sc_add_inegalite(), sc_append(), sc_copy(), sc_creer_base(), sc_integer_feasibility_ofl_ctrl(), sc_rm(), sc_variable_rename(), TCST, VALUE_MONE, VALUE_ONE, vect_make(), and VECTEUR_NUL.

Referenced by step_compute_step_interlaced().

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

◆ load_step_comm()

void load_step_comm ( void  )

Definition at line 190 of file analyse.c.

191 {
192  step_comm comms = (step_comm)db_get_memory_resource(DBR_STEP_COMM, "", true);
193 
194  set_step_effect_path(step_comm_path(comms));
195  set_step_interlaced(step_comm_interlaced(comms));
196  set_step_partial(step_comm_partial(comms));
197 }
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define step_comm_partial(x)
Definition: step_private.h:353
#define step_comm_path(x)
Definition: step_private.h:349
struct _newgen_struct_step_comm_ * step_comm
Definition: step_private.h:75
#define step_comm_interlaced(x)
Definition: step_private.h:351

References db_get_memory_resource(), step_comm_interlaced, step_comm_partial, and step_comm_path.

Referenced by step_analyse(), and step_compile_analysed_module().

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

◆ rectangularization_region()

region rectangularization_region ( region  reg)

Definition at line 395 of file analyse.c.

396 {
399  Pbase phis = list_to_base(ephis);
400  gen_free_list(ephis);
402  base_rm(phis);
403  return reg;
404 }
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
Pbase list_to_base(list l)
Pbase list_to_base(list l): returns the Pbase that contains the variables of list "l",...
Psysteme sc_rectangular_hull(Psysteme, Pbase)
take the rectangular bounding box of the systeme sc, by projecting each constraint of the systeme aga...
Definition: sc_enveloppe.c:456
list expressions_to_entities(list expressions)
map expression_to_entity on expressions
Definition: expression.c:3161
#define reference_indices(x)
Definition: ri.h:2328
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
#define base_rm(b)

References base_rm, expressions_to_entities(), gen_free_list(), list_to_base(), reference_indices, region_any_reference, region_system, and sc_rectangular_hull().

Referenced by create_step_regions(), and loop_basic_workchunk_to_workchunk().

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

◆ reset_step_comm()

void reset_step_comm ( void  )

Definition at line 199 of file analyse.c.

200 {
201  reset_step_effect_path();
202  reset_step_interlaced();
203  reset_step_partial();
204 }

Referenced by step_compile_analysed_module().

+ Here is the caller graph for this function:

◆ step_add_point_into_effect_path()

static void step_add_point_into_effect_path ( effect  new_eff,
entity  module,
statement  stmt,
effect  previous_eff 
)
static

Definition at line 227 of file analyse.c.

228 {
229  pips_debug(4, "begin\n");
230  step_point point;
231  point = make_step_point(module, stmt, previous_eff);
232  store_step_effect_path(new_eff, point);
233  pips_debug(4, "end\n");
234 }
step_point make_step_point(entity a1, statement a2, effect a3)
Definition: step_private.c:447

References make_step_point(), module, and pips_debug.

Referenced by step_init_effect_path(), step_translate_and_map(), and summarize_and_map_step_regions().

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

◆ step_analyse()

bool step_analyse ( const char *  module_name)

remove_from_summary_send et remove_from_summary_recv contain only directive regions and translated regions. They do not contain summary regions.

Parameters
module_nameodule_name

Definition at line 1429 of file analyse.c.

1430 {
1431  debug_on("STEP_ANALYSE_DEBUG_LEVEL");
1432  bool exist_regions_p;
1433  pips_debug(2, "begin %d module_name = %s\n", __LINE__, module_name);
1434 
1437 
1441 
1442  statement body = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
1445 
1448 
1450 
1451  load_step_comm();
1452 
1454 
1455  init_step_send_regions();
1456  init_step_recv_regions();
1457 
1458  exist_regions_p = step_compute_SENDRECV_regions(module, body);
1459 
1460  pips_debug(2, "exist_regions_p = %d\n", exist_regions_p);
1461 
1462  if(exist_regions_p)
1463  {
1464  set remove_from_summary_send, remove_from_summary_recv;
1465  list full_send_l, partial_send_l;
1466 
1467  step_analyse_CHAINS_DG(module_name, &remove_from_summary_send, &remove_from_summary_recv);
1468 
1469  /* remove_from_summary_send et remove_from_summary_recv contain
1470  only directive regions and translated regions. They do not
1471  contain summary regions. */
1472 
1473  step_update_SUMMARY_SENDRECV_regions(remove_from_summary_send, remove_from_summary_recv, &full_send_l, &partial_send_l);
1474 
1475  /*
1476  full_send_l are TRANSLATED or DIRECTIVE regions.
1477  partial_send_l are SUMMARY regions.
1478  */
1479  step_update_comm(full_send_l, partial_send_l);
1480  }
1481 
1482  DB_PUT_MEMORY_RESOURCE(DBR_STEP_SEND_REGIONS, module_name, get_step_send_regions());
1483  DB_PUT_MEMORY_RESOURCE(DBR_STEP_RECV_REGIONS, module_name, get_step_recv_regions());
1484 
1485  reset_step_send_regions();
1486  reset_step_recv_regions();
1487 
1489 
1490  store_step_comm();
1491 
1493 
1496 
1499 
1500  reset_in_effects();
1502  reset_rw_effects();
1503 
1505 
1506  pips_debug(2, "End step_analyse\n");
1507  debug_off();
1508  return true;
1509 }
static void step_analyse_CHAINS_DG(const char *module_name, set *remove_from_summary_send, set *remove_from_summary_recv)
Definition: analyse.c:1248
static void step_update_SUMMARY_SENDRECV_regions(set remove_from_summary_send, set remove_from_summary_recv, list *full_send_l, list *partial_send_l)
Definition: analyse.c:1340
static void step_statement_path_init(statement body)
Definition: analyse.c:71
void load_step_comm()
Definition: analyse.c:190
static bool step_compute_SENDRECV_regions(entity module, statement body)
Definition: analyse.c:1413
void store_step_comm()
Definition: analyse.c:206
static void step_statement_path_finalize(void)
Definition: analyse.c:80
static void step_update_comm(list full_send_l, list partial_send_l)
Definition: analyse.c:1383
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void init_convex_rw_regions(const char *)
Definition: methods.c:495
void set_methods_for_convex_effects(void)
methods.c
Definition: methods.c:235
void reset_convex_rw_regions(const char *)
Definition: methods.c:560
void set_rw_effects(statement_effects)
void reset_out_effects(void)
void set_out_effects(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
void generic_effects_reset_all_methods(void)
void reset_rw_effects(void)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
void step_directives_reset()
Definition: directives.c:103
void step_directives_init(bool first_p)
Definition: directives.c:88
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, generic_effects_reset_all_methods(), init_convex_rw_regions(), load_step_comm(), local_name_to_top_level_entity(), module, module_name(), pips_debug, reset_convex_rw_regions(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_ordering_to_statement(), reset_out_effects(), reset_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_methods_for_convex_effects(), set_ordering_to_statement(), set_out_effects(), set_rw_effects(), step_analyse_CHAINS_DG(), step_compute_SENDRECV_regions(), step_directives_init(), step_directives_reset(), step_statement_path_finalize(), step_statement_path_init(), step_update_comm(), step_update_SUMMARY_SENDRECV_regions(), and store_step_comm().

+ Here is the call graph for this function:

◆ step_analyse_CHAINS_DG()

static void step_analyse_CHAINS_DG ( const char *  module_name,
set remove_from_summary_send,
set remove_from_summary_recv 
)
static

for graph data structure, see newgen/graph.pdf

CHAINS is computed by the REGION_CHAINS phase.

Definition at line 1248 of file analyse.c.

1249 {
1250  graph dependences_graph = (graph) db_get_memory_resource(DBR_CHAINS, module_name, true);
1251 
1252  *remove_from_summary_send = set_make(set_pointer);
1253  *remove_from_summary_recv = set_make(set_pointer);
1254 
1255  pips_debug(1, "################ CHAINS DG %s ###############\n", module_name);
1256 
1257  /* for graph data structure, see newgen/graph.pdf */
1258  /* CHAINS is computed by the REGION_CHAINS phase. */
1259 
1260  FOREACH(VERTEX, v1, graph_vertices(dependences_graph))
1261  {
1263  {
1266  list s1_send_l = NIL;
1267  list s2_recv_l = NIL;
1268 
1269  ifdebug(2)
1270  {
1271  pips_debug(2, "new s1->s2 \n");
1273  pips_debug(2, "to %s", safe_statement_identification(s2));
1274  STEP_DEBUG_STATEMENT(2, "statement s1", s1);
1275  STEP_DEBUG_STATEMENT(2, "statement s2", s2);
1276  }
1277 
1278 
1279  step_compute_CHAINS_DG_SENDRECV_regions(s1, s2, &s1_send_l, &s2_recv_l);
1280 
1281  ifdebug(2)
1282  {
1283  debug_print_effects_list(s1_send_l, "SEND S1");
1284  debug_print_effects_list(s2_recv_l, "RECV S2");
1285  }
1286 
1287  step_compute_CHAINS_DG_remove_summary_regions(su, s1_send_l, s2_recv_l, remove_from_summary_send, remove_from_summary_recv);
1288 
1289  pips_debug(2, "end statement s1->s2\n");
1290  }
1291  }
1292  pips_debug(2, "end\n");
1293 }
static void step_compute_CHAINS_DG_SENDRECV_regions(statement s1, statement s2, list *s1_send_l, list *s2_recv_l)
Definition: analyse.c:1205
static void step_compute_CHAINS_DG_remove_summary_regions(successor su, list source_send_l, list sink_recv_l, set *remove_from_summary_send, set *remove_from_summary_recv)
Definition: analyse.c:1149
#define successor_vertex(x)
Definition: graph.h:118
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
#define vertex_successors(x)
Definition: graph.h:154
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
string safe_statement_identification(statement)
Definition: statement.c:1726
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
Definition: util.c:45
@ set_pointer
Definition: newgen_set.h:44
set set_make(set_type)
Create an empty set of any type but hash_private.
Definition: set.c:102
s1
Definition: set.c:247

References db_get_memory_resource(), debug_print_effects_list(), FOREACH, graph_vertices, ifdebug, module_name(), NIL, pips_debug, s1, safe_statement_identification(), set_make(), set_pointer, step_compute_CHAINS_DG_remove_summary_regions(), step_compute_CHAINS_DG_SENDRECV_regions(), STEP_DEBUG_STATEMENT, SUCCESSOR, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().

Referenced by step_analyse().

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

◆ step_analyse_init()

bool step_analyse_init ( const string  module_name)

init intrinsics

other intrinsics

Parameters
module_nameodule_name

Definition at line 361 of file analyse.c.

362 {
363  pips_debug(2, "begin for module \"%s\".\n", module_name);
365 
366  string srcpath = strdup(PIPS_RUNTIME_DIR "/" STEP_DEFAULT_RT_H);
367  string old_path = pips_srcpath_append(srcpath);
368  free(old_path);
369  free(srcpath);
370 
371  /* init intrinsics */
372  static struct intrin {
373  char * name;
374  intrinsic_desc_t desc;
375  } step_intrinsics [] = {
376 #include "STEP_RT_intrinsic.h"
377  { NULL , {NULL, 0} }
378  };
379  for(struct intrin *p = step_intrinsics;p->name;++p)
380  register_intrinsic_handler(p->name,&(p->desc));
381 
382  /* other intrinsics */
383  static IntrinsicDescriptor IntrinsicTypeDescriptorTable[] =
384  {
385 #include "STEP_RT_bootstrap.h"
386  {NULL, 0, 0, 0, 0}
387  };
388  for(IntrinsicDescriptor *p=IntrinsicTypeDescriptorTable;p->name;p++)
390 
391  pips_debug(2, "end\n");
392  return true;
393 }
map_effect_bool make_map_effect_bool(void)
Definition: step_private.c:52
step_comm make_step_comm(map_effect_step_point a1, map_effect_bool a2, map_effect_bool a3)
Definition: step_private.c:306
map_effect_step_point make_map_effect_step_point(void)
Definition: step_private.c:109
void register_intrinsic_type_descriptor(IntrinsicDescriptor *p)
This function is called one time (at the very beginning) to create all intrinsic functions.
Definition: bootstrap.c:4411
string pips_srcpath_append(string)
returns an allocated pointer to the old value
Definition: source_file.c:177
void register_intrinsic_handler(const char *name, intrinsic_desc_t *desc)
after this call, name and desc are owned by intrinsic_handlers, but will never be deallocated they mu...
Definition: misc.c:2517
char * strdup()
#define STEP_DEFAULT_RT_H
Definition: defines-local.h:45
The following data structure describes an intrinsic function: its name and its arity and its type,...
for intrinsic registration

References DB_PUT_MEMORY_RESOURCE, free(), make_map_effect_bool(), make_map_effect_step_point(), make_step_comm(), module_name(), IntrinsicDescriptor::name, pips_debug, pips_srcpath_append(), register_intrinsic_handler(), register_intrinsic_type_descriptor(), STEP_DEFAULT_RT_H, and strdup().

+ Here is the call graph for this function:

◆ step_analysed_module_p()

bool step_analysed_module_p ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 179 of file analyse.c.

180 {
181  return db_resource_required_or_available_p(DBR_STEP_SEND_REGIONS, module_name);
182 }
bool db_resource_required_or_available_p(const char *rname, const char *oname)
from now on we must not know about the database internals?
Definition: database.c:505

References db_resource_required_or_available_p(), and module_name().

Referenced by step_compile(), and step_compile_generated_module().

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

◆ step_compute_CHAINS_DG_remove_summary_regions()

static void step_compute_CHAINS_DG_remove_summary_regions ( successor  su,
list  source_send_l,
list  sink_recv_l,
set remove_from_summary_send,
set remove_from_summary_recv 
)
static

a arc label in this CHAINS DG graph is a list of conflicts, see dg.pdf

WRITE-READ dependence

Definition at line 1149 of file analyse.c.

1150 {
1151  pips_debug(2, "begin\n");
1152  /* a arc label in this CHAINS DG graph is a list of conflicts, see dg.pdf */
1153 
1155  {
1156  effect source_eff = conflict_source(c);
1157  effect sink_eff = conflict_sink(c);
1158 
1159  pips_debug(2,"Conflict source_eff sink_eff\n");
1160 
1161  if(!(effect_write_p(source_eff) && effect_read_p(sink_eff)))
1162  {
1163  pips_debug(2,"not WRITE->READ dependence (ignored)\n");
1164  continue;
1165  }
1166 
1167 
1168  /* WRITE-READ dependence */
1169  pips_debug(2, "Dependence :\n\t\t%s from\t%s\t\t%s to \t%s",
1170  effect_to_string(source_eff), text_to_string(text_region(source_eff)),
1171  effect_to_string(sink_eff), text_to_string(text_region(sink_eff)));
1172 
1173  bool source_send_p = concerned_entity_p(source_eff, source_send_l);
1174  bool sink_recv_p = concerned_entity_p(sink_eff, sink_recv_l);
1175 
1176  if (source_send_p)
1177  {
1178  if (sink_recv_p)
1179  {
1180  pips_debug(2,"optimizable SEND, SEND and RECV are already summarized at the module level\n");
1181  }
1182  else
1183  {
1184  pips_debug(2,"unoptimizable SEND (no matching RECV)\n");
1185 
1186  step_get_comparable_effects(source_send_l, source_eff, remove_from_summary_send);
1187  }
1188 
1189  continue;
1190  }
1191 
1192  if (sink_recv_p)
1193  {
1194  pips_debug(2,"no corresponding SEND, remove RECV from summarized list at the module level\n");
1195 
1196  step_get_comparable_effects(sink_recv_l, sink_eff, remove_from_summary_recv);
1197  continue;
1198  }
1199 
1200  pips_debug(2,"no SEND/RECV for %s\n",effect_to_string(source_eff));
1201  }
1202  pips_debug(2, "end\n");
1203 }
static bool concerned_entity_p(effect eff, list regions)
Definition: analyse.c:1119
static void step_get_comparable_effects(list eff_list, effect eff, set *effects_set)
Definition: analyse.c:1135
#define conflict_sink(x)
Definition: dg.h:167
#define CONFLICT(x)
CONFLICT.
Definition: dg.h:134
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define conflict_source(x)
Definition: dg.h:165
string effect_to_string(effect)
#define effect_write_p(eff)
#define effect_read_p(eff)
#define effect_scalar_p(eff) entity_scalar_p(effect_entity(eff))
#define successor_arc_label(x)
Definition: graph.h:116

References concerned_entity_p(), CONFLICT, conflict_sink, conflict_source, dg_arc_label_conflicts, effect_read_p, effect_to_string(), effect_write_p, FOREACH, pips_debug, step_get_comparable_effects(), successor_arc_label, text_region(), and text_to_string().

Referenced by step_analyse_CHAINS_DG().

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

◆ step_compute_CHAINS_DG_SENDRECV_regions()

static void step_compute_CHAINS_DG_SENDRECV_regions ( statement  s1,
statement  s2,
list s1_send_l,
list s2_recv_l 
)
static

compute first directive statement on suffix_sp1 and suffix_sp2

Get directive region

no directive on path thus if regions corresponding to s1 exist, they are translated regions

Get directive region

no directive on path thus if regions corresponding to s1 exist, they are translated regions

Definition at line 1205 of file analyse.c.

1206 {
1207  pips_debug(3, "begin\n");
1208 
1209  /* compute first directive statement on suffix_sp1 and suffix_sp2 */
1210  list suffix_sp1, suffix_sp2;
1211  list __attribute__ ((unused)) common_sp = step_statement_path_factorise(s1, s2, &suffix_sp1, &suffix_sp2);
1212 
1213  statement first_directive_stmt1 = gen_find_if((gen_filter_func_t)step_directives_bound_p, suffix_sp1, gen_chunk_identity);
1214  statement first_directive_stmt2 = gen_find_if((gen_filter_func_t)step_directives_bound_p, suffix_sp2, gen_chunk_identity);
1215 
1216 
1217  if(!statement_undefined_p(first_directive_stmt1))
1218  {
1219  STEP_DEBUG_STATEMENT(3, "directive on statement path suffix_sp1", first_directive_stmt1);
1220  /* Get directive region */
1221  *s1_send_l = step_send_regions_list_load(first_directive_stmt1);
1222  }
1223  else
1224  {
1225  pips_debug(3, "no directive on statement path suffix_sp1\n");
1226  /* no directive on path thus if regions corresponding to s1 exist, they are translated regions */
1227  if (bound_step_send_regions_p(s1))
1228  *s1_send_l = step_send_regions_list_load(s1);
1229  }
1230 
1231  if(!statement_undefined_p(first_directive_stmt2))
1232  {
1233  STEP_DEBUG_STATEMENT(3, "directive on statement path suffix_sp2", first_directive_stmt2);
1234  /* Get directive region */
1235  *s2_recv_l = step_recv_regions_list_load(first_directive_stmt2);
1236  }
1237  else
1238  {
1239  pips_debug(3, "no directive on statement path suffix_sp2\n");
1240  /* no directive on path thus if regions corresponding to s1 exist, they are translated regions */
1241  if (bound_step_recv_regions_p(s2))
1242  *s2_recv_l = step_recv_regions_list_load(s2);
1243  }
1244 
1245  pips_debug(3, "end\n");
1246 }
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
Definition: 3dnow.h:3
static list step_send_regions_list_load(statement s)
Definition: analyse.c:665
static list step_statement_path_factorise(statement s1, statement s2, list *suffix_sp1, list *suffix_sp2)
Definition: analyse.c:141
static list step_recv_regions_list_load(statement s)
Definition: analyse.c:710
void * gen_chunk_identity(gen_chunk x)
Definition: genClib.c:2812
void * gen_find_if(gen_filter_func_t test, const list l, gen_extract_func_t extract)
Definition: list.c:370
bool(* gen_filter_func_t)(const void *)
Definition: newgen_types.h:109

References gen_chunk_identity(), gen_find_if(), pips_debug, s1, statement_undefined_p, STEP_DEBUG_STATEMENT, step_directives_bound_p(), step_recv_regions_list_load(), step_send_regions_list_load(), and step_statement_path_factorise().

Referenced by step_analyse_CHAINS_DG().

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

◆ step_compute_SENDRECV_regions()

static bool step_compute_SENDRECV_regions ( entity  module,
statement  body 
)
static

Initialization of summary regions

Definition at line 1413 of file analyse.c.

1414 {
1415  bool exist_regions_p = false;
1416  pips_debug(2, "################ REGIONS %s ###############\n", entity_name(module));
1417 
1418  /* Initialization of summary regions */
1421 
1423 
1424  pips_debug(2, "end exist_regions_p = %d\n", exist_regions_p);
1425  return exist_regions_p;
1426 }
static bool compute_SENDRECV_regions(statement stmt, bool *exist_regions_p)
Definition: analyse.c:1078
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362

References compute_SENDRECV_regions(), entity_name, gen_context_recurse, gen_null2(), module, NIL, pips_debug, statement_domain, step_recv_regions_list_store(), and step_send_regions_list_store().

Referenced by step_analyse().

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

◆ step_compute_step_interlaced()

static void step_compute_step_interlaced ( list  send_l,
step_directive  d 
)
static

Definition at line 875 of file analyse.c.

876 {
878  FOREACH(REGION, reg, send_l)
879  {
880  bool interlaced_p = interlaced_basic_workchunk_regions_p(reg, index_l);
881  store_step_interlaced(reg, interlaced_p);
882  }
883 }
static bool interlaced_basic_workchunk_regions_p(region reg, list index_l)
Definition: analyse.c:622
list step_directive_basic_workchunk_index(step_directive d)
Definition: directives.c:320

References FOREACH, interlaced_basic_workchunk_regions_p(), REGION, and step_directive_basic_workchunk_index().

Referenced by compute_directive_regions().

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

◆ step_get_comparable_effects()

static void step_get_comparable_effects ( list  eff_list,
effect  eff,
set effects_set 
)
static

Definition at line 1135 of file analyse.c.

1136 {
1137  pips_debug(2, "begin\n");
1138  FOREACH(EFFECT, eff2, eff_list)
1139  {
1140  if (effect_comparable_p(eff, eff2))
1141  {
1142  pips_debug(2,"############################# unoptimizable %p %s\n", eff2, entity_name(effect_entity(eff2)));
1143  *effects_set = set_add_element(*effects_set, *effects_set, eff2);
1144  }
1145  }
1146  pips_debug(2, "end\n");
1147 }
entity effect_entity(effect)
cproto-generated files
Definition: effects.c:52
set set_add_element(set, const set, const void *)
Definition: set.c:152

References EFFECT, effect_comparable_p(), effect_entity(), entity_name, FOREACH, pips_debug, and set_add_element().

Referenced by step_compute_CHAINS_DG_remove_summary_regions().

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

◆ step_get_effect_path()

static list step_get_effect_path ( effect  start_eff)
static

Definition at line 262 of file analyse.c.

263 {
264  list path = NIL;
265  effect current_eff = start_eff ;
266 
267  pips_debug(4, "begin\n");
268  while(bound_step_effect_path_p(current_eff))
269  {
270  step_point point = load_step_effect_path(current_eff);
271 
272  path = CONS(STEP_POINT, point, path);
273 
274  if (step_point_data(point) == current_eff)
275  break;
276 
277  current_eff = step_point_data(point);
278  }
279 
280  ifdebug(5)
281  {
283  }
284 
285  pips_debug(4, "end\n");
286  return path;
287 }
static void step_print_effect_path(list path)
Definition: analyse.c:236

References CONS, ifdebug, NIL, pips_debug, STEP_POINT, step_point_data, and step_print_effect_path().

Referenced by get_directive_statement_region().

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

◆ step_init_effect_path()

static void step_init_effect_path ( entity  module,
statement  stmt,
list  regions_l 
)
static

Add an initial point into the path, key effect is equal to data field (effect) used as stop condition in step_get_path()

Definition at line 464 of file analyse.c.

465 {
466  pips_debug(4,"begin\n");
467 
468  FOREACH(REGION, reg, regions_l)
469  {
470  /* Add an initial point into the path,
471  key effect is equal to data field (effect)
472  used as stop condition in step_get_path() */
474  }
475 
476  pips_debug(4,"end\n");
477 }
static void step_add_point_into_effect_path(effect new_eff, entity module, statement stmt, effect previous_eff)
Definition: analyse.c:227

References FOREACH, module, pips_debug, REGION, and step_add_point_into_effect_path().

Referenced by compute_directive_regions().

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

◆ step_initialize_step_partial()

static void step_initialize_step_partial ( list  send_l)
static

All SENDs are initialized as PARTIAL

Definition at line 865 of file analyse.c.

866 {
867  FOREACH(REGION, reg, send_l)
868  {
869  /* All SENDs are initialized as PARTIAL */
871  }
872 }
static void step_set_communication_type_partial(effect send_region)
Definition: analyse.c:329

References FOREACH, REGION, and step_set_communication_type_partial().

Referenced by compute_directive_regions().

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

◆ step_interlaced_p()

bool step_interlaced_p ( region  reg)

Definition at line 167 of file analyse.c.

168 {
169  assert(bound_step_interlaced_p(reg));
170  return load_step_interlaced(reg);
171 }

References assert.

Referenced by region_interlaced_p().

+ Here is the caller graph for this function:

◆ step_partial_p()

bool step_partial_p ( region  reg)

Definition at line 173 of file analyse.c.

174 {
175  assert(bound_step_partial_p(reg));
176  return load_step_partial(reg);
177 }

References assert.

Referenced by comm_partial_p().

+ Here is the caller graph for this function:

◆ step_print_directives_regions()

static void step_print_directives_regions ( step_directive  d,
list  send_l,
list  recv_l 
)
static

Definition at line 757 of file analyse.c.

758 {
759  pips_debug(2, "begin\n");
760  ifdebug(2)
761  {
762  statement stmt_basic_workchunk = step_directive_basic_workchunk(d);
763  assert(!statement_undefined_p(stmt_basic_workchunk));
764 
765  list rw_l = load_rw_effects_list(stmt_basic_workchunk);
766  list in_l = load_in_effects_list(stmt_basic_workchunk);
767  list out_l = load_out_effects_list(stmt_basic_workchunk);
768 
769  string str_reg;
770  bool property_prettyprint_scalar_regions = get_bool_property("PRETTYPRINT_SCALAR_REGIONS");
771  set_bool_property("PRETTYPRINT_SCALAR_REGIONS", true);
772 
773  str_reg = text_to_string(text_rw_array_regions(rw_l));
774  pips_debug(1, "REGIONS RW : %s\n", str_reg); free(str_reg);
775  str_reg = text_to_string(text_rw_array_regions(in_l));
776  pips_debug(1, "REGIONS IN : %s\n", str_reg); free(str_reg);
777  str_reg = text_to_string(text_rw_array_regions(out_l));
778  pips_debug(1, "REGIONS OUT : %s\n", str_reg); free(str_reg);
779 
780  set_bool_property("PRETTYPRINT_SCALAR_REGIONS", property_prettyprint_scalar_regions);
781  }
782 
783  debug_print_effects_list(recv_l, "REGION RECV");
784 
785  if(ENDP(send_l))
786  debug_print_effects_list(send_l, "REGION SEND");
787  else
788  {
789  FOREACH(REGION, r, send_l)
790  {
791  pips_assert("interlaced defined", bound_step_interlaced_p(r));
792  list l = CONS(EFFECT, r, NIL);
793  debug_print_effects_list(l, load_step_interlaced(r)?"REGION SEND INTERLACED":"REGION SEND");
794  gen_free_list(l);
795  }
796  }
797  pips_debug(2, "end\n");
798 }

References assert, CONS, debug_print_effects_list(), EFFECT, ENDP, FOREACH, free(), gen_free_list(), get_bool_property(), ifdebug, load_in_effects_list(), load_out_effects_list(), load_rw_effects_list(), NIL, pips_assert, pips_debug, REGION, set_bool_property(), statement_undefined_p, step_directive_basic_workchunk(), text_rw_array_regions(), and text_to_string().

Referenced by compute_directive_regions().

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

◆ step_print_effect_path()

static void step_print_effect_path ( list  path)
static

Definition at line 236 of file analyse.c.

237 {
238  int level=1;
239  FOREACH(STEP_POINT, point, path)
240  {
241  string txt = safe_statement_identification(step_point_stmt(point));
242  pips_debug(1, "level=%d module=%s statment= %s", level, entity_name(step_point_module(point)), txt);
243  free(txt);
244  debug_print_effects_list(CONS(EFFECT, step_point_data(point),NIL), "step_point_data :");
245  level++;
246  }
247 }
#define level
#define step_point_module(x)
Definition: step_private.h:468
#define step_point_stmt(x)
Definition: step_private.h:470

References CONS, debug_print_effects_list(), EFFECT, entity_name, FOREACH, free(), level, NIL, pips_debug, safe_statement_identification(), STEP_POINT, step_point_data, step_point_module, and step_point_stmt.

Referenced by step_get_effect_path().

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

◆ step_recv_regions_list_add()

static void step_recv_regions_list_add ( statement  stmt,
list  l_regions 
)
static

Definition at line 744 of file analyse.c.

745 {
746  pips_debug(4, "begin\n");
747 
748  pips_assert ("step_recv_regions", bound_step_recv_regions_p(stmt));
749 
750  effects e = load_step_recv_regions(stmt);
751  effects_effects(e) = gen_nconc(l_regions, effects_effects(e));
752  update_step_recv_regions(stmt, e);
753 
754  pips_debug(4, "end\n");
755 }
#define effects_effects(x)
Definition: effects.h:710
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344

References effects_effects, gen_nconc(), pips_assert, and pips_debug.

Referenced by step_summarize_and_map_step_regions().

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

◆ step_recv_regions_list_load()

static list step_recv_regions_list_load ( statement  s)
static

Definition at line 710 of file analyse.c.

711 {
712  pips_debug(4, "begin\n");
713  if (!bound_step_recv_regions_p(s))
714  return NIL;
715 
716  effects e = load_step_recv_regions(s);
717  ifdebug(8) pips_assert("recv regions loaded are consistent", effects_consistent_p(e));
718 
719  pips_debug(4, "end\n");
721 }
bool effects_consistent_p(effects p)
Definition: effects.c:541

References effects_consistent_p(), effects_effects, ifdebug, NIL, pips_assert, and pips_debug.

Referenced by step_compute_CHAINS_DG_SENDRECV_regions(), step_summarize_and_map_step_regions(), and step_update_SUMMARY_SENDRECV_regions().

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

◆ step_recv_regions_list_store()

static void step_recv_regions_list_store ( statement  s,
list  l_regions 
)
static

Definition at line 723 of file analyse.c.

724 {
725  pips_debug(4, "begin\n");
726  effects e = make_effects(l_regions);
727  ifdebug(8) pips_assert("recv regions to store are consistent", effects_consistent_p(e));
728  store_step_recv_regions(s, e);
729  pips_debug(4, "end\n");
730 }
effects make_effects(list a)
Definition: effects.c:568

References effects_consistent_p(), ifdebug, make_effects(), pips_assert, and pips_debug.

Referenced by compute_directive_regions(), step_compute_SENDRECV_regions(), and step_translate_and_map_step_regions().

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

◆ step_recv_regions_list_update()

static void step_recv_regions_list_update ( statement  s,
list  l_regions 
)
static

Definition at line 732 of file analyse.c.

733 {
734  pips_debug(4, "begin\n");
735  if (bound_step_recv_regions_p(s))
736  {
737  effects e = load_step_recv_regions(s);
738  effects_effects(e) = l_regions;
739  update_step_recv_regions(s, e);
740  }
741  pips_debug(4, "end\n");
742 }

References effects_effects, and pips_debug.

Referenced by step_update_SUMMARY_SENDRECV_regions().

+ Here is the caller graph for this function:

◆ step_send_regions_list_add()

static void step_send_regions_list_add ( statement  stmt,
list  l_regions 
)
static

Definition at line 698 of file analyse.c.

699 {
700  pips_debug(4, "begin\n");
701  pips_assert ("step_send_regions", bound_step_send_regions_p(stmt));
702 
703  effects e = load_step_send_regions(stmt);
704  effects_effects(e) = gen_nconc(l_regions, effects_effects(e));
705  update_step_send_regions(stmt, e);
706 
707  pips_debug(4, "end\n");
708 }

References effects_effects, gen_nconc(), pips_assert, and pips_debug.

Referenced by step_summarize_and_map_step_regions().

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

◆ step_send_regions_list_load()

static list step_send_regions_list_load ( statement  s)
static

Definition at line 665 of file analyse.c.

666 {
667  pips_debug(4, "begin\n");
668  if (!bound_step_send_regions_p(s))
669  return NIL;
670 
671  effects e = load_step_send_regions(s);
672  ifdebug(8) pips_assert("send regions loaded are consistent", effects_consistent_p(e));
673  pips_debug(4, "end\n");
675 }

References effects_consistent_p(), effects_effects, ifdebug, NIL, pips_assert, and pips_debug.

Referenced by step_compute_CHAINS_DG_SENDRECV_regions(), step_summarize_and_map_step_regions(), and step_update_SUMMARY_SENDRECV_regions().

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

◆ step_send_regions_list_store()

static void step_send_regions_list_store ( statement  s,
list  l_regions 
)
static

Definition at line 677 of file analyse.c.

678 {
679  pips_debug(4, "begin\n");
680  effects e = make_effects(l_regions);
681  ifdebug(8) pips_assert("send regions to store are consistent", effects_consistent_p(e));
682  store_step_send_regions(s, e);
683  pips_debug(4, "end\n");
684 }

References effects_consistent_p(), ifdebug, make_effects(), pips_assert, and pips_debug.

Referenced by compute_directive_regions(), step_compute_SENDRECV_regions(), and step_translate_and_map_step_regions().

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

◆ step_send_regions_list_update()

static void step_send_regions_list_update ( statement  s,
list  l_regions 
)
static

Definition at line 686 of file analyse.c.

687 {
688  pips_debug(4, "begin\n");
689  if (bound_step_send_regions_p(s))
690  {
691  effects e = load_step_send_regions(s);
692  effects_effects(e) = l_regions;
693  update_step_send_regions(s, e);
694  }
695  pips_debug(4, "end\n");
696 }

References effects_effects, and pips_debug.

Referenced by step_update_SUMMARY_SENDRECV_regions().

+ Here is the caller graph for this function:

◆ step_set_communication_type_full()

static void step_set_communication_type_full ( effect  send_region)
static

Definition at line 325 of file analyse.c.

326 {
327  step_set_step_partial(send_region, false);
328 }
static void step_set_step_partial(effect send_region, bool partial_p)
Definition: analyse.c:309

References step_set_step_partial().

Referenced by step_update_comm().

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

◆ step_set_communication_type_partial()

static void step_set_communication_type_partial ( effect  send_region)
static

Definition at line 329 of file analyse.c.

330 {
331  step_set_step_partial(send_region, true);
332 }

References step_set_step_partial().

Referenced by step_initialize_step_partial(), and step_update_comm().

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

◆ step_set_step_partial()

static void step_set_step_partial ( effect  send_region,
bool  partial_p 
)
static

Retrieve the corresponding original DIRECTIVE region from any king of region: SUMMARY, TRANSLATED or DIRECTIVE region

Definition at line 309 of file analyse.c.

310 {
311  pips_debug(4, "begin\n");
312 
313  effect directive_statement_send;
314 
315  /* Retrieve the corresponding original DIRECTIVE
316  region from any king of region: SUMMARY, TRANSLATED or DIRECTIVE region */
317  directive_statement_send = get_directive_statement_region(send_region);
318 
319  if(!partial_p)
320  store_or_update_step_partial(directive_statement_send, false);
321  else if(!bound_step_partial_p(directive_statement_send))
322  store_step_partial(directive_statement_send, true);
323  pips_debug(4, "end\n");
324 }
static effect get_directive_statement_region(effect reg)
Definition: analyse.c:289

References get_directive_statement_region(), and pips_debug.

Referenced by step_set_communication_type_full(), and step_set_communication_type_partial().

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

◆ step_statement_path_build()

static bool step_statement_path_build ( statement  stmt,
list sp_current 
)
static

Definition at line 57 of file analyse.c.

58 {
59  *sp_current = CONS(STATEMENT, stmt, *sp_current);
60 
61  list sp = gen_nreverse(gen_copy_seq(*sp_current));
63 
64  return true;
65 }
static hash_table step_statement_path
The step_analyse phase computes three main resources:
Definition: analyse.c:55
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CONS, gen_copy_seq(), gen_nreverse(), hash_put(), STATEMENT, and step_statement_path.

Referenced by step_statement_path_init().

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

◆ step_statement_path_factorise()

static list step_statement_path_factorise ( statement  s1,
statement  s2,
list suffix_sp1,
list suffix_sp2 
)
static

Definition at line 141 of file analyse.c.

142 {
143  list common_sp = NIL;
144 
145  pips_debug(5, "begin\n");
146 
147  *suffix_sp1 = step_statement_path_get(s1);
148  *suffix_sp2 = step_statement_path_get(s2);
149 
150  while(!ENDP(*suffix_sp1) && !ENDP(*suffix_sp2) && STATEMENT(CAR(*suffix_sp1))==STATEMENT(CAR(*suffix_sp2)))
151  {
152  common_sp = CONS(STATEMENT, STATEMENT(CAR(*suffix_sp1)), common_sp);
153  POP(*suffix_sp1);
154  POP(*suffix_sp2);
155  }
156 
157  pips_debug(5, "end\n");
158  return common_sp;
159 }
static list step_statement_path_get(statement stmt)
Definition: analyse.c:93
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59

References CAR, CONS, ENDP, NIL, pips_debug, POP, s1, STATEMENT, and step_statement_path_get().

Referenced by step_compute_CHAINS_DG_SENDRECV_regions().

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

◆ step_statement_path_finalize()

static void step_statement_path_finalize ( void  )
static

Definition at line 80 of file analyse.c.

81 {
83 
84  HASH_MAP(stmt, sp,
85  {
86  gen_free_list(sp);
88 
91 }
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
#define hash_table_undefined_p(h)
Definition: newgen_hash.h:50
#define hash_table_undefined
Value of an undefined hash_table.
Definition: newgen_hash.h:49

References assert, gen_free_list(), HASH_MAP, hash_table_free(), hash_table_undefined, hash_table_undefined_p, and step_statement_path.

Referenced by step_analyse().

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

◆ step_statement_path_first_directive_statement()

static statement step_statement_path_first_directive_statement ( statement  stmt)
static

Definition at line 98 of file analyse.c.

99 {
101 
102  statement first_directive_stmt;
103 
105 
106  return first_directive_stmt;
107 }

References gen_chunk_identity(), gen_find_if(), step_directives_bound_p(), and step_statement_path_get().

Referenced by step_summarize_and_map_step_regions().

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

◆ step_statement_path_get()

static list step_statement_path_get ( statement  stmt)
static

Definition at line 93 of file analyse.c.

94 {
96 }
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449

References hash_get(), and step_statement_path.

Referenced by step_statement_path_factorise(), and step_statement_path_first_directive_statement().

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

◆ step_statement_path_init()

static void step_statement_path_init ( statement  body)
static

Definition at line 71 of file analyse.c.

72 {
75 
76  list sp_current = NIL;
78 }
static bool step_statement_path_build(statement stmt, list *sp_current)
Definition: analyse.c:57
static void step_statement_path_unbuild(statement stmt, list *sp_current)
Definition: analyse.c:66
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
@ hash_pointer
Definition: newgen_hash.h:32
#define HASH_DEFAULT_SIZE
Definition: newgen_hash.h:26

References assert, gen_context_recurse, HASH_DEFAULT_SIZE, hash_pointer, hash_table_make(), hash_table_undefined_p, NIL, statement_domain, step_statement_path, step_statement_path_build(), and step_statement_path_unbuild().

Referenced by step_analyse().

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

◆ step_statement_path_unbuild()

static void step_statement_path_unbuild ( statement  stmt,
list sp_current 
)
static

Definition at line 66 of file analyse.c.

67 {
68  gen_remove_once(sp_current, stmt);
69 }
void gen_remove_once(list *pl, const void *o)
Remove the first occurence of o in list pl:
Definition: list.c:691

References gen_remove_once().

Referenced by step_statement_path_init().

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

◆ step_summarize_and_map_step_regions()

static void step_summarize_and_map_step_regions ( statement  stmt)
static

search for the first stmt of type directive_stmt in the path from the body to stmt S

if the first_directive_stmt is different than stmt, it means that stmt is imbricated inside another directive.

In case of an imbricated statement, regions attached to stmt are not summarized at the module level.

Store SEND summary regions

Store RECV summary regions

Definition at line 822 of file analyse.c.

823 {
824  /*
825  For the statement stmt included in a module,
826  add the list of regions at the statement level to the list of regions at the module level.
827 
828  Summarized_send_l (resp. recv_l) means list of send (resp. recv)
829  regions at the module level.
830  */
831  pips_debug(4, "begin\n");
832 
833  /* search for the first stmt of type directive_stmt in the path from the
834  body to stmt S
835 
836  if the first_directive_stmt is different than stmt, it means that
837  stmt is imbricated inside another directive.
838 
839  In case of an imbricated statement, regions attached to stmt are
840  not summarized at the module level.
841  */
843 
844  if(statement_undefined_p(first_directive_stmt) || first_directive_stmt == stmt)
845  {
848  list summarized_send_l, summarized_recv_l;
849 
850  pips_assert("stmt != body", stmt != body);
851  pips_assert("statement with step regions", bound_step_send_regions_p(stmt) && bound_step_recv_regions_p(stmt));
852 
854  /* Store SEND summary regions */
855  step_send_regions_list_add(body, summarized_send_l);
857  /* Store RECV summary regions */
858  step_recv_regions_list_add(body, summarized_recv_l);
859 
860  pips_debug(4, " SEND and RECV propagated on module %s\n", entity_name(module));
861  }
862  pips_debug(4, "end\n");
863 }
static void step_recv_regions_list_add(statement stmt, list l_regions)
Definition: analyse.c:744
static void step_send_regions_list_add(statement stmt, list l_regions)
Definition: analyse.c:698
static statement step_statement_path_first_directive_statement(statement stmt)
Definition: analyse.c:98
static list summarize_and_map_step_regions(list effect_l, entity module, statement body)
Definition: analyse.c:800
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208

References entity_name, get_current_module_entity(), get_current_module_statement(), module, pips_assert, pips_debug, statement_undefined_p, step_recv_regions_list_add(), step_recv_regions_list_load(), step_send_regions_list_add(), step_send_regions_list_load(), step_statement_path_first_directive_statement(), and summarize_and_map_step_regions().

Referenced by compute_SENDRECV_regions().

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

◆ step_translate_and_map()

static list step_translate_and_map ( statement  stmt,
list  effects_called_l 
)
static

for generic_effects_backward_translation()

for generic_effects_backward_translation() cf. summary_rw_effects_engine() dans Libs/effects-generic/rw_effects_engine.c

to avoid low level debug messages of generic_effects_backward_translation

create a new translated effect in list caller_l

map

one called effect should produce a unique translated effect

Definition at line 939 of file analyse.c.

940 {
941  pips_debug(2, "begin\n");
942 
943  effect translated_eff;
944  list translated_l = NIL;
948  transformer context = load_statement_precondition(stmt); /* for generic_effects_backward_translation() */
949 
950  make_effects_private_current_context_stack(); /* for generic_effects_backward_translation()
951  cf. summary_rw_effects_engine()
952  dans Libs/effects-generic/rw_effects_engine.c */
953 
954  FOREACH(EFFECT, called_eff, effects_called_l)
955  {
956  /* to avoid low level debug messages of generic_effects_backward_translation */
957  setenv("REGION_TRANSLATION_DEBUG_LEVEL", "0", 0);
958  debug_on("REGION_TRANSLATION_DEBUG_LEVEL");
959 
960  /* create a new translated effect in list caller_l */
961  list tmp_l = CONS(EFFECT, called_eff, NIL);
962  list caller_l = generic_effects_backward_translation(called, args, tmp_l, context);
963 
964  debug_off();
965 
966  if(gen_length(caller_l)>1)
967  {
968  pips_user_warning("to many effect at callsite : %d effect\n", gen_length(caller_l));
969  pips_debug(1, "input effect list (called_eff) :\n %s", text_to_string(text_rw_array_regions(tmp_l)));
970  pips_debug(0, "output effect list (caller_l) :\n %s", text_to_string(text_rw_array_regions(caller_l)));
971  list keep_l = NIL;
972 
973  FOREACH(EFFECT, eff, caller_l)
974  {
975  if (anywhere_effect_p(eff) && effect_action_tag(called_eff)==effect_action_tag(eff))
976  {
977  gen_free_list(keep_l);
978  keep_l = CONS(EFFECT, eff, NIL);
979  pips_debug(0, "keep only %s", text_to_string(text_rw_array_regions(keep_l)));
980  break;
981  }
982 
985  keep_l = CONS(EFFECT, eff, keep_l);
986  else
987  pips_debug(0, "drop effect on not array entity : %s", text_to_string(text_rw_array_regions(CONS(EFFECT, eff, NIL))));
988  }
989  gen_free_list(caller_l);
990  caller_l = keep_l;
991  }
992 
993  /* map */
994  switch (gen_length(caller_l))
995  {
996  case 1:
997  /* one called effect should produce a unique translated effect */
998  translated_eff = EFFECT(CAR(caller_l));
999  pips_debug(2, "translate called_eff = %p, translated_eff = %p\n", called_eff, translated_eff);
1000  step_add_point_into_effect_path(translated_eff, module, stmt, called_eff);
1001  translated_l = gen_nconc(translated_l, caller_l);
1002  case 0:
1003  break;
1004  default:
1005  pips_debug(0, "Error\n");
1006  pips_debug(0, "input effect list (called_eff) :\n %s\n", text_to_string(text_rw_array_regions(tmp_l)));
1007  pips_debug(0, "output effect list (caller_l) :\n %s\n", text_to_string(text_rw_array_regions(caller_l)));
1008  pips_assert("gen_length(caller_l)<2", 0);
1009  }
1010  gen_free_list(tmp_l);
1011  }
1012 
1014  pips_debug(2, "end\n");
1015  return translated_l;
1016 }
void free_effects_private_current_context_stack(void)
void make_effects_private_current_context_stack(void)
list generic_effects_backward_translation(entity, list, list, transformer)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_action_tag(eff)
size_t gen_length(const list l)
Definition: list.c:150
bool entity_array_p(entity e)
Is e a variable with an array type?
Definition: entity.c:754
#define reference_variable(x)
Definition: ri.h:2326
#define call_arguments(x)
Definition: ri.h:711
Definition: delay.c:253

References anywhere_effect_p(), call_arguments, call_function, CAR, CONS, debug_off, debug_on, EFFECT, effect_action_tag, effect_any_reference, entity_array_p(), FOREACH, free_effects_private_current_context_stack(), gen_free_list(), gen_length(), gen_nconc(), generic_effects_backward_translation(), get_current_module_entity(), load_statement_precondition(), make_effects_private_current_context_stack(), module, NIL, pips_assert, pips_debug, pips_user_warning, reference_variable, statement_call(), step_add_point_into_effect_path(), text_rw_array_regions(), and text_to_string().

Referenced by step_translate_and_map_step_regions().

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

◆ step_translate_and_map_step_regions()

static bool step_translate_and_map_step_regions ( statement  stmt)
static

SEND

Store SEND translated regions

RECV

Store RECV translated regions

Definition at line 1021 of file analyse.c.

1022 {
1023  entity called;
1024  list caller_l, called_l;
1025  statement_effects regions;
1026  bool new_region_p = false;
1027 
1028  pips_debug(2, "begin\n");
1030  called = call_function(statement_call(stmt));
1031 
1032  assert(entity_module_p(called));
1033  statement called_body = (statement) db_get_memory_resource(DBR_CODE, entity_user_name(called), true);
1034 
1035  ifdebug(1)
1036  {
1037  pips_debug(1,"------------------> CALL\n");
1038  string txt = safe_statement_identification(stmt);
1039  pips_debug(1, "%s\n", txt);
1040  free(txt);
1041  }
1042 
1043  /* SEND */
1044  regions = (statement_effects)db_get_memory_resource(DBR_STEP_SEND_REGIONS, entity_user_name(called), true);
1045  called_l = effects_effects(apply_statement_effects(regions, called_body));
1046  caller_l = step_translate_and_map(stmt, called_l);
1047  /* Store SEND translated regions */
1049 
1050  new_region_p |= !ENDP(caller_l);
1051 
1052  ifdebug(2)
1053  {
1054  debug_print_effects_list(called_l, "CALLED REGIONS SEND");
1055  debug_print_effects_list(caller_l, "CALLER REGIONS SEND");
1056  }
1057 
1058  /* RECV */
1059  regions = (statement_effects)db_get_memory_resource(DBR_STEP_RECV_REGIONS, entity_user_name(called), true);
1060  called_l = effects_effects(apply_statement_effects(regions, called_body));
1061  caller_l = step_translate_and_map(stmt, called_l);
1062  /* Store RECV translated regions */
1064 
1065  new_region_p |= !ENDP(caller_l);
1066 
1067  ifdebug(2)
1068  {
1069  debug_print_effects_list(called_l, "CALLED REGIONS RECV");
1070  debug_print_effects_list(caller_l, "CALLER REGIONS RECV");
1071  }
1072 
1073  pips_debug(2, "end\n");
1074 
1075  return new_region_p;
1076 }
effects apply_statement_effects(statement_effects f, statement k)
Definition: effects.c:1007
static list step_translate_and_map(statement stmt, list effects_called_l)
Definition: analyse.c:939
struct _newgen_struct_statement_effects_ * statement_effects
Definition: effects.h:210
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487

References apply_statement_effects(), assert, call_function, db_get_memory_resource(), debug_print_effects_list(), effects_effects, ENDP, entity_module_p(), entity_user_name(), free(), ifdebug, pips_debug, safe_statement_identification(), statement_call(), statement_call_p(), step_recv_regions_list_store(), step_send_regions_list_store(), and step_translate_and_map().

Referenced by compute_SENDRECV_regions().

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

◆ step_update_comm()

static void step_update_comm ( list  full_send_l,
list  partial_send_l 
)
static

Definition at line 1383 of file analyse.c.

1384 {
1385  pips_debug(2, "begin\n");
1386 
1387  FOREACH(EFFECT, eff, full_send_l)
1388  {
1390  }
1391  FOREACH(EFFECT, eff, partial_send_l)
1392  {
1394  }
1395 
1396  ifdebug(1)
1398  {
1399  pips_debug(1, "################ COMM ###############\n");
1400  MAP_EFFECT_BOOL_MAP(eff, partial,
1401  {
1402  step_point point = load_step_effect_path(eff);
1403  pips_debug(1, "module : %s\n", entity_user_name(step_point_module(point)));
1404  ifdebug(2)
1407  }, get_step_partial());
1408  }
1409 
1410  pips_debug(2, "end\n");
1411 }
static void step_set_communication_type_full(effect send_region)
Definition: analyse.c:325
if(!(yy_init))
Definition: genread_lex.c:1029
#define COMMUNICATION(x)
COMMUNICATION.
Definition: paf_ri.h:230
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
bool entity_main_module_p(entity e)
Definition: entity.c:700
#define MAP_EFFECT_BOOL_MAP(k, v, c, f)
Definition: step_private.h:135

References CONS, debug_print_effects_list(), EFFECT, entity_main_module_p(), entity_user_name(), FOREACH, get_current_module_entity(), ifdebug, MAP_EFFECT_BOOL_MAP, NIL, pips_debug, print_statement(), step_point_data, step_point_module, step_point_stmt, step_set_communication_type_full(), and step_set_communication_type_partial().

Referenced by step_analyse().

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

◆ step_update_SUMMARY_SENDRECV_regions()

static void step_update_SUMMARY_SENDRECV_regions ( set  remove_from_summary_send,
set  remove_from_summary_recv,
list full_send_l,
list partial_send_l 
)
static

Regions corresponding to body are SYMMARY regions

Store SEND summary regions

Regions corresponding to body are SYMMARY regions

Store RECV summary regions

Definition at line 1340 of file analyse.c.

1341 {
1343  list tmp_summary_send;
1344  list tmp_summary_recv;
1345  list final_summary_send = NIL;
1346  list final_summary_recv = NIL;
1347 
1348  pips_debug(2, "begin\n");
1349 
1350  /* Regions corresponding to body are SYMMARY regions */
1351  tmp_summary_send = step_send_regions_list_load(body);
1352  update_SUMMARY_SENDRECV_regions(remove_from_summary_send, tmp_summary_send, &final_summary_send);
1353  /* Store SEND summary regions */
1354  step_send_regions_list_update(body, final_summary_send);
1355 
1356  /* Regions corresponding to body are SYMMARY regions */
1357  tmp_summary_recv = step_recv_regions_list_load(body);
1358  update_SUMMARY_SENDRECV_regions(remove_from_summary_recv, tmp_summary_recv, &final_summary_recv);
1359  /* Store RECV summary regions */
1360  step_recv_regions_list_update(body, final_summary_recv);
1361 
1362  ifdebug(2)
1363  {
1364  debug_print_effects_list(final_summary_send, "FINAL SUMMARIZED SEND");
1365  debug_print_effects_list(final_summary_recv, "FINAL SUMMARIZED RECV");
1366  }
1367 
1368  /*
1369  full_send_l are TRANSLATED or DIRECTIVE regions.
1370  partial_send_l are SUMMARY regions.
1371 
1372  They will both be to retrieve the corresponding original DIRECTIVE
1373  region.
1374  This can be done from any SUMMARY or TRANSLATED and DIRECTIVE (of
1375  course) kind of region.
1376  */
1377 
1378  *full_send_l = set_to_list(remove_from_summary_send);
1379  *partial_send_l = final_summary_send;
1380  pips_debug(2, "end\n");
1381 }
static void update_SUMMARY_SENDRECV_regions(set remove_from_summary_regions, list tmp_summary_regions_l, list *final_summary_regions_l)
Definition: analyse.c:1296
static void step_recv_regions_list_update(statement s, list l_regions)
Definition: analyse.c:732
static void step_send_regions_list_update(statement s, list l_regions)
Definition: analyse.c:686
list set_to_list(const set)
create a list from a set the set is not freed
Definition: set.c:436

References debug_print_effects_list(), get_current_module_statement(), ifdebug, NIL, pips_debug, set_to_list(), step_recv_regions_list_load(), step_recv_regions_list_update(), step_send_regions_list_load(), step_send_regions_list_update(), and update_SUMMARY_SENDRECV_regions().

Referenced by step_analyse().

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

◆ store_step_comm()

void store_step_comm ( void  )

Definition at line 206 of file analyse.c.

207 {
208  step_comm comms = (step_comm)db_get_memory_resource(DBR_STEP_COMM, "", true);
209 
210  step_comm_path(comms) = get_step_effect_path();
211  step_comm_interlaced(comms) = get_step_interlaced();
212  step_comm_partial(comms) = get_step_partial();
213 
214  DB_PUT_MEMORY_RESOURCE(DBR_STEP_COMM, "", comms);
215 
216  reset_step_effect_path();
217  reset_step_interlaced();
218  reset_step_partial();
219 }

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, step_comm_interlaced, step_comm_partial, and step_comm_path.

Referenced by step_analyse().

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

◆ summarize_and_map_step_regions()

static list summarize_and_map_step_regions ( list  effect_l,
entity  module,
statement  body 
)
static

Definition at line 800 of file analyse.c.

801 {
802  pips_debug(4, "begin\n");
803  list summarized_l = NIL;
804 
805  FOREACH(EFFECT, eff, effect_l)
806  {
807  effect new_eff = copy_effect(eff);
808 
809  pips_debug(4, "tmp summarize eff = %p new_eff = %p\n", eff, new_eff);
810  step_add_point_into_effect_path(new_eff, module, body, eff);
811  summarized_l = CONS(EFFECT, new_eff, summarized_l);
812  }
813 
814  pips_debug(4, "end\n");
815  return summarized_l;
816 }
effect copy_effect(effect p)
EFFECT.
Definition: effects.c:448

References CONS, copy_effect(), EFFECT, FOREACH, module, NIL, pips_debug, and step_add_point_into_effect_path().

Referenced by step_summarize_and_map_step_regions().

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

◆ update_SUMMARY_SENDRECV_regions()

static void update_SUMMARY_SENDRECV_regions ( set  remove_from_summary_regions,
list  tmp_summary_regions_l,
list final_summary_regions_l 
)
static

Definition at line 1296 of file analyse.c.

1297 {
1298  pips_debug(1, "begin\n");
1299 
1300  /*
1301 
1302  The effects in the remove_from_summary_send and
1303  remove_from_summary_send sets are not SUMMARY. They can be
1304  DIRECTIVE regions or TRANSLATED regions.
1305 
1306  They are built from SEND and RECV effects corresponding to
1307  statements S1 and S2 of the DG.
1308 
1309  We need to get pathpoint corresponding to the SUMMARY
1310  effects to retrieve the original effects (from which summary was
1311  computed).
1312 
1313  Because the pathpoint corresponds to a SUMMARY, the effect in the
1314  pathpoint data field can be either TRANSLATED or DIRECTIVE region.
1315 
1316  */
1317 
1318  FOREACH(EFFECT, summ_eff, tmp_summary_regions_l)
1319  {
1320  assert(bound_step_effect_path_p(summ_eff));
1321 
1322  step_point point = load_step_effect_path(summ_eff);
1323  effect from_region = step_point_data(point);
1324 
1325  /*
1326  from_region can be either DIRECTIVE or TRANSLATED region. See comments above.
1327 
1328  if from_region corresponding to the SUMMARY effect is not is
1329  the remove set then add the SUMMARY effect into the final SUMMARY regions list.
1330  */
1331  if(!set_belong_p(remove_from_summary_regions, from_region))
1332  *final_summary_regions_l = CONS(EFFECT, summ_eff, *final_summary_regions_l);
1333  else
1334  pips_debug(2, "drop unoptimizable tmp_summary %p -> data %p\n", summ_eff, step_point_data(point));
1335  }
1336 
1337  pips_debug(1, "end\n");
1338 }
bool set_belong_p(const set, const void *)
Definition: set.c:194

References assert, CONS, EFFECT, FOREACH, pips_debug, set_belong_p(), and step_point_data.

Referenced by step_update_SUMMARY_SENDRECV_regions().

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

Variable Documentation

◆ step_statement_path

hash_table step_statement_path = hash_table_undefined
static

The step_analyse phase computes three main resources:

  • step_comm
  • step_send_regions
  • step_recv_regions Declaration of the step_send_regions and step_send_regions resources.

Store all different kind of regions:

  • directive regions (at directive statement level)
  • translated regions (at call statement level)
  • summary regions (at body statement level)

Definition at line 55 of file analyse.c.

Referenced by step_statement_path_build(), step_statement_path_finalize(), step_statement_path_get(), and step_statement_path_init().