PIPS
wp65.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 "properties.h"
#include "text-util.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "resources.h"
#include "pipsdbm.h"
#include "movements.h"
#include "effects-generic.h"
#include "effects-convex.h"
#include "top-level.h"
#include "control.h"
#include "wp65.h"
+ Include dependency graph for wp65.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 unary_into_binary_ref (reference ref)
 
static void translate_unary_into_binary_ref (statement stat)
 
entity MakeEntityFunction (string sname)
 
bool wp65 (const string input_module_name)
 
void module_to_wp65_modules (entity module, statement module_code, graph dg, int pn, int bn, int ls, int pd, entity *pcompute_module, statement *pcomputational, entity *pmemory_module, statement *pemulator)
 
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. More...
 
bool wp65_conform_p (statement s)
 

Typedef Documentation

◆ arc_label

Code Generation for Distributed Memory Machines.

Higher level functions

File: wp65.c

PUMA, ESPRIT contract 2701

Francois Irigoin, Corinne Ancourt, Lei Zhou 1991

Definition at line 49 of file wp65.c.

◆ vertex_label

Definition at line 50 of file wp65.c.

Function Documentation

◆ fprint_wp65_hash_tables()

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.

Parameters
fdd
llv_to_lcrlv_to_lcr
r_to_llv_to_llv
v_to_lllv_to_lllv
r_to_ud_to_ud
v_to_esv_to_esv

Definition at line 406 of file wp65.c.

414 {
415  fputs("\nKey mappings for WP65:\n\n", fd);
416 
417  fputs("Mapping llv_to_lcr from list of local variables to conflicting references:\n",
418  fd);
419  HASH_MAP(llv, lcr,
420  {
421  list llvl=(list) llv;
422  list lcrl= (list) lcr;
423  for(; !ENDP(llvl); POP(llvl)) {
424  entity lv = ENTITY(CAR(llvl));
425  fputs(entity_local_name(lv), fd);
426  if(ENDP(CDR(llvl)))
427  (void) putc(' ', fd);
428  else
429  (void) putc(',', fd);
430  }
431  fputs("\t->\t",fd);
432  for(; !ENDP(lcrl); POP(lcrl)) {
433  reference r = REFERENCE(CAR(lcrl));
434  fprint_reference(fd, r);
435  if(ENDP(CDR(lcrl)))
436  (void) putc('\n', fd);
437  else
438  (void) putc(',', fd);
439  }
440  },
441  llv_to_lcr);
442 
443  fputs("\nMapping r_to_llv from a reference to a list of local variables:\n",
444  fd);
445  HASH_MAP(r, llv,
446  { list llvl=(list) llv;
447  fprint_reference(fd, (reference) r);
448  fputs("\t->\t",fd);
449  for(; !ENDP(llvl); POP(llvl)) {
450  entity lv = ENTITY(CAR(llvl));
451  fputs(entity_local_name(lv), fd);
452  if(ENDP(CDR(llvl)))
453  (void) putc(' ', fd);
454  else
455  (void) putc(',', fd);
456  }
457  (void) putc('\n', fd);
458  },
459  r_to_llv);
460 
461  fputs("\nMapping v_to_lllv from variables to lists of lists of local variables:\n",
462  fd);
463  HASH_MAP(v, lllv,
464  { list lllvl=(list)lllv;
465  (void) fprintf(fd,"%s\t->\t", entity_name((entity) v));
466  for(; !ENDP(lllvl); POP(lllvl)) {
467  list llv = LIST(CAR(lllvl));
468  (void) putc('(',fd);
469  for(; !ENDP(llv); POP(llv)) {
470  fputs(entity_local_name(ENTITY(CAR(llv))), fd);
471  if(ENDP(CDR(llv)))
472  (void) putc(')', fd);
473  else
474  (void) putc(',', fd);
475  }
476  if(ENDP(CDR(lllvl)))
477  (void) putc('\n', fd);
478  else
479  (void) putc(',',fd);
480  }
481  },
482  v_to_lllv);
483 
484 
485  fputs("\nMapping r_to_ud from references to use-def:\n", fd);
486  HASH_MAP(r, use_def,
487  {
488  fprint_reference(fd, (reference) r);
489  fputs("\t->\t",fd);
490  fputs(((intptr_t) use_def == (intptr_t)is_action_read) ? "use\n" : "def\n", fd);
491  },
492  r_to_ud);
493 
494 
495  fputs("\nMapping v_to_esv from variables to emulated shared variables:\n",
496  fd);
497  HASH_MAP(v, esv,
498  {
499  (void) fprintf(fd,"%s\t->\t", entity_name((entity) v));
500  (void) fprintf(fd,"%s\n", entity_name((entity) esv));
501  },
502  v_to_esv);
503 
504  (void) putc('\n', fd);
505 }
@ is_action_read
Definition: effects.h:292
#define LIST(x)
Definition: genC.h:93
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#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
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
struct cons * list
Definition: newgen_types.h:106
void fprint_reference(FILE *fd, reference r)
Definition: expression.c:128
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 REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_name(x)
Definition: ri.h:2790
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define intptr_t
Definition: stdint.in.h:294
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References CAR, CDR, ENDP, ENTITY, entity_local_name(), entity_name, fprint_reference(), fprintf(), HASH_MAP, intptr_t, is_action_read, LIST, POP, and REFERENCE.

