PIPS
comEngine_generate_HRECode.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 "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_HRECode.c:

Go to the source code of this file.

Functions

expression get_fifo_from_ref (reference ref)
 
entity get_HRE_buff_ent_from_ref (reference ref)
 
statement make_wait_step_statement ()
 
static statement generate_fifo_stat (reference curRef, expression buffIndExp, entity ind, bool bRead)
 
static void generate_fifo_stats (list lRef, expression buffIndExp, entity ind, list *lReadStats, list *lWriteStats)
 
void replace_array_ref_with_fifos (list lRef, expression buffIndExp, entity ind, statement *newStat)
 
static void generate_scalar_variables ()
 
statement generate_stat_from_ref_list_HRE (list lRef, statement stat)
 
list generate_stat_from_ref_list_HRE_list (list lRef, list lInStats)
 
void get_supportedRef_HRE (statement stat, list *lSupportedRef, list *lUnSupportedRef)
 
void process_replacement_HRE (list lRef, expression buffIndExp, statement *stat)
 
list process_replacement_HRE_OutRef (list lRef, list lStats)
 
statement get_call_stat_HRE (statement stat)
 
list make_loop_lStats_HRE (statement stat, entity transferSize, statement innerStat, entity newOuterInd, _UNUSED_ list lSupportedRef, _UNUSED_ hash_table htOffset, expression bufferSizeExp)
 
statement generate_code_test_HRE (statement stat)
 
list process_gLoopToSync_HRE (statement stat, list lInStats)
 
statement comEngine_generate_HRECode (statement externalized_code, string new_module_name, _UNUSED_ list l_in, _UNUSED_ list l_out, _UNUSED_ list l_params, _UNUSED_ list l_priv, const char *module_name, _UNUSED_ int hreMemSize)
 

Variables

hash_table gRefToHREVar
 comEngine_generate_HRECode.c More...
 

Function Documentation

◆ comEngine_generate_HRECode()

statement comEngine_generate_HRECode ( statement  externalized_code,
string  new_module_name,
_UNUSED_ list  l_in,
_UNUSED_ list  l_out,
_UNUSED_ list  l_params,
_UNUSED_ list  l_priv,
const char *  module_name,
_UNUSED_ int  hreMemSize 
)

Definition at line 636 of file comEngine_generate_HRECode.c.

645 {
646  statement newStat;
647 
649 
650  if(get_bool_property("COMENGINE_CONTROL_IN_HRE"))
651  {
652  entity new_fun = make_empty_subroutine(new_module_name,make_language_unknown());
653 
655 
656  set_current_module_entity(new_fun);
657 
658  // Generate the HRE private variables
660 
661  // This means the HRE code is going to be generated
662  gGenHRE = true;
663 
664  //This function generates the HRE code if we want to have only
665  //one process on the HRE
666  newStat = comEngine_generate_code(externalized_code);
667 
668  // Create the new HRE module
669  create_HRE_module(new_module_name,
670  module_name, newStat, new_fun);
671  }
672  else
673  {
674  // Generate the HRE code if several HRE processes can be created
675  newStat = HRE_distribute(externalized_code, new_module_name, module_name);
676  }
677 
678  //printf("HRE\n");
679  //print_statement(newStat);
680 
682 
683  return newStat;
684 }
language make_language_unknown(void)
Definition: ri.c:1259
statement HRE_distribute(statement stat, string new_module_name, const char *module_name)
void create_HRE_module(const char *new_module_name, const char *module_name, statement stat, entity new_fun)
static void generate_scalar_variables()
hash_table gRefToHREVar
comEngine_generate_HRECode.c
statement comEngine_generate_code(statement stat)
bool gGenHRE
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
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
entity make_empty_subroutine(const char *name, language l)
Definition: entity.c:268

