PIPS
comEngine_feasability.c File Reference
#include <stdio.h>
#include <ctype.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "resources.h"
#include "misc.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "text-util.h"
#include "ray_dte.h"
#include "sommet.h"
#include "sg.h"
#include "polyedre.h"
#include "phrase_tools.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "effects-convex.h"
#include "phrase_distribution.h"
#include "comEngine.h"
#include "phrase.h"
+ Include dependency graph for comEngine_feasability.c:

Go to the source code of this file.

Macros

#define LESSER_DIRECTION   4
 
#define GREATER_DIRECTION   1
 
#define ZERO_DIRECTION   2
 
#define ANY_DIRECTION   7
 
#define NO_DIRECTION   0
 

Functions

static bool check_distribution_feasability (statement stat)
 
static bool check_for_conflict (reference ref)
 
static list local_syntax_to_reference_list (syntax s, list lr)
 
list comEngine_expression_to_reference_list (expression e, list lr)
 conversion of an expression into a list of references; references are appended to list lr as they are encountered; array references are added before their index expressions are scanned; More...
 
static void has_loop_inside_rwt (statement stat, bool *bHasLoopInside)
 
static bool has_loop_inside (statement stat)
 
static void fill_gRefToEncLoop (statement stat)
 
static void fill_gRefToEncLoop_loop (statement stat)
 
static void fill_gRefToEncLoop_call (statement stat)
 
static void fill_gRefToEncLoop_test (statement stat)
 
static bool entity_in_ref_list (entity searchedEnt, list lRef)
 
static int find_or_create_fifo_from_ref (reference ref, bool bReadAct, hash_table refToFifo, int inc)
 
static void compute_fifo_from_ref (reference ref, bool bReadAct, int inc)
 
static void attach_ref_to_stat (reference callRef, statement stat, hash_table pTable, bool firstRef, int inc)
 
static bool check_loop_distribution_feasability (statement stat)
 
bool code_has_write_eff_ref_p (reference ref, statement stat)
 
list reference_indices_entity_list (reference ref)
 
static bool is_good_direction_p (Ptsg sg, int loopLev, bool bReadIsSource)
 
static statement find_common_loop (list n1, list n2, list *lWLoops)
 
static bool attach_ref_to_loop (reference callRef, statement inStat, bool firstRef, list lIndRef)
 
static bool process_ref_list (list lCallRef, bool firstRef, statement inStat)
 
static bool check_call_distribution_feasability (statement inStat)
 
static bool check_test_distribution_feasability (statement inStat)
 
bool comEngine_feasability (statement externalized_code, graph dg)
 

Variables

static int gIfCount = 0
 
static hash_table gRefToEncLoop
 
static list lLoop
 
static list glIndUsed
 
static graph gDg
 
static statement g_externalized_code
 
static int vertex_to_direction [3] = {LESSER_DIRECTION, ZERO_DIRECTION, GREATER_DIRECTION}
 
static int ray_to_direction [3] = {LESSER_DIRECTION, NO_DIRECTION, GREATER_DIRECTION}
 
static int line_to_direction [3] = {ANY_DIRECTION, NO_DIRECTION, ANY_DIRECTION}
 
static char * direction_to_representation [8] = {"?", "<", "=", "<=", ">", "*", ">=", "*"}
 

Macro Definition Documentation

◆ ANY_DIRECTION

#define ANY_DIRECTION   7

Definition at line 626 of file comEngine_feasability.c.

◆ GREATER_DIRECTION

#define GREATER_DIRECTION   1

Definition at line 624 of file comEngine_feasability.c.

◆ LESSER_DIRECTION

#define LESSER_DIRECTION   4

Definition at line 623 of file comEngine_feasability.c.

◆ NO_DIRECTION

#define NO_DIRECTION   0

Definition at line 627 of file comEngine_feasability.c.

◆ ZERO_DIRECTION

#define ZERO_DIRECTION   2

Definition at line 625 of file comEngine_feasability.c.

Function Documentation

◆ attach_ref_to_loop()

static bool attach_ref_to_loop ( reference  callRef,
statement  inStat,
bool  firstRef,
list  lIndRef 
)
static

Definition at line 884 of file comEngine_feasability.c.

886 {
887  //printf("callRef\n");
888  //print_reference(callRef);printf("\n");
889 
890  MAPL(lLoopStat,
891  {
892  statement loopStat = STATEMENT(CAR(lLoopStat));
893 
894  bool attachToThisLoop = false;
895  entity loopIndex = loop_index(statement_loop(loopStat));
896 
897  // If the indices of the reference callRef contains the index
898  // of the loop loopStat, then let us try to attach the reference
899  // to this loop.
900  MAP(REFERENCE, indRef,
901  {
902  if(same_entity_p(loopIndex, reference_variable(indRef)))
903  {
904  attachToThisLoop = true;
905  break;
906  }
907 
908  }, lIndRef);
909 
910  // If callRef is involved in a data dependency that prevents
911  // the pipeline, then let us attach the reference to the
912  // stat where it is used and not to a loop
913  if(check_for_conflict(callRef))
914  {
915  attach_ref_to_stat(callRef, inStat, gStatToRef,
916  firstRef, 1);
917 
918  if(gIfCount != 0)
919  {
920  pips_internal_error("conflict with reference: %s",
921  reference_to_string(callRef));
922 
923  return false;
924  }
925  break;
926  }
927 
928  // If the reference must be attached to this loop, let us do this.
929  if(attachToThisLoop)
930  {
931  attach_ref_to_stat(callRef, loopStat, gLoopToRef,
932  firstRef, 1);
933 
934  break;
935  }
936 
937  if(loopStat == STATEMENT(CAR(gen_last(lLoop))))
938  {
940  firstRef, 1);
941  break;
942  }
943 
944  }, lLoop);
945 
946  return true;
947 }
hash_table gStatToRef
hash_table gLoopToRef
comEngine_distribute.c
static list lLoop
static void attach_ref_to_stat(reference callRef, statement stat, hash_table pTable, bool firstRef, int inc)
static bool check_for_conflict(reference ref)
static int gIfCount
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
#define pips_internal_error
Definition: misc-local.h:149
string reference_to_string(reference r)
Definition: expression.c:87
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
#define reference_variable(x)
Definition: ri.h:2326
#define loop_index(x)
Definition: ri.h:1640
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References attach_ref_to_stat(), CAR, check_for_conflict(), gen_last(), gIfCount, gLoopToRef, gStatToRef, lLoop, loop_index, MAP, MAPL, pips_internal_error, REFERENCE, reference_to_string(), reference_variable, same_entity_p(), STATEMENT, and statement_loop().

Referenced by process_ref_list().

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

◆ attach_ref_to_stat()

static void attach_ref_to_stat ( reference  callRef,
statement  stat,
hash_table  pTable,
bool  firstRef,
int  inc 
)
static

Definition at line 381 of file comEngine_feasability.c.

384 {
385  list lRef = hash_get(pTable, stat);
386 
387  // If no association is in the hash_table pTable, then
388  // initialize the list that will contains the associations
389  if(lRef == HASH_UNDEFINED_VALUE)
390  {
391  lRef = NIL;
392  }
393 
394  // Go through the list of association for this statement
395  // to see if the reference is already associated to this statement or not
396  bool alreadyAttached = false;
397  MAP(REFERENCE, curRef,
398  {
399  if(!reference_equal_p(callRef, curRef))
400  continue;
401 
402  string effAction1 = hash_get(gRefToEff, (reference)curRef);
403 
404  pips_assert("effAction1 != HASH_UNDEFINED_VALUE",
405  effAction1 != HASH_UNDEFINED_VALUE);
406 
407  if((!strcmp(effAction1, R_EFFECT) && !firstRef) ||
408  (!strcmp(effAction1, W_EFFECT) && firstRef))
409  {
410  alreadyAttached = true;
411  }
412  }, lRef);
413 
414  //printf("put %d\n", inc);
415  //print_reference(callRef);
416  //printf("\n");
417 
418  // If the reference is not yet associated to the statement,
419  // then do it.
420  if(!alreadyAttached)
421  {
422  lRef = gen_nconc(lRef, CONS(REFERENCE, callRef, NIL));
423  hash_put(pTable, stat, lRef);
424  }
425 
426  // Store the effect of the reference in gRefToEff
427  if(firstRef)
428  {
429  hash_put(gRefToEff, callRef, W_EFFECT);
430  }
431  else
432  {
433  hash_put(gRefToEff, callRef, R_EFFECT);
434  }
435 
436  // Create or find the fifo associated to the reference callRef
437  compute_fifo_from_ref(callRef, !firstRef, inc);
438 }
#define R_EFFECT
Definition: comEngine.h:29
#define W_EFFECT
Definition: comEngine.h:30
hash_table gRefToEff
static void compute_fifo_from_ref(reference ref, bool bReadAct, int inc)
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
void * 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
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 pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
bool reference_equal_p(reference r1, reference r2)
Definition: expression.c:1500
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References compute_fifo_from_ref(), CONS, gen_nconc(), gRefToEff, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, MAP, NIL, pips_assert, R_EFFECT, REFERENCE, reference_equal_p(), and W_EFFECT.

Referenced by attach_ref_to_loop(), check_loop_distribution_feasability(), and process_ref_list().

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

◆ check_call_distribution_feasability()

static bool check_call_distribution_feasability ( statement  inStat)
static

Definition at line 1049 of file comEngine_feasability.c.

1050 {
1051  list lCallRef = NIL;
1052 
1053  call curCall = instruction_call(statement_instruction(inStat));
1054 
1055  bool firstRef = true;
1056 
1057  MAP(EXPRESSION, exp,
1058  {
1059  list old = lCallRef;
1060  list new = NIL;
1062 
1063  lCallRef = gen_concatenate(old, new);
1064 
1065  gen_free_list(old);
1066  gen_free_list(new);
1067 
1068  }, call_arguments(curCall));
1069 
1070  bool success = process_ref_list(lCallRef, firstRef, inStat);
1071 
1072  gen_free_list(lCallRef);
1073 
1074  return success;
1075 }
static bool process_ref_list(list lCallRef, bool firstRef, statement inStat)
list comEngine_expression_to_reference_list(expression e, list lr)
conversion of an expression into a list of references; references are appended to list lr as they are...
bool success
Definition: gpips-local.h:59
list gen_concatenate(const list l1x, const list l2x)
concatenate two lists.
Definition: list.c:436
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define call_arguments(x)
Definition: ri.h:711
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References call_arguments, comEngine_expression_to_reference_list(), exp, EXPRESSION, gen_concatenate(), gen_free_list(), instruction_call, MAP, NIL, process_ref_list(), and statement_instruction.

Referenced by check_distribution_feasability().

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

◆ check_distribution_feasability()

static bool check_distribution_feasability ( statement  stat)
static

Definition at line 1132 of file comEngine_feasability.c.

1133 {
1134  bool success = true;
1135  instruction instr = statement_instruction(stat);
1136 
1137  switch(instruction_tag(instr))
1138  {
1140  {
1141  MAP(STATEMENT, curStat,
1142  {
1144 
1146  break;
1147  }
1148  case is_instruction_loop:
1149  {
1151  break;
1152  }
1153  case is_instruction_call:
1154  {
1156  break;
1157  }
1158  case is_instruction_test:
1159  {
1161  break;
1162  }
1163  default:
1164  {
1165  success = false;
1166  break;
1167  }
1168  }
1169 
1170  return success;
1171 }
static bool check_call_distribution_feasability(statement inStat)
static bool check_loop_distribution_feasability(statement stat)
static bool check_distribution_feasability(statement stat)
static bool check_test_distribution_feasability(statement inStat)
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_sequence
Definition: ri.h:1469
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define sequence_statements(x)
Definition: ri.h:2360
#define instruction_sequence(x)
Definition: ri.h:1514

References check_call_distribution_feasability(), check_loop_distribution_feasability(), check_test_distribution_feasability(), instruction_sequence, instruction_tag, is_instruction_call, is_instruction_loop, is_instruction_sequence, is_instruction_test, MAP, sequence_statements, STATEMENT, and statement_instruction.

Referenced by check_loop_distribution_feasability(), check_test_distribution_feasability(), and comEngine_feasability().

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

◆ check_for_conflict()

static bool check_for_conflict ( reference  ref)
static

rintf("conf\n"); printf("read\n"); print_reference(readRef);printf("\n"); printf("write\n"); print_reference(writeRef);printf("\n");

Definition at line 734 of file comEngine_feasability.c.

735 {
736  //printf("check_for_conflict:\n");
737  //print_reference(ref);printf("\n");
738  MAP(VERTEX, a_vertex,
739  {
740  MAP(SUCCESSOR, suc,
741  {
742  MAP(CONFLICT, c,
743  {
744  effect sourceEff = conflict_source(c);
745  effect sinkEff = conflict_sink(c);
746 
747  // If this is a read-read or a write-write dependence,
748  // then there is no problem
749  if((effect_read_p(sourceEff) &&
750  effect_read_p(sinkEff)) ||
751  (effect_write_p(sourceEff) &&
752  effect_write_p(sinkEff)))
753  continue;
754 
757 
758  if(effect_read_p(sourceEff))
759  {
760  readRef = effect_any_reference(sourceEff);
761  writeRef = effect_any_reference(sinkEff);
762  }
763  else
764  {
765  writeRef = effect_any_reference(sourceEff);
766  readRef = effect_any_reference(sinkEff);
767  }
768 
769  // If this conflict does not involve ref,
770  // let us not consider this conflict
771  if((readRef != ref) &&
772  (writeRef != ref))
773  continue;
774 
775  // If there is a conflict but that the references are
776  // equal then the conflict does not prevent the pipeline
777  if(reference_equal_p(readRef, writeRef))
778  continue;
779 
780  list lReadLoop = hash_get(gRefToEncLoop, readRef);
781  list lWriteLoop = hash_get(gRefToEncLoop, writeRef);
782 
783  pips_assert("lReadLoop != HASH_UNDEFINED_VALUE",
784  lReadLoop != HASH_UNDEFINED_VALUE);
785 
786  pips_assert("lWriteLoop != HASH_UNDEFINED_VALUE",
787  lWriteLoop != HASH_UNDEFINED_VALUE);
788 
789  /*printf("conf\n");
790  printf("read\n");
791  print_reference(readRef);printf("\n");
792  printf("write\n");
793  print_reference(writeRef);printf("\n");
794  */
795  //print_reference(effect_any_reference(sourceEff));printf("\n");
796  //print_reference(effect_any_reference(sinkEff));printf("\n");
797 
798  // If the conflict cone is not undefined, let us study it.
799  if(conflict_cone(c) != cone_undefined)
800  {
801  int maxLevel = -1;
802 
803  MAPL(pl,
804  {
805  if(maxLevel == -1)
806  {
807  maxLevel = INT(CAR(pl));
808  }
809  else if(INT(CAR(pl)) > maxLevel)
810  {
811  maxLevel = INT(CAR(pl));
812  }
813 
814  }, cone_levels(conflict_cone(c)));
815 
816  pips_assert("maxLevel != -1", maxLevel != -1);
817 
819  if (!SG_UNDEFINED_P(gs))
820  {
821  // If the conflict does not prevent the pipeline then continue
822  if(is_good_direction_p(gs, maxLevel,
823  (readRef == effect_any_reference(sourceEff))))
824  {
825  sg_fprint_as_ddv(stdout, gs);
826  continue;
827  }
828  }
829  }
830 
831  statement lastRLoop = statement_undefined;
832  statement lastWLoop = statement_undefined;
833 
834  if(lReadLoop != NIL)
835  {
836  lastRLoop = STATEMENT(CAR(gen_last(lReadLoop)));
837  }
838 
839  if(lWriteLoop != NIL)
840  {
841  lastWLoop = STATEMENT(CAR(gen_last(lWriteLoop)));
842  }
843 
844  // If there is a conflict but that the references invloved are in to
845  // different nested loops, then let us consider that there is no conflicts
846  // but let us put a bubble in the pipeline.
847  if(lastRLoop != lastWLoop)
848  {
849  list lWLoops = NIL;
850 
851  statement comLoop = find_common_loop(lReadLoop, lWriteLoop, &lWLoops);
852 
853  if((comLoop != lastRLoop) &&
854  (comLoop != lastWLoop))
855  {
856  pips_assert("lWLoops != NIL", lWLoops != NIL);
857 
858  // Let us put a bubble in the pipeline
859  hash_put(gLoopToSync, STATEMENT(CAR(lWLoops)), (void *)true);
860 
861  gen_free_list(lWLoops);
862  continue;
863  }
864 
865  gen_free_list(lWLoops);
866  }
867 
868  // If we got here, it means there is a true conflict.
869  return true;
870 
872 
873  }, vertex_successors(a_vertex));
874 
875  },graph_vertices(gDg));
876 
877  return false;
878 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
@ INT
Definition: atomic.c:48
hash_table gLoopToSync
static graph gDg
static bool is_good_direction_p(Ptsg sg, int loopLev, bool bReadIsSource)
static statement find_common_loop(list n1, list n2, list *lWLoops)
static hash_table gRefToEncLoop
#define cone_generating_system(x)
Definition: dg.h:130
#define conflict_sink(x)
Definition: dg.h:167
#define cone_levels(x)
Definition: dg.h:128
#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
#define cone_undefined
Definition: dg.h:104
#define conflict_cone(x)
Definition: dg.h:169
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#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
#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
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
Definition: properties.c:783
#define statement_undefined
Definition: ri.h:2419
struct type_sg * Ptsg
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
#define SG_UNDEFINED_P(sg)
Definition: sg-local.h:74
void sg_fprint_as_ddv(FILE *fd, Ptsg sg)
Definition: sg.c:341
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
Definition: sg-local.h:66

References CAR, cone_generating_system, cone_levels, cone_undefined, CONFLICT, conflict_cone, conflict_sink, conflict_source, dg_arc_label_conflicts, effect_any_reference, effect_read_p, effect_write_p, find_common_loop(), gDg, gen_free_list(), gen_last(), gLoopToSync, graph_vertices, gRefToEncLoop, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, INT, is_good_direction_p(), MAP, MAPL, NIL, pips_assert, pl, ref, reference_equal_p(), sg_fprint_as_ddv(), SG_UNDEFINED_P, STATEMENT, statement_undefined, SUCCESSOR, successor_arc_label, VERTEX, and vertex_successors.

Referenced by attach_ref_to_loop().

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

◆ check_loop_distribution_feasability()

static bool check_loop_distribution_feasability ( statement  stat)
static

Definition at line 443 of file comEngine_feasability.c.

444 {
445  bool success = true;
446 
447  loop curLoop = statement_loop(stat);
448 
449  entity index = loop_index(curLoop);
450  range lpRange = loop_range(curLoop);
451  statement body = loop_body(curLoop);
452 
453  expression rgLower = range_lower(lpRange);
454  expression rgUpper = range_upper(lpRange);
455  expression rgIncr = range_increment(lpRange);
456 
457  list lLowerRef = NIL;
458  list lUpperRef = NIL;
459  list lIncrRef = NIL;
460 
461  lLowerRef = expression_to_reference_list(rgLower, lLowerRef);
462  lUpperRef = expression_to_reference_list(rgUpper, lUpperRef);
463  lIncrRef = expression_to_reference_list(rgIncr, lIncrRef);
464 
465  list bodyEff = load_cumulated_rw_effects_list(body);
466 
467  // The same index cannot be used in several loops
468  if(gen_in_list_p(index, glIndUsed))
469  {
470  pips_internal_error("loop index used in several loops: %s",
471  entity_user_name(index));
472  return false;
473  }
474  glIndUsed = CONS(ENTITY, index, glIndUsed);
475 
476  // A reference that is used in range_lower, range_upper or
477  // range_increment of a loop cannot be written in the body of the loop
478  MAP(EFFECT, eff,
479  {
480  if(action_write_p(effect_action(eff)))
481  {
482  if(same_entity_p(index, effect_entity(eff)))
483  {
484  success = false;
485  break;
486  }
487 
488  if(entity_in_ref_list(effect_entity(eff), lLowerRef) ||
489  entity_in_ref_list(effect_entity(eff), lUpperRef) ||
490  entity_in_ref_list(effect_entity(eff), lIncrRef))
491  {
492  success = false;
493  break;
494  }
495  }
496  }, bodyEff);
497 
498  if(!same_expression_p(rgIncr, int_to_expression(1)) ||
499  !same_expression_p(rgLower, int_to_expression(0)))
500  {
501  success = false;
502 
503  gen_free_list(lLowerRef);
504  gen_free_list(lUpperRef);
505  gen_free_list(lIncrRef);
506 
507  return success;
508  }
509 
510  MAP(REFERENCE, curRef,
511  {
512  // If a reference, used in the range_lower of a loop,
513  // is an array or has a written effect in the code to export,
514  // then the exportation is not feasible
515  if((gen_length(reference_indices(curRef)) != 0) ||
517  {
518  success = false;
519  break;
520  }
521 
523  false, 1);
524 
525  }, lLowerRef);
526 
527  MAP(REFERENCE, curRef,
528  {
529  // If a reference, used in the range_upper of a loop,
530  // is an array or has a written effect in the code to export,
531  // then the exportation is not feasible
532  if((gen_length(reference_indices(curRef)) != 0) ||
534  {
535  success = false;
536  break;
537  }
538 
540  false, 1);
541 
542  }, lUpperRef);
543 
544  gen_free_list(lLowerRef);
545  gen_free_list(lUpperRef);
546  gen_free_list(lIncrRef);
547 
548  // Add the current loop to the loop list
549  lLoop = CONS(STATEMENT, stat, lLoop);
550 
552 
553  // Remove the current loop from the loop list
554  gen_remove(&lLoop, stat);
555 
556  return success;
557 }
static statement g_externalized_code
bool code_has_write_eff_ref_p(reference ref, statement stat)
static list glIndUsed
static bool entity_in_ref_list(entity searchedEnt, list lRef)
list load_cumulated_rw_effects_list(statement)
entity effect_entity(effect)
cproto-generated files
Definition: effects.c:52
#define effect_action(x)
Definition: effects.h:642
#define action_write_p(x)
Definition: effects.h:314
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
size_t gen_length(const list l)
Definition: list.c:150
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
Definition: list.c:734
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
list expression_to_reference_list(expression e, list lr)
conversion of an expression into a list of references; references are appended to list lr as they are...
Definition: expression.c:1263
bool same_expression_p(expression e1, expression e2)
this is slightly different from expression_equal_p, as it will return true for a+b vs b+a
Definition: expression.c:1426
#define loop_body(x)
Definition: ri.h:1644
#define range_upper(x)
Definition: ri.h:2290
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define range_increment(x)
Definition: ri.h:2292
#define reference_indices(x)
Definition: ri.h:2328
#define range_lower(x)
Definition: ri.h:2288
#define loop_range(x)
Definition: ri.h:1642

References action_write_p, attach_ref_to_stat(), check_distribution_feasability(), code_has_write_eff_ref_p(), CONS, EFFECT, effect_action, effect_entity(), ENTITY, entity_in_ref_list(), entity_user_name(), expression_to_reference_list(), g_externalized_code, gen_free_list(), gen_in_list_p(), gen_length(), gen_remove(), glIndUsed, gStatToRef, int_to_expression(), lLoop, load_cumulated_rw_effects_list(), loop_body, loop_index, loop_range, MAP, NIL, pips_internal_error, range_increment, range_lower, range_upper, REFERENCE, reference_indices, same_entity_p(), same_expression_p(), STATEMENT, and statement_loop().

Referenced by check_distribution_feasability().

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

◆ check_test_distribution_feasability()

static bool check_test_distribution_feasability ( statement  inStat)
static

Definition at line 1080 of file comEngine_feasability.c.

1081 {
1082  test curTest = statement_test(inStat);
1083 
1084  // If the test statement has at least one loop inside, then
1085  // the compilation is impossbile.
1086  if(has_loop_inside(inStat))
1087  {
1088  return false;
1089  }
1090 
1091  list lCondRef = NIL;
1092  lCondRef = comEngine_expression_to_reference_list(test_condition(curTest), lCondRef);
1093 
1094  bool firstRef = false;
1095 
1096  // Process the condition
1097  if(!process_ref_list(lCondRef, firstRef, inStat))
1098  {
1099  return false;
1100  }
1101 
1102  gen_free_list(lCondRef);
1103 
1104  gIfCount++;
1105 
1106  // Process the true statement
1107  if(test_true(curTest) != statement_undefined)
1108  {
1110  {
1111  return false;
1112  }
1113  }
1114 
1115  // Process the false statement
1116  if(test_false(curTest) != statement_undefined)
1117  {
1119  {
1120  return false;
1121  }
1122  }
1123 
1124  gIfCount--;
1125 
1126  return true;
1127 }
static bool has_loop_inside(statement stat)
test statement_test(statement)
Get the test of a statement.
Definition: statement.c:1348
#define test_false(x)
Definition: ri.h:2837
#define test_true(x)
Definition: ri.h:2835
#define test_condition(x)
Definition: ri.h:2833

References check_distribution_feasability(), comEngine_expression_to_reference_list(), gen_free_list(), gIfCount, has_loop_inside(), NIL, process_ref_list(), statement_test(), statement_undefined, test_condition, test_false, and test_true.

Referenced by check_distribution_feasability().

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

◆ code_has_write_eff_ref_p()

bool code_has_write_eff_ref_p ( reference  ref,
statement  stat 
)
Parameters
refef
stattat

Definition at line 563 of file comEngine_feasability.c.

564 {
565  bool actionWrite = false;
566 
567  MAP(EFFECT, f,
568  {
569  bool effEntIsIndex = false;
570  entity effEnt = effect_entity(f);
571 
572  MAP(STATEMENT,loopStat,
573  {
574  entity index = loop_index(statement_loop(loopStat));
575 
576  if(same_entity_p(index, effEnt))
577  {
578  effEntIsIndex = true;
579  }
580 
581  }, lLoop);
582 
583  if(effEntIsIndex)
584  {
585  continue;
586  }
587 
590  {
591  actionWrite = true;
592  }
593 
595 
596  return actionWrite;
597 }
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15

References action_write_p, EFFECT, effect_action, effect_entity(), f(), lLoop, load_cumulated_rw_effects_list(), loop_index, MAP, ref, reference_variable, same_entity_p(), STATEMENT, and statement_loop().

Referenced by check_loop_distribution_feasability(), phrase_check_reference(), and process_ref_list().

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

◆ comEngine_expression_to_reference_list()

list comEngine_expression_to_reference_list ( expression  e,
list  lr 
)

conversion of an expression into a list of references; references are appended to list lr as they are encountered; array references are added before their index expressions are scanned;

comEngine_feasability.c

references to functions and constants (which are encoded as null-ary functions) are not recorded

Parameters
lrr

Definition at line 100 of file comEngine_feasability.c.

103 {
104  syntax s = expression_syntax(e);
105  lr = local_syntax_to_reference_list(s, lr);
106  return lr;
107 }
static list local_syntax_to_reference_list(syntax s, list lr)
#define expression_syntax(x)
Definition: ri.h:1247

References expression_syntax, and local_syntax_to_reference_list().

Referenced by check_call_distribution_feasability(), check_test_distribution_feasability(), fill_gRefToEncLoop_call(), fill_gRefToEncLoop_test(), generate_code_call(), HRE_distribute_call(), HRE_distribute_test(), local_syntax_to_reference_list(), and reference_indices_entity_list().

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

◆ comEngine_feasability()

bool comEngine_feasability ( statement  externalized_code,
graph  dg 
)
Parameters
externalized_codexternalized_code
dgg

Definition at line 1177 of file comEngine_feasability.c.

1178 {
1179  bool success = false;
1180 
1181  // Initialize some global variables
1182  gDg = dg;
1183  g_externalized_code = externalized_code;
1184  gIfCount = 0;
1186  lLoop = NIL;
1187  glIndUsed = NIL;
1188 
1190 
1191  // Fill the hash_table gRefToEncLoop
1192  fill_gRefToEncLoop(externalized_code);
1193 
1194  pips_assert("lLoop == NIL", lLoop == NIL);
1195 
1196  // Perform the actual analysis
1197  success = check_distribution_feasability(externalized_code);
1198 
1200 
1201  // Free some global variables
1202  HASH_MAP(curRef, curLoopList,
1203  {
1204  gen_free_list(curLoopList);
1205  }, gRefToEncLoop);
1208 
1209  return success;
1210 }
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
static void fill_gRefToEncLoop(statement stat)
void hash_dont_warn_on_redefinition(void)
Definition: hash.c:188
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void hash_warn_on_redefinition(void)
these function set the variable should_i_warn_on_redefinition to the value true or false
Definition: hash.c:183
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
@ hash_pointer
Definition: newgen_hash.h:32

References check_distribution_feasability(), dg, fill_gRefToEncLoop(), g_externalized_code, gDg, gen_free_list(), gIfCount, glIndUsed, gRefToEncLoop, hash_dont_warn_on_redefinition(), HASH_MAP, hash_pointer, hash_table_free(), hash_table_make(), hash_warn_on_redefinition(), lLoop, NIL, and pips_assert.

Referenced by comEngine_distribute_code().

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

◆ compute_fifo_from_ref()

static void compute_fifo_from_ref ( reference  ref,
bool  bReadAct,
int  inc 
)
static

Definition at line 367 of file comEngine_feasability.c.

368 {
369  intptr_t fifoNum = 0;
370 
371  fifoNum = find_or_create_fifo_from_ref(ref, bReadAct, gRefToFifo, inc);
372 
373  hash_put(gRefToHREFifo, ref, (void *)fifoNum);
374 }
hash_table gRefToFifo
hash_table gRefToHREFifo
static int find_or_create_fifo_from_ref(reference ref, bool bReadAct, hash_table refToFifo, int inc)
#define intptr_t
Definition: stdint.in.h:294

References find_or_create_fifo_from_ref(), gRefToFifo, gRefToHREFifo, hash_put(), intptr_t, and ref.

Referenced by attach_ref_to_stat().

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

◆ entity_in_ref_list()

static bool entity_in_ref_list ( entity  searchedEnt,
list  lRef 
)
static

Definition at line 296 of file comEngine_feasability.c.

297 {
298  MAP(REFERENCE, ref,
299  {
301 
302  if(same_entity_p(ent, searchedEnt))
303  {
304  return true;
305  }
306  }, lRef);
307 
308  return false;
309 }

References MAP, ref, REFERENCE, reference_variable, and same_entity_p().

Referenced by check_loop_distribution_feasability().

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

◆ fill_gRefToEncLoop()

static void fill_gRefToEncLoop ( statement  stat)
static

Definition at line 255 of file comEngine_feasability.c.

256 {
257  instruction instr = statement_instruction(stat);
258 
259  switch(instruction_tag(instr))
260  {
262  {
263  MAP(STATEMENT, curStat,
264  {
265  fill_gRefToEncLoop(curStat);
266 
268  break;
269  }
270  case is_instruction_loop:
271  {
273  break;
274  }
275  case is_instruction_call:
276  {
278  break;
279  }
280  case is_instruction_test:
281  {
283  break;
284  }
285  default:
286  {
287  break;
288  }
289  }
290 }
static void fill_gRefToEncLoop_loop(statement stat)
static void fill_gRefToEncLoop_call(statement stat)
static void fill_gRefToEncLoop_test(statement stat)

References fill_gRefToEncLoop_call(), fill_gRefToEncLoop_loop(), fill_gRefToEncLoop_test(), instruction_sequence, instruction_tag, is_instruction_call, is_instruction_loop, is_instruction_sequence, is_instruction_test, MAP, sequence_statements, STATEMENT, and statement_instruction.

Referenced by comEngine_feasability(), fill_gRefToEncLoop_loop(), and fill_gRefToEncLoop_test().

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

◆ fill_gRefToEncLoop_call()

static void fill_gRefToEncLoop_call ( statement  stat)
static

Definition at line 192 of file comEngine_feasability.c.

193 {
194  list lCallRef = NIL;
195 
197 
198  MAP(EXPRESSION, exp,
199  {
200  list old = lCallRef;
201  list new = NIL;
203 
204  lCallRef = gen_concatenate(old, new);
205 
206  gen_free_list(old);
207  gen_free_list(new);
208 
209  }, call_arguments(curCall));
210 
211  MAP(REFERENCE, callRef,
212  {
214  }, lCallRef);
215 
216  gen_free_list(lCallRef);
217 }
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501

References call_arguments, comEngine_expression_to_reference_list(), exp, EXPRESSION, gen_concatenate(), gen_copy_seq(), gen_free_list(), gRefToEncLoop, hash_put(), instruction_call, lLoop, MAP, NIL, REFERENCE, and statement_instruction.

Referenced by fill_gRefToEncLoop().

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

◆ fill_gRefToEncLoop_loop()

static void fill_gRefToEncLoop_loop ( statement  stat)
static

Definition at line 176 of file comEngine_feasability.c.

177 {
178  loop curLoop = statement_loop(stat);
179 
180  statement body = loop_body(curLoop);
181 
182  lLoop = gen_nconc(lLoop, CONS(STATEMENT, stat, NIL));
183 
184  fill_gRefToEncLoop(body);
185 
186  gen_remove(&lLoop, stat);
187 }

References CONS, fill_gRefToEncLoop(), gen_nconc(), gen_remove(), lLoop, loop_body, NIL, STATEMENT, and statement_loop().

Referenced by fill_gRefToEncLoop().

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

◆ fill_gRefToEncLoop_test()

static void fill_gRefToEncLoop_test ( statement  stat)
static

Definition at line 222 of file comEngine_feasability.c.

223 {
224  test curTest = statement_test(stat);
225 
226  list lCondRef = NIL;
227  lCondRef = comEngine_expression_to_reference_list(test_condition(curTest), lCondRef);
228 
229  MAP(REFERENCE, condRef,
230  {
231  if(gen_length(reference_indices(condRef)) != 0)
232  {
234  }
235  }, lCondRef);
236 
237  if(test_true(curTest) != statement_undefined)
238  {
239  fill_gRefToEncLoop(test_true(curTest));
240  }
241 
242  if(test_false(curTest) != statement_undefined)
243  {
244  fill_gRefToEncLoop(test_false(curTest));
245  }
246 
247  gen_free_list(lCondRef);
248 }

References comEngine_expression_to_reference_list(), fill_gRefToEncLoop(), gen_copy_seq(), gen_free_list(), gen_length(), gRefToEncLoop, hash_put(), lLoop, MAP, NIL, REFERENCE, reference_indices, statement_test(), statement_undefined, test_condition, test_false, and test_true.

Referenced by fill_gRefToEncLoop().

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

◆ find_common_loop()

static statement find_common_loop ( list  n1,
list  n2,
list lWLoops 
)
static

Definition at line 703 of file comEngine_feasability.c.

704 {
705  statement comLoop = statement_undefined;
706 
707  statement lastLoop = statement_undefined;
708 
709  while (n1 != NIL && n2 != NIL) {
710  if (STATEMENT(CAR(n1)) != STATEMENT(CAR(n2)))
711  {
712  break;
713  }
714  lastLoop = STATEMENT(CAR(n1));
715  n1 = CDR(n1);
716  n2 = CDR(n2);
717  }
718 
719  while(n2 != NIL)
720  {
721  *lWLoops = gen_nconc(*lWLoops, CONS(STATEMENT, STATEMENT(CAR(n2)), NIL));
722  n2 = CDR(n2);
723  }
724 
725 
726  comLoop = lastLoop;
727 
728  return comLoop;
729 }
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111

References CAR, CDR, CONS, gen_nconc(), NIL, STATEMENT, and statement_undefined.

Referenced by check_for_conflict().

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

◆ find_or_create_fifo_from_ref()

static int find_or_create_fifo_from_ref ( reference  ref,
bool  bReadAct,
hash_table  refToFifo,
int  inc 
)
static

Definition at line 316 of file comEngine_feasability.c.

318 {
319  pips_assert("true", bReadAct==bReadAct);
320  intptr_t fifoNum = -1;
321 
322  // Goes through the hash_table refToFifo to see if
323  // a fifo is already associated with the reference ref.
324  HASH_MAP(curRef,
325  buff,
326  {
327  if(reference_equal_p(curRef, ref))
328  {
329  fifoNum = (intptr_t)buff;
330  break;
331  }
332  }, refToFifo);
333 
334  // If no fifo is associated to ref, then create one
335  if(fifoNum == -1)
336  {
337  //printf("create %d\n", (int) fifoNum);
338  //print_reference(ref);printf("\n");
339  static int numFifo = 1;
340 
341  fifoNum = numFifo;
342  numFifo += inc;
343 
344  hash_put(refToFifo, ref, (void *)fifoNum);
345  }
346  // else a fifo already exists, so just store the value
347  // in refToFifo
348  else
349  {
350  //printf("put %d\n", (int) fifoNum);
351  //print_reference(ref);printf("\n");
352 
353  hash_put(refToFifo, ref, (void *)fifoNum);
354  }
355 
356  //printf("real fifoNum %d\n", fifoNum);
357 
358  return fifoNum;
359 }

References HASH_MAP, hash_put(), intptr_t, pips_assert, ref, and reference_equal_p().

Referenced by compute_fifo_from_ref().

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

◆ has_loop_inside()

static bool has_loop_inside ( statement  stat)
static

Definition at line 161 of file comEngine_feasability.c.

162 {
163  bool bHasLoopInside = false;
164 
165  gen_context_recurse(stat, &bHasLoopInside,
167 
168  return bHasLoopInside;
169 }
static void has_loop_inside_rwt(statement stat, bool *bHasLoopInside)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
Definition: genClib.c:2785
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362

References gen_context_recurse, gen_true2(), has_loop_inside_rwt(), and statement_domain.

Referenced by check_test_distribution_feasability().

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

◆ has_loop_inside_rwt()

static void has_loop_inside_rwt ( statement  stat,
bool bHasLoopInside 
)
static

Definition at line 141 of file comEngine_feasability.c.

142 {
143  instruction instr = statement_instruction(stat);
144 
145  switch(instruction_tag(instr))
146  {
147  case is_instruction_loop:
150  *bHasLoopInside = true;
151  break;
152  default:
153  break;
154  }
155 }
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_forloop
Definition: ri.h:1477

References instruction_tag, is_instruction_forloop, is_instruction_loop, is_instruction_whileloop, and statement_instruction.

Referenced by has_loop_inside().

+ Here is the caller graph for this function:

◆ is_good_direction_p()

static bool is_good_direction_p ( Ptsg  sg,
int  loopLev,
bool  bReadIsSource 
)
static

For each coordinate

For all vertices

For all rays

For all lines

Definition at line 641 of file comEngine_feasability.c.

642 {
643  Pbase c = BASE_NULLE;
644  int ddv = 0;
645 
646  int counter = 1;
647  string dir = "";
648 
649  /* For each coordinate */
650  for(c=sg->base; !BASE_NULLE_P(c); c = c->succ) {
651  Psommet v;
652  Pray_dte r;
653  Pray_dte l;
654 
655  /* For all vertices */
656  for(v=sg_sommets(sg); v!= NULL; v = v->succ) {
658  }
659 
660  /* For all rays */
661  for(r=sg_rayons(sg); r!= NULL; r = r->succ) {
663  }
664 
665  /* For all lines */
666  for(l=sg_droites(sg); l!= NULL; l = l->succ) {
668  }
669 
670  if(counter == loopLev)
671  {
672  dir = direction_to_representation[ddv];
673  break;
674  }
675 
676  counter++;
677  }
678 
679  if(((!strcmp(dir, "<")) ||
680  (!strcmp(dir, "<="))) &&
681  bReadIsSource)
682  {
683  return true;
684  }
685  else if(((!strcmp(dir, ">")) ||
686  (!strcmp(dir, ">="))) &&
687  !bReadIsSource)
688  {
689  return true;
690  }
691  else if(!strcmp(dir, "="))
692  {
693  return false;
694  }
695 
696  return false;
697 }
#define value_sign(v)
trian operators on values
static int ray_to_direction[3]
static char * direction_to_representation[8]
static int vertex_to_direction[3]
static int line_to_direction[3]
Ptsg sg
#define sg_sommets(sg)
vieilles definitions des fonctions d'impression void sg_fprint(); #define print_sg(sg) sg_fprint(stdo...
Definition: sg-local.h:85
#define sg_rayons(sg)
acces au premier rayon de la liste des rayons d'un systeme generateur defini par un pointeur: sg_rayo...
Definition: sg-local.h:89
#define sg_droites(sg)
acces a la premiere droite de la liste des droites d'un systeme generateur defini par un pointeur: sg...
Definition: sg-local.h:93
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct Svecteur * succ
Definition: vecteur-local.h:92
struct rdte * succ
Definition: ray_dte-local.h:46
struct Svecteur * vecteur
Definition: ray_dte-local.h:45
structure de donnees Sommet
Definition: sommet-local.h:64
struct typ_som * succ
Definition: sommet-local.h:68
Pvecteur vecteur
Definition: sommet-local.h:66
Pbase base
Definition: sg-local.h:70
#define vecteur_var(v)
#define BASE_NULLE
MACROS SUR LES BASES.
#define BASE_NULLE_P(b)
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

References type_sg::base, BASE_NULLE, BASE_NULLE_P, direction_to_representation, line_to_direction, ray_to_direction, sg, sg_droites, sg_rayons, sg_sommets, rdte::succ, typ_som::succ, Svecteur::succ, value_sign, vect_coeff(), rdte::vecteur, typ_som::vecteur, vecteur_var, and vertex_to_direction.

Referenced by check_for_conflict().

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

◆ local_syntax_to_reference_list()

static list local_syntax_to_reference_list ( syntax  s,
list  lr 
)
static

Definition at line 109 of file comEngine_feasability.c.

112 {
113  switch(syntax_tag(s)) {
114  case is_syntax_reference:
115  lr = gen_nconc(lr, CONS(REFERENCE, syntax_reference(s), NIL));
116  break;
117  case is_syntax_range:
121  lr);
122  break;
123  case is_syntax_call:
124  MAPL(ce, {
125  expression e = EXPRESSION(CAR(ce));
127  },
129  break;
130  default:
131  pips_internal_error("illegal tag %d",
132  syntax_tag(s));
133 
134  }
135  return lr;
136 }
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define syntax_range(x)
Definition: ri.h:2733
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_reference
Definition: ri.h:2691
#define syntax_call(x)
Definition: ri.h:2736

References call_arguments, CAR, comEngine_expression_to_reference_list(), CONS, EXPRESSION, gen_nconc(), is_syntax_call, is_syntax_range, is_syntax_reference, MAPL, NIL, pips_internal_error, range_increment, range_lower, range_upper, REFERENCE, syntax_call, syntax_range, syntax_reference, and syntax_tag.

Referenced by comEngine_expression_to_reference_list().

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

◆ process_ref_list()

static bool process_ref_list ( list  lCallRef,
bool  firstRef,
statement  inStat 
)
static

rintf("call ref\n"); print_reference(callRef); printf("\n");

Definition at line 953 of file comEngine_feasability.c.

954 {
955  list lIndRef = NIL;
956 
957  MAP(REFERENCE, callRef,
958  {
959 
960  if(gen_length(reference_indices(callRef)) == 0)
961  {
962  // If a loop index is used in some call or test statement,
963  // then the compilation is impossible
964  MAP(STATEMENT,loopStat,
965  {
967  reference_variable(callRef)))
968  {
969  pips_internal_error("loop index must not vary in the code: %s",
970  reference_to_string(callRef));
971 
972  return false;
973  }
974 
975  }, lLoop);
976 
977  lIndRef = NIL;
978 
979  // Attach callRef to the suitable statement
980  if(lLoop == NIL)
981  {
983  firstRef, 1);
984  }
985  else
986  {
987  if(!attach_ref_to_loop(callRef, inStat, firstRef, lIndRef))
988  {
989  gen_free_list(lIndRef);
990  return false;
991  }
992  }
993 
994  firstRef = false;
995  continue;
996  }
997 
998  /*printf("call ref\n");
999  print_reference(callRef);
1000  printf("\n");
1001  */
1002  lIndRef = reference_indices_entity_list(callRef);
1003 
1004  MAP(REFERENCE, indRef,
1005  {
1006  // If one reference contained in callRef indices is an
1007  // array reference or that the reference is written in
1008  // the code to compile, then the compilation is impossible
1009  if((gen_length(reference_indices(indRef)) != 0) ||
1011  {
1012  gen_free_list(lIndRef);
1013 
1014  pips_internal_error("%s is not a valid reference",
1015  reference_to_string(callRef));
1016 
1017  return false;
1018  }
1019 
1020  }, lIndRef);
1021 
1022  // Attach callRef to the suitable statement
1023  if(lLoop == NIL)
1024  {
1026  firstRef, 1);
1027  }
1028  else
1029  {
1030  if(!attach_ref_to_loop(callRef, inStat, firstRef, lIndRef))
1031  {
1032  gen_free_list(lIndRef);
1033  return false;
1034  }
1035  }
1036 
1037  gen_free_list(lIndRef);
1038 
1039  firstRef = false;
1040 
1041  }, lCallRef);
1042 
1043  return true;
1044 }
list reference_indices_entity_list(reference ref)
static bool attach_ref_to_loop(reference callRef, statement inStat, bool firstRef, list lIndRef)

References attach_ref_to_loop(), attach_ref_to_stat(), code_has_write_eff_ref_p(), g_externalized_code, gen_free_list(), gen_length(), gStatToRef, lLoop, loop_index, MAP, NIL, pips_internal_error, REFERENCE, reference_indices, reference_indices_entity_list(), reference_to_string(), reference_variable, same_entity_p(), STATEMENT, and statement_loop().

Referenced by check_call_distribution_feasability(), and check_test_distribution_feasability().

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

◆ reference_indices_entity_list()

list reference_indices_entity_list ( reference  ref)
Parameters
refef

Definition at line 603 of file comEngine_feasability.c.

604 {
605  list lIndRef = NIL;
606 
607  MAP(EXPRESSION, index,
608  {
609  list old = lIndRef;
610  list new = NIL;
611  new = comEngine_expression_to_reference_list(index, new);
612 
613  lIndRef = gen_concatenate(old, new);
614 
615  gen_free_list(old);
616  gen_free_list(new);
617 
618  }, reference_indices(ref));
619 
620  return lIndRef;
621 }

References comEngine_expression_to_reference_list(), EXPRESSION, gen_concatenate(), gen_free_list(), MAP, NIL, ref, and reference_indices.

Referenced by phrase_check_reference(), and process_ref_list().

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

Variable Documentation

◆ direction_to_representation

char* direction_to_representation[8] = {"?", "<", "=", "<=", ">", "*", ">=", "*"}
static

Definition at line 635 of file comEngine_feasability.c.

Referenced by is_good_direction_p().

◆ g_externalized_code

statement g_externalized_code
static

◆ gDg

graph gDg
static

Definition at line 85 of file comEngine_feasability.c.

Referenced by check_for_conflict(), and comEngine_feasability().

◆ gIfCount

int gIfCount = 0
static

◆ glIndUsed

list glIndUsed
static

◆ gRefToEncLoop

◆ line_to_direction

int line_to_direction[3] = {ANY_DIRECTION, NO_DIRECTION, ANY_DIRECTION}
static

Definition at line 633 of file comEngine_feasability.c.

Referenced by is_good_direction_p().

◆ lLoop

◆ ray_to_direction

int ray_to_direction[3] = {LESSER_DIRECTION, NO_DIRECTION, GREATER_DIRECTION}
static

Definition at line 631 of file comEngine_feasability.c.

Referenced by is_good_direction_p().

◆ vertex_to_direction

int vertex_to_direction[3] = {LESSER_DIRECTION, ZERO_DIRECTION, GREATER_DIRECTION}
static

Definition at line 629 of file comEngine_feasability.c.

Referenced by is_good_direction_p().