PIPS
make_loop_body.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "constants.h"
#include "matrice.h"
#include "tiling.h"
#include "movements.h"
#include "misc.h"
#include "text-util.h"
#include "parser_private.h"
#include "polyedre.h"
#include "prettyprint.h"
+ Include dependency graph for make_loop_body.c:

Go to the source code of this file.

Functions

void wp65_debug_print_text (entity m, statement s)
 include "values.h" More...
 
void wp65_debug_print_module (entity m, statement s)
 
bool variable_in_declaration_module_p (entity m, entity v)
 
static entity find_entity (entity module, Pvecteur pv, string st)
 
entity find_operator (entity module, string oper, string str)
 
statement make_statement_operator (entity oper, cons *args)
 
statement make_movements_loop_body_wp65 (entity module, bool receive_code, entity ent, Pbase local_indices, Pbase var_id, Psysteme sc_neg, Psysteme sc_pos, Pbase index_base, int rank, int number_of_lower_bounds, int number_of_upper_bounds)
 statement make_movements_loop_body_wp65(module,receive_code, ent,local_indices,var_id, sc_neg,sc_pos,index_base,rank, number_of_lower_bounds, number_of_upper_bounds) More...
 
statement make_datum_movement (entity module, bool receive_code, entity ent, Pbase local_indices, Pbase var_id)
 statement make_datum_movement(module,receive_code,ent, local_indices,var_id) More...
 
statement make_movement_scalar_wp65 (entity module, bool receive_code, reference r, entity var_id)
 statement make_movement_scalar_wp65(receive_code,r) More...
 

Variables

Value offset_dim1
 include "generation.h" More...
 
Value offset_dim2
 

Function Documentation

◆ find_entity()

static entity find_entity ( entity  module,
Pvecteur  pv,
string  st 
)
static

Definition at line 94 of file make_loop_body.c.

95 {
96  entity new_ind;
97  string name;
98  new_ind=gen_find_tabulated(
102  st, (char *) NULL),
103  entity_domain);
104 
105  if (new_ind == entity_undefined) {
107  st, NULL));
110  free(name);
111  }
112  return(new_ind);
113 }
void free(void *)
#define MODULE_SEP_STRING
Definition: naming-local.h:30
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
static char * module
Definition: pips.c:74
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
void 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
#define entity_undefined
Definition: ri.h:2761
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
char * strdup()
#define vecteur_var(v)

References AddEntityToDeclarations(), concatenate(), entity_domain, entity_local_name(), entity_undefined, free(), gen_find_tabulated(), make_scalar_integer_entity(), module, MODULE_SEP_STRING, strdup(), and vecteur_var.

Referenced by make_movements_loop_body_wp65().

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

◆ find_operator()

entity find_operator ( entity  module,
string  oper,
string  str 
)
Parameters
moduleodule
operper
strtr

Definition at line 117 of file make_loop_body.c.

118 {
119  entity operator;
120  string name = concatenate(TOP_LEVEL_MODULE_NAME,
123  "_",oper, "_",str,NULL);
124 
125  if ((operator = gen_find_tabulated(name, entity_domain))
126  == entity_undefined)
127  operator=make_entity(strdup(name),
131  UU))),
134  return(operator);
135 }
functional make_functional(list a1, type a2)
Definition: ri.c:1109
storage make_storage_rom(void)
Definition: ri.c:2285
value make_value(enum value_utype tag, void *val)
Definition: ri.c:2832
type make_type(enum type_utype tag, void *val)
Definition: ri.c:2706
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
#define UU
Definition: newgen_types.h:98
#define make_entity(n, t, s, i)
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
@ is_value_unknown
Definition: ri.h:3035
@ is_type_void
Definition: ri.h:2904
@ is_type_functional
Definition: ri.h:2901

References concatenate(), entity_domain, entity_undefined, gen_find_tabulated(), is_type_functional, is_type_void, is_value_unknown, make_entity, make_functional(), make_storage_rom(), make_type(), make_value(), module, module_local_name(), MODULE_SEP_STRING, NIL, strdup(), TOP_LEVEL_MODULE_NAME, and UU.