Referenced by loop_nest_to_wp65_code().

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

◆ MakeEntityFunction()

entity MakeEntityFunction ( string  sname)
Parameters
snamename

Definition at line 101 of file wp65.c.

102 {
104  return f;
105 }
language make_language_unknown(void)
Definition: ri.c:1259
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
entity make_empty_function(const char *name, type r, language l)
Definition: entity.c:283
type MakeIntegerResult(void)
Definition: type.c:276

References f(), make_empty_function(), make_language_unknown(), and MakeIntegerResult().

Referenced by module_to_wp65_modules().

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

◆ module_to_wp65_modules()

void module_to_wp65_modules ( entity  module,
statement  module_code,
graph  dg,
int  pn,
int  bn,
int  ls,
int  pd,
entity pcompute_module,
statement pcomputational,
entity pmemory_module,
statement pemulator 
)

variable to emulated shared variable

To establish an occurence numbering accross loop nests

Generate two new modules, compute module and memory module

Generate scalar variables that are going to be used all over the compute and memory module

variables related to bank emulation are put together in one basis to decrease the number of parameters; they are used as such when liner systems of constraints are built

skip a potential useless unstructured

generate code for each loop nest in the module and append it to computational and emulator

kill_statement_number_and_ordering(computational); kill_statement_number_and_ordering(emulator);

return results

Parameters
moduleodule
module_codeodule_code
dgg
pndependence graph
bnprocessor_number
lsbank number
pdline size
pcompute_modulepipeline depth
pcomputationalcomputational
pmemory_modulememory_module
pemulatoremulator

Definition at line 202 of file wp65.c.