References comEngine_generate_code(), create_HRE_module(), generate_scalar_variables(), get_bool_property(), gGenHRE, gRefToHREVar, hash_pointer, hash_table_free(), hash_table_make(), HRE_distribute(), make_empty_subroutine(), make_language_unknown(), module_name(), reset_current_module_entity(), and set_current_module_entity().

Referenced by comEngine_distribute_code().

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

◆ generate_code_test_HRE()

statement generate_code_test_HRE ( statement  stat)
Parameters
stattat

Definition at line 547 of file comEngine_generate_HRECode.c.

548 {
549  //printf("generate_code_test\n");
550  //print_statement(stat);printf("\n");
551  statement newStat = statement_undefined;
552 
553  newStat = get_call_stat_HRE(stat);
554 
555  test newTest = statement_test(newStat);
556 
557  if(test_true(newTest) != statement_undefined)
558  {
559  free_statement(test_true(newTest));
560 
561  test_true(newTest) = make_empty_statement();
562  }
563 
564  if(test_false(newTest) != statement_undefined)
565  {
566  free_statement(test_false(newTest));
567 
568  test_false(newTest) = make_empty_statement();
569  }
570 
571  list lRef = hash_get(gStatToRef, stat);
572 
573  if(lRef != HASH_UNDEFINED_VALUE)
574  {
576 
577  newStat = generate_stat_from_ref_list_HRE(lRef, newStat);
578  }
579 
580  // Get the new statements for the true statement
581  statement trueStat = generate_code_function(test_true(statement_test(stat)), false);
582 
583  // Get the new statements for the false statement
584  statement falseStat = generate_code_function(test_false(statement_test(stat)), false);
585 
586  free_statement(test_true(newTest));
587  free_statement(test_false(newTest));
588 
589  if(trueStat != statement_undefined)
590  {
591  test_true(newTest) = trueStat;
592  }
593  else
594  {
595  test_true(newTest) = make_empty_statement();
596  }
597 
598  if(falseStat != statement_undefined)
599  {
600  test_false(newTest) = falseStat;
601  }
602  else
603  {
604  test_false(newTest) = make_empty_statement();
605  }
606 
607  return newStat;
608 }
void free_statement(statement p)
Definition: ri.c:2189
hash_table gStatToRef
statement get_call_stat_HRE(statement stat)
statement generate_stat_from_ref_list_HRE(list lRef, statement stat)
void process_replacement_HRE(list lRef, expression buffIndExp, statement *stat)
statement generate_code_function(statement stat, bool bCalledFromSeq)
test statement_test(statement)
Get the test of a statement.
Definition: statement.c:1348
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 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
#define make_empty_statement
An alias for make_empty_block_statement.
#define test_false(x)
Definition: ri.h:2837
#define expression_undefined
Definition: ri.h:1223
#define test_true(x)
Definition: ri.h:2835
#define statement_undefined
Definition: ri.h:2419
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References expression_undefined, free_statement(), generate_code_function(), generate_stat_from_ref_list_HRE(), get_call_stat_HRE(), gStatToRef, hash_get(), HASH_UNDEFINED_VALUE, make_empty_statement, process_replacement_HRE(), 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_fifo_stat()

static statement generate_fifo_stat ( reference  curRef,
expression  buffIndExp,
entity  ind,
bool  bRead 
)
static

Definition at line 128 of file comEngine_generate_HRECode.c.