Referenced by make_datum_movement(), make_movement_scalar_wp65(), and make_movements_loop_body_wp65().

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

◆ make_datum_movement()

statement make_datum_movement ( entity  module,
bool  receive_code,
entity  ent,
Pbase  local_indices,
Pbase  var_id 
)

statement make_datum_movement(module,receive_code,ent, local_indices,var_id)

This function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

BANK_/WP65_ send/receive_nb_bytes(ES_A,O,1,L,Prod_id) ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

BANK_/WP65_send/receive_nb_bytes(L_A,LI,1,LJ,Bank_id)

L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices corresponds to the Pvecteur belonging Prod_id if bank_code and Bank_id otherwise

build the list of expressions : Prod_id,ES_A(L,O),1 for bank case and Bank_id,L_A(LJ,LI),1 for engine case

generate the send or the receive call

Parameters
moduleodule
receive_codeeceive_code
entThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

BANK_/WP65_ send/receive_nb_bytes(ES_A,O,1,L,Prod_id) ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

BANK_/WP65_send/receive_nb_bytes(L_A,LI,1,LJ,Bank_id)

L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices is true if the code is generated for receive

Parameters
local_indicesThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

BANK_/WP65_ send/receive_nb_bytes(ES_A,O,1,L,Prod_id) ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

BANK_/WP65_send/receive_nb_bytes(L_A,LI,1,LJ,Bank_id)

L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices corresponds to the shared entiy if bank_code and to the local entity otherwise

Parameters
var_idThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

BANK_/WP65_ send/receive_nb_bytes(ES_A,O,1,L,Prod_id) ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

BANK_/WP65_send/receive_nb_bytes(L_A,LI,1,LJ,Bank_id)

L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices correspond to O,L if bank_code and to LJ,LI otherwise

Definition at line 401 of file make_loop_body.c.

410 {
411 
412  expression exp_ent;
413  statement lbody;
414  Pvecteur ofs = local_indices;
415  Pvecteur pvt =VECTEUR_NUL;
416  entity operator_receive,operator_send;
417  cons * args, * args2;
418  type tp = entity_type(ent);
419  int nb_bytes = 0;
420  char *str1;
421  debug_on("MOVEMENT_DEBUG_LEVEL");
422  debug(8,"make_datum_movement","begin\n");
423 
424  if (type_variable_p(tp)) {
425  variable var = type_variable(tp);
426  basic b = variable_basic(var);
427  nb_bytes = SizeOfElements(b);
428  }
429 
430  str1=int2a(nb_bytes);
431  operator_receive = find_operator(module, "RECEIVE",str1);
432  operator_send = find_operator(module,"SEND",str1);
433  free(str1);
434 
435  /* build the list of expressions :
436  Prod_id,ES_A(L,O),1 for bank case and
437  Bank_id,L_A(LJ,LI),1 for engine case
438  */
439 
441  pvt =(!VECTEUR_NUL_P(ofs->succ)) ?
445 
447  pvt =vect_new(vecteur_var(ofs),VALUE_ONE);
450  args2);
451 
453  make_reference(ent,
454  args2
455  )),
457 
458  args = CONS(EXPRESSION,exp_ent,args);
459  args = CONS(EXPRESSION,make_vecteur_expression(vect_dup(var_id)),args);
460  /* generate the send or the receive call */
461 
462  lbody = (receive_code) ?
463  make_statement_operator(operator_receive,args):
464  make_statement_operator(operator_send,args);
465 
466  debug(8,"make_datum_movement","end\n");
467  debug_off();
468  return (lbody);
469 
470 }
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
#define VALUE_ONE
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
Value offset_dim1
include "generation.h"
Definition: code.c:67
statement make_statement_operator(entity oper, cons *args)
entity find_operator(entity module, string oper, string str)
Value offset_dim2
Definition: code.c:68
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
Definition: expression.c:1650
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
_int SizeOfElements(basic)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
Definition: size.c:297
#define normalized_undefined
Definition: ri.h:1745
#define type_variable(x)
Definition: ri.h:2949
@ is_syntax_reference
Definition: ri.h:2691
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_type(x)
Definition: ri.h:2792
#define type_variable_p(x)
Definition: ri.h:2947
#define variable_basic(x)
Definition: ri.h:3120
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
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
char * int2a(int)
util.c
Definition: util.c:42
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define VECTEUR_NUL_P(v)
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
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53
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 CONS, debug(), debug_off, debug_on, entity_type, EXPRESSION, find_operator(), free(), int2a(), int_to_expression(), is_syntax_reference, make_expression(), make_reference(), make_statement_operator(), make_syntax(), make_vecteur_expression(), module, NIL, normalized_undefined, offset_dim1, offset_dim2, SizeOfElements(), Svecteur::succ, TCST, type_variable, type_variable_p, VALUE_ONE, variable_basic, vect_add(), vect_add_elem(), vect_dup(), vect_new(), VECTEUR_NUL, VECTEUR_NUL_P, and vecteur_var.

