PIPS
instruction_to_wp65_code.c File Reference
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "dg.h"
#include "graph.h"
#include "matrice.h"
#include "tiling.h"
#include "database.h"
#include "text.h"
#include "misc.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "text-util.h"
#include "resources.h"
#include "pipsdbm.h"
#include "movements.h"
#include "rice.h"
#include "constants.h"
#include "ricedg.h"
#include "wp65.h"
+ Include dependency graph for instruction_to_wp65_code.c:

Go to the source code of this file.

Typedefs

typedef dg_arc_label arc_label
 Code Generation for Distributed Memory Machines. More...
 
typedef dg_vertex_label vertex_label
 

Functions

static void add_range_in_list (range r)
 
static void implied_do_ranges (statement s)
 
static void update_loop_nest_dim (loop l)
 
static void compute_loop_nest_dim (statement l)
 
static void reduce_loop_bound (loop l)
 Function used during code generation for non-perfectly nested loops. More...
 
static void reduce_loop_bound_for_st (statement stmp)
 
bool list_of_calls_p (list lsb)
 instruction_to_wp65_code.c More...
 
entity ith_index_of_ref (reference r, int level)
 
loop ith_loop_in_loop_nest (statement s1, int level)
 
void instruction_to_wp65_code (entity module, list l, graph dg, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map)
 
void call_to_wp65_code (statement s, entity compute_module, entity memory_module, entity bank_id, entity proc_id, statement computational, statement emulator, statement_mapping fetch_map, statement_mapping store_map, hash_table v_to_esv)
 
expression ref_in_implied_do (expression exp)
 This function extracts from an implied_do expression the reference having to be computed or printed. More...
 
reference translate_IO_ref (call c, hash_table v_to_esv, bool loop_or_call_print)
 This function translates a reference in I/O statement into its corresponding emulated shared memory reference. More...
 
statement generate_io_wp65_code (statement s1, statement body, hash_table v_to_esv, bool loop_or_call_print)
 
bool io_loop_nest_p (statement st)
 Test if the statement resulting from the perfectly_loop_nest_to_body function contains at first call an io. More...
 
void loop_nest_movement_generation (entity module, statement loop_nest, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map, statement mod_stat, bool fully_parallel, Psysteme sc_tile, Pbase initial_basis, Pbase local_basis, Pbase local_basis2, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_tile_basis2, Pbase loop_body_indices, list lpv, list *lb, list *blb, list *sb, list *bsb, int first_parallel_level, int last_parallel_level, hash_table llv_to_lcr, hash_table r_to_llv, hash_table v_to_lllv, hash_table r_to_ud)
 
void loop_nest_to_wp65_code (entity module, statement loop_nest, graph dg, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map, statement mod_stat)
 
void make_all_movement_blocks (entity initial_module, entity compute_module, entity memory_module, entity v, list map, hash_table llv_to_lcr, hash_table v_to_lllv, hash_table r_to_ud, hash_table v_to_esv, int pn, int bn, int ls, Psysteme iteration_domain, Pbase initial_basis, Pbase local_basis, entity proc_id, Pbase bank_indices, Pbase loop_body_indices, list *pmb, list *pbmb, tag use_def, int first_parallel_level, int last_parallel_level)
 generates all data movements related to entity v, loads or stores depending on use_def More...
 
void search_parallel_loops (statement mod_stat, statement loop_statement, graph dg, loop_carried_dep)
 
bool full_parallel_loop_nest_p (statement mod_stat, statement loop_stmt, int nest_dim, graph dg, bool *loop_carried_dep)
 

Variables

static list implied_do_range_list =NIL
 
static int loop_nest_dim =0
 
static list loops_of_nest =NIL
 

Typedef Documentation

◆ arc_label

Code Generation for Distributed Memory Machines.

Higher level functions

PUMA, ESPRIT contract 2701

Francois Irigoin, Corinne Ancourt 1991

Definition at line 46 of file instruction_to_wp65_code.c.

◆ vertex_label

Definition at line 47 of file instruction_to_wp65_code.c.

Function Documentation

◆ add_range_in_list()

static void add_range_in_list ( range  r)
static

Definition at line 74 of file instruction_to_wp65_code.c.

75 {
77  CONS(RANGE,r,NIL):
79 }
#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
static list implied_do_range_list
#define RANGE(x)
RANGE.
Definition: ri.h:2257

References CONS, gen_nconc(), implied_do_range_list, NIL, and RANGE.

Referenced by implied_do_ranges().

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

◆ call_to_wp65_code()

void call_to_wp65_code ( statement  s,
entity  compute_module,
entity  memory_module,
entity  bank_id,
entity  proc_id,
statement  computational,
statement  emulator,
statement_mapping  fetch_map,
statement_mapping  store_map,
hash_table  v_to_esv 
)

To deal with implied_do and I/Os

communications for variables having to be loaded in local memories for assignments

communications for variables having to be stored in global memory for assignments

Parameters
compute_moduleompute_module
memory_moduleemory_module
bank_idank_id
proc_idroc_id
computationalomputational
emulatormulator
fetch_mapetch_map
store_maptore_map
v_to_esv_to_esv

Definition at line 267 of file instruction_to_wp65_code.c.

272 {
273  list lrefs;
274  bool load_code = true;
275  instruction i;
277  /* To deal with implied_do and I/Os */
278 
279 
280  if (strcmp(entity_local_name(call_function(c)), "WRITE") == 0) {
281  generate_io_wp65_code(s,s,v_to_esv,false);
282  i = statement_instruction(emulator);
284  CONS(STATEMENT,
285  copy_statement(s), NIL));
286  }
287  else { /* communications for variables having to be
288  loaded in local memories for assignments */
289  if ((lrefs = (list) GET_STATEMENT_MAPPING(fetch_map,s))
290  != (list) HASH_UNDEFINED_VALUE) {
291  ifdebug(9) {
292  (void) fprintf(stderr,
293  "Vars having to be loaded for stat %"PRIdPTR":\n",
294  statement_number(s));
295  reference_list_print(lrefs); }
296  include_constant_symbolic_communication(compute_module,lrefs,
297  load_code,computational,
298  proc_id);
299  include_constant_symbolic_communication(memory_module,lrefs,
300  !load_code,emulator,
301  bank_id);
302  }
303  i = statement_instruction(computational);
306  /* communications for variables having to be
307  stored in global memory for assignments */
308  if ((lrefs = (list) GET_STATEMENT_MAPPING(store_map,s))
309  != (list) HASH_UNDEFINED_VALUE) {
310  load_code = false;
311  ifdebug(9) {
312  (void) fprintf(stderr,
313  "Vars having to be stored for stat %"PRIdPTR":\n",
314  statement_number(s));
315  reference_list_print(lrefs); }
316  include_constant_symbolic_communication(compute_module,lrefs,
317  load_code,computational,proc_id);
318  include_constant_symbolic_communication(memory_module,lrefs,
319  !load_code,emulator,bank_id);
320  }
321  }
322 }
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
void include_constant_symbolic_communication(entity compute_or_memory_module, list lrefs, bool load_code, statement computational_or_emulator, entity var_id)
statement generate_io_wp65_code(statement s1, statement body, hash_table v_to_esv, bool loop_or_call_print)
#define GET_STATEMENT_MAPPING(map, stat)
Definition: newgen-local.h:49
#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 reference_list_print(list l)
This function prints the references belonging to l.
Definition: references.c:186
#define instruction_block(i)
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
#define call_function(x)
Definition: ri.h:709
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define statement_number(x)
Definition: ri.h:2452
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define ifdebug(n)
Definition: sg.c:47
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References call_function, CONS, copy_statement(), entity_local_name(), fprintf(), gen_nconc(), generate_io_wp65_code(), GET_STATEMENT_MAPPING, HASH_UNDEFINED_VALUE, ifdebug, include_constant_symbolic_communication(), instruction_block, instruction_call, NIL, reference_list_print(), STATEMENT, statement_instruction, and statement_number.

Referenced by instruction_to_wp65_code().

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

◆ compute_loop_nest_dim()

static void compute_loop_nest_dim ( statement  l)
static

Definition at line 96 of file instruction_to_wp65_code.c.

97 {
98  loop_nest_dim = 0;
100 }
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
static int loop_nest_dim
static void update_loop_nest_dim(loop l)
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218

References gen_recurse, gen_true(), loop_domain, loop_nest_dim, and update_loop_nest_dim().

Referenced by loop_nest_to_wp65_code().

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

◆ full_parallel_loop_nest_p()

bool full_parallel_loop_nest_p ( statement  mod_stat,
statement  loop_stmt,
int  nest_dim,
graph  dg,
bool loop_carried_dep 
)
Parameters
mod_statod_stat
loop_stmtoop_stmt
nest_dimest_dim
dgg
loop_carried_depoop_carried_dep