130 {
131  statement newStat = statement_undefined;
132 
133  string name = NULL;
134  list arg = NIL;
135 
136  expression buffExp = get_fifo_from_ref(curRef);
137 
138  if(buffExp == expression_undefined)
139  {
140  return statement_undefined;
141  }
142 
143  if(ind != entity_undefined)
144  {
146  buffExp,
148  NULL);
149 
151  addArg));
152  }
153 
154  entity hreBuffEnt = get_HRE_buff_ent_from_ref(curRef);
155 
156  pips_assert("hreBuffEnt != entity_undefined",
157  hreBuffEnt != entity_undefined);
158 
159  expression realInd;
160 
161  if(bRead)
162  {
163  name = strdup(GEN_GET_BUFF);
164  }
165  else
166  {
167  name = strdup(GEN_WRITE_BUFF);
168  }
169 
170  if(buffIndExp == expression_undefined)
171  {
172  realInd = int_to_expression(0);
173  }
174  else
175  {
176  realInd = copy_expression(buffIndExp);
177  }
178 
180  buffExp,
181  realInd,
182  entity_to_expression(hreBuffEnt),
183  NULL);
184 
185  newStat = call_to_statement(
187  arg));
188 
189  return newStat;
190 }
call make_call(entity a1, list a2)
Definition: ri.c:269
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
#define GEN_WRITE_BUFF
Definition: comEngine.h:38
#define GEN_GET_BUFF
Definition: comEngine.h:37
expression get_fifo_from_ref(reference ref)
entity get_HRE_buff_ent_from_ref(reference ref)
list gen_make_list(int domain,...)
Definition: list.c:851
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define PLUS_OPERATOR_NAME
#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
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
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
expression call_to_expression(call c)
Build an expression that call a function or procedure.
Definition: expression.c:309
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154
#define entity_undefined
Definition: ri.h:2761
char * strdup()

References call_to_expression(), call_to_statement, copy_expression(), entity_intrinsic(), entity_to_expression(), entity_undefined, expression_domain, expression_undefined, GEN_GET_BUFF, gen_make_list(), GEN_WRITE_BUFF, get_fifo_from_ref(), get_HRE_buff_ent_from_ref(), int_to_expression(), make_call(), module_name_to_runtime_entity(), NIL, pips_assert, PLUS_OPERATOR_NAME, statement_undefined, and strdup().

Referenced by generate_fifo_stats().

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

◆ generate_fifo_stats()

static void generate_fifo_stats ( list  lRef,
expression  buffIndExp,
entity  ind,
list lReadStats,
list lWriteStats 
)
static

Definition at line 196 of file comEngine_generate_HRECode.c.

198 {
199  list lReadDone = NIL;
200  list lWriteDone = NIL;
201 
202  MAP(REFERENCE, curRef,
203  {
204  string effAction = hash_get(gRefToEff, curRef);
205 
206  pips_assert("effAction != HASH_UNDEFINED_VALUE",
207  effAction != HASH_UNDEFINED_VALUE);
208 
209  //printf("fifo ref %d\n", (int)curRef);
210  //print_reference(curRef);printf("\n");
211 
212  if(!strcmp(effAction, R_EFFECT))
213  {
214  bool alreadyDone = false;
215 
216  MAP(REFERENCE, doneRef,
217  {
218  if(reference_equal_p(curRef, doneRef))
219  {
220  alreadyDone = true;
221  break;
222  }
223  }, lReadDone);
224 
225  if(!alreadyDone)
226  {
227  //printf("read eff\n");
228 
229  lReadDone = gen_nconc(lReadDone, CONS(REFERENCE, curRef, NIL));
230 
231  statement readStat = generate_fifo_stat(curRef, buffIndExp,
232  ind, true);
233 
234  if(readStat == statement_undefined)
235  {
236  continue;
237  }
238 
239  *lReadStats = gen_nconc(*lReadStats, CONS(STATEMENT, readStat, NIL));
240  //print_statement(readStat);
241  }
242  }
243  else
244  {
245  bool alreadyDone = false;
246 
247  MAP(REFERENCE, doneRef,
248  {
249  if(reference_equal_p(curRef, doneRef))
250  {
251  alreadyDone = true;
252  break;
253  }
254  }, lWriteDone);
255 
256  if(!alreadyDone)
257  {
258  //printf("write eff\n");
259 
260  lWriteDone = gen_nconc(lWriteDone, CONS(REFERENCE, curRef, NIL));
261 
262  statement writeStat = generate_fifo_stat(curRef, buffIndExp,
263  ind, false);
264 
265  if(writeStat == statement_undefined)
266  {
267  continue;
268  }
269 
270  *lWriteStats = gen_nconc(*lWriteStats, CONS(STATEMENT, writeStat, NIL));
271 
272  //print_statement(writeStat);
273  }
274  }
275 
276  }, lRef);
277 
278  gen_free_list(lReadDone);
279  gen_free_list(lWriteDone);
280 }
#define R_EFFECT
Definition: comEngine.h:29
hash_table gRefToEff
static statement generate_fifo_stat(reference curRef, expression buffIndExp, entity ind, bool bRead)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
void gen_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
bool reference_equal_p(reference r1, reference r2)
Definition: expression.c:1500
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CONS, gen_free_list(), gen_nconc(), generate_fifo_stat(), gRefToEff, hash_get(), HASH_UNDEFINED_VALUE, MAP, NIL, pips_assert, R_EFFECT, REFERENCE, reference_equal_p(), STATEMENT, and statement_undefined.

