PIPS
comEngine_generate_procCode.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 "properties.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 "comEngine_generate_code.h"
#include "phrase.h"
+ Include dependency graph for comEngine_generate_procCode.c:

Go to the source code of this file.

Functions

static list make_mmcd_stats_from_ref (statement stat, list lSupportedRef, hash_table htOffset, entity transferSize, entity newOuterInd, statement innerStat)
 
static bool get_final_offset (list lRefDim, intptr_t offset, int rank, intptr_t *retVal)
 
static bool supported_ref_p (reference ref, entity index, hash_table htOffset)
 
static bool has_call_stat_inside_flt (statement stat, bool *bHasCallStat)
 
static void has_call_stat_inside_rwt (_UNUSED_ statement stat, _UNUSED_ bool *bHasCallStat)
 
bool has_call_stat_inside (statement stat)
 comEngine_generate_procCode.c More...
 
static intptr_t get_realFifoNum (intptr_t fifoNum)
 
static entity get_toggleEnt_from_ref (reference curRef, list lToggleEnt)
 
static statement make_mmcd_load_store_stat (string name, expression hreBuff, expression refExp, expression offExp, expression countExp)
 
static statement generate_mmcd_stat_from_ref (reference curRef, int offset, expression count, bool bRead, list lToggleEnt)
 
static void generate_mmcd_stats_from_ref (list lRef, hash_table htOffset, expression count, list lToggleEnt, list *lReadStats, list *lWriteStats)
 
statement make_step_inc_statement (int incNum)
 
statement make_loop_step_stat (statement stat, entity newOuterInd)
 
static bool has_loop_inside_flt (statement stat, bool *bHasLoop)
 
static bool has_loop_inside (statement stat)
 
static int alloc_new_slot (entity ent)
 
statement make_toggle_mmcd (entity ent)
 
static int find_or_create_slot (entity ent)
 
statement make_init_newInd_stat (statement stat, entity newInd)
 
statement make_transStat (statement stat, entity newOuterInd, entity transferSize, expression bufferSizeExp)
 
static void comEngine_replace_reference_in_stat_rwt (expression exp, expression newExp)
 
void comEngine_replace_reference_in_stat (statement stat, reference ref, expression new)
 
static list make_lStats (statement stat, entity transferSize, statement innerStat, entity newOuterInd, list lSupportedRef, hash_table htOffset, expression bufferSizeExp)
 
statement make_exec_mmcd ()
 
statement generate_stat_from_ref_list_proc (list lRef, list lToggleEnt, statement stat)
 
list generate_stat_from_ref_list_proc_list (list lRef, list lInStats)
 
void process_innerStat1_proc (statement stat, entity oldInd, entity newOuterInd, entity newInnerInd)
 
void get_supportedRef_proc (statement stat, hash_table htOffset, list *lSupportedRef, list *lUnSupportedRef)
 
statement get_call_stat_proc (_UNUSED_ statement stat)
 
list make_loop_lStats_proc (statement stat, entity transferSize, statement innerStat, entity newOuterInd, list lSupportedRef, hash_table htOffset, expression bufferSizeExp)
 
list add_index_out_effect_proc (loop curLoop, list lStats)
 
statement generate_code_test_proc (statement stat)
 
list process_gLoopToSync_proc (statement stat, list lInStats)
 
void create_realFifo_proc (statement stat, list lRef)
 
statement comEngine_generate_procCode (statement externalized_code, _UNUSED_ list l_in, _UNUSED_ list l_out)
 

Variables

static hash_table gRealFifo
 
static entity gStepEnt
 
static hash_table gOldRefToHREFifo
 
static reference gRefToReplace
 

Function Documentation

◆ add_index_out_effect_proc()

list add_index_out_effect_proc ( loop  curLoop,
list  lStats 
)
Parameters
curLoopurLoop
lStatsStats

Definition at line 1129 of file comEngine_generate_procCode.c.

1130 {
1131  statement assignStat =
1134 
1135  return gen_nconc(lStats, CONS(STATEMENT, assignStat, NIL));
1136 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
#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
statement make_assign_statement(expression, expression)
Definition: statement.c:583
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
#define range_upper(x)
Definition: ri.h:2290
#define loop_range(x)
Definition: ri.h:1642
#define loop_index(x)
Definition: ri.h:1640
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CONS, copy_expression(), entity_to_expression(), gen_nconc(), loop_index, loop_range, make_assign_statement(), NIL, range_upper, and STATEMENT.

Referenced by generate_code_loop().

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

◆ alloc_new_slot()

static int alloc_new_slot ( entity  ent)
static

f((curFifo == -1) || (curInd == get_int_property("COMENGINE_SIZE_OF_FIFO"))) {

Definition at line 645 of file comEngine_generate_procCode.c.

646 {
647  static intptr_t curFifo = -1;
648  static intptr_t curInd = 0;
649 
650  /*if((curFifo == -1) || (curInd == get_int_property("COMENGINE_SIZE_OF_FIFO")))
651  {*/
652  curFifo = get_realFifoNum(-1);
653 
654  curInd = 0;
655  //}
656 
657  hash_put(gEntToHREFifo, ent, (void*)curFifo);
658 
659  hash_put(gIndToNum, ent, (void*)curInd++);
660 
661  return curFifo;
662 }
hash_table gIndToNum
hash_table gEntToHREFifo
static intptr_t get_realFifoNum(intptr_t fifoNum)
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 intptr_t
Definition: stdint.in.h:294

References gEntToHREFifo, get_realFifoNum(), gIndToNum, hash_put(), and intptr_t.

Referenced by find_or_create_slot(), and make_toggle_mmcd().

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

◆ comEngine_generate_procCode()

statement comEngine_generate_procCode ( statement  externalized_code,
_UNUSED_ list  l_in,
_UNUSED_ list  l_out 
)

Definition at line 1289 of file comEngine_generate_procCode.c.

1293 {
1294  statement newStat;
1295 
1296  // Initialize some global variables
1301  (strdup("step"),
1302  make_basic(is_basic_int, (void*)4));
1303  gGenHRE = false;
1304 
1305  // Do the job
1306  newStat = comEngine_generate_code(externalized_code);
1307 
1308  // Add the step variable initialization
1309  statement stepStat =
1311  int_to_expression(1));
1312 
1313  // Add the start HRE statement
1314  statement startStat =
1316  NIL));
1317 
1318  // Add the wait HRE statement
1319  statement waitStat =
1321  NIL));
1322 
1324  stepStat,
1325  newStat,
1326  startStat,
1327  waitStat,
1328  NULL);
1329 
1330  newStat = make_block_statement(lStats);
1331 
1332  // Fre some global variables
1335 
1336  //printf("final newStat\n");
1337  //print_statement(newStat);
1338 
1339  return newStat;
1340 }
call make_call(entity a1, list a2)
Definition: ri.c:269
basic make_basic(enum basic_utype tag, void *val)
Definition: ri.c:155
#define WAIT_FOR_HRE
Definition: comEngine.h:43
#define START_HRE
Definition: comEngine.h:42
hash_table gRefToHREFifo
entity comEngine_make_new_scalar_variable(const char *prefix, basic bas)
statement comEngine_generate_code(statement stat)
bool gGenHRE
static hash_table gOldRefToHREFifo
static hash_table gRealFifo
static entity gStepEnt
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
list gen_make_list(int domain,...)
Definition: list.c:851
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
@ hash_pointer
Definition: newgen_hash.h:32
#define call_to_statement(c)
entity module_name_to_runtime_entity(const char *name)
similar to module_name_to_entity but generates a warning and a stub if the entity is not found
Definition: entity.c:1485
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
@ is_basic_int
Definition: ri.h:571
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
char * strdup()
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References call_to_statement, comEngine_generate_code(), comEngine_make_new_scalar_variable(), entity_to_expression(), gen_make_list(), gGenHRE, gOldRefToHREFifo, gRealFifo, gRefToHREFifo, gStepEnt, hash_pointer, hash_table_free(), hash_table_make(), int_to_expression(), is_basic_int, make_assign_statement(), make_basic(), make_block_statement(), make_call(), module_name_to_runtime_entity(), NIL, START_HRE, statement_domain, strdup(), and WAIT_FOR_HRE.