Definition at line 1119 of file instruction_to_wp65_code.c.

1121 {
1122  int i;
1123  search_parallel_loops(mod_stat,loop_stmt, dg,loop_carried_dep);
1124  for (i=1; i<= nest_dim && loop_carried_dep[i]== false; i++);
1125  return( (i>nest_dim) ? true : false);
1126 }
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
void search_parallel_loops(statement mod_stat, statement loop_statement, graph dg, loop_carried_dep)

References dg, mod_stat, and search_parallel_loops().

Referenced by loop_nest_to_wp65_code().

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

◆ generate_io_wp65_code()

statement generate_io_wp65_code ( statement  s1,
statement  body,
hash_table  v_to_esv,
bool  loop_or_call_print 
)

we know that it is a loop nest containing a PRINT function The loop body contains block statement in case of CONTINUE loop nest style

loop nest belonging IO statement

implied_do case

Parameters
s11
bodyody
v_to_esv_to_esv
loop_or_call_printoop_or_call_print

Definition at line 406 of file instruction_to_wp65_code.c.

407 {
408 
409  list rvld,pl;
410  statement result = s1;
411  instruction inst = statement_instruction(body);
412  call c;
413  reference r;
414 
415  entity rv,esv_ref;
416  type rvt;
417  int nb_dim,i;
418 
419  /* we know that it is a loop nest containing a PRINT function
420  The loop body contains block statement in case of CONTINUE
421  loop nest style*/
423  if (instruction_block_p(inst)) {
424  list b = instruction_block(inst);
426  }
427  else
428  c= instruction_call(inst);
429  r = translate_IO_ref(c,v_to_esv,loop_or_call_print);
430  rv = reference_variable(r);
431  esv_ref = (entity) hash_get(v_to_esv,(char *) rv);
432  rvt = entity_type(esv_ref);
433  rvld = variable_dimensions(type_variable(rvt));
434  nb_dim = gen_length((list) rvld);
435 
436  if (loop_or_call_print) /* loop nest belonging IO statement */
437  for (i=1; i<=nb_dim; i++) {
438  list ldim = gen_nthcdr(i-1,rvld);
439  expression low = dimension_lower(DIMENSION(CAR(ldim)));
441  range looprange = make_range(low, up,
442  int_to_expression(1));
443  loop loopi = ith_loop_in_loop_nest(result,i);
444  loop_range(loopi) = looprange;
445  }
446  else { /* implied_do case */
448  implied_do_ranges(result);
450  for (i=1,pl = implied_do_range_list; !ENDP(pl); POP(pl),i++) {
451  range r1 = RANGE(CAR(pl));
452  list ldim = gen_nthcdr(i-1,rvld);
454  dimension_lower(DIMENSION(CAR(ldim))));
456  dimension_upper(DIMENSION(CAR(ldim))));
457  range_lower(r1)=low;
458  range_upper(r1)=up;
459  }
460  }
461  return(result);
462 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
size_t gen_length(const list l)
Definition: list.c:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
list gen_nthcdr(int n, const list lx)
caution: the first item is 0! was: return( (n<=0) ? l : gen_nthcdr( n-1, CDR( l ))) ; if n>gen_length...
Definition: list.c:700
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
loop ith_loop_in_loop_nest(statement s1, int level)
reference translate_IO_ref(call c, hash_table v_to_esv, bool loop_or_call_print)
This function translates a reference in I/O statement into its corresponding emulated shared memory r...
static void implied_do_ranges(statement s)
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
Definition: properties.c:783
#define instruction_block_p(i)
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
#define reference_variable(x)
Definition: ri.h:2326
#define range_upper(x)
Definition: ri.h:2290
#define statement_ordering(x)
Definition: ri.h:2454
#define dimension_lower(x)
Definition: ri.h:980
#define type_variable(x)
Definition: ri.h:2949
#define dimension_upper(x)
Definition: ri.h:982
#define range_lower(x)
Definition: ri.h:2288
#define variable_dimensions(x)
Definition: ri.h:3122
#define loop_range(x)
Definition: ri.h:1642
#define entity_type(x)
Definition: ri.h:2792
s1
Definition: set.c:247

References CAR, copy_expression(), DIMENSION, dimension_lower, dimension_upper, ENDP, entity_type, gen_length(), gen_nreverse(), gen_nthcdr(), hash_get(), implied_do_range_list, implied_do_ranges(), instruction_block, instruction_block_p, instruction_call, int_to_expression(), ith_loop_in_loop_nest(), loop_range, make_range(), NIL, pl, POP, RANGE, range_lower, range_upper, reference_variable, s1, STATEMENT, statement_instruction, statement_ordering, STATEMENT_ORDERING_UNDEFINED, translate_IO_ref(), type_variable, and variable_dimensions.

Referenced by call_to_wp65_code(), and loop_nest_to_wp65_code().

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

◆ implied_do_ranges()

static void implied_do_ranges ( statement  s)
static

Definition at line 81 of file instruction_to_wp65_code.c.

82 {
84 }
static void add_range_in_list(range r)
#define range_domain
newgen_ram_domain_defined
Definition: ri.h:330

References add_range_in_list(), gen_recurse, gen_true(), and range_domain.

Referenced by generate_io_wp65_code().

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

◆ instruction_to_wp65_code()

void instruction_to_wp65_code ( entity  module,
list  l,
graph  dg,
int  pn,
int  bn,
int  ls,
int  pd,
entity  proc_id,
entity  proc_id_mm,
Pbase  bank_indices,
hash_table  v_to_esv,
hash_table  v_to_nlv,
entity  compute_module,
statement  computational,
entity  memory_module,
statement  emulator,
statement_mapping  fetch_map,
statement_mapping  store_map 
)

cms

FI: the semantics has been changed: the next two get_xxx() cannot/should not return something undefined.

if ((cme = get_current_module_entity()) == entity_undefined)

FI: already done somewhere else

set_current_module_entity(local_name_to_top_level_entity(module_local_name(module)));

if ((cms = get_current_module_statement()) == statement_undefined)

FI: shouldn't the current statement be retrieved at the same time as the current module?

reset_current_module_entity();

Parameters
moduleodule
dgg
pnn
bnn
lss
pdd
proc_idroc_id
proc_id_mmroc_id_mm
bank_indicesank_indices
v_to_esv_to_esv
v_to_nlv_to_nlv
compute_moduleompute_module
computationalomputational
memory_moduleemory_module
emulatormulator
fetch_mapetch_map
store_maptore_map

Definition at line 175 of file instruction_to_wp65_code.c.

182 {
183 
184  statement mod_stat/*,cms*/;
185  //entity cme;
186  debug_on("WP65_DEBUG_LEVEL");
187 
188  /* FI: the semantics has been changed: the next two get_xxx() cannot/should not return
189  * something undefined.
190  */
191  /* if ((cme = get_current_module_entity()) == entity_undefined) */
192  /* FI: already done somewhere else */
193  /* set_current_module_entity(local_name_to_top_level_entity(module_local_name(module))); */
194  /* if ((cms = get_current_module_statement()) == statement_undefined) */
195  /* FI: shouldn't the current statement be retrieved at the same time as the current module? */
197  db_get_memory_resource(DBR_CODE,
199  true) );
201  MAPL(pm,{
202  statement s1 = STATEMENT(CAR(pm));
204  ifdebug(9)
205  (void) fprintf(stderr,
206  "instruction_to_wp65_code-instruction- begin\n");
207  switch(instruction_tag(inst)) {
208 
209  case is_instruction_block:{
211  dg, pn, bn, ls, pd,
212  proc_id, proc_id_mm, bank_indices,
213  v_to_esv, v_to_nlv,
214  compute_module, computational,
215  memory_module, emulator,
216  fetch_map,store_map);
217 
218  break;}
219  case is_instruction_test: {
220  (void) fprintf(stderr,
221  "instruction_to_wp65_code-Sorry:test not implemented\n");
222  break;}
223  case is_instruction_goto: {
224  (void) fprintf(stderr,
225  "instruction_to_wp65_cod -Sorry:goto implemented\n");
226  break;}
227  case is_instruction_loop: {
228  loop_nest_to_wp65_code(module, s1, dg, pn, bn, ls, pd,
229  proc_id, proc_id_mm, bank_indices,
230  v_to_esv, v_to_nlv,
231  compute_module, computational,
232  memory_module, emulator,
233  fetch_map,store_map,mod_stat);
234  break;}
235  case is_instruction_call: {
236  if (!return_statement_p(s1)) {
237 
238  call_to_wp65_code(s1,compute_module,
239  memory_module,
240  (entity) bank_indices->var,proc_id,
241  computational,emulator, fetch_map,
242  store_map,v_to_esv);
243  }
244  break;
245  }
247  pips_internal_error("Sorry: unstructured not implemented");
248  break;}
249  default:
250  (void) fprintf(stderr,
251  " instruction_to_wp65_code- bad instruction tag \n");
252  break;
253  }
254  ifdebug(9)
255  (void) fprintf(stderr,
256  "instruction_to_wp65_code-instruction_end \n");
257  },l);
258  /* reset_current_module_entity(); */
260  debug_off();
261 }
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
#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
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
Definition: statement.c:172
void loop_nest_to_wp65_code(entity module, statement loop_nest, graph dg, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map, statement mod_stat)
void instruction_to_wp65_code(entity module, list l, graph dg, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map)
void call_to_wp65_code(statement s, entity compute_module, entity memory_module, entity bank_id, entity proc_id, statement computational, statement emulator, statement_mapping fetch_map, statement_mapping store_map, hash_table v_to_esv)
#define debug_on(env)
Definition: misc-local.h:157
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
static char * module
Definition: pips.c:74
#define is_instruction_block
soft block->sequence transition
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
Variable var
Definition: vecteur-local.h:90

References call_to_wp65_code(), CAR, db_get_memory_resource(), debug_off, debug_on, dg, fprintf(), get_current_module_statement(), ifdebug, instruction_block, instruction_tag, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, loop_nest_to_wp65_code(), MAPL, mod_stat, module, module_local_name(), pips_internal_error, reset_current_module_statement(), return_statement_p(), s1, set_current_module_statement(), STATEMENT, statement_instruction, and Svecteur::var.

Referenced by module_to_wp65_modules().

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

◆ io_loop_nest_p()

bool io_loop_nest_p ( statement  st)

Test if the statement resulting from the perfectly_loop_nest_to_body function contains at first call an io.

Parameters
stt

Definition at line 467 of file instruction_to_wp65_code.c.

468 {
470  call c;
471  if (instruction_block_p(inst)) {
472  list b = instruction_block(inst);
474  }
475  else
476  c= instruction_call(inst);
477  return (strcmp(entity_local_name(call_function(c)), "WRITE") == 0) ;
478 }

References call_function, CAR, entity_local_name(), instruction_block, instruction_block_p, instruction_call, STATEMENT, and statement_instruction.

Referenced by loop_nest_to_wp65_code().

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

◆ ith_index_of_ref()

entity ith_index_of_ref ( reference  r,
int  level 
)
Parameters
levelevel

Definition at line 146 of file instruction_to_wp65_code.c.

147 {
148  entity result = entity_undefined;
149  list ith_index=reference_indices(r);
150  expression exp_ind = EXPRESSION(gen_nth(level,ith_index));
151  syntax sy = expression_syntax(exp_ind);
152  if (syntax_reference_p(sy))
153  result = reference_variable(syntax_reference(sy));
154  return (result);
155 }
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
Definition: list.c:710
#define syntax_reference_p(x)
Definition: ri.h:2728
#define syntax_reference(x)
Definition: ri.h:2730
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_undefined
Definition: ri.h:2761
#define reference_indices(x)
Definition: ri.h:2328
#define expression_syntax(x)
Definition: ri.h:1247
#define level

References entity_undefined, EXPRESSION, expression_syntax, gen_nth(), level, reference_indices, reference_variable, syntax_reference, and syntax_reference_p.

+ Here is the call graph for this function:

◆ ith_loop_in_loop_nest()

loop ith_loop_in_loop_nest ( statement  s1,
int  level 
)
Parameters
s11
levelevel

Definition at line 158 of file instruction_to_wp65_code.c.

159 {
161  loop loop1;
162  if (instruction_block_p(inst)) {
164  inst = statement_instruction(st1);
165  }
166  loop1 = instruction_loop(inst);
167  return((level ==1) ? loop1 :
169 
170 }
loop loop1
tiling_sequence.c
#define loop_body(x)
Definition: ri.h:1644
#define instruction_loop(x)
Definition: ri.h:1520

References CAR, instruction_block, instruction_block_p, instruction_loop, level, loop1, loop_body, s1, STATEMENT, and statement_instruction.

Referenced by generate_io_wp65_code().

+ Here is the caller graph for this function:

◆ list_of_calls_p()

bool list_of_calls_p ( list  lsb)

instruction_to_wp65_code.c

Parameters
lsbsb

Definition at line 136 of file instruction_to_wp65_code.c.

137 {
138  list pl;
139  for(pl=lsb;
141  pl = CDR(pl));
142  return(pl==NIL);
143 }
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
bool statement_call_p(statement)
Definition: statement.c:364

References CAR, CDR, NIL, pl, STATEMENT, and statement_call_p().

Referenced by concat_data_list(), and loop_nest_to_wp65_code().

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

◆ loop_nest_movement_generation()

void loop_nest_movement_generation ( entity  module,
statement  loop_nest,
int  pn,
int  bn,
int  ls,
int  pd,
entity  proc_id,
entity  proc_id_mm,
Pbase  bank_indices,
hash_table  v_to_esv,
hash_table  v_to_nlv,
entity  compute_module,
statement  computational,
entity  memory_module,
statement  emulator,
statement_mapping  fetch_map,
statement_mapping  store_map,
statement  mod_stat,
bool  fully_parallel,
Psysteme  sc_tile,
Pbase  initial_basis,
Pbase  local_basis,
Pbase  local_basis2,
Pbase  tile_basis_in_tile_basis,
Pbase  tile_basis_in_tile_basis2,
Pbase  loop_body_indices,
list  lpv,
list lb,
list blb,
list sb,
list bsb,
int  first_parallel_level,
int  last_parallel_level,
hash_table  llv_to_lcr,
hash_table  r_to_llv,
hash_table  v_to_lllv,
hash_table  r_to_ud 
)

the list of data having to be store into the global memory is the concatenation of store_map sets of the internal loops

update of variable names according to the module of appartenance

Parameters
moduleodule
loop_nestoop_nest
pnn
bnn
lss
pdd
proc_idroc_id
proc_id_mmroc_id_mm
bank_indicesank_indices
v_to_esv_to_esv
v_to_nlv_to_nlv
compute_moduleompute_module
computationalomputational
memory_moduleemory_module
emulatormulator
fetch_mapetch_map
store_maptore_map
mod_statod_stat
fully_parallelully_parallel
sc_tilec_tile
initial_basisnitial_basis
local_basisocal_basis
local_basis2ocal_basis2
tile_basis_in_tile_basisile_basis_in_tile_basis
tile_basis_in_tile_basis2ile_basis_in_tile_basis2
loop_body_indicesoop_body_indices
lpvpv
lbb
blblb
sbb
bsbsb
first_parallel_levelirst_parallel_level
last_parallel_levelast_parallel_level
llv_to_lcrlv_to_lcr
r_to_llv_to_llv
v_to_lllv_to_lllv
r_to_ud_to_ud

Definition at line 483 of file instruction_to_wp65_code.c.

521 {
522  pips_assert("true", pd==pd
523  && proc_id_mm==proc_id_mm
524  &&v_to_nlv==v_to_nlv
525  && emulator==emulator
526  && mod_stat==mod_stat
527  && r_to_llv==r_to_llv
528  && computational==computational);
529 
530  list fetch_data_list =NIL;
531  list store_data_list = NIL;
532  list fetch_reference_list = NIL;
533  list store_reference_list = NIL;
534  debug_on("WP65_DEBUG_LEVEL");
535  /* the list of data having to be store into the global memory
536  is the concatenation of store_map sets of the internal loops */
537 
538  concat_data_list(&fetch_data_list,&fetch_reference_list,
539  loop_nest,fetch_map,fully_parallel);
540  concat_data_list(&store_data_list , &store_reference_list ,
541  loop_nest,store_map,fully_parallel);
542  MAPL(r1,{ entity rv = (entity) reference_variable(REFERENCE(CAR(r1)));
543  if(!entity_is_argument_p(rv, lpv))
545  module,compute_module,memory_module,
546  rv,fetch_reference_list,
547  llv_to_lcr, v_to_lllv,r_to_ud, v_to_esv,
548  pn,bn, ls,
549  sc_tile, initial_basis, local_basis,
550  proc_id, bank_indices,loop_body_indices,
551  lb, blb,is_action_read,first_parallel_level,
552  last_parallel_level);
553  },
554  fetch_data_list);
555  /* update of variable names according to the module of appartenance */
556  sc_variables_rename(sc_tile,local_basis2,local_basis, (string(*)(void*))entity_local_name);
557  sc_variables_rename(sc_tile, tile_basis_in_tile_basis2,
558  tile_basis_in_tile_basis,(string(*)(void*))entity_local_name);
559  MAPL(r1,{
560  reference rf = REFERENCE(CAR(r1));
561  entity rv = (entity) reference_variable(rf);
562  if (!reference_scalar_p(rf) && !entity_is_argument_p(rv, lpv))
563  make_all_movement_blocks(module,compute_module,memory_module,
564  rv,store_reference_list ,
565  llv_to_lcr, v_to_lllv, r_to_ud, v_to_esv,
566  pn,bn, ls,
567  sc_tile, initial_basis, local_basis,
568  proc_id, bank_indices, loop_body_indices,
569  sb, bsb, is_action_write,
570  first_parallel_level,
571  last_parallel_level);
572  },
573  store_data_list);
574  debug_off();
575 }
bool entity_is_argument_p(entity e, cons *args)
Definition: arguments.c:150
@ is_action_write
Definition: effects.h:293
@ is_action_read
Definition: effects.h:292
void make_all_movement_blocks(entity initial_module, entity compute_module, entity memory_module, entity v, list map, hash_table llv_to_lcr, hash_table v_to_lllv, hash_table r_to_ud, hash_table v_to_esv, int pn, int bn, int ls, Psysteme iteration_domain, Pbase initial_basis, Pbase local_basis, entity proc_id, Pbase bank_indices, Pbase loop_body_indices, list *pmb, list *pbmb, tag use_def, int first_parallel_level, int last_parallel_level)
generates all data movements related to entity v, loads or stores depending on use_def
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
void concat_data_list(list *l, list *lr, statement st, statement_mapping map, bool perfect_nested_loop)
Definition: references.c:236
bool reference_scalar_p(reference r)
This function returns true if Reference r is scalar.
Definition: expression.c:3530
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
Psysteme sc_variables_rename(Psysteme s, Pvecteur pv_old, Pvecteur pv_new, get_variable_name_t variable_name)
Psysteme sc_variables_rename(Psysteme s, Pvecteur pv_old, Pvecteur pv_new): reecriture du systeme s r...
Definition: sc.c:224
Definition: statement.c:4047