Referenced by replace_array_ref_with_fifos().

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

◆ generate_scalar_variables()

static void generate_scalar_variables ( )
static

Definition at line 327 of file comEngine_generate_HRECode.c.

328 {
329  list lDone = NIL;
330 
331  HASH_MAP(curRef, curBuff,
332  {
333  bool alreadyDone = false;
334  reference refFound = reference_undefined;
335 
336  MAP(REFERENCE, ref1,
337  {
338  if(reference_equal_p(curRef, ref1))
339  {
340  alreadyDone = true;
341  refFound = ref1;
342  break;
343  }
344 
345  }, lDone);
346 
347  if(!alreadyDone)
348  {
349  //printf("it\n");
350  //print_reference(curRef);printf("\n");
351 
352  string name = strdup(entity_local_name(reference_variable((reference)curRef)));
353 
354  basic bas = basic_of_reference((reference)curRef);
355 
356  pips_assert("bas != basic_undefined", bas != basic_undefined);
357 
360  bas);
361  AddEntityToCurrentModule(new_ent);
362 
363  hash_put(gRefToHREVar, curRef, new_ent);
364 
365  lDone = CONS(REFERENCE, curRef, lDone);
366  }
367  else
368  {
369  entity scalEnt = hash_get(gRefToHREVar, refFound);
370 
371  hash_put(gRefToHREVar, curRef, scalEnt);
372  }
373 
374  }, gRefToHREFifo);
375 
376  gen_free_list(lDone);
377 }
hash_table gRefToHREFifo
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
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 HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
Definition: variable.c:260
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
Definition: variable.c:592
basic basic_of_reference(reference)
Retrieves the basic of a reference in a newly allocated basic object.
Definition: type.c:1459
#define reference_undefined
Definition: ri.h:2302
#define reference_variable(x)
Definition: ri.h:2326
#define basic_undefined
Definition: ri.h:556

References AddEntityToCurrentModule(), basic_of_reference(), basic_undefined, CONS, entity_local_name(), gen_free_list(), get_current_module_entity(), gRefToHREFifo, gRefToHREVar, hash_get(), HASH_MAP, hash_put(), make_new_scalar_variable_with_prefix(), MAP, NIL, pips_assert, REFERENCE, reference_equal_p(), reference_undefined, reference_variable, and strdup().

Referenced by comEngine_generate_HRECode().

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

◆ generate_stat_from_ref_list_HRE()

statement generate_stat_from_ref_list_HRE ( list  lRef,
statement  stat 
)
Parameters
lRefRef
stattat

Definition at line 382 of file comEngine_generate_HRECode.c.