Referenced by comEngine_distribute_code().

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

◆ comEngine_replace_reference_in_stat()

void comEngine_replace_reference_in_stat ( statement  stat,
reference  ref,
expression  new 
)
Parameters
stattat
refef
newew

Definition at line 871 of file comEngine_generate_procCode.c.

873 {
874  gRefToReplace = ref;
875 
876  gen_context_recurse(stat, new,
878 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
static void comEngine_replace_reference_in_stat_rwt(expression exp, expression newExp)
static reference gRefToReplace
#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 expression_domain
newgen_execution_domain_defined
Definition: ri.h:154

References comEngine_replace_reference_in_stat_rwt(), expression_domain, gen_context_recurse, gen_true2(), gRefToReplace, and ref.

Referenced by generate_code_loop(), make_lInitStats(), make_lSwitchStats(), make_mmcd_stats_from_ref(), process_innerStat1_proc(), regenerate_toggles(), replace_array_ref_with_fifos(), and replace_array_ref_with_fifos2().

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

◆ comEngine_replace_reference_in_stat_rwt()

static void comEngine_replace_reference_in_stat_rwt ( expression  exp,
expression  newExp 
)
static

Definition at line 849 of file comEngine_generate_procCode.c.

850 {
854  {
856 
858 
860 
862 
864  }
865 }
void free_normalized(normalized p)
Definition: ri.c:1407
void free_syntax(syntax p)
Definition: ri.c:2445
#define NORMALIZE_EXPRESSION(e)
bool reference_equal_p(reference r1, reference r2)
Definition: expression.c:1500
bool expression_reference_p(expression e)
Test if an expression is a reference.
Definition: expression.c:528
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832
#define normalized_undefined
Definition: ri.h:1745
#define expression_normalized(x)
Definition: ri.h:1249
#define expression_syntax(x)
Definition: ri.h:1247
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References exp, expression_normalized, expression_reference(), expression_reference_p(), expression_syntax, free_normalized(), free_syntax(), gRefToReplace, NORMALIZE_EXPRESSION, normalized_undefined, and reference_equal_p().

Referenced by comEngine_replace_reference_in_stat().

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

◆ create_realFifo_proc()

void create_realFifo_proc ( statement  stat,
list  lRef 
)
Parameters
stattat
lRefRef

Definition at line 1210 of file comEngine_generate_procCode.c.

1211 {
1212  list lDone = NIL;
1213 
1214  pips_assert("true", stat==stat);
1215 
1216  //bool readAndWrite = false;
1217 
1218  MAP(REFERENCE, curRef1,
1219  {
1220  bool bDone = false;
1221 
1222  MAP(REFERENCE, refDone,
1223  {
1224  if(reference_equal_p(curRef1, refDone))
1225  {
1226  hash_put(gRefToFifoOff, hash_get(gRefToFifo, refDone), (void *)3);
1227  bDone = true;
1228  break;
1229  }
1230  }, lDone);
1231 
1232  if(bDone)
1233  continue;
1234 
1235  void* fifoNum = hash_get(gRefToFifo, curRef1);
1236 
1237  pips_assert("fifoNum != HASH_UNDEFINED_VALUE",
1238  fifoNum != HASH_UNDEFINED_VALUE);
1239 
1240  hash_put(gRefToFifoOff, fifoNum, (void *)2);
1241 
1242  MAP(REFERENCE, curRef2,
1243  {
1244  if(reference_equal_p(curRef1, curRef2))
1245  {
1246  string effAction1 = hash_get(gRefToEff, curRef1);
1247 
1248  pips_assert("effAction1 != HASH_UNDEFINED_VALUE",
1249  effAction1 != HASH_UNDEFINED_VALUE);
1250 
1251  string effAction2 = hash_get(gRefToEff, curRef2);
1252 
1253  pips_assert("effAction2 != HASH_UNDEFINED_VALUE",
1254  effAction2 != HASH_UNDEFINED_VALUE);
1255 
1256  if(strcmp(effAction1, effAction2))
1257  {
1258  hash_put(gRefToFifoOff, fifoNum, (void *)3);
1259 
1260  lDone = CONS(REFERENCE, curRef1, lDone);
1261 
1262  break;
1263  }
1264  }
1265  }, lRef);
1266  }, lRef);
1267 
1268  gen_free_list(lDone);
1269 
1270  printf("create_realFifo_proc\n");
1271  MAP(REFERENCE, curRef,
1272  {
1273  printf("create_realFifo_proc it\n");
1274  print_reference(curRef);printf("\n");
1275  intptr_t fifoNum = (intptr_t)hash_get(gRefToFifo, curRef);
1276 
1277  pips_assert("fifoNum != HASH_UNDEFINED_VALUE",
1278  fifoNum != (intptr_t)HASH_UNDEFINED_VALUE);
1279 
1280  get_realFifoNum(fifoNum);
1281  }, lRef);
1282 
1283  printf("create_realFifo_proc end\n");
1284 }
hash_table gRefToFifoOff
hash_table gRefToFifo
hash_table gRefToEff
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#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
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
#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
void print_reference(reference r)
Definition: expression.c:142
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
int printf()

References CONS, gen_free_list(), get_realFifoNum(), gRefToEff, gRefToFifo, gRefToFifoOff, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, intptr_t, MAP, NIL, pips_assert, print_reference(), printf(), REFERENCE, and reference_equal_p().

Referenced by generate_code_loop().

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

◆ find_or_create_slot()

static int find_or_create_slot ( entity  ent)
static

Definition at line 685 of file comEngine_generate_procCode.c.

686 {
687  intptr_t fifoNum = (intptr_t)hash_get(gEntToHREFifo, ent);
688 
689  if(fifoNum == (intptr_t)HASH_UNDEFINED_VALUE)
690  {
691  fifoNum = alloc_new_slot(ent);
692  }
693 
694  return fifoNum;
695 }
static int alloc_new_slot(entity ent)

References alloc_new_slot(), gEntToHREFifo, hash_get(), HASH_UNDEFINED_VALUE, and intptr_t.

Referenced by make_init_newInd_stat().

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

◆ generate_code_test_proc()

statement generate_code_test_proc ( statement  stat)
Parameters
stattat

Definition at line 1142 of file comEngine_generate_procCode.c.

1143 {
1144  printf("generate_code_test\n");
1145  print_statement(stat);printf("\n");
1146  statement newStat = statement_undefined;
1147 
1148  newStat = get_call_stat_proc(stat);
1149 
1150  list lRef = hash_get(gStatToRef, stat);
1151 
1152  if(lRef != HASH_UNDEFINED_VALUE)
1153  {
1154  newStat = generate_stat_from_ref_list_proc(lRef, NIL, newStat);
1155  }
1156 
1157  // Get the new statements for the true statement
1158  statement trueStat = generate_code_function(test_true(statement_test(stat)), false);
1159 
1160  // Get the new statements for the false statement
1161  statement falseStat = generate_code_function(test_false(statement_test(stat)), false);
1162 
1163  list lStats = NIL;
1164 
1165  if(newStat != statement_undefined)
1166  {
1167  lStats = gen_nconc(lStats, CONS(STATEMENT, newStat, NIL));
1168  }
1169 
1170  if(trueStat != statement_undefined)
1171  {
1172  lStats = gen_nconc(lStats, CONS(STATEMENT, trueStat, NIL));
1173  }
1174 
1175  if(falseStat != statement_undefined)
1176  {
1177  lStats = gen_nconc(lStats, CONS(STATEMENT, falseStat, NIL));
1178  }
1179 
1180  newStat = make_block_statement(lStats);
1181 
1182  return newStat;
1183 }
hash_table gStatToRef
statement generate_code_function(statement stat, bool bCalledFromSeq)
statement get_call_stat_proc(_UNUSED_ statement stat)
statement generate_stat_from_ref_list_proc(list lRef, list lToggleEnt, statement stat)
test statement_test(statement)
Get the test of a statement.
Definition: statement.c:1348
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
#define test_false(x)
Definition: ri.h:2837
#define test_true(x)
Definition: ri.h:2835
#define statement_undefined
Definition: ri.h:2419

References CONS, gen_nconc(), generate_code_function(), generate_stat_from_ref_list_proc(), get_call_stat_proc(), gStatToRef, hash_get(), HASH_UNDEFINED_VALUE, make_block_statement(), NIL, print_statement(), printf(), STATEMENT, statement_test(), statement_undefined, test_false, and test_true.

Referenced by generate_code_function().

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

◆ generate_mmcd_stat_from_ref()

static statement generate_mmcd_stat_from_ref ( reference  curRef,
int  offset,
expression  count,
bool  bRead,
list  lToggleEnt 
)
static

Definition at line 402 of file comEngine_generate_procCode.c.

405 {
406  statement newStat = statement_undefined;
407 
408  string name = NULL;
409 
410  intptr_t fifoNum = (intptr_t)hash_get(gRefToFifo, curRef);
411 
412  pips_assert("fifoNum != HASH_UNDEFINED_VALUE",
413  fifoNum != (intptr_t)HASH_UNDEFINED_VALUE);
414 
415  // Get the fifo number
416  int realFifoNum = get_realFifoNum(fifoNum);
417 
419 
420  // If the toggle entity list is NIL, then realFifoNum is
421  // the fifo Number to use
422  if(lToggleEnt == NIL)
423  {
424  hreBuff = int_to_expression(realFifoNum);
425  }
426  // else, ...
427  else
428  {
429  printf("generate_mmcd_stat_from_ref 1\n");
430  print_reference(curRef);printf("\n");
431 
432  // Get the toggle entity
433  entity toggleEnt = get_toggleEnt_from_ref(curRef, lToggleEnt);
434 
436  int_to_expression(realFifoNum),
437  entity_to_expression(toggleEnt),
438  NULL);
439 
440  // Add the toggle entity and the fifo number
441  hreBuff =
443  addArg));
444  }
445 
446  if(bRead)
447  {
448  name = strdup(GEN_LOAD_MMCD);
449  }
450  else
451  {
452  name = strdup(GEN_STORE_MMCD);
453  }
454 
455  // Generate the statement
456  newStat =
457  make_mmcd_load_store_stat(name, hreBuff,
460 
461  return newStat;
462 }
reference copy_reference(reference p)
REFERENCE.
Definition: ri.c:2047
static int count
Definition: SDG.c:519
#define GEN_LOAD_MMCD
Definition: comEngine.h:40
#define GEN_STORE_MMCD
Definition: comEngine.h:41
static statement make_mmcd_load_store_stat(string name, expression hreBuff, expression refExp, expression offExp, expression countExp)
static entity get_toggleEnt_from_ref(reference curRef, list lToggleEnt)
static Value offset
Definition: translation.c:283
#define PLUS_OPERATOR_NAME
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
expression reference_to_expression(reference r)
Definition: expression.c:196
expression call_to_expression(call c)
Build an expression that call a function or procedure.
Definition: expression.c:309
#define expression_undefined
Definition: ri.h:1223