References CAR, concat_data_list(), debug_off, debug_on, entity_is_argument_p(), entity_local_name(), is_action_read, is_action_write, make_all_movement_blocks(), MAPL, mod_stat, module, NIL, pips_assert, REFERENCE, reference_scalar_p(), reference_variable, and sc_variables_rename().

Referenced by loop_nest_to_wp65_code().

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

◆ loop_nest_to_wp65_code()

void loop_nest_to_wp65_code ( entity  module,
statement  loop_nest,
graph  dg,
int  pn,
int  bn,
int  ls,
int  pd,
entity  proc_id,
entity  proc_id_mm,
Pbase  bank_indices,
hash_table  v_to_esv,
hash_table  v_to_nlv,
entity  compute_module,
statement  computational,
entity  memory_module,
statement  emulator,
statement_mapping  fetch_map,
statement_mapping  store_map,
statement  mod_stat 
)

load block

bank load block

store block

bank store block

compute block

list of local variables to list of conflicting references

inverse table: list of local variables to use for a given reference

variable to list of list of local variables: the main list is an image of connected components of the dependence graph filtered for a given variable, v; the low-level list is a function of the number of pipeline stages

reference to use-def usage ; use and def are encoded as action_is_read and action_is_write

pipelining offset; no pipelining is implemented yet

private variables for the loop nest

local variables

pour eviter tous les problemes de tiling sur les nids de boucles internes a des nids de boucles mal imbriques on execute les boucles internes en sequentiel. Il faudrait autrement s'assurer que l'on a les meme indices de boucles en interne pour le tiling et que les bornes sont identiques (meme restrictions que pour du loop fusion)

creation of new indices

a modifie pour tenir compte des dimensions reelles des domaines

normalement full_initila_basis == initial_basis2

a modifie pour tenir compte des dimensions reelles des domaines

put together the different pieces of code as two lists of statements

add the scanning over the tiles around them to build a proper stmt

update computational and emulator with cs and ems

Parameters
moduleodule
loop_nestoop_nest
dgg
pnn
bnn
lss
pdd
proc_idroc_id
proc_id_mmroc_id_mm
bank_indicesank_indices
v_to_esv_to_esv
v_to_nlv_to_nlv
compute_moduleompute_module
computationalomputational
memory_moduleemory_module
emulatormulator
fetch_mapetch_map
store_maptore_map
mod_statod_stat

Definition at line 579 of file instruction_to_wp65_code.c.

599 {
600 
601  Psysteme iteration_domain = sc_new();
602  Psysteme iteration_domain2 = sc_new();
603  Psysteme sc_tile = SC_UNDEFINED;
604  tiling tile;
605  Pvecteur tile_delay = VECTEUR_NUL;
606  Pvecteur pv;
607  int it;
608  list lb = NIL; /* load block */
609  list blb = NIL; /* bank load block */
610  list sb = NIL; /* store block */
611  list bsb = NIL; /* bank store block */
612  list cb = NIL; /* compute block */
613  /* list of local variables to list of conflicting references */
614  hash_table llv_to_lcr = hash_table_make(hash_pointer, 0);
615  /* inverse table: list of local variables to use for a given reference */
616  hash_table r_to_llv = hash_table_make(hash_pointer, 0);
617  /* variable to list of list of local variables: the main list
618  is an image of connected components of the dependence graph filtered
619  for a given variable, v; the low-level list is a function of
620  the number of pipeline stages */
621  hash_table v_to_lllv = hash_table_make(hash_pointer,0);
622  /* reference to use-def usage ; use and def are encoded as action_is_read
623  and action_is_write */
625 
626  /* pipelining offset; no pipelining is implemented yet */
627  Pbase offsets = VECTEUR_NUL;
628  statement body;
629 
630  /* private variables for the loop nest */
632 
633  /* local variables */
634  list cbl, embl = NIL;
635  statement cs, ems,bs;
637  instruction i;
638  list store_data_list = NIL;
639  list store_reference_list = NIL;
640  Pbase initial_basis = BASE_NULLE;
641  Pbase full_initial_basis = BASE_NULLE;
642  Pbase local_basis = BASE_NULLE;
643  Pbase tile_basis_in_initial_basis = BASE_NULLE;
644  Pbase tile_basis_in_tile_basis = BASE_NULLE;
645  Pbase local_basis2 = BASE_NULLE;
646  Pbase initial_basis2= BASE_NULLE;
647  Pbase tile_basis_in_tile_basis2 = BASE_NULLE;
648  Pbase loop_body_indices = BASE_NULLE;
649  int i1,lpl, loop_nest_dimt;
650  int first_parallel_level=1;
651  int last_parallel_level, perfect_nested_loop_size;
652  bool loop_carried_dep[11];
653  bool fully_parallel;
654  bool fully_sequential=true;
655  int nested_level2,nested_level=0;
656  list list_statement_block=NIL;
657  list list_statement_block2=NIL;
658  list new_compute_lst = NIL;
659  list new_bank_lst = NIL;
660  instruction binst,binst2;
661  bool io_statementp=false;
662 
663  debug_on("WP65_DEBUG_LEVEL");
664  debug(5,"loop_nest_to_wp65_code", "begin\n");
665 
666  for (i1=1;i1<=10;i1++) loop_carried_dep[i1] = false;
667  compute_loop_nest_dim(loop_nest);
668  loop_nest_dimt = loop_nest_dim;
669 
670 
671  fully_parallel = full_parallel_loop_nest_p(mod_stat,loop_nest,
672  loop_nest_dimt,dg,
673  loop_carried_dep);
674  find_iteration_domain(loop_nest,&iteration_domain, &initial_basis,
675  &nested_level,&list_statement_block, &binst);
676  full_initial_basis = base_dup(initial_basis);
677  perfect_nested_loop_size= vect_size(initial_basis);
678 
679  /* pour eviter tous les problemes de tiling sur les nids de boucles
680  internes a des nids de boucles mal imbriques on execute les boucles
681  internes en sequentiel. Il faudrait autrement s'assurer que l'on a
682  les meme indices de boucles en interne pour le tiling et que les
683  bornes sont identiques (meme restrictions que pour du loop fusion) */
684 
685  for (i1=perfect_nested_loop_size+1;i1<=10;i1++)
686  loop_carried_dep[i1] = true;
687  assert(perfect_nested_loop_size <=10);
688 
689  last_parallel_level =perfect_nested_loop_size+1;
690  if (!fully_parallel) {
691  for (i1=1; i1<=loop_nest_dimt && (loop_carried_dep[i1] == true);
692  i1++);
693  first_parallel_level = i1;
694  for (i1=first_parallel_level;
695  i1<=loop_nest_dimt && (loop_carried_dep[i1] == false);i1++);
696  last_parallel_level = i1-1;
697  for (it=1, pv=initial_basis;
698  it <perfect_nested_loop_size && it<last_parallel_level;
699  it++, pv=pv->succ);
700  loop_body_indices = base_dup(pv->succ);
701  ifdebug(4) {
702  (void) fprintf(stderr,"first_parallel_level :%d, last_parallel_level %d\n",
703  first_parallel_level,last_parallel_level);
704  (void) fprintf(stderr,"\nLoop body basis - loop_nest:");
705  base_fprint(stderr, loop_body_indices, (string(*)(void*))entity_local_name);
706  (void) fprintf(stderr,"\nInitial basis - loop_nest:");
707  base_fprint(stderr, initial_basis, (string(*)(void*))entity_local_name);
708  }
709  }
710 
711  /* creation of new indices */
712  create_tile_basis(module,compute_module,memory_module, initial_basis,
713  &tile_basis_in_initial_basis,
714  &tile_basis_in_tile_basis,
715  &local_basis,
716  &tile_basis_in_tile_basis2,
717  &local_basis2);
718  lpl = (fully_parallel) ? last_parallel_level-1:last_parallel_level;
719  tile = loop_nest_to_tile(iteration_domain, ls,
720  initial_basis, first_parallel_level,lpl,
721  perfect_nested_loop_size);
722 
723  sc_tile = loop_bounds_to_tile_bounds(iteration_domain,initial_basis,
724  tile, tile_delay,
725  tile_basis_in_tile_basis,
726  local_basis);
727 
728  ifdebug(8) {
729  fprintf(stderr,"loop body \n");
731  list_statement_block);
732  }
733  if (list_of_calls_p(list_statement_block)) {
734  body = perfectly_nested_loop_to_body(loop_nest);
735 
736  if (io_loop_nest_p(body)) {
737  io_st = generate_io_wp65_code(loop_nest,body,v_to_esv,true);
738  io_statementp = true;}
739  else {
740 
741  /* a modifie pour tenir compte des dimensions reelles des domaines */
742 
743  loop_nest_to_local_variables(module, compute_module, memory_module,
744  llv_to_lcr, r_to_llv, v_to_lllv,
745  r_to_ud, v_to_esv, v_to_nlv,
746  lpv, body, initial_basis, dg,
747  bn, ls, pd,
748  tile);
749  ifdebug(4) fprint_wp65_hash_tables(stderr, llv_to_lcr, r_to_llv, v_to_lllv,
750  r_to_ud, v_to_esv);
751 
752  loop_nest_movement_generation(module,loop_nest,pn,bn, ls, pd,proc_id,proc_id_mm,
753  bank_indices,v_to_esv,v_to_nlv,compute_module,
754  computational, memory_module,emulator,fetch_map,
755  store_map,mod_stat,fully_parallel,sc_tile,
756  full_initial_basis,local_basis, local_basis2,
757  tile_basis_in_tile_basis, tile_basis_in_tile_basis2,
758  loop_body_indices,lpv,&lb,&blb,&sb,
759  &bsb,first_parallel_level, last_parallel_level,
760  llv_to_lcr, r_to_llv, v_to_lllv,r_to_ud );
761 }
762  }
763  else {
764  Pbase tbib2 = BASE_NULLE;
765  Pbase tbtl3 = BASE_NULLE;
766  Pbase tbtl4 = BASE_NULLE;
767  Pbase lba3 = BASE_NULLE;
768  Pbase lba4 = BASE_NULLE;
769  Pbase lba5 = BASE_NULLE;
770  Pbase lba6 = BASE_NULLE;
771  Pbase tbtl5 = BASE_NULLE;
772  Pbase tbtl6 = BASE_NULLE;
773  Psysteme sc_tile2 = SC_UNDEFINED;
774  tiling tile2;
775 
776  MAPL(lsb,
777  {
778  statement stmp = STATEMENT(CAR(lsb));
779  if (!continue_statement_p(stmp)) {
780  instruction_block(binst) = CONS(STATEMENT,stmp,NIL);
781  ifdebug(8)
782  {
783  fprintf(stderr,"generation des transferts pour \n");
784  wp65_debug_print_text(module, loop_nest);
785  }
786  body = perfectly_nested_loop_to_body(loop_nest);
787  find_iteration_domain(loop_nest,&iteration_domain2,
788  &initial_basis2,&nested_level2,
789  &list_statement_block2,&binst2);
790  if (loop_nest_dimt > perfect_nested_loop_size) {
791  loop_body_indices = vect_dup(initial_basis2);
792  for ( pv=initial_basis; pv!= NULL;
793  vect_chg_coeff(&loop_body_indices,pv->var,VALUE_ZERO),
794  pv =pv->succ);
795  full_initial_basis=base_reversal(vect_add(initial_basis,
796  loop_body_indices));
797  /* normalement full_initila_basis == initial_basis2*/
798  }
799  ifdebug(2) {
800  (void) fprintf(stderr,"full basis\n");
801  base_fprint(stderr, initial_basis2,
802  (string(*)(void*))entity_local_name);
803  (void) fprintf(stderr,"full iteration domain\n");
804  sc_fprint(stderr,iteration_domain2,
805  (string(*)(void*))entity_local_name);
806  }
807  create_tile_basis(module,compute_module,memory_module, loop_body_indices,
808  &tbib2, &tbtl3, &lba3, &tbtl4, &lba4);
809  tbtl5= base_reversal(vect_add(tile_basis_in_tile_basis, tbtl3));
810  tbtl6= base_reversal(vect_add(tile_basis_in_tile_basis2, tbtl4));
811  //Pbase tbib3=base_reversal(vect_add(tile_basis_in_initial_basis, tbib2));
812  lba5= base_reversal(vect_add( local_basis, lba3));
813  lba6= base_reversal(vect_add( local_basis2, lba4));
814  /* a modifie pour tenir compte des dimensions reelles des domaines */
815  tile2 = loop_nest_to_tile(iteration_domain2, ls, initial_basis2,
816  first_parallel_level,lpl,
817  perfect_nested_loop_size);
818  sc_tile2=loop_bounds_to_tile_bounds(iteration_domain2,initial_basis2,
819  tile2, tile_delay,tbtl5,lba5);
820 
821  loop_nest_to_local_variables(module, compute_module, memory_module,
822  llv_to_lcr, r_to_llv, v_to_lllv,
823  r_to_ud, v_to_esv, v_to_nlv,
824  lpv, body, initial_basis2, dg,
825  bn, ls, pd,tile2);
826  ifdebug(4) fprint_wp65_hash_tables(stderr, llv_to_lcr,
827  r_to_llv, v_to_lllv,
828  r_to_ud, v_to_esv);
830  module,stmp,pn,bn, ls, pd,proc_id,
831  proc_id_mm, bank_indices,v_to_esv,
832  v_to_nlv,compute_module, computational,
833  memory_module,emulator,fetch_map,
834  store_map, mod_stat,fully_parallel,
835  sc_tile2,initial_basis2,lba5,lba6,tbtl5,
836  tbtl6,loop_body_indices,lpv,&lb,&blb,&sb,
837  &bsb,first_parallel_level,
838  last_parallel_level, llv_to_lcr,
839  r_to_llv, v_to_lllv,r_to_ud );
841  }
842 
843  },
844  list_statement_block);
845  }
846  fully_sequential = (first_parallel_level >last_parallel_level);
847 
848  if (io_statementp) {
849  cs = statement_undefined;
850  ems =io_st;
851  }
852  else {
853  insert_run_time_communications(compute_module, memory_module,
854  bank_indices,bn,ls,proc_id,
855  list_statement_block,fetch_map,
856  store_map,&new_compute_lst,
857  &new_bank_lst,v_to_esv,
858  fully_sequential,
859  initial_basis,tile, tile_delay,
860  tile_basis_in_tile_basis,
861  local_basis);
862 
863  instruction_block(binst)= new_compute_lst;
864  body = instruction_to_statement(binst);
865  ifdebug(8) {
866  fprintf(stderr,"loop body \n");
868  fprintf(stderr,"base_initiale 1\n");
869  vect_fprint(stderr,initial_basis,(string(*)(void*))entity_local_name);
870  }
871 
872  sc_variables_rename(sc_tile,local_basis,local_basis2, (string(*)(void*))entity_local_name);
873  sc_variables_rename(sc_tile, tile_basis_in_tile_basis,
874  tile_basis_in_tile_basis2,(string(*)(void*))entity_local_name);
875 
876  cb = make_compute_block(compute_module, body, offsets, r_to_llv,tile,
877  initial_basis, local_basis2,
878  tile_basis_in_tile_basis2,
879  tile_basis_in_initial_basis,
880  iteration_domain,first_parallel_level,
881  last_parallel_level);
882 
883 
884  if (new_bank_lst != NIL) {
886  make_block_statement(new_bank_lst),
887  tile, initial_basis, local_basis,
888  tile_basis_in_tile_basis,
889  tile_basis_in_initial_basis,
890  iteration_domain,
891  first_parallel_level,
892  last_parallel_level);
893  new_bank_lst = CONS(STATEMENT,bs,NIL);
894  }
895  /* put together the different pieces of code as two lists of
896  statements */
897  cbl = gen_nconc(lb, gen_nconc(cb ,sb));
898  bsb = gen_nconc(new_bank_lst, bsb);
899  embl =gen_nconc(blb, bsb);
900 
901  /* add the scanning over the tiles around them to build a proper stmt */
902  cs = make_scanning_over_tiles(compute_module, cbl, proc_id, pn,tile,
903  initial_basis,
904  tile_basis_in_tile_basis2,
905  tile_basis_in_initial_basis,
906  iteration_domain,first_parallel_level,
907  last_parallel_level);
908  ems = make_scanning_over_tiles(memory_module, embl, proc_id_mm,
909  pn, tile, initial_basis,
910  tile_basis_in_tile_basis,
911  tile_basis_in_initial_basis,
912  iteration_domain,first_parallel_level,
913  last_parallel_level);
914 
915  if (fully_sequential) {
916  range looprange = make_range(int_to_expression(0),
917  int_to_expression(pn-1),
918  int_to_expression(1));
919  entity looplabel = make_loop_label(9000,
920  compute_module);
921  loop newloop = make_loop(proc_id,
922  looprange,
923  ems,
924  looplabel,
926  UU),
927  NIL);
928 
929  ems = loop_to_statement(newloop);
930  }
931  /* update computational and emulator with cs and ems */
932  }
933  i = statement_instruction(computational);
934  if (cs != statement_undefined)
936  i = statement_instruction(emulator);
938 
939  ifdebug(5) {
940  (void) fprintf(stderr,
941  "Vars having to be stored into global memory:\n");
942  reference_list_print(store_data_list);
943  reference_list_print(store_reference_list);
944  }
946 
947  MAPL(r1,{
948  reference rf = REFERENCE(CAR(r1));
949  if (reference_scalar_p(rf)) {
951  false,computational,proc_id);
953  true,emulator,(entity)bank_indices->var);
954  }
955  },
956  store_data_list);
957  hash_table_free(llv_to_lcr);
958  hash_table_free(r_to_llv);
959  hash_table_free(v_to_lllv);
960  hash_table_free(r_to_ud);
961 
962  debug(5,"loop_nest_to_wp65_code", "end\n");
963  debug_off();
964 }
execution make_execution(enum execution_utype tag, void *val)
Definition: ri.c:838
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
Definition: ri.c:1301
tiling loop_nest_to_tile(Psysteme sc, int ls, Pbase base_index, int first_parallel_level, int last_parallel_level, int perfect_nested_level)
Code Generation for Distributed Memory Machines.
Definition: tiling.c:58
#define VALUE_ZERO
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
Definition: base.c:221
void create_tile_basis(entity initial_module, entity compute_module, entity memory_module, Pbase initial_basis, Pbase *tile_basis_in_initial_basis, Pbase *tile_basis_in_tile_basis, Pbase *local_tile_basis, Pbase *tile_basis_in_tile_basis2, Pbase *local_tile_basis2)
Definition: basis.c:100
Psysteme loop_bounds_to_tile_bounds(Psysteme loop_bounds, Pbase loop_indices, tiling t, Pvecteur tile_delay, Pvecteur tile_indices, Pvecteur tile_local_indices)
this function returns the system of constraints
Definition: build_sc_tile.c:97
statement make_scanning_over_tiles(entity module, list body, entity proc_id, int pn, tiling tile, Pbase initial_basis, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_initial_basis, Psysteme iteration_domain, int first_parallel_level, int last_parallel_level)
make_scanning_over_tiles()
Definition: code.c:227
list make_compute_block(entity module, statement body, Pvecteur offsets, hash_table r_to_llv, tiling tile, Pbase initial_basis, Pbase local_basis, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_initial_basis, Psysteme iteration_domain, int first_parallel_level, int last_parallel_level)
Definition: code.c:679
statement make_scanning_over_one_tile(entity module, statement body, tiling tile, Pbase initial_basis, Pbase local_basis, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_initial_basis, Psysteme iteration_domain, int first_parallel_level, int last_parallel_level)
make_scanning_over_one_tile():
Definition: code.c:475
void insert_run_time_communications(entity compute_module, entity memory_module, Pbase bank_indices, int bn, int ls, entity proc_id, list list_statement_block, statement_mapping fetch_map, statement_mapping store_map, list *new_slst, list *new_blist, hash_table v_to_esv, bool fully_sequential, Pbase loop_indices, tiling tile, Pvecteur tile_delay, Pvecteur tile_indices, Pvecteur tile_local_indices)
void find_iteration_domain(statement s, Psysteme *sc, Pbase *basis, nested_level, list *list_statement_block, instruction *inst)
if(!(yy_init))
Definition: genread_lex.c:1029
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
Definition: statement.c:597
statement perfectly_nested_loop_to_body(statement loop_nest)
Extract the body of a perfectly nested loop body.
Definition: loop.c:590
void gen_map(gen_iter_func_t fp, const list l)
Definition: list.c:172
#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 continue_statement_p(statement)
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python....
Definition: statement.c:203
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
bool io_loop_nest_p(statement st)
Test if the statement resulting from the perfectly_loop_nest_to_body function contains at first call ...
bool full_parallel_loop_nest_p(statement mod_stat, statement loop_stmt, int nest_dim, graph dg, bool *loop_carried_dep)
void loop_nest_movement_generation(entity module, statement loop_nest, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map, statement mod_stat, bool fully_parallel, Psysteme sc_tile, Pbase initial_basis, Pbase local_basis, Pbase local_basis2, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_tile_basis2, Pbase loop_body_indices, list lpv, list *lb, list *blb, list *sb, list *bsb, int first_parallel_level, int last_parallel_level, hash_table llv_to_lcr, hash_table r_to_llv, hash_table v_to_lllv, hash_table r_to_ud)
static void reduce_loop_bound_for_st(statement stmp)
bool list_of_calls_p(list lsb)
instruction_to_wp65_code.c
static void compute_loop_nest_dim(statement l)
void base_fprint(FILE *f, Pbase b, get_variable_name_t variable_name)
void base_fprint(FILE * f, Pbase b, char * (*variable_name)()): impression d'une base sur le fichier ...
Definition: io.c:342
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
Definition: io.c:124
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
void wp65_debug_print_text(entity m, statement s)
include "values.h"
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
#define assert(ex)
Definition: newgen_assert.h:41
@ hash_pointer
Definition: newgen_hash.h:32
void(* gen_iter_func_t)(void *)
Definition: newgen_types.h:116
#define UU
Definition: newgen_types.h:98
void loop_nest_to_local_variables(entity initial_module, entity compute_module, entity memory_module, hash_table llv_to_lcr, hash_table r_to_llv, hash_table v_to_lllv, hash_table r_to_ud, hash_table v_to_esv, hash_table v_to_nlv, list lpv, statement body, Pbase indices, graph dg, int bn, int ls, int pd, tiling tile)
for the phi variable
Definition: variable.c:80
void reference_scalar_defined_p(reference r)
Definition: references.c:199
#define loop_to_statement(l)
entity make_loop_label(int __attribute__((unused)) desired_number, entity module)
Definition: entity.c:370
#define loop_locals(x)
Definition: ri.h:1650
@ is_execution_parallel
Definition: ri.h:1190
#define statement_undefined
Definition: ri.h:2419
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
else
Definition: set.c:239
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
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define BASE_NULLE
MACROS SUR LES BASES.
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51
Pbase base_dup(Pbase b)
Pbase base_dup(Pbase b) Note: this function changes the value of the pointer.
Definition: alloc.c:268
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143
void fprint_wp65_hash_tables(FILE *fd, hash_table llv_to_lcr, hash_table r_to_llv, hash_table v_to_lllv, hash_table r_to_ud, hash_table v_to_esv)
Ignore this function: debugging purposes only.
Definition: wp65.c:406

References assert, base_dup(), base_fprint(), BASE_NULLE, base_reversal(), CAR, compute_loop_nest_dim(), CONS, continue_statement_p(), create_tile_basis(), debug(), debug_off, debug_on, dg, entity_local_name(), find_iteration_domain(), fprint_wp65_hash_tables(), fprintf(), full_parallel_loop_nest_p(), gen_map(), gen_nconc(), generate_io_wp65_code(), hash_pointer, hash_table_free(), hash_table_make(), ifdebug, include_constant_symbolic_communication(), insert_run_time_communications(), instruction_block, instruction_loop, instruction_to_statement(), int_to_expression(), io_loop_nest_p(), is_execution_parallel, list_of_calls_p(), loop_bounds_to_tile_bounds(), loop_locals, loop_nest_dim, loop_nest_movement_generation(), loop_nest_to_local_variables(), loop_nest_to_tile(), loop_to_statement, make_block_statement(), make_compute_block(), make_execution(), make_loop(), make_loop_label(), make_range(), make_scanning_over_one_tile(), make_scanning_over_tiles(), MAP, MAPL, mod_stat, module, NIL, perfectly_nested_loop_to_body(), reduce_loop_bound_for_st(), REFERENCE, reference_list_print(), reference_scalar_defined_p(), reference_scalar_p(), sc_fprint(), sc_new(), sc_variables_rename(), STATEMENT, statement_instruction, statement_undefined, Svecteur::succ, UU, VALUE_ZERO, Svecteur::var, vect_add(), vect_chg_coeff(), vect_dup(), vect_fprint(), vect_size(), VECTEUR_NUL, and wp65_debug_print_text().

Referenced by instruction_to_wp65_code().

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

◆ make_all_movement_blocks()

void make_all_movement_blocks ( entity  initial_module,
entity  compute_module,
entity  memory_module,
entity  v,
list  map,
hash_table  llv_to_lcr,
hash_table  v_to_lllv,
hash_table  r_to_ud,
hash_table  v_to_esv,
int  pn,
int  bn,
int  ls,
Psysteme  iteration_domain,
Pbase  initial_basis,
Pbase  local_basis,
entity  proc_id,
Pbase  bank_indices,
Pbase  loop_body_indices,
list pmb,
list pbmb,
tag  use_def,
int  first_parallel_level,
int  last_parallel_level 
)

generates all data movements related to entity v, loads or stores depending on use_def

FI: depending on the pipeline stage, a specific lv should be chosen; by default, let's take the first one

statement for one movement block

statement for one bank movement block

Parameters
initial_modulenitial_module
compute_moduleompute_module
memory_moduleemory_module
mapap
llv_to_lcrlv_to_lcr
v_to_lllv_to_lllv
r_to_ud_to_ud
v_to_esv_to_esv
pnn
bnn
lss
iteration_domainteration_domain
initial_basisnitial_basis
local_basisocal_basis
proc_idroc_id
bank_indicesank_indices
loop_body_indicesoop_body_indices
pmbmb
pbmbmovement blocks
use_defbank movement blocks
first_parallel_levelirst_parallel_level
last_parallel_levelast_parallel_level

Definition at line 972 of file instruction_to_wp65_code.c.

1001 {
1002  list lllv = (list) hash_get(v_to_lllv, (char *) v);
1003  entity esv = (entity) hash_get(v_to_esv, (char *) v);
1004 
1005  debug(8,"make_all_movement_blocks", "begin\n");
1006  for(; !ENDP(lllv); POP(lllv)) {
1007  /* FI: depending on the pipeline stage, a specific lv should be
1008  chosen; by default, let's take the first one */
1009  list llv = LIST(CAR(lllv));
1010  entity lv = ENTITY(CAR(llv));
1011  list lr = (list) hash_get(llv_to_lcr, (char *) llv);
1012  bool proper_tag = false;
1013 
1014  for(; !ENDP(lr) && !proper_tag ; POP(lr)) {
1015  reference r = REFERENCE(CAR(lr));
1016  if( reference_in_list_p(r,map) &&
1017  (intptr_t) hash_get(r_to_ud, r) == (intptr_t)use_def) {
1018  statement mbs = NULL; /* statement for one movement block */
1019  statement bmbs = NULL; /* statement for one bank movement block */
1020 
1021  proper_tag = true;
1022  switch(use_def) {
1023  case is_action_read:
1024  make_load_blocks(initial_module,compute_module,
1025  memory_module, v, esv, lv,
1026  lr, r_to_ud, iteration_domain,
1027  initial_basis, bank_indices,
1028  local_basis, loop_body_indices,
1029  proc_id, pn,bn, ls,
1030  &mbs, &bmbs,first_parallel_level,
1031  last_parallel_level);
1032 
1033  break;
1034  case is_action_write:
1035  make_store_blocks(initial_module,compute_module,
1036  memory_module, v, esv, lv,
1037  lr, r_to_ud, iteration_domain,
1038  initial_basis,
1039  bank_indices,local_basis,
1040  loop_body_indices,
1041  proc_id, pn,bn, ls,
1042  &mbs, &bmbs,first_parallel_level,
1043  last_parallel_level);
1044  break;
1045  default:
1046  pips_internal_error("unexpected use-def = %d", use_def);
1047  }
1048 
1049  ifdebug(9) {
1050  pips_debug(9, "mbs=\n");
1051  wp65_debug_print_text(compute_module, mbs);
1052  pips_debug(9, "bmbs=\n");
1053  wp65_debug_print_text(compute_module, mbs);
1054  }
1055 
1056  *pmb = gen_nconc(*pmb, CONS(STATEMENT, mbs, NIL));
1057  *pbmb = gen_nconc(*pbmb, CONS(STATEMENT, bmbs, NIL));
1058  }
1059  }
1060  }
1061 
1062  debug(8,"make_all_movement_blocks", "end\n");
1063 }
void make_store_blocks(entity initial_module, entity compute_module, entity memory_module, entity var, entity shared_variable, entity local_variable, list lrefs, hash_table r_to_ud, Psysteme sc_domain, Pbase index_base, Pbase bank_indices, Pbase tile_indices, Pbase loop_body_indices, entity Proc_id, int pn, int bn, int ls, statement *store_block, statement *bank_store_block, int first_parallel_level, int last_parallel_level)
Definition: code.c:1166
void make_load_blocks(entity initial_module, entity compute_module, entity memory_module, entity var, entity shared_variable, entity local_variable, list lrefs, hash_table r_to_ud, Psysteme sc_domain, Pbase index_base, Pbase bank_indices, Pbase tile_indices, Pbase loop_body_indices, entity Proc_id, int pn, int bn, int ls, statement *load_block, statement *bank_load_block, int first_parallel_level, int last_parallel_level)
Definition: code.c:1312
#define LIST(x)
Definition: genC.h:93
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
struct cons * list
Definition: newgen_types.h:106
bool reference_in_list_p(reference r, list lwr)
This function tests whether at least one array indice of Reference r belongs to List lwr or not.
Definition: references.c:130
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define intptr_t
Definition: stdint.in.h:294

References CAR, CONS, debug(), ENDP, ENTITY, gen_nconc(), hash_get(), ifdebug, intptr_t, is_action_read, is_action_write, LIST, make_load_blocks(), make_store_blocks(), NIL, pips_debug, pips_internal_error, POP, REFERENCE, reference_in_list_p(), STATEMENT, and wp65_debug_print_text().

Referenced by loop_nest_movement_generation().

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

◆ reduce_loop_bound()

static void reduce_loop_bound ( loop  l)
static

Function used during code generation for non-perfectly nested loops.

The loops of inner nests are executed sequentially. No tiling is applied on these inner loops. Thus, the new loop bounds do not change, except that there are shift -1 to deal with Fortran declarations.

Definition at line 109 of file instruction_to_wp65_code.c.

110 {
111  range r = loop_range(l);
112  Pvecteur vlow = VECTEUR_NUL,vup = VECTEUR_NUL;
113  expression low = range_lower(r);
114  expression up = range_upper(r);
115  normalized low_norm = NORMALIZE_EXPRESSION(low);
116  normalized up_norm = NORMALIZE_EXPRESSION(up);
117 
118  if (normalized_linear_p(low_norm) && normalized_linear_p(up_norm)){
119  vlow = (Pvecteur) normalized_linear(low_norm);
120  vup = (Pvecteur) normalized_linear(up_norm);
121  vect_add_elem(&vlow,TCST, VALUE_MONE);
125  }
126  else (void) fprintf(stderr,"non linear loop bounds-cannot be reduced\n");
127 }
#define VALUE_MONE
#define NORMALIZE_EXPRESSION(e)
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
Definition: expression.c:1650
#define normalized_linear_p(x)
Definition: ri.h:1779
#define normalized_linear(x)
Definition: ri.h:1781
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
struct Svecteur * Pvecteur
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

References fprintf(), loop_range, make_vecteur_expression(), NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, range_lower, range_upper, TCST, VALUE_MONE, vect_add_elem(), and VECTEUR_NUL.

Referenced by reduce_loop_bound_for_st().

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

◆ reduce_loop_bound_for_st()

static void reduce_loop_bound_for_st ( statement  stmp)
static

Definition at line 130 of file instruction_to_wp65_code.c.

131 {
133 
134 }
static void reduce_loop_bound(loop l)
Function used during code generation for non-perfectly nested loops.

References gen_recurse, gen_true(), loop_domain, and reduce_loop_bound().

Referenced by loop_nest_to_wp65_code().

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

◆ ref_in_implied_do()

expression ref_in_implied_do ( expression  exp)

This function extracts from an implied_do expression the reference having to be computed or printed.

Parameters
expxp

Definition at line 328 of file instruction_to_wp65_code.c.

329 {
331  list call_args = call_arguments(c2);
332  expression last_call = EXPRESSION(CAR(gen_last(call_args)));
333  syntax s = expression_syntax(last_call);
334 
335  return((syntax_call_p(s)
337  "IMPLIED-DO") == 0)) ?
338  ref_in_implied_do(last_call):
339  last_call );
340 }
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
expression ref_in_implied_do(expression exp)
This function extracts from an implied_do expression the reference having to be computed or printed.
#define syntax_call_p(x)
Definition: ri.h:2734
#define syntax_call(x)
Definition: ri.h:2736
#define call_arguments(x)
Definition: ri.h:711
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References call_arguments, call_function, CAR, entity_local_name(), exp, EXPRESSION, expression_syntax, gen_last(), syntax_call, and syntax_call_p.

Referenced by translate_IO_ref().

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

◆ search_parallel_loops()

void search_parallel_loops ( statement  mod_stat,
statement  loop_statement,
graph  dg,
loop_carried_dep   
)

Definition at line 1068 of file instruction_to_wp65_code.c.

1073 {
1074  cons *pv1, *ps, *pc;
1075  set region = region_of_loop(loop_statement);;
1076 
1078 
1079  for (pv1 = graph_vertices(dg); !ENDP(pv1); pv1 = CDR(pv1)) {
1080  vertex v1 = VERTEX(CAR(pv1));
1083 
1084  if (set_belong_p(region,(char *) s1)) {
1085  for (ps = vertex_successors(v1); !ENDP(ps); ps = CDR(ps)) {
1086  successor su = SUCCESSOR(CAR(ps));
1087  vertex v2 = successor_vertex(su);
1088  statement s2 = vertex_to_statement(v2);
1089  list loops2 = load_statement_enclosing_loops(s2);
1091  int nbrcomloops = FindMaximumCommonLevel(loops1, loops2);
1092 
1093  for (pc = dg_arc_label_conflicts(dal);
1094  !ENDP(pc); pc = CDR(pc)) {
1095  conflict c = CONFLICT(CAR(pc));
1096 
1097  if(conflict_cone(c) != cone_undefined) {
1098  cons * lls = cone_levels(conflict_cone(c));
1099  cons *llsred =NIL;
1100  MAPL(pl,{
1101  int level = INT(CAR(pl));
1102  if ((level <= nbrcomloops)
1103  && !ignore_this_conflict(v1,v2,c,level))
1104  llsred = gen_nconc(llsred, CONS(INT, level, NIL));
1105  }, lls);
1106  if (llsred != NIL)
1107  MAPL(pl,
1108  { loop_carried_dep[INT(CAR(pl))] = true;
1109  }, llsred);
1110  }
1111  }
1112  }
1113  }
1114  }
1116 }
@ INT
Definition: atomic.c:48
struct _newgen_struct_dg_arc_label_ * dg_arc_label
Definition: dg.h:60
#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 cone_undefined
Definition: dg.h:104
#define conflict_cone(x)
Definition: dg.h:169
#define region
simulation of the type region
#define successor_vertex(x)
Definition: graph.h:118
#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
set region_of_loop(statement l)
this function returns the set of all statements belonging to the given loop even if the loop contains...
Definition: loop.c:254
statement_mapping loops_mapping_of_statement(statement stat)
Definition: loop.c:155
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
Definition: util.c:45
bool set_belong_p(const set, const void *)
Definition: set.c:194
list load_statement_enclosing_loops(statement)
void reset_enclosing_loops_map(void)
void set_enclosing_loops_map(statement_mapping)
bool ignore_this_conflict(vertex v1, vertex v2, conflict c, int l)
This function checks if conflict c between vertices v1 and v2 should be ignored at level l.
Definition: codegen.c:163
int FindMaximumCommonLevel(cons *, cons *)
Definition: testdep_util.c:307
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59

References CAR, CDR, cone_levels, cone_undefined, CONFLICT, conflict_cone, CONS, dg, dg_arc_label_conflicts, ENDP, FindMaximumCommonLevel(), gen_nconc(), graph_vertices, ignore_this_conflict(), INT, level, load_statement_enclosing_loops(), loops_mapping_of_statement(), MAPL, mod_stat, NIL, pl, region, region_of_loop(), reset_enclosing_loops_map(), s1, set_belong_p(), set_enclosing_loops_map(), SUCCESSOR, successor_arc_label, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().

Referenced by full_parallel_loop_nest_p().

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

◆ translate_IO_ref()

reference translate_IO_ref ( call  c,
hash_table  v_to_esv,
bool  loop_or_call_print 
)

This function translates a reference in I/O statement into its corresponding emulated shared memory reference.

scan the argument list till IOLIST' arguments

implied-do case: the array reference is the first argument in the last argument list of the implied do call

Parameters
v_to_esv_to_esv
loop_or_call_printoop_or_call_print

Definition at line 346 of file instruction_to_wp65_code.c.

347 {
348  pips_assert("true", loop_or_call_print==loop_or_call_print);
349  list pio,pc = NIL;
350  bool iolist_reached = false;
351  expression exp;
352  syntax s;
354  if (same_string_p(entity_local_name(call_function(c)), "WRITE")) {
355  pio = pc = call_arguments(c);
356  /* scan the argument list till IOLIST' arguments*/
357  while (!ENDP(pio) && (!iolist_reached)) {
358  call c1;
359  expression arg;
360  s = expression_syntax(EXPRESSION(CAR(pio)));
361  c1=syntax_call(s);
362  arg = EXPRESSION(CAR(CDR(pio)));
363 
364  if (((strcmp(entity_local_name(call_function(c1)),"FMT=")==0) &&
365  (strcmp(expression_to_string(arg),"*")==0))
366  ||((strcmp(entity_local_name(call_function(c1)),"UNIT=")==0)
367  &&
368  (strcmp(expression_to_string(arg),"*")==0)))
369  pio = CDR(CDR(pio));
370  else
371  if (strcmp(entity_local_name(call_function(c1)),
372  "IOLIST=")==0) {
373  iolist_reached = true;
374  pio = CDR(pio);
375  }
376  }
377  exp = EXPRESSION(CAR(pio));
378  /* implied-do case: the array reference is the first argument
379  in the last argument list of the implied do call */
381  if (syntax_call_p(s) &&
383  "IMPLIED-DO") == 0)) {
386  }
387  if (syntax_reference_p(s)) {
389  reference ref1 = syntax_reference(sy1);
391  entity ent1=(entity)hash_get(v_to_esv,
392  (char *) reference_variable(ref1));
393  reference newr = make_reference(ent1,indic);
395  result = ref1;
396  }
397  }
398  else
399  pips_user_error("function calls are not handled in this version\n");
400  return result;
401 }
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
list gen_full_copy_list(list l)
Copy a list structure with element copy.
Definition: list.c:535
#define pips_user_error
Definition: misc-local.h:147
#define same_string_p(s1, s2)
string expression_to_string(expression e)
Definition: expression.c:77
#define reference_undefined
Definition: ri.h:2302
@ is_syntax_reference
Definition: ri.h:2691

References call_arguments, call_function, CAR, CDR, ENDP, entity_local_name(), exp, EXPRESSION, expression_syntax, expression_to_string(), gen_full_copy_list(), hash_get(), is_syntax_reference, make_reference(), make_syntax(), NIL, pips_assert, pips_user_error, ref_in_implied_do(), reference_indices, reference_undefined, reference_variable, same_string_p, syntax_call, syntax_call_p, syntax_reference, and syntax_reference_p.

Referenced by generate_io_wp65_code().

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

◆ update_loop_nest_dim()

static void update_loop_nest_dim ( loop  l)
static

Definition at line 87 of file instruction_to_wp65_code.c.

88 {
89 
92  loop_nest_dim ++;
93 }
static list loops_of_nest

References CONS, loop_nest_dim, loop_to_statement, loops_of_nest, and STATEMENT.

Referenced by compute_loop_nest_dim().

+ Here is the caller graph for this function:

Variable Documentation

◆ implied_do_range_list

list implied_do_range_list =NIL
static

Definition at line 69 of file instruction_to_wp65_code.c.

Referenced by add_range_in_list(), and generate_io_wp65_code().

◆ loop_nest_dim

int loop_nest_dim =0
static

◆ loops_of_nest

list loops_of_nest =NIL
static

Definition at line 71 of file instruction_to_wp65_code.c.

Referenced by update_loop_nest_dim().