383 {
384  bool writeFound = false;
385 
386  MAP(REFERENCE, curRef,
387  {
388  string effAction = hash_get(gRefToEff, curRef);
389 
390  pips_assert("effAction != HASH_UNDEFINED_VALUE",
391  effAction != HASH_UNDEFINED_VALUE);
392 
393  if(!strcmp(effAction, W_EFFECT))
394  {
395  writeFound = true;
396  break;
397  }
398 
399  }, lRef);
400 
401  statement stepStat = make_wait_step_statement();
402 
403  list lStats = NIL;
404 
405  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
406  if(stat != statement_undefined)
407  {
408  lStats = gen_nconc(lStats, CONS(STATEMENT, stat, NIL));
409  }
410 
411  if(writeFound)
412  {
413  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
414  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
415  }
416 
417  free_statement(stepStat);
418 
419  return make_block_statement(lStats);
420 }
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
#define W_EFFECT
Definition: comEngine.h:30
statement make_wait_step_statement()
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616

References CONS, copy_statement(), free_statement(), gen_nconc(), gRefToEff, hash_get(), HASH_UNDEFINED_VALUE, make_block_statement(), make_wait_step_statement(), MAP, NIL, pips_assert, REFERENCE, STATEMENT, statement_undefined, and W_EFFECT.

Referenced by generate_code_call(), generate_code_loop(), generate_code_test_HRE(), 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_HRE_list()

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

Definition at line 425 of file comEngine_generate_HRECode.c.

426 {
427  bool writeFound = false;
428 
429  MAP(REFERENCE, curRef,
430  {
431  string effAction = hash_get(gRefToEff, curRef);
432 
433  pips_assert("effAction != HASH_UNDEFINED_VALUE",
434  effAction != HASH_UNDEFINED_VALUE);
435 
436  if(!strcmp(effAction, W_EFFECT))
437  {
438  writeFound = true;
439  break;
440  }
441 
442  }, lRef);
443 
444  statement stepStat = make_wait_step_statement();
445 
446  list lStats = NIL;
447 
448  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
449 
450  lStats = gen_nconc(lStats, lInStats);
451 
452  if(writeFound)
453  {
454  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
455  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
456  }
457 
458  free_statement(stepStat);
459 
460  return lStats;
461 }

References CONS, copy_statement(), free_statement(), gen_nconc(), gRefToEff, hash_get(), HASH_UNDEFINED_VALUE, make_wait_step_statement(), MAP, NIL, pips_assert, REFERENCE, STATEMENT, and W_EFFECT.

Referenced by generate_code_loop().

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

◆ get_call_stat_HRE()

statement get_call_stat_HRE ( statement  stat)
Parameters
stattat

Definition at line 513 of file comEngine_generate_HRECode.c.

514 {
515  statement newStat = copy_statement(stat);
516 
518 
519  return newStat;
520 }
#define string_undefined
Definition: newgen_types.h:40
#define statement_comments(x)
Definition: ri.h:2456

References copy_statement(), statement_comments, and string_undefined.

Referenced by generate_code_call(), and generate_code_test_HRE().

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

◆ get_fifo_from_ref()

expression get_fifo_from_ref ( reference  ref)
Parameters
refef

Definition at line 74 of file comEngine_generate_HRECode.c.