217 {
218  string compute_module_name;
219  string memory_module_name;
221  list l = list_undefined;
222  entity proc_id = entity_undefined;
223  entity proc_id_mm = entity_undefined;
224  entity bank_id = entity_undefined;
225  entity bank_line = entity_undefined;
226  entity bank_offset = entity_undefined;
227  Pbase bank_indices = BASE_NULLE;
229 
230  /* variable to emulated shared variable */
232  /* To establish an occurence numbering accross loop nests */
233  hash_table v_to_nlv = hash_table_make(hash_pointer, 0);
234 
235  entity compute_module;
236  statement computational;
237  entity memory_module;
238  statement emulator;
241  entity div;
242 
243  debug(6,"module_to_wp65_modules","begin\n");
244 
245  /* Generate two new modules, compute module and memory module
246  */
247  compute_module_name = strdup(COMPUTE_ENGINE_NAME);
248  compute_module = make_empty_subroutine(compute_module_name,copy_language(module_language(module)));
249 
250  module_functional_parameters(compute_module)
254  NIL);
255 
256  memory_module_name = strdup(BANK_NAME);
257  memory_module = make_empty_subroutine(memory_module_name,copy_language(module_language(module)));
258 
259  module_functional_parameters(memory_module)
260  = CONS(PARAMETER,
262  4), NIL),
265  NIL);
266  computational = make_block_statement(NIL);
267  emulator = make_block_statement(NIL);
268 
269  div =MakeEntityFunction("idiv");
270  AddEntityToDeclarations(div,compute_module);
271  AddEntityToDeclarations(div,memory_module);
272 
273 
274  /* Generate scalar variables that are going to be used all over
275  the compute and memory module
276  */
278  entity_local_name(memory_module));
279  AddEntityToDeclarations( proc_id_mm,memory_module);
280 
282  entity_local_name(compute_module));
284  make_formal(compute_module, 1));
285  AddEntityToDeclarations( proc_id,compute_module);
286 
288  entity_local_name(compute_module));
289  AddEntityToDeclarations( bank_id,compute_module);
290 
292  entity_local_name(memory_module));
294  make_formal(memory_module, 1));
295  AddEntityToDeclarations( bank_id,memory_module);
296 
298  entity_local_name(compute_module));
299  AddEntityToDeclarations( bank_line,compute_module);
300 
302  entity_local_name(memory_module));
303  AddEntityToDeclarations( bank_line,memory_module);
304 
306  entity_local_name(memory_module));
307  AddEntityToDeclarations( bank_offset,memory_module);
309  entity_local_name(compute_module));
310  AddEntityToDeclarations( bank_offset,compute_module);
311  /* variables related to bank emulation are put together in one basis
312  to decrease the number of parameters; they are used as such when
313  liner systems of constraints are built */
314  bank_indices =
316  (char*)
317  bank_offset),
318  (char *) bank_line),
319  (char *) bank_id);
320 
321  ifdebug(6) {
322  (void) fprintf(stderr,"Bank indices:\n");
323  vect_fprint(stderr, bank_indices, (string(*)(void*))entity_local_name);
324  (void) fprintf(stderr,"Code for the computational module:\n");
325  wp65_debug_print_module(compute_module,computational);
326  (void) fprintf(stderr,"Code for the memory module:\n");
327  wp65_debug_print_module(memory_module,emulator);
328  }
329 
330 
331  /* skip a potential useless unstructured */
332  i = statement_instruction(module_code);
337  }
338 
339  /* generate code for each loop nest in the module and append it
340  to computational and emulator */
341  l = instruction_block(i);
342 
343  compute_communications(l,&fetch_map,&store_map);
344 
346  pn, bn, ls, pd,
347  proc_id, proc_id_mm, bank_indices,
348  v_to_esv, v_to_nlv,
349  compute_module, computational,
350  memory_module, emulator, fetch_map,store_map);
351 
352  i = statement_instruction(computational);
354  CONS(STATEMENT,
355  make_return_statement(compute_module),
356  NIL));
357  i = statement_instruction(emulator);
359  CONS(STATEMENT,
360  make_return_statement(memory_module),
361  NIL));
362 
363 
364  fs = STATEMENT(CAR(instruction_block(statement_instruction(computational))));
365  statement_comments(fs) =
366  strdup(concatenate("\nC WP65 DISTRIBUTED CODE FOR ",
367  module_local_name(module), "\n",
369  ? NULL :statement_comments(fs)),
370  NULL));
371  module_reorder(fs);
373  statement_comments(fs) =
374  strdup(concatenate("\nC BANK DISTRIBUTED CODE FOR ",
375  module_local_name(module), "\n",
377  ? NULL :statement_comments(fs)),
378  NULL));
379  module_reorder(fs);
380  /* kill_statement_number_and_ordering(computational);
381  kill_statement_number_and_ordering(emulator);*/
382 
383 
384  ifdebug(1) {
385  (void) fprintf(stderr,"Final code for the computational module:\n");
386  wp65_debug_print_module(compute_module,computational);
387  (void) fprintf(stderr,"Final code for the memory module:\n");
388  wp65_debug_print_module(memory_module,emulator);
389  }
390 
391  hash_table_free(v_to_esv);
392  hash_table_free(v_to_nlv);
393 
394  /* return results */
395  * pcompute_module = compute_module;
396  * pcomputational = computational;
397  * pmemory_module = memory_module;
398  * pemulator = emulator;
399 
400  debug(6,"module_to_wp65_modules","end\n");
401 
402 }
parameter make_parameter(type a1, mode a2, dummy a3)
Definition: ri.c:1495
mode make_mode(enum mode_utype tag, void *val)
Definition: ri.c:1350
storage make_storage(enum storage_utype tag, void *val)
Definition: ri.c:2273
basic make_basic_int(intptr_t _field_)
Definition: ri.c:158
language copy_language(language p)
LANGUAGE.
Definition: ri.c:1202
dummy make_dummy_unknown(void)
Definition: ri.c:617
formal make_formal(entity a1, intptr_t a2)
Definition: ri.c:1067
Pbase vect_add_variable(Pbase b, Variable v)
package vecteur - routines sur les bases
Definition: base.c:61
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
void compute_communications(list l, statement_mapping *fetch_map, statement_mapping *store_map)
This function associates to each variable the statement in l where it should be communicated Fecth_ma...
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
#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
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
statement make_return_statement(entity)
Definition: statement.c:779
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
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 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
void wp65_debug_print_module(entity m, statement s)
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
@ hash_pointer
Definition: newgen_hash.h:32
#define string_undefined_p(s)
Definition: newgen_types.h:41
#define UU
Definition: newgen_types.h:98
static char * module
Definition: pips.c:74
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define module_language(e)
implemented as a macro to allow lhs
#define instruction_block(i)
#define module_functional_parameters(func)
entity make_empty_subroutine(const char *name, language l)
Definition: entity.c:268
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
void AddEntityToDeclarations(entity, entity)
END_EOLE.
Definition: variable.c:108
entity make_scalar_integer_entity(const char *, const char *)
Create an integer variable of name "name" in module of name "module_name".
Definition: variable.c:1068
type MakeTypeVariable(basic, cons *)
BEGIN_EOLE.
Definition: type.c:116
@ is_mode_reference
Definition: ri.h:1676
#define entity_storage(x)
Definition: ri.h:2794
#define instruction_undefined
Definition: ri.h:1454
@ is_storage_formal
Definition: ri.h:2493
#define entity_undefined
Definition: ri.h:2761
#define PARAMETER(x)
PARAMETER.
Definition: ri.h:1788
#define instruction_unstructured_p(x)
Definition: ri.h:1530
#define statement_instruction(x)
Definition: ri.h:2458
#define statement_comments(x)
Definition: ri.h:2456
#define control_statement(x)
Definition: ri.h:941
#define instruction_unstructured(x)
Definition: ri.h:1532
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
char * strdup()
#define ifdebug(n)
Definition: sg.c:47
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
#define BASE_NULLE
MACROS SUR LES BASES.
#define BANK_IDENTIFIER
Definition: wp65-local.h:42
#define BANK_NAME
#define WP65_SUFFIX "_WP65"
Definition: wp65-local.h:39
#define COMPUTE_ENGINE_NAME
Definition: wp65-local.h:37
#define BANK_LINE_IDENTIFIER
Definition: wp65-local.h:43
#define PROCESSOR_IDENTIFIER
#define MEMORY_EMULATOR_SUFFIX "_BANK"
Definition: wp65-local.h:41
#define BANK_OFFSET_IDENTIFIER
Definition: wp65-local.h:44
entity MakeEntityFunction(string sname)
Definition: wp65.c:101

References AddEntityToDeclarations(), BANK_IDENTIFIER, BANK_LINE_IDENTIFIER, BANK_NAME, BANK_OFFSET_IDENTIFIER, BASE_NULLE, CAR, compute_communications(), COMPUTE_ENGINE_NAME, concatenate(), CONS, control_statement, copy_language(), debug(), dg, entity_local_name(), entity_storage, entity_undefined, fprintf(), gen_nconc(), hash_pointer, hash_table_free(), hash_table_make(), ifdebug, instruction_block, instruction_to_wp65_code(), instruction_undefined, instruction_unstructured, instruction_unstructured_p, is_mode_reference, is_storage_formal, list_undefined, make_basic_int(), make_block_statement(), make_dummy_unknown(), make_empty_subroutine(), make_formal(), make_mode(), make_parameter(), make_return_statement(), make_scalar_integer_entity(), MAKE_STATEMENT_MAPPING, make_storage(), MakeEntityFunction(), MakeTypeVariable(), module, module_functional_parameters, module_language, module_local_name(), module_reorder(), NIL, PARAMETER, PROCESSOR_IDENTIFIER, STATEMENT, statement_comments, statement_instruction, statement_undefined, strdup(), string_undefined_p, unstructured_control, UU, vect_add_variable(), vect_fprint(), and wp65_debug_print_module().