References call_to_expression(), copy_reference(), count, entity_intrinsic(), entity_to_expression(), expression_domain, expression_undefined, GEN_LOAD_MMCD, gen_make_list(), GEN_STORE_MMCD, get_realFifoNum(), get_toggleEnt_from_ref(), gRefToFifo, hash_get(), HASH_UNDEFINED_VALUE, int_to_expression(), intptr_t, make_call(), make_mmcd_load_store_stat(), NIL, offset, pips_assert, PLUS_OPERATOR_NAME, print_reference(), printf(), reference_to_expression(), statement_undefined, and strdup().

Referenced by generate_mmcd_stats_from_ref().

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

◆ generate_mmcd_stats_from_ref()

static void generate_mmcd_stats_from_ref ( list  lRef,
hash_table  htOffset,
expression  count,
list  lToggleEnt,
list lReadStats,
list lWriteStats 
)
static

Definition at line 468 of file comEngine_generate_procCode.c.

471 {
472  list lReadDone = NIL;
473  list lWriteDone = NIL;
474 
475  intptr_t offset = 0;
476 
477  MAP(REFERENCE, curRef,
478  {
479  if(htOffset != NULL)
480  {
481  offset = (intptr_t)hash_get(htOffset, curRef);
482 
483  pips_assert("ref offset undefined", offset != (intptr_t) HASH_UNDEFINED_VALUE);
484  }
485  else
486  {
487  offset = 1;
488  }
489 
490  string effAction = hash_get(gRefToEff, curRef);
491 
492  pips_assert("effAction != HASH_UNDEFINED_VALUE",
493  effAction != HASH_UNDEFINED_VALUE);
494 
495  //printf("mmcd ref\n");
496  //print_reference(curRef);printf("\n");
497 
498  if(!strcmp(effAction, R_EFFECT))
499  {
500  //printf("read eff\n");
501 
502  statement readStat = generate_mmcd_stat_from_ref(curRef, offset,
503  count, true,
504  lToggleEnt);
505 
506  //print_statement(readStat);
507 
508  *lReadStats = gen_nconc(*lReadStats, CONS(STATEMENT, readStat, NIL));
509 
510  lReadDone = gen_nconc(lReadDone, CONS(REFERENCE, curRef, NIL));
511  }
512  else
513  {
514  //printf("write eff\n");
515 
516  statement writeStat = generate_mmcd_stat_from_ref(curRef, offset,
517  count, false,
518  lToggleEnt);
519 
520  //print_statement(writeStat);
521 
522  *lWriteStats = gen_nconc(*lWriteStats, CONS(STATEMENT, writeStat, NIL));
523 
524  lWriteDone = gen_nconc(lWriteDone, CONS(REFERENCE, curRef, NIL));
525  }
526 
527  }, lRef);
528 
529  gen_free_list(lReadDone);
530  gen_free_list(lWriteDone);
531 }
#define R_EFFECT
Definition: comEngine.h:29
static statement generate_mmcd_stat_from_ref(reference curRef, int offset, expression count, bool bRead, list lToggleEnt)