75 {
77 
79 
80  if(fifoNum != (intptr_t)HASH_UNDEFINED_VALUE)
81  {
82  retExp = int_to_expression(fifoNum);
83  }
84 
85  return retExp;
86 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
#define intptr_t
Definition: stdint.in.h:294

References expression_undefined, gRefToHREFifo, hash_get(), HASH_UNDEFINED_VALUE, int_to_expression(), intptr_t, and ref.

Referenced by generate_fifo_stat(), and generate_fifo_stat2().

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

◆ get_HRE_buff_ent_from_ref()

entity get_HRE_buff_ent_from_ref ( reference  ref)
Parameters
refef

Definition at line 91 of file comEngine_generate_HRECode.c.

92 {
93  entity buffEnt = entity_undefined;
94 
95  HASH_MAP(curRef, hreBuff,
96  {
97  if(reference_equal_p(curRef, ref))
98  {
99  buffEnt = hreBuff;
100  break;
101  }
102 
103  }, gRefToHREVar);
104 
105  return buffEnt;
106 }

References entity_undefined, gRefToHREVar, HASH_MAP, ref, and reference_equal_p().

Referenced by generate_fifo_stat(), generate_fifo_stat2(), 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:

◆ get_supportedRef_HRE()

void get_supportedRef_HRE ( statement  stat,
list lSupportedRef,
list lUnSupportedRef 
)
Parameters
stattat
lSupportedRefSupportedRef
lUnSupportedRefUnSupportedRef

Definition at line 467 of file comEngine_generate_HRECode.c.

469 {
470  *lSupportedRef = hash_get(gLoopToSupRef, stat);
471  *lUnSupportedRef = hash_get(gLoopToUnSupRef, stat);
472 
473  pips_assert("*lSupportedRef != HASH_UNDEFINED_VALUE",
474  *lSupportedRef != HASH_UNDEFINED_VALUE);
475 
476  pips_assert("*lUnSupportedRef != HASH_UNDEFINED_VALUE",
477  *lUnSupportedRef != HASH_UNDEFINED_VALUE);
478 }
hash_table gLoopToSupRef
hash_table gLoopToUnSupRef

References gLoopToSupRef, gLoopToUnSupRef, hash_get(), HASH_UNDEFINED_VALUE, and pips_assert.

Referenced by generate_code_loop().

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

◆ make_loop_lStats_HRE()

list make_loop_lStats_HRE ( statement  stat,
entity  transferSize,
statement  innerStat,
entity  newOuterInd,
_UNUSED_ list  lSupportedRef,
_UNUSED_ hash_table  htOffset,
expression  bufferSizeExp 
)

Definition at line 525 of file comEngine_generate_HRECode.c.

530 {
531  list lStats = NIL;
532 
533  statement transStat = make_transStat(stat, newOuterInd,
534  transferSize, bufferSizeExp);
535 
536  lStats = gen_nconc(lStats, CONS(STATEMENT, transStat, NIL));
537 
538  lStats = gen_nconc(lStats, CONS(STATEMENT, innerStat, NIL));
539 
540  return lStats;
541 }
statement make_transStat(statement stat, entity newOuterInd, entity transferSize, expression bufferSizeExp)

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

Referenced by make_loopStat1().

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

◆ make_wait_step_statement()

statement make_wait_step_statement ( void  )

Definition at line 113 of file comEngine_generate_HRECode.c.

114 {
115  statement newStat = statement_undefined;
116 
117  newStat = call_to_statement(
119  NIL));
120 
121  return newStat;
122 }
#define WAIT_FOR_NEXT_STEP
Definition: comEngine.h:39

References call_to_statement, make_call(), module_name_to_runtime_entity(), NIL, statement_undefined, and WAIT_FOR_NEXT_STEP.

Referenced by generate_code_call(), generate_stat_from_ref_list_HRE(), generate_stat_from_ref_list_HRE_list(), make_loop_step_stat(), and process_gLoopToSync_HRE().

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

◆ process_gLoopToSync_HRE()

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

Definition at line 613 of file comEngine_generate_HRECode.c.

614 {
615  bool loopSync = (intptr_t)hash_get(gLoopToSync, stat);
616 
617  if(loopSync == (intptr_t)HASH_UNDEFINED_VALUE)
618  {
619  return lInStats;
620  }
621 
622  statement stepStat = make_wait_step_statement();
623 
624  list lStats = NIL;
625 
626  lStats = gen_nconc(lStats, lInStats);
627  lStats = gen_nconc(lStats, CONS(STATEMENT, stepStat, NIL));
628  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
629 
630  return lStats;
631 }
hash_table gLoopToSync

References CONS, copy_statement(), gen_nconc(), gLoopToSync, hash_get(), HASH_UNDEFINED_VALUE, intptr_t, make_wait_step_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_replacement_HRE()

void process_replacement_HRE ( list  lRef,
expression  buffIndExp,
statement stat 
)
Parameters
lRefRef
buffIndExpuffIndExp
stattat

Definition at line 483 of file comEngine_generate_HRECode.c.

485 {
486  replace_array_ref_with_fifos(lRef, buffIndExp, entity_undefined, stat);
487 }
void replace_array_ref_with_fifos(list lRef, expression buffIndExp, entity ind, statement *newStat)

References entity_undefined, and replace_array_ref_with_fifos().

Referenced by generate_code_call(), generate_code_loop(), generate_code_test_HRE(), make_loopStat1(), process_code_seq(), process_opt_replace(), and usual_loop_tiling().

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

◆ process_replacement_HRE_OutRef()

list process_replacement_HRE_OutRef ( list  lRef,
list  lStats 
)
Parameters
lRefRef
lStatsStats

Definition at line 493 of file comEngine_generate_HRECode.c.

494 {
495  statement stat = STATEMENT(CAR(lStats));
496 
497  list savedList = CDR(lStats);
498 
499  CDR(lStats) = NIL;
500  gen_free_list(lStats);
501 
503  entity_undefined, &stat);
504 
505  lStats = gen_nconc(CONS(STATEMENT, stat, NIL), savedList);
506 
507  return lStats;
508 }
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111

References CAR, CDR, CONS, entity_undefined, expression_undefined, gen_free_list(), gen_nconc(), NIL, replace_array_ref_with_fifos(), and STATEMENT.

Referenced by generate_code_loop().

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

◆ replace_array_ref_with_fifos()

void replace_array_ref_with_fifos ( list  lRef,
expression  buffIndExp,
entity  ind,
statement newStat 
)
Parameters
lRefRef
buffIndExpuffIndExp
indnd
newStatewStat

Definition at line 286 of file comEngine_generate_HRECode.c.

288 {
289  list lStats = NIL;
290 
291  list lReadStats = NIL;
292  list lWriteStats = NIL;
293 
294  // Generate the read or write fifo statements
295  generate_fifo_stats(lRef, buffIndExp, ind, &lReadStats, &lWriteStats);
296 
297  // Replace the references by the private variables
298  MAP(REFERENCE, curRef,
299  {
300  //printf("replace_array_ref %d\n", (int)curRef);
301  //print_reference(curRef);printf("\n");
302 
303  entity hreBuffEnt = get_HRE_buff_ent_from_ref(curRef);
304 
305  pips_assert("hreBuffEnt != entity_undefined",
306  hreBuffEnt != entity_undefined);
307 
308  reference hreBuffRef = make_reference(hreBuffEnt, NIL);
309 
310  comEngine_replace_reference_in_stat(*newStat, curRef, reference_to_expression(hreBuffRef));
311 
312  }, lRef);
313 
314  lStats = lReadStats;
315  if(*newStat != statement_undefined)
316  {
317  lStats = gen_nconc(lStats, CONS(STATEMENT, *newStat, NIL));
318  }
319  lStats = gen_nconc(lStats, lWriteStats);
320 
321  *newStat = make_block_statement(lStats);
322 }
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
static void generate_fifo_stats(list lRef, expression buffIndExp, entity ind, list *lReadStats, list *lWriteStats)
void comEngine_replace_reference_in_stat(statement stat, reference ref, expression new)
expression reference_to_expression(reference r)
Definition: expression.c:196

References comEngine_replace_reference_in_stat(), CONS, entity_undefined, gen_nconc(), generate_fifo_stats(), get_HRE_buff_ent_from_ref(), make_block_statement(), make_reference(), MAP, NIL, pips_assert, REFERENCE, reference_to_expression(), STATEMENT, and statement_undefined.

Referenced by process_replacement_HRE(), and process_replacement_HRE_OutRef().

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

Variable Documentation

◆ gRefToHREVar