Referenced by bound_generation().

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

◆ make_movement_scalar_wp65()

statement make_movement_scalar_wp65 ( entity  module,
bool  receive_code,
reference  r,
entity  var_id 
)

statement make_movement_scalar_wp65(receive_code,r)

This function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

call BANK_/WP65_send/receive_nb_bytes(S)

In the case of engine code generation the loop body must be :

call BANK_/WP65_send/receive_nb_bytes(S)

where nb_bytes is the number of bytes needed for the variable location

nb_bytes is the number of bytes needed for the variable location

build the expression : S

args = CONS(EXPRESSION,int_expr(nb_bytes),NIL);

generate the send or the receive call

Parameters
moduleodule
receive_codeeceive_code
rThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
call BANK_/WP65_send/receive_nb_bytes(S)
In the case of engine code generation the loop body must be :
call BANK_/WP65_send/receive_nb_bytes(S)
where nb_bytes is the number of bytes needed for the variable location is true if the code is generated for receive
var_idThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
call BANK_/WP65_send/receive_nb_bytes(S)
In the case of engine code generation the loop body must be :
call BANK_/WP65_send/receive_nb_bytes(S)
where nb_bytes is the number of bytes needed for the variable location corresponds to scalaire entity

Definition at line 485 of file make_loop_body.c.

490 {
491 
492  statement lbody;
493  cons * args;
494  expression expr;
495  list lexp1;
496  entity
497  operator_receive, operator_send,
498  var = reference_variable(r);
499  type t;
500  int nb_bytes=4; /* nb_bytes is the number of bytes
501  needed for the variable location */
502  basic bas;
503  char *str1;
504 
505  debug_on("MOVEMENT_DEBUG_LEVEL");
506  pips_debug(8, "begin\n");
507  pips_debug(8, "considering %s\n", entity_local_name(var));
508 
509  t = entity_type(var);
510 
511  if (type_variable_p(t)) {
512  variable var = type_variable(t);
513  bas = variable_basic(var);
514  nb_bytes = SizeOfElements(bas);
515  }
516  str1=int2a(nb_bytes);
517  operator_receive = find_operator(module, "RECEIVE",str1);
518  operator_send = find_operator(module,"SEND",str1);
519  free(str1);
520 
521  /* build the expression : S */
522  /* args = CONS(EXPRESSION,int_expr(nb_bytes),NIL);*/
523 
527  args = CONS(EXPRESSION,expr,lexp1);
528  args = CONS(EXPRESSION,
530  VALUE_ONE)),args);
531  /* generate the send or the receive call */
532 
533  lbody = (receive_code) ?
534  make_statement_operator(operator_receive,args):
535  make_statement_operator(operator_send,args);
536  ifdebug(9) {
537  pips_debug(9, "returning :\n");
539  }
540 
541  pips_debug(8,"end\n");
542  debug_off();
543  return (lbody);
544 
545 }
void wp65_debug_print_text(entity m, statement s)
include "values.h"
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define reference_variable(x)
Definition: ri.h:2326
#define ifdebug(n)
Definition: sg.c:47
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60

References CONS, debug_off, debug_on, entity_local_name(), entity_type, entity_undefined, EXPRESSION, find_operator(), free(), ifdebug, int2a(), int_to_expression(), is_syntax_reference, make_expression(), make_statement_operator(), make_syntax(), make_vecteur_expression(), module, NIL, normalized_undefined, pips_debug, reference_variable, SizeOfElements(), type_variable, type_variable_p, VALUE_ONE, variable_basic, vect_new(), and wp65_debug_print_text().

Referenced by constant_symbolic_communication(), make_load_blocks(), and make_store_blocks().

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

◆ make_movements_loop_body_wp65()

statement make_movements_loop_body_wp65 ( entity  module,
bool  receive_code,
entity  ent,
Pbase  local_indices,
Pbase  var_id,
Psysteme  sc_neg,
Psysteme  sc_pos,
Pbase  index_base,
int  rank,
int  number_of_lower_bounds,
int  number_of_upper_bounds 
)

statement make_movements_loop_body_wp65(module,receive_code, ent,local_indices,var_id, sc_neg,sc_pos,index_base,rank, number_of_lower_bounds, number_of_upper_bounds)

This function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)

ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices

create the new indices new_ind1 et new_ind2 corresponding to LI1 et LI2 when the code is generated for engines and O1 et O2 when code is generated for banks vecteur_var(ofs) is respectivly LI or O

build the expression new_ind2 - new_ind1+1

build the list of expressions : Prod_id,ES_A(L,O1),O2-O1+1 for bank case and Bank_id,L_A(LJ,LI1),LI2-LI1+1 for engine case

generate the send or the receive call

build the test around stat

if (pmin == INT_MIN || pmax == INT_MAX || pmax > pmin) {

}

build the whole code:

O1 = ..... O2 = ..... IF (O1.LE.O2) THEN BANK_/WP65_send/receive(Prod_id,ES_A(L,O1),O2-O1+1) for bank case or: LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive(Bank_id,L_A(LJ,LI1),LI2-LI1+1) for engine case

Parameters
moduleodule
receive_codeeceive_code
entThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)
ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices is true if the code is generated for receive

Parameters
local_indicesThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)
ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices corresponds to the shared entiy if bank_code and to the local entity otherwise

Parameters
var_idThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)
ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices correspond to O,L if bank_code and to LI,LJ otherwise

Parameters
sc_negThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)
ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices corresponds to the Pvecteur belonging Prod_id if bank_code and Bank_id otherwise

Parameters
sc_posc_pos
index_basendex_base
rankank
number_of_lower_boundsumber_of_lower_bounds
number_of_upper_boundsumber_of_upper_bounds

Definition at line 182 of file make_loop_body.c.

195 {
196  expression lower_bound,upper_bound;
197  expression expr_ind1,expr_ind2,expr,expr2,exp_ent,expr_cond;
198  entity new_ind1,new_ind2, mod;
199  entity operator_assign,operator_minus,operator_plus,operator_le,
200  operator_receive,operator_send;
201  string lower_or_equal;
202  statement stat,stat1,stat2,lbody;
203  Pvecteur pvt,ofs = local_indices;
204  type tp = entity_type(ent);
205  Value pmin,pmax;
206  int nb_bytes = 0;
207  text t;
208  test test1;
209  cons * args, * args2, * lex2, * lex3;
210  char *str1;
211  Psysteme sctmp=NULL;
212  debug_on("MOVEMENT_DEBUG_LEVEL");
213  debug(8,"make_movements_loop_body_wp65","begin\n");
214 
215  operator_assign=
218  entity_domain);
219 
220  operator_minus=
223  entity_domain);
224  operator_plus=
227  entity_domain);
228 
229  if (type_variable_p(tp)) {
230  variable var = type_variable(tp);
231  basic b = variable_basic(var);
232  nb_bytes = SizeOfElements(b);
233  }
234 
235  str1=int2a(nb_bytes);
236  operator_receive = find_operator(module, "RECEIVE",str1);
237  operator_send = find_operator(module,"SEND",str1);
238  free(str1);
239 
240  ofs = local_indices;
241 
242  /* create the new indices new_ind1 et new_ind2 corresponding to
243  LI1 et LI2 when the code is generated for engines
244  and O1 et O2 when code is generated for banks
245  vecteur_var(ofs) is respectivly LI or O */
246 
247 
248 
250  expr_ind1 = make_vecteur_expression(vect_new((char *) new_ind1,
251  vecteur_val(ofs)));
252 
254  expr_ind2 = make_vecteur_expression(vect_new((char *) new_ind2,
255  vecteur_val(ofs)));
256 
257  /* build the expression new_ind2 - new_ind1+1 */
258 
259  lex2 = CONS(EXPRESSION,expr_ind1,NIL);
260  expr = make_op_expression(operator_minus,
261  CONS(EXPRESSION,expr_ind2,lex2));
262 
264  expr2 = make_op_expression(operator_plus,
265  CONS(EXPRESSION,expr,lex2));
266 
267  /* build the list of expressions :
268  Prod_id,ES_A(L,O1),O2-O1+1 for bank case and
269  Bank_id,L_A(LJ,LI1),LI2-LI1+1 for engine case
270 
271  */
272 
273  args = CONS(EXPRESSION,expr2,NIL);;
274  pvt =vect_new((char *) new_ind1, vecteur_val(ofs));
276 
277  expr_ind1 = make_vecteur_expression(pvt);
278 
279  pvt =(!VECTEUR_NUL_P(ofs->succ)) ?
283  args2 = CONS(EXPRESSION,
285  NIL);
286  args2 = CONS(EXPRESSION,expr_ind1,args2);
288  make_reference(ent,
289  args2
290  )),
292  args = CONS(EXPRESSION,exp_ent,args);
293  args = CONS(EXPRESSION,make_vecteur_expression(vect_dup(var_id)),args);
294 
295  /* generate the send or the receive call */
296 
297  stat =(receive_code) ? make_statement_operator(operator_receive,args)
298  : make_statement_operator(operator_send,args);
299 
300  /* build the test around stat */
301 
302  sctmp = sc_dup(sc_pos);
303  sctmp = sc_append(sctmp,sc_neg);
304 
305 
306  (void)sc_minmax_of_variable(sctmp, vecteur_var(ofs), &pmin, &pmax);
307  ifdebug(4) {
308  fprint_string_Value(stderr, "borne min ", pmin);
309  fprint_string_Value(stderr, ", borne sup ", pmax);
310  fprintf(stderr,"\n");
311  }
312  /* if (pmin == INT_MIN || pmax == INT_MAX || pmax > pmin) { */
314 
315  expr_ind1 = make_vecteur_expression(vect_new((char *) new_ind1,
316  vecteur_val(ofs)));
317 
319  expr_ind2 = make_vecteur_expression(vect_new((char *) new_ind2,
320  vecteur_val(ofs)));
321 
322 
323  lower_or_equal = concatenate(TOP_LEVEL_MODULE_NAME,
324  MODULE_SEP_STRING,".LE.", NULL);
325 
326  if ((operator_le =
327  gen_find_tabulated(lower_or_equal, entity_domain))
328  == entity_undefined)
330  lower_or_equal);
331  expr_cond = MakeBinaryCall(operator_le,expr_ind1,expr_ind2);
332 
333  test1 = make_test(expr_cond,stat,make_continue_statement(entity_empty_label()));
334  stat = test_to_statement(test1);
335  /* }*/
336  /* build the whole code:
337 
338  O1 = .....
339  O2 = .....
340  IF (O1.LE.O2) THEN
341  BANK_/WP65_send/receive(Prod_id,ES_A(L,O1),O2-O1+1) for bank case
342  or:
343  LI1 = ....
344  LI2 = ....
345  IF (LI1.LE.LI2) THEN
346  BANK_/WP65_send/receive(Bank_id,L_A(LJ,LI1),LI2-LI1+1) for engine case */
347  expr_ind1 = make_vecteur_expression(vect_new((char *) new_ind1,
348  vecteur_val(ofs)));
349  expr_ind2 = make_vecteur_expression(vect_new((char *) new_ind2,
350  vecteur_val(ofs)));
351  lower_bound = lower_bound_generation(sc_neg,index_base,
352  number_of_lower_bounds,
353  rank);
354  lex2 = CONS(EXPRESSION,lower_bound,NIL);
355  stat1 = make_statement_operator(operator_assign,
356  CONS(EXPRESSION,expr_ind1,lex2));
357 
358  upper_bound = upper_bound_generation(sc_pos,index_base,
359  number_of_upper_bounds,
360  rank);
361 
362  lex2 = CONS(EXPRESSION,upper_bound,NIL);
363  stat2 = make_statement_operator(operator_assign,
364  CONS(EXPRESSION,expr_ind2,lex2));
365  lex2 = CONS(STATEMENT,stat,NIL);
366  lex3 = CONS(STATEMENT,stat2,lex2);
367 
368  lbody = make_block_statement(CONS(STATEMENT,stat1,lex3));
369  ifdebug(8) {
371  t = Text_Statement(mod, 2, lbody);
372  print_text(stderr,t);
373  }
374  debug(8,"make_movements_loop_body_wp65","end\n");
375  debug_off();
376 
377 
378  return (lbody);
379 
380 }
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
int Value
void fprint_string_Value(FILE *, char *, Value)
Definition: io.c:47
string make_entity_fullname(const char *module_name, const char *local_name)
END_EOLE.
Definition: entity_names.c:230
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
statement make_continue_statement(entity)
Definition: statement.c:953
static entity find_entity(entity module, Pvecteur pv, string st)
#define SUFFIX_FOR_TEMP_VAR2_IN_INNER_LOOP
#define SUFFIX_FOR_TEMP_VAR1_IN_INNER_LOOP
expression lower_bound_generation(Psysteme sc_neg, Pbase index_base, int number_of_lower_bounds, int loop_rank)
This fonction generates the lower bounds of the "loop_rank"-th loop.
expression upper_bound_generation(Psysteme sc_pos, Pbase index_base, int number_of_upper_bounds, int loop_rank)
This fonction generates the upper bounds of the "loop_rank"-th loop.
expression make_op_expression(entity, cons *)
Definition: operation.c:55
static entity rank
text Text_Statement(entity, int, statement)
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define test_to_statement(t)
#define ASSIGN_OPERATOR_NAME
Definition: ri-util-local.h:95
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
Definition: entity.c:1586
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
entity entity_empty_label(void)
Definition: entity.c:1105
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
bool sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, Value *pmax)
void sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour tr...
Definition: sc_eval.c:143
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
void print_text(FILE *fd, text t)
Definition: print.c:195
#define vecteur_val(v)

References ASSIGN_OPERATOR_NAME, concatenate(), CONS, debug(), debug_off, debug_on, entity_domain, entity_empty_label(), entity_local_name(), entity_type, entity_undefined, EXPRESSION, find_entity(), find_operator(), FindOrCreateEntity(), fprint_string_Value(), fprintf(), free(), gen_find_tabulated(), ifdebug, int2a(), int_to_expression(), is_syntax_reference, local_name_to_top_level_entity(), lower_bound_generation(), make_block_statement(), make_continue_statement(), make_entity_fullname(), make_expression(), make_op_expression(), make_reference(), make_statement_operator(), make_syntax(), make_test(), make_vecteur_expression(), MakeBinaryCall(), MINUS_OPERATOR_NAME, module, MODULE_SEP_STRING, NIL, normalized_undefined, offset_dim1, offset_dim2, PLUS_OPERATOR_NAME, print_text(), rank, sc_append(), sc_dup(), sc_minmax_of_variable(), SizeOfElements(), STATEMENT, Svecteur::succ, SUFFIX_FOR_TEMP_VAR1_IN_INNER_LOOP, SUFFIX_FOR_TEMP_VAR2_IN_INNER_LOOP, TCST, test_to_statement, Text_Statement(), TOP_LEVEL_MODULE_NAME, type_variable, type_variable_p, upper_bound_generation(), VALUE_ONE, variable_basic, vect_add(), vect_add_elem(), vect_dup(), vect_new(), VECTEUR_NUL_P, vecteur_val, and vecteur_var.

Referenced by bound_generation().

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

◆ make_statement_operator()

statement make_statement_operator ( entity  oper,
cons args 
)
Parameters
operper
argsrgs

Definition at line 138 of file make_loop_body.c.

139 {
145  make_call (oper, args)),
146  NIL,
147  NULL,
149 }
call make_call(entity a1, list a2)
Definition: ri.c:269
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
Definition: ri.c:2222
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
synchronization make_synchronization_none(void)
Definition: ri.c:2424
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define string_undefined
Definition: newgen_types.h:40
#define STATEMENT_NUMBER_UNDEFINED
default values
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
@ is_instruction_call
Definition: ri.h:1474

References empty_extensions(), entity_empty_label(), is_instruction_call, make_call(), make_instruction(), make_statement(), make_synchronization_none(), NIL, STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, and string_undefined.

Referenced by make_datum_movement(), make_movement_scalar_wp65(), and make_movements_loop_body_wp65().

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

◆ variable_in_declaration_module_p()

bool variable_in_declaration_module_p ( entity  m,
entity  v 
)

Definition at line 74 of file make_loop_body.c.

77 {
78  value val = entity_initial(m);
79  code c = value_code(val);
80  cons *d, *cp1;
81  d = code_declarations(c);
82 
83  if (d == NIL) return(false) ;
84  for (cp1 = d ; !ENDP(cp1) ; cp1 = CDR( cp1 )) {
85  if (strcmp(entity_local_name(ENTITY(CAR(cp1))),
86  entity_local_name(v)) == 0)
87  return(true);
88  }
89  return (false);
90 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#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 ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define code_declarations(x)
Definition: ri.h:784
#define value_code(x)
Definition: ri.h:3067
#define entity_initial(x)
Definition: ri.h:2796

References CAR, CDR, code_declarations, ENDP, ENTITY, entity_initial, entity_local_name(), NIL, and value_code.

+ Here is the call graph for this function:

◆ wp65_debug_print_module()

void wp65_debug_print_module ( entity  m,
statement  s 
)

Definition at line 61 of file make_loop_body.c.

62 {
63  debug_on("PRETTYPRINT_DEBUG_LEVEL");
64  text t = text_module(m, s);
65  print_text(stderr, t);
66  free_text(t);
67  debug_off();
68 }
void free_text(text p)
Definition: text.c:74
text text_module(entity, statement)

References debug_off, debug_on, free_text(), print_text(), and text_module().

Referenced by module_to_wp65_modules().

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

◆ wp65_debug_print_text()

void wp65_debug_print_text ( entity  m,
statement  s 
)

include "values.h"

make_loop_body.c

Definition at line 53 of file make_loop_body.c.

54 {
55  debug(1, "For module %s:\n", entity_name(m));
56  debug_on("PRETTYPRINT_DEBUG_LEVEL");
57  print_statement(s);
58  debug_off();
59 }
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
#define entity_name(x)
Definition: ri.h:2790

References debug(), debug_off, debug_on, entity_name, and print_statement().

Referenced by bound_generation(), eval_variable_in_statement(), loop_nest_to_wp65_code(), make_all_movement_blocks(), make_movement_scalar_wp65(), make_scanning_over_one_tile(), make_scanning_over_tiles(), movement_computation(), reference_conversion_statement(), and translate_unary_into_binary_ref().

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

Variable Documentation

◆ offset_dim1

Value offset_dim1
extern

include "generation.h"

Definition at line 67 of file code.c.

Referenced by make_datum_movement(), and make_movements_loop_body_wp65().

◆ offset_dim2

Value offset_dim2
extern

Definition at line 68 of file code.c.

Referenced by make_datum_movement(), and make_movements_loop_body_wp65().