References CONS, count, gen_free_list(), gen_nconc(), generate_mmcd_stat_from_ref(), gRefToEff, hash_get(), HASH_UNDEFINED_VALUE, intptr_t, MAP, NIL, offset, pips_assert, R_EFFECT, REFERENCE, and STATEMENT.

Referenced by generate_stat_from_ref_list_proc(), generate_stat_from_ref_list_proc_list(), and make_mmcd_stats_from_ref().

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

◆ generate_stat_from_ref_list_proc()

statement generate_stat_from_ref_list_proc ( list  lRef,
list  lToggleEnt,
statement  stat 
)
Parameters
lRefRef
lToggleEntToggleEnt
stattat

Definition at line 989 of file comEngine_generate_procCode.c.

991 {
992  list lStats = NIL;
993 
994  list lReadStats = NIL;
995  list lWriteStats = NIL;
996 
997  generate_mmcd_stats_from_ref(lRef, NULL,
999  lToggleEnt,
1000  &lReadStats, &lWriteStats);
1001 
1002  statement stepStat1 = make_step_inc_statement(1);
1003  statement stepStat2 = make_step_inc_statement(2);
1004 
1005  lStats = gen_nconc(CONS(STATEMENT, stepStat1, NIL), lReadStats);
1006  if(stat != statement_undefined)
1007  {
1008  lStats = gen_nconc(lStats, CONS(STATEMENT, stat, NIL));
1009  }
1010  lStats = gen_nconc(lStats, lWriteStats);
1011 
1012  if(lWriteStats != NIL)
1013  {
1014  lStats = gen_nconc(lStats, CONS(STATEMENT, stepStat2, NIL));
1015  }
1016 
1017  return make_block_statement(lStats);
1018 }
static void generate_mmcd_stats_from_ref(list lRef, hash_table htOffset, expression count, list lToggleEnt, list *lReadStats, list *lWriteStats)
statement make_step_inc_statement(int incNum)

References CONS, gen_nconc(), generate_mmcd_stats_from_ref(), int_to_expression(), make_block_statement(), make_step_inc_statement(), NIL, STATEMENT, and statement_undefined.

Referenced by generate_code_call(), generate_code_loop(), generate_code_test_proc(), process_code_seq(), and usual_loop_tiling().

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

◆ generate_stat_from_ref_list_proc_list()

list generate_stat_from_ref_list_proc_list ( list  lRef,
list  lInStats 
)
Parameters
lRefRef
lInStatsInStats

Definition at line 1025 of file comEngine_generate_procCode.c.

1026 {
1027  list lStats = NIL;
1028 
1029  list lReadStats = NIL;
1030  list lWriteStats = NIL;
1031 
1032  generate_mmcd_stats_from_ref(lRef, NULL,
1033  int_to_expression(1),
1034  NIL,
1035  &lReadStats, &lWriteStats);
1036 
1037  statement stepStat1 = make_step_inc_statement(1);
1038  statement stepStat2 = make_step_inc_statement(2);
1039 
1040  lStats = gen_nconc(CONS(STATEMENT, stepStat1, NIL), lReadStats);
1041 
1042  lStats = gen_nconc(lStats, lInStats);
1043 
1044  lStats = gen_nconc(lStats, lWriteStats);
1045 
1046  if(lWriteStats != NIL)
1047  {
1048  lStats = gen_nconc(lStats, CONS(STATEMENT, stepStat2, NIL));
1049  }
1050 
1051  return lStats;
1052 }

References CONS, gen_nconc(), generate_mmcd_stats_from_ref(), int_to_expression(), make_step_inc_statement(), NIL, and STATEMENT.

Referenced by generate_code_loop().

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

◆ get_call_stat_proc()

statement get_call_stat_proc ( _UNUSED_ statement  stat)

Definition at line 1109 of file comEngine_generate_procCode.c.

1110 {
1111  return statement_undefined;
1112 }

References statement_undefined.

Referenced by generate_code_call(), and generate_code_test_proc().

+ Here is the caller graph for this function:

◆ get_final_offset()

static bool get_final_offset ( list  lRefDim,
intptr_t  offset,
int  rank,
intptr_t retVal 
)
static

Definition at line 86 of file comEngine_generate_procCode.c.

87 {
88  bool fort_org = get_bool_property("SIMD_FORTRAN_MEM_ORGANISATION");
89 
90  int i = 0;
91  int ind;
92 
93  intptr_t finalOffset = 1;
94 
95  for(i = 0; i < (int) gen_length(lRefDim); i++)
96  {
97  if(fort_org)
98  {
99  ind = i;
100  }
101  else
102  {
103  ind = gen_length(lRefDim) - i - 1;
104  }
105 
106  if(ind == rank)
107  {
108  break;
109  }
110 
111  dimension curDim = DIMENSION(gen_nth(ind, lRefDim));
112 
113  expression lowerExp = dimension_lower(curDim);
114  expression upperExp = dimension_upper(curDim);
115 
116  if(!integer_constant_expression_p(lowerExp) ||
118  {
119  return false;
120  }
121 
122  int lower = integer_constant_expression_value(lowerExp);
123  int upper = integer_constant_expression_value(upperExp);
124 
125  pips_assert("lower < upper", lower < upper);
126 
127  finalOffset = finalOffset * (upper - lower + 1);
128  }
129 
130  *retVal = finalOffset * offset;
131 
132  return true;
133 }
void const char const char const int
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
size_t gen_length(const list l)
Definition: list.c:150
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
Definition: list.c:710
static entity rank
bool integer_constant_expression_p(expression e)
positive integer constant expression: call to a positive constant or to a sum of positive integer con...
Definition: expression.c:903
int integer_constant_expression_value(expression e)
Definition: expression.c:1545
#define dimension_lower(x)
Definition: ri.h:980
#define dimension_upper(x)
Definition: ri.h:982

References DIMENSION, dimension_lower, dimension_upper, gen_length(), gen_nth(), get_bool_property(), int, integer_constant_expression_p(), integer_constant_expression_value(), intptr_t, offset, pips_assert, and rank.

Referenced by supported_ref_p().

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

◆ get_realFifoNum()

static intptr_t get_realFifoNum ( intptr_t  fifoNum)
static

Definition at line 274 of file comEngine_generate_procCode.c.

275 {
276  static intptr_t gCurFifoCounter = 1;
277 
278  //printf("get_realFifoNum %d\n", fifoNum);
279 
280  // fifoNum value can be -1, if we want to increment
281  // gCurFifoCounter with 1
282  if(fifoNum < 0)
283  {
284  intptr_t newFifoNum = gCurFifoCounter;
285 
286  gCurFifoCounter += 1;
287 
288  return newFifoNum;
289  }
290 
291  intptr_t realFifoNum = (intptr_t)hash_get(gRealFifo, (void *)fifoNum);
292 
293  // If no realFifoNum was associated with fifoNum,
294  // then create a new realFifoNum
295  if(realFifoNum == (intptr_t)HASH_UNDEFINED_VALUE)
296  {
297  realFifoNum = gCurFifoCounter;
298 
299  hash_put(gRealFifo, (void *)fifoNum, (void *)realFifoNum);
300 
301  HASH_MAP(ref1, fifo1,
302  {
303  if((intptr_t)fifo1 == (intptr_t)fifoNum)
304  {
305  hash_put(gRefToHREFifo, ref1, (void *)realFifoNum);
306  }
307  }, gOldRefToHREFifo);
308 
309  // Get the number of fifo that has to be allocated for this
310  // realFifoNum
311  intptr_t inc = (intptr_t)hash_get(gRefToFifoOff, (void *)fifoNum);
312 
313  if(inc == (intptr_t)HASH_UNDEFINED_VALUE)
314  {
315  inc = 1;
316  }
317 
318  gCurFifoCounter += inc;
319  }
320 
321  return realFifoNum;
322 }
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60

References gOldRefToHREFifo, gRealFifo, gRefToFifoOff, gRefToHREFifo, hash_get(), HASH_MAP, hash_put(), HASH_UNDEFINED_VALUE, and intptr_t.

Referenced by alloc_new_slot(), create_realFifo_proc(), and generate_mmcd_stat_from_ref().

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

◆ get_supportedRef_proc()

void get_supportedRef_proc ( statement  stat,
hash_table  htOffset,
list lSupportedRef,
list lUnSupportedRef 
)
Parameters
stattat
htOffsettOffset
lSupportedRefSupportedRef
lUnSupportedRefUnSupportedRef

Definition at line 1077 of file comEngine_generate_procCode.c.

1079 {
1080  loop curLoop = statement_loop(stat);
1081 
1082  list lRef = hash_get(gLoopToRef, stat);
1083 
1084  if(lRef == HASH_UNDEFINED_VALUE)
1085  {
1086  lRef = NIL;
1087  }
1088 
1089  MAP(REFERENCE, curRef,
1090  {
1091  //printf("loop ref\n");
1092  //print_reference(curRef);printf("\n");
1093 
1094  if(supported_ref_p(curRef, loop_index(curLoop), htOffset))
1095  {
1096  *lSupportedRef = gen_nconc(*lSupportedRef, CONS(REFERENCE, curRef, NIL));
1097  }
1098  else
1099  {
1100  *lUnSupportedRef = gen_nconc(*lUnSupportedRef, CONS(REFERENCE, curRef, NIL));
1101  }
1102 
1103  }, lRef);
1104 
1105  hash_put(gLoopToSupRef, stat, *lSupportedRef);
1106  hash_put(gLoopToUnSupRef, stat, *lUnSupportedRef);
1107 }
hash_table gLoopToSupRef
hash_table gLoopToRef
comEngine_distribute.c
hash_table gLoopToUnSupRef
static bool supported_ref_p(reference ref, entity index, hash_table htOffset)
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374

References CONS, gen_nconc(), gLoopToRef, gLoopToSupRef, gLoopToUnSupRef, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, loop_index, MAP, NIL, REFERENCE, statement_loop(), and supported_ref_p().

Referenced by do_HRE_memory_mapping_loop().

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

◆ get_toggleEnt_from_ref()

static entity get_toggleEnt_from_ref ( reference  curRef,
list  lToggleEnt 
)
static

Definition at line 327 of file comEngine_generate_procCode.c.

328 {
329  void* fifoNum = hash_get(gRefToFifo, curRef);
330 
331  pips_assert("fifoNum != HASH_UNDEFINED_VALUE",
332  fifoNum != HASH_UNDEFINED_VALUE);
333 
334  intptr_t numOfFifo = (intptr_t)hash_get(gRefToFifoOff, fifoNum);
335 
336  pips_assert("(numOfFifo == 2) || (numOfFifo == 3)",
337  (numOfFifo == 2) || (numOfFifo == 3));
338 
339  entity toggleEnt = entity_undefined;
340 
341  MAP(ENTITY, curEnt,
342  {
343  intptr_t curInc = (intptr_t)hash_get(gToggleToInc, curEnt);
344 
345  if(curInc == numOfFifo)
346  {
347  toggleEnt = curEnt;
348  break;
349  }
350 
351  }, lToggleEnt);
352 
353  pips_assert("toggleEnt != entity_undefined",
354  toggleEnt != entity_undefined);
355 
356  return toggleEnt;
357 }
hash_table gToggleToInc
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_undefined
Definition: ri.h:2761

References ENTITY, entity_undefined, gRefToFifo, gRefToFifoOff, gToggleToInc, hash_get(), HASH_UNDEFINED_VALUE, intptr_t, MAP, and pips_assert.

Referenced by generate_mmcd_stat_from_ref(), and make_mmcd_stats_from_ref().

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

◆ has_call_stat_inside()

bool has_call_stat_inside ( statement  stat)

comEngine_generate_procCode.c

Parameters
stattat

Definition at line 260 of file comEngine_generate_procCode.c.

261 {
262  bool bHasCallStat = false;
263 
264  gen_context_recurse(stat, &bHasCallStat, statement_domain,
266 
267  return bHasCallStat;
268 }
static bool has_call_stat_inside_flt(statement stat, bool *bHasCallStat)
static void has_call_stat_inside_rwt(_UNUSED_ statement stat, _UNUSED_ bool *bHasCallStat)

References gen_context_recurse, has_call_stat_inside_flt(), has_call_stat_inside_rwt(), and statement_domain.

+ Here is the call graph for this function:

◆ has_call_stat_inside_flt()

static bool has_call_stat_inside_flt ( statement  stat,
bool bHasCallStat 
)
static

Definition at line 213 of file comEngine_generate_procCode.c.

214 {
215  instruction instr = statement_instruction(stat);
216 
217  switch(instruction_tag(instr))
218  {
219  case is_instruction_loop:
222  {
223  return false;
224  break;
225  }
226 
228  case is_instruction_test:
229  {
230  return true;
231  break;
232  }
233  case is_instruction_call:
234  {
235  *bHasCallStat = true;
236  break;
237  }
238  default:
239  {
240  pips_internal_error("unsupported tag");
241  break;
242  }
243  }
244 
245  return false;
246 }
#define pips_internal_error
Definition: misc-local.h:149
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_sequence
Definition: ri.h:1469
@ is_instruction_forloop
Definition: ri.h:1477
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define statement_instruction(x)
Definition: ri.h:2458

References instruction_tag, is_instruction_call, is_instruction_forloop, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_whileloop, pips_internal_error, and statement_instruction.

Referenced by has_call_stat_inside().

+ Here is the caller graph for this function:

◆ has_call_stat_inside_rwt()

static void has_call_stat_inside_rwt ( _UNUSED_ statement  stat,
_UNUSED_ bool bHasCallStat 
)
static

Definition at line 251 of file comEngine_generate_procCode.c.

254 {
255 }

Referenced by has_call_stat_inside().

+ Here is the caller graph for this function:

◆ has_loop_inside()

static bool has_loop_inside ( statement  stat)
static

Definition at line 632 of file comEngine_generate_procCode.c.

633 {
634  bool bHasLoop = false;
635 
636  gen_context_recurse(stat, &bHasLoop,
638 
639  return bHasLoop;
640 }
static bool has_loop_inside_flt(statement stat, bool *bHasLoop)
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758

References gen_context_recurse, gen_null2(), has_loop_inside_flt(), and statement_domain.

Referenced by make_init_newInd_stat().

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

◆ has_loop_inside_flt()

static bool has_loop_inside_flt ( statement  stat,
bool bHasLoop 
)
static

Definition at line 594 of file comEngine_generate_procCode.c.

595 {
596  instruction instr = statement_instruction(stat);
597 
598  switch(instruction_tag(instr))
599  {
600  case is_instruction_loop:
603  {
604  *bHasLoop = true;
605  return false;
606  break;
607  }
608 
610  case is_instruction_test:
611  {
612  return true;
613  break;
614  }
615  case is_instruction_call:
616  {
617  break;
618  }
619  default:
620  {
621  pips_internal_error("unsupported tag");
622  break;
623  }
624  }
625 
626  return false;
627 }

References instruction_tag, is_instruction_call, is_instruction_forloop, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_whileloop, pips_internal_error, and statement_instruction.

Referenced by has_loop_inside().

+ Here is the caller graph for this function:

◆ make_exec_mmcd()

statement make_exec_mmcd ( void  )

Definition at line 967 of file comEngine_generate_procCode.c.

968 {
969  static int number = 0;
970 
973  int_to_expression(number++),
974  NULL);
975 
976  statement mmcdStat =
979  arg));
980 
981  return mmcdStat;
982 }

References call_to_statement, entity_to_expression(), expression_domain, gen_make_list(), gStepEnt, int_to_expression(), make_call(), module_name_to_runtime_entity(), and strdup().

Referenced by add_exec_mmcd().

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

◆ make_init_newInd_stat()

statement make_init_newInd_stat ( statement  stat,
entity  newInd 
)
Parameters
stattat
newIndewInd

Definition at line 701 of file comEngine_generate_procCode.c.

702 {
703  //printf("make_init_newInd_stat beg\n");
704 
705  list lUnSupportedRef = hash_get(gLoopToUnSupRef, stat);
706 
707  pips_assert("lUnSupportedRef != HASH_UNDEFINED_VALUE",
708  lUnSupportedRef != HASH_UNDEFINED_VALUE);
709 
710  if((!has_loop_inside(loop_body(statement_loop(stat)))) &&
711  (lUnSupportedRef == NIL))
712  {
713  return statement_undefined;
714  }
715 
716  int fifoNum = find_or_create_slot(loop_index(statement_loop(stat)));
717 
718  statement newStat =
720  int_to_expression(fifoNum),
721  entity_to_expression(newInd),
723  int_to_expression(1));
724 
725  //printf("make_init_newInd_stat end\n");
726  return newStat;
727 }
static int find_or_create_slot(entity ent)
static bool has_loop_inside(statement stat)
#define loop_body(x)
Definition: ri.h:1644

References entity_to_expression(), find_or_create_slot(), GEN_LOAD_MMCD, gLoopToUnSupRef, has_loop_inside(), hash_get(), HASH_UNDEFINED_VALUE, int_to_expression(), loop_body, loop_index, make_mmcd_load_store_stat(), NIL, pips_assert, statement_loop(), statement_undefined, and strdup().

Referenced by add_toggle_inc_statements().

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

◆ make_loop_lStats_proc()

list make_loop_lStats_proc ( statement  stat,
entity  transferSize,
statement  innerStat,
entity  newOuterInd,
list  lSupportedRef,
hash_table  htOffset,
expression  bufferSizeExp 
)
Parameters
stattat
transferSizeransferSize
innerStatnnerStat
newOuterIndewOuterInd
lSupportedRefSupportedRef
htOffsettOffset
bufferSizeExpufferSizeExp

Definition at line 1114 of file comEngine_generate_procCode.c.

1118 {
1119  return make_lStats(stat, transferSize,
1120  innerStat, newOuterInd,
1121  lSupportedRef, htOffset,
1122  bufferSizeExp);
1123 }
static list make_lStats(statement stat, entity transferSize, statement innerStat, entity newOuterInd, list lSupportedRef, hash_table htOffset, expression bufferSizeExp)

References make_lStats().

Referenced by make_loopStat1().

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

◆ make_loop_step_stat()

statement make_loop_step_stat ( statement  stat,
entity  newOuterInd 
)
Parameters
stattat
newOuterIndewOuterInd

Definition at line 554 of file comEngine_generate_procCode.c.

555 {
556  loop curLoop = statement_loop(stat);
557 
558  statement stepStat;
559 
560  if(gGenHRE)
561  {
562  stepStat = make_wait_step_statement();
563  }
564  else
565  {
566  stepStat = make_step_inc_statement(1);
567  }
568 
570  entity_to_expression(newOuterInd),
572  NULL);
573 
574  expression neExp =
576  neArg));
577 
578  test t = make_test(neExp, stepStat, make_empty_statement());
579 
580  stepStat = make_statement(entity_empty_label(),
585  NIL,NULL,
587 
588  return stepStat;
589 }
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
Definition: ri.c:2222
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
synchronization make_synchronization_none(void)
Definition: ri.c:2424
statement make_wait_step_statement()
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define C_GREATER_THAN_OPERATOR_NAME
#define STATEMENT_NUMBER_UNDEFINED
default values
#define empty_comments
Empty comments (i.e.
#define make_empty_statement
An alias for make_empty_block_statement.
entity entity_empty_label(void)
Definition: entity.c:1105
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
#define range_lower(x)
Definition: ri.h:2288

References C_GREATER_THAN_OPERATOR_NAME, call_to_expression(), copy_expression(), empty_comments, empty_extensions(), entity_empty_label(), entity_intrinsic(), entity_to_expression(), expression_domain, gen_make_list(), gGenHRE, is_instruction_test, loop_range, make_call(), make_empty_statement, make_instruction(), make_statement(), make_step_inc_statement(), make_synchronization_none(), make_test(), make_wait_step_statement(), NIL, range_lower, statement_loop(), STATEMENT_NUMBER_UNDEFINED, and STATEMENT_ORDERING_UNDEFINED.

+ Here is the call graph for this function:

◆ make_lStats()

static list make_lStats ( statement  stat,
entity  transferSize,
statement  innerStat,
entity  newOuterInd,
list  lSupportedRef,
hash_table  htOffset,
expression  bufferSizeExp 
)
static

Definition at line 942 of file comEngine_generate_procCode.c.

946 {
947  list lStats = NIL;
948 
949  statement transStat = make_transStat(stat, newOuterInd,
950  transferSize, bufferSizeExp);
951 
952  lStats = gen_nconc(lStats, CONS(STATEMENT, transStat, NIL));
953 
954  list lTemp = NIL;
955 
956  lTemp = make_mmcd_stats_from_ref(stat, lSupportedRef, htOffset,
957  transferSize, newOuterInd, innerStat);
958 
959  lStats = gen_nconc(lStats, lTemp);
960 
961  return lStats;
962 }
statement make_transStat(statement stat, entity newOuterInd, entity transferSize, expression bufferSizeExp)
static list make_mmcd_stats_from_ref(statement stat, list lSupportedRef, hash_table htOffset, entity transferSize, entity newOuterInd, statement innerStat)

References CONS, gen_nconc(), make_mmcd_stats_from_ref(), make_transStat(), NIL, and STATEMENT.

Referenced by make_loop_lStats_proc().

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

◆ make_mmcd_load_store_stat()

static statement make_mmcd_load_store_stat ( string  name,
expression  hreBuff,
expression  refExp,
expression  offExp,
expression  countExp 
)
static

Definition at line 359 of file comEngine_generate_procCode.c.

364 {
365  expression stepExp;
366 
367  if(!strcmp(name, GEN_STORE_MMCD))
368  {
372  NULL);
373 
374  stepExp =
376  addArg));
377  }
378  else
379  {
380  stepExp = entity_to_expression(gStepEnt);
381  }
382 
384  stepExp,
385  hreBuff,
386  refExp,
387  offExp,
388  countExp,
389  NULL);
390 
391  statement newStat =
393  arg));
394 
395  return newStat;
396 }
#define PLUS_C_OPERATOR_NAME

References call_to_expression(), call_to_statement, entity_intrinsic(), entity_to_expression(), expression_domain, gen_make_list(), GEN_STORE_MMCD, gStepEnt, int_to_expression(), make_call(), module_name_to_runtime_entity(), and PLUS_C_OPERATOR_NAME.

Referenced by generate_mmcd_stat_from_ref(), make_init_newInd_stat(), and make_toggle_mmcd().

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

◆ make_mmcd_stats_from_ref()

static list make_mmcd_stats_from_ref ( statement  stat,
list  lSupportedRef,
hash_table  htOffset,
entity  transferSize,
entity  newOuterInd,
statement  innerStat 
)
static

Definition at line 884 of file comEngine_generate_procCode.c.

886 {
887  loop curLoop = statement_loop(stat);
888 
889  list lStats = NIL;
890 
891  list lSupReadStats = NIL;
892  list lSupWriteStats = NIL;
893 
894  list lToggleEnt = hash_get(gLoopToToggleEnt, stat);
895 
896  pips_assert("lToggleEnt != HASH_UNDEFINED_VALUE",
897  lToggleEnt != HASH_UNDEFINED_VALUE);
898 
899  generate_mmcd_stats_from_ref(lSupportedRef, htOffset,
900  entity_to_expression(transferSize), lToggleEnt,
901  &lSupReadStats, &lSupWriteStats);
902 
903  MAP(REFERENCE, curRef,
904  {
905  hash_put(gRefToInd, curRef, loop_index(statement_loop(stat)));
906  }, lSupportedRef);
907 
908  MAP(REFERENCE, curRef,
909  {
910  entity toggleEnt = get_toggleEnt_from_ref(curRef, lToggleEnt);
911 
912  hash_put(gRefToToggle, curRef, toggleEnt);
913 
914  }, lSupportedRef);
915 
916  MAP(STATEMENT, curStat,
917  {
919  make_reference(loop_index(curLoop), NIL),
920  entity_to_expression(newOuterInd));
921  }, lSupReadStats);
922 
923  MAP(STATEMENT, curStat,
924  {
926  make_reference(loop_index(curLoop), NIL),
927  entity_to_expression(newOuterInd));
928  }, lSupWriteStats);
929 
930  lStats = gen_nconc(lStats, lSupReadStats);
931 
932  if(innerStat != statement_undefined)
933  {
934  lStats = gen_nconc(lStats, CONS(STATEMENT, innerStat, NIL));
935  }
936 
937  lStats = gen_nconc(lStats, lSupWriteStats);
938 
939  return lStats;
940 }
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
hash_table gLoopToToggleEnt
hash_table gRefToInd
hash_table gRefToToggle
void comEngine_replace_reference_in_stat(statement stat, reference ref, expression new)

References comEngine_replace_reference_in_stat(), CONS, entity_to_expression(), gen_nconc(), generate_mmcd_stats_from_ref(), get_toggleEnt_from_ref(), gLoopToToggleEnt, gRefToInd, gRefToToggle, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, loop_index, make_reference(), MAP, NIL, pips_assert, REFERENCE, STATEMENT, statement_loop(), and statement_undefined.

Referenced by make_lStats().

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

◆ make_step_inc_statement()

statement make_step_inc_statement ( int  incNum)

◆ make_toggle_mmcd()

statement make_toggle_mmcd ( entity  ent)
Parameters
entnt

Definition at line 668 of file comEngine_generate_procCode.c.

669 {
670  int fifoNum = alloc_new_slot(ent);
671 
672  statement newStat =
674  int_to_expression(fifoNum),
677  int_to_expression(1));
678 
679  return newStat;
680 }

References alloc_new_slot(), entity_to_expression(), GEN_LOAD_MMCD, int_to_expression(), make_mmcd_load_store_stat(), and strdup().

Referenced by add_toggle_inc_statements(), and regenerate_toggles().

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

◆ make_transStat()

statement make_transStat ( statement  stat,
entity  newOuterInd,
entity  transferSize,
expression  bufferSizeExp 
)

tatement stepStat = make_loop_step_stat(stat, newOuterInd);

newStat = make_block_statement(gen_nconc(CONS(STATEMENT, stepStat, NIL), CONS(STATEMENT, newStat, NIL)));

f(!gGenHRE) { statement indStat = make_init_newInd_stat(stat, newOuterInd);

if(indStat != statement_undefined) { newStat = make_block_statement(gen_nconc(CONS(STATEMENT, newStat, NIL), CONS(STATEMENT, indStat, NIL))); } }

Parameters
stattat
newOuterIndewOuterInd
transferSizeransferSize
bufferSizeExpufferSizeExp

Definition at line 733 of file comEngine_generate_procCode.c.

735 {
736  statement newStat = statement_undefined;
737 
738  loop curLoop = statement_loop(stat);
739 
740  list rgSizeArg1 = gen_make_list(expression_domain,
742  copy_expression(bufferSizeExp),
743  NULL);
744 
745  expression rgSizeExp1 =
747  rgSizeArg1));
748 
749 
751  copy_expression(bufferSizeExp),
752  rgSizeExp1,
753  NULL);
754 
756  arg2Arg));
757 
759  arg2,
760  entity_to_expression(newOuterInd),
761  NULL);
762 
763  expression leExp =
765  leArg));
766 
769  copy_expression(bufferSizeExp),
770  NULL);
771 
772  expression modExp =
774  modArg));
775 
777  modExp,
779  NULL);
780 
781  expression addExp =
783  addArg));
784 
785  statement trueStat = make_assign_statement(entity_to_expression(transferSize),
786  addExp);
787 
788  statement falseStat = make_assign_statement(entity_to_expression(transferSize),
789  copy_expression(bufferSizeExp));
790 
791  expression rgUpper = range_upper(loop_range(curLoop));
792  intptr_t upVal = -1;
793  intptr_t rate = -1;
794  expression_integer_value(rgUpper, &upVal);
795  expression_integer_value(bufferSizeExp, &rate);
796 
797  if((upVal != -1) &&
798  (rate != -1) &&
799  ((upVal+1)%rate == 0))
800  {
801  free_expression(leExp);
802  free_statement(trueStat);
803  newStat = falseStat;
804  }
805  else if((upVal+1) < rate)
806  {
807  free_expression(leExp);
808  free_statement(falseStat);
809  newStat = trueStat;
810  }
811  else
812  {
813  test t = make_test(leExp, trueStat, falseStat);
814 
815  newStat = make_statement(entity_empty_label(),
820  NIL,NULL,
822  }
823 
824  /*statement stepStat = make_loop_step_stat(stat, newOuterInd);
825 
826  newStat = make_block_statement(gen_nconc(CONS(STATEMENT, stepStat, NIL),
827  CONS(STATEMENT, newStat, NIL)));
828  */
829  /*if(!gGenHRE)
830  {
831  statement indStat = make_init_newInd_stat(stat, newOuterInd);
832 
833  if(indStat != statement_undefined)
834  {
835  newStat =
836  make_block_statement(gen_nconc(CONS(STATEMENT, newStat, NIL),
837  CONS(STATEMENT, indStat, NIL)));
838  }
839  }
840 */
841  return newStat;
842 }
void free_expression(expression p)
Definition: ri.c:853
void free_statement(statement p)
Definition: ri.c:2189
#define C_LESS_OR_EQUAL_OPERATOR_NAME
#define C_MODULO_OPERATOR_NAME
#define DIVIDE_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792

References C_LESS_OR_EQUAL_OPERATOR_NAME, C_MODULO_OPERATOR_NAME, call_to_expression(), copy_expression(), DIVIDE_OPERATOR_NAME, empty_comments, empty_extensions(), entity_empty_label(), entity_intrinsic(), entity_to_expression(), expression_domain, expression_integer_value(), free_expression(), free_statement(), gen_make_list(), int_to_expression(), intptr_t, is_instruction_test, loop_range, make_assign_statement(), make_call(), make_instruction(), make_statement(), make_synchronization_none(), make_test(), MULTIPLY_OPERATOR_NAME, NIL, PLUS_C_OPERATOR_NAME, range_upper, statement_loop(), STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, and statement_undefined.

Referenced by make_loop_lStats_HRE(), and make_lStats().

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

◆ process_gLoopToSync_proc()

list process_gLoopToSync_proc ( statement  stat,
list  lInStats 
)
Parameters
stattat
lInStatsInStats

Definition at line 1188 of file comEngine_generate_procCode.c.

1189 {
1190  bool loopSync = (intptr_t)hash_get(gLoopToSync, stat);
1191 
1192  if(loopSync == (intptr_t)HASH_UNDEFINED_VALUE)
1193  {
1194  return lInStats;
1195  }
1196 
1197  statement stepStat = make_step_inc_statement(2);
1198 
1199  list lStats = NIL;
1200 
1201  lStats = gen_nconc(lStats, lInStats);
1202  lStats = gen_nconc(lStats, CONS(STATEMENT, stepStat, NIL));
1203 
1204  return lInStats;
1205 }
hash_table gLoopToSync

References CONS, gen_nconc(), gLoopToSync, hash_get(), HASH_UNDEFINED_VALUE, intptr_t, make_step_inc_statement(), NIL, and STATEMENT.

Referenced by generate_code_loop().

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

◆ process_innerStat1_proc()

void process_innerStat1_proc ( statement  stat,
entity  oldInd,
entity  newOuterInd,
entity  newInnerInd 
)
Parameters
stattat
oldIndldInd
newOuterIndewOuterInd
newInnerIndewInnerInd

Definition at line 1057 of file comEngine_generate_procCode.c.

1059 {
1061  entity_to_expression(newOuterInd),
1062  entity_to_expression(newInnerInd),
1063  NULL);
1064 
1066  addArg));
1067 
1069  make_reference(oldInd, NIL),
1070  arg2);
1071 }

References call_to_expression(), comEngine_replace_reference_in_stat(), entity_intrinsic(), entity_to_expression(), expression_domain, gen_make_list(), make_call(), make_reference(), NIL, and PLUS_OPERATOR_NAME.

Referenced by usual_loop_tiling().

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

◆ supported_ref_p()

static bool supported_ref_p ( reference  ref,
entity  index,
hash_table  htOffset 
)
static

Definition at line 139 of file comEngine_generate_procCode.c.

140 {
141  bool success = true;
142  int offset = 0;
143  int rank = 0;
144 
145  //printf("supported_ref_p \n");
146  //print_reference(ref);printf("\n");
147 
148  MAP(EXPRESSION, ind,
149  {
151 
152  list indRefList = NIL;
153 
155  {
157 
158  int curOffset = vect_coeff((Variable) index, vect);
159 
160  if(curOffset != 0)
161  {
162  if(offset != 0)
163  {
164  success = false;
165  }
166 
167  offset = curOffset;
168  }
169  }
170  else
171  {
172  success = false;
173  }
174 
175  if(offset == 0)
176  {
177  rank++;
178  }
179 
180  gen_free_list(indRefList);
181 
182  }, reference_indices(ref));
183 
184  if(success)
185  {
187 
188  pips_assert("ref type is not variable", type_variable_p(refType));
189 
190  list lRefDim = variable_dimensions(type_variable(refType));
191 
192  intptr_t finalOffset;
193 
194  if(!get_final_offset(lRefDim, offset, rank, &finalOffset))
195  {
196  return false;
197  }
198 
199  //printf("finalOffset %d\n", finalOffset);
200  //printf("\n");
201 
202  pips_assert("finalOffset > 0", (finalOffset > 0));
203 
204  hash_put(htOffset, ref, (void*)finalOffset);
205  }
206 
207  return success;
208 }
static bool get_final_offset(list lRefDim, intptr_t offset, int rank, intptr_t *retVal)
bool success
Definition: gpips-local.h:59
static void norm(struct rproblem *RR)
cette procedure normalise la fonction cout, calcule les valeurs des seconds membres resultant d'une n...
Definition: r1.c:271
#define normalized_linear_p(x)
Definition: ri.h:1779
#define reference_variable(x)
Definition: ri.h:2326
#define type_variable(x)
Definition: ri.h:2949
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define reference_indices(x)
Definition: ri.h:2328
#define variable_dimensions(x)
Definition: ri.h:3122
#define entity_type(x)
Definition: ri.h:2792
#define normalized_linear(x)
Definition: ri.h:1781
#define type_variable_p(x)
Definition: ri.h:2947
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
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
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 entity_type, EXPRESSION, gen_free_list(), get_final_offset(), hash_put(), intptr_t, MAP, NIL, norm(), NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, offset, pips_assert, rank, ref, reference_indices, reference_variable, type_variable, type_variable_p, variable_dimensions, and vect_coeff().

Referenced by get_supportedRef_proc().

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

Variable Documentation

◆ gOldRefToHREFifo

hash_table gOldRefToHREFifo
static

Definition at line 77 of file comEngine_generate_procCode.c.

Referenced by comEngine_generate_procCode(), and get_realFifoNum().

◆ gRealFifo

hash_table gRealFifo
static

Definition at line 68 of file comEngine_generate_procCode.c.

Referenced by comEngine_generate_procCode(), and get_realFifoNum().

◆ gRefToReplace

◆ gStepEnt