Referenced by wp65().

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

◆ translate_unary_into_binary_ref()

static void translate_unary_into_binary_ref ( statement  stat)
static

Definition at line 88 of file wp65.c.

89 {
91  ifdebug(8) {
93  fprintf(stderr,"statement without unary references \n");
95  }
96 
97 }
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
void wp65_debug_print_text(entity m, statement s)
include "values.h"
#define reference_domain
newgen_range_domain_defined
Definition: ri.h:338
static void unary_into_binary_ref(reference ref)
Definition: wp65.c:78

References fprintf(), gen_recurse, gen_true(), get_current_module_entity(), ifdebug, module, reference_domain, unary_into_binary_ref(), and wp65_debug_print_text().

Referenced by wp65().

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

◆ unary_into_binary_ref()

static void unary_into_binary_ref ( reference  ref)
static

Definition at line 78 of file wp65.c.

79 {
80  list lt;
81  if (gen_length((lt = reference_indices(ref))) ==1) {
82  expression expr = int_to_expression(1);
84  CONS(EXPRESSION,expr,NIL));
85  }
86 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
size_t gen_length(const list l)
Definition: list.c:150
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 EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define reference_indices(x)
Definition: ri.h:2328

References CAR, CONS, EXPRESSION, gen_length(), int_to_expression(), NIL, ref, and reference_indices.

Referenced by translate_unary_into_binary_ref().

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

◆ wp65()

bool wp65 ( const string  input_module_name)

Let's modify the old code instead of copy it but do not tell pipsdbm; else we would get a copy of the code, not consistent with the dependence graph

fprintf(stderr,"refs du code\n"); debug_refs(s); fprintf(stderr,"refs du dg\n"); debug_refs(dg);

fprintf(stderr,"refs du code\n"); debug_refs(s); fprintf(stderr,"refs du dg\n"); debug_refs(dg);

Put final code for the computational module in a text resource of the database

Put final code for the memory module in a text resource of the database

reset_current_module_statement();

Parameters
input_module_namenput_module_name

Definition at line 128 of file wp65.c.

129 {
130  entity module = module_name_to_entity(input_module_name);
131  /* Let's modify the old code instead of copy it but do not tell
132  pipsdbm; else we would get a *copy* of the code, not consistent
133  with the dependence graph */
134  statement s;
135  entity compute_module = entity_undefined;
136  statement computational = statement_undefined;
137  entity memory_module = entity_undefined;
138  statement emulator = statement_undefined;
139  int pn, bn, ls, pd = PIPELINE_DEPTH;
140  graph dg;
141  string ppp;
142 
143  s = (statement) db_get_memory_resource(DBR_CODE, input_module_name,true);
144  dg = (graph) db_get_memory_resource(DBR_DG, input_module_name, true);
146  debug_on("WP65_DEBUG_LEVEL");
147  debug(8, "wp65", "begin\n");
148 
149  get_model(&pn, &bn, &ls);
150  ifdebug(1) model_fprint(stderr, pn, bn ,ls);
151 
152  regions_init();
156 
157  /* fprintf(stderr,"refs du code\n"); debug_refs(s);
158  fprintf(stderr,"refs du dg\n"); debug_refs(dg); */
159 
161 
162  /* fprintf(stderr,"refs du code\n"); debug_refs(s);
163  fprintf(stderr,"refs du dg\n"); debug_refs(dg); */
164 
166  pn, bn, ls, pd,
167  &compute_module, &computational,
168  &memory_module, &emulator);
169 
170  (void) variable_declaration_coherency_p(compute_module,computational);
171  (void) variable_declaration_coherency_p(memory_module,emulator);
172 
173 
174  /* Put final code for the computational module in a text resource
175  of the database */
177  make_text_resource(input_module_name,
178  DBR_WP65_COMPUTE_FILE,
179  WP65_COMPUTE_EXT,
180  text_module(compute_module,computational));
182 
183  /* Put final code for the memory module in a text resource
184  of the database */
185  make_text_resource(input_module_name,
186  DBR_WP65_BANK_FILE,
187  WP65_BANK_EXT,
188  text_module(memory_module,emulator));
189 
190  debug(8, "wp65", "end\n");
191 
192  /* reset_current_module_statement(); */
196  debug_off();
197 
198 return true;
199 
200 }
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void regions_init(void)
char * get_string_property(const char *)
void free(void *)
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
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
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
char end
Definition: gtk_status.c:82
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
void get_model(int *ppn, int *pbn, int *pls)
Definition: model.c:71
void model_fprint(FILE *fd, int pn, int bn, int ls)
Code Generation for Distributed Memory Machines.
Definition: model.c:50
#define true
Definition: newgen_types.h:81
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
text empty_text(entity __attribute__((unused)) e, int __attribute__((unused)) m, statement __attribute__((unused)) s)
Definition: misc.c:219
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
Definition: misc.c:242
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
Definition: misc.c:231
text text_module(entity, statement)
bool make_text_resource(const char *, const char *, const char *, text)
print.c
Definition: print.c:55
#define PRETTYPRINT_PARALLEL
void set_string_property(const char *, const char *)
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
bool variable_declaration_coherency_p(entity module, statement st)
Definition: module.c:203
return(s1)
#define PIPELINE_DEPTH
These values should be read in model.rc (FI, 20/11/91) #define PROCESSOR_NUMBER 4 #define BANK_NUMBER...
Definition: wp65-local.h:58
void module_to_wp65_modules(entity module, statement module_code, graph dg, int pn, int bn, int ls, int pd, entity *pcompute_module, statement *pcomputational, entity *pmemory_module, statement *pemulator)
Definition: wp65.c:202
static void translate_unary_into_binary_ref(statement stat)
Definition: wp65.c:88
bool wp65(const string input_module_name)
Definition: wp65.c:128

References close_prettyprint(), db_get_memory_resource(), debug(), debug_off, debug_on, dg, empty_text(), entity_undefined, free(), get_model(), get_string_property(), ifdebug, init_prettyprint(), make_text_resource(), model_fprint(), module, module_name_to_entity(), module_to_wp65_modules(), PIPELINE_DEPTH, PRETTYPRINT_PARALLEL, regions_init(), reset_current_module_entity(), reset_ordering_to_statement(), set_current_module_entity(), set_ordering_to_statement(), set_string_property(), statement_undefined, strdup(), text_module(), translate_unary_into_binary_ref(), and variable_declaration_coherency_p().

+ Here is the call graph for this function:

◆ wp65_conform_p()

bool wp65_conform_p ( statement  s)

there should be only one instruction: do not put a STOP in the source file

Definition at line 508 of file wp65.c.

509 {
511 
513  /* there should be only one instruction: do not put a STOP in the
514  source file */
517  if(control_predecessors(c) == NIL && control_successors(c) == NIL) {
519  }
520  else {
521  debug(1,"wp65_conform_p",
522  "program body is an unstructured with at least two nodes\n");
523  return false;
524  }
525  }
526 
527  if(!instruction_block_p(i)) {
528  debug(1,"wp65_conform_p","program body is not a block\n");
529  return false;
530  }
531  else {
532  list ls = instruction_block(i);
533  MAPL(pm,{
534  statement s1 = STATEMENT(CAR(pm));
537  debug(1,"wp65_conform_p",
538  "program body contains a non-perfectly nested loop\n");
539  return false;
540  }
541  }
542  },ls);
543  }
544  return true;
545 }
bool perfectly_nested_loop_p(statement stat)
Test if a statement is a perfect loop-nest.
Definition: loop.c:543
#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
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
Definition: statement.c:172
bool stop_statement_p(statement)
Test if a statement is a Fortran STOP.
Definition: statement.c:263
bool assignment_statement_p(statement)
Test if a statement is an assignment.
Definition: statement.c:135
#define instruction_block_p(i)
#define control_predecessors(x)
Definition: ri.h:943
#define control_successors(x)
Definition: ri.h:945
s1
Definition: set.c:247

References assignment_statement_p(), CAR, control_predecessors, control_statement, control_successors, debug(), instruction_block, instruction_block_p, instruction_unstructured, instruction_unstructured_p, MAPL, NIL, perfectly_nested_loop_p(), return_statement_p(), s1, STATEMENT, statement_instruction, stop_statement_p(), and unstructured_control.

+ Here is the call graph for this function: