PIPS
run-time.c File Reference
#include "defines-local.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "effects-convex.h"
+ Include dependency graph for run-time.c:

Go to the source code of this file.

Data Structures

struct  RunTimeSupportDescriptor
 

Macros

#define is_end   0
 this file stores the table that describes run time functions and variables that may be called or referenced by the generated code. More...
 
#define is_sub   1
 
#define is_fun   2
 
#define is_var   3
 
#define is_int   4
 
#define is_ifn   5 /**intrinsic like function */
 
#define is_iof   6 /**I/O like function */
 
#define no_basic   is_basic_overloaded
 
#define no_entity   entity_undefined
 

Functions

entity MakeRunTimeSupportSubroutine (string local_name, _UNUSED_ int number_of_arguments)
 Runtime Support Functions Management. More...
 
entity MakeRunTimeSupportFunction (string local_name, _UNUSED_ int number_of_arguments, tag return_type)
 entity MakeRunTimeSupportFunction (local_name, number_of_arguments, return_type) More...
 
expression pvm_what_option_expression (entity v)
 
string pvm_what_options (basic b)
 string pvm_what_options(b) More...
 
statement st_call_send_or_receive (entity f, reference r)
 Sends. More...
 
statement st_compute_current_computer (reference ref)
 Computes. More...
 
statement st_compute_current_owners (reference ref)
 
expression expr_compute_local_index (entity array, int dim, expression expr)
 new index computation formula, derived from the new declarations made for the given dimension. More...
 
statement hpfc_make_call_statement (entity e, list l)
 statement hpfc_make_call_statement(e, l) generate a call statement to function e, with expression list l as an argument. More...
 
static void rwt (call c)
 
static void srwt (statement s)
 
static void substitute_return (entity o, entity n, statement s)
 
void add_pvm_init_and_end (statement *phs, statement *pns)
 this is for the main. More...
 
statement st_compute_neighbour (int d)
 call to the runtime support function HPFC_CMPNEIGHBOUR(d) More...
 
static entity make_packing_function (int ndim, bool kind, basic base, int nargs)
 find or create an entity for the packing function... More...
 
statement st_generate_packing (entity array, list content, bool bsend)
 statement st_generate_packing_and_passing(array, content, bsend) More...
 
entity hpfc_main_entity (entity e)
 returns the entity to which e is attached, that is first a common, then a function... More...
 
const char * hpfc_main_entity_name (entity e)
 returns the name of the entity e belongs too (common, function...) More...
 
string bound_parameter_name (entity array, string side, int dim)
 returns a name for the bound of the declaration of array array, side side and dimension dim. More...
 
entity argument_bound_entity (entity module, entity array, bool upper, int dim)
 
expression hpfc_array_bound (entity array, bool upper, int dim)
 
static list array_bounds_list (entity array, bool upper)
 of expressions More...
 
list array_lower_upper_bounds_list (entity array)
 of expressions More...
 
void hpfc_init_run_time_entities ()
 to be seen from outside of this file More...
 
static RunTimeSupportDescriptorfind_entry_by_name (const char *name)
 
entity hpfc_name_to_entity (const char *name)
 
bool hpfc_intrinsic_like_function (entity e)
 
bool hpfc_io_like_function (entity e)
 

Variables

static entity sub_call_o = entity_undefined
 
static entity sub_call_n = entity_undefined
 
static entity sub_ret_label = entity_undefined
 
static bool RTSTable_initialized_p = false
 
static RunTimeSupportDescriptor RTSTable []
 

Macro Definition Documentation

◆ is_end

#define is_end   0

this file stores the table that describes run time functions and variables that may be called or referenced by the generated code.

the information needed (name, arity, type...) is stored in a static table here. The table is scanned to create the corresponding entities for once. Then the entities are quickly returned on demand thru the hpfc_name_to_entity function. It was inspired to me by some static table here around in PIPS, that deal with intrinsics for instance. local defines

Definition at line 570 of file run-time.c.

◆ is_fun

#define is_fun   2

Definition at line 572 of file run-time.c.

◆ is_ifn

#define is_ifn   5 /**intrinsic like function */

Definition at line 575 of file run-time.c.

◆ is_int

#define is_int   4

Definition at line 574 of file run-time.c.

◆ is_iof

#define is_iof   6 /**I/O like function */

Definition at line 576 of file run-time.c.

◆ is_sub

#define is_sub   1

Definition at line 571 of file run-time.c.

◆ is_var

#define is_var   3

Definition at line 573 of file run-time.c.

◆ no_basic

#define no_basic   is_basic_overloaded

Definition at line 578 of file run-time.c.

◆ no_entity

#define no_entity   entity_undefined

Definition at line 579 of file run-time.c.

Function Documentation

◆ add_pvm_init_and_end()

void add_pvm_init_and_end ( statement phs,
statement pns 
)

this is for the main.

also subs CALL RETURN -> CALL HPFC {HOST|NONE} END...

Parameters
phshs
pnsns

Definition at line 364 of file run-time.c.

365 {
366  entity
367  rete = entity_intrinsic("RETURN"),
371 
372  substitute_return(rete, hhe, *phs);
373  substitute_return(rete, hne, *pns);
374 
375 
379  }
380 
382  CONS(STATEMENT, (*phs),
383  CONS(STATEMENT, ret,
384  NIL))));
385 
387  CONS(STATEMENT, (*pns),
389  NIL))));
390 }
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
#define ret(why, what)
true if not a remapping for old.
Definition: dynamic.c:986
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
#define HOST_END
#define st_init_host()
#define NODE_END
#define st_init_node()
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
#define statement_label(x)
Definition: ri.h:2450
#define entity_undefined
Definition: ri.h:2761
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
static entity sub_ret_label
Definition: run-time.c:330
static void substitute_return(entity o, entity n, statement s)
Definition: run-time.c:345
entity hpfc_name_to_entity(const char *name)
Definition: run-time.c:817
statement hpfc_make_call_statement(entity e, list l)
statement hpfc_make_call_statement(e, l) generate a call statement to function e, with expression lis...
Definition: run-time.c:318

References CONS, copy_statement(), entity_intrinsic(), entity_undefined, HOST_END, hpfc_make_call_statement(), hpfc_name_to_entity(), make_block_statement(), NIL, NODE_END, ret, st_init_host, st_init_node, STATEMENT, statement_label, sub_ret_label, and substitute_return().

Referenced by compile_module().

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

◆ argument_bound_entity()

entity argument_bound_entity ( entity  module,
entity  array,
bool  upper,
int  dim 
)
Parameters
moduleodule
arrayrray
upperpper
dimim

Definition at line 499 of file run-time.c.

504 {
505  entity result;
506  string name = bound_parameter_name(array, upper? UPPER: LOWER, dim);
507 
509  is_basic_int);
510 
511  free(name);
512  return result;
513 }
#define UPPER(c)
Definition: genSML.c:37
void free(void *)
#define LOWER
static char * module
Definition: pips.c:74
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
entity find_or_create_typed_entity(string, const char *, tag)
Looks for an entity of the specified basic.
Definition: variable.c:1046
@ is_basic_int
Definition: ri.h:571
string bound_parameter_name(entity array, string side, int dim)
returns a name for the bound of the declaration of array array, side side and dimension dim.
Definition: run-time.c:488
static entity array

References array, bound_parameter_name(), find_or_create_typed_entity(), free(), is_basic_int, LOWER, module, module_local_name(), and UPPER.

Referenced by create_bound_entity().

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

◆ array_bounds_list()

static list array_bounds_list ( entity  array,
bool  upper 
)
static

of expressions

Definition at line 527 of file run-time.c.

528 {
529  int i = -1, ndim = NumberOfDimension(array);
530  list result = NIL;
531 
532  for (i=ndim ; i>=1 ; i--)
533  result = CONS(EXPRESSION, hpfc_array_bound(array, upper, i), result);
534 
535  return result;
536 }
int NumberOfDimension(entity)
Definition: size.c:588
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
expression hpfc_array_bound(entity array, bool upper, int dim)
Definition: run-time.c:516
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References array, CONS, EXPRESSION, hpfc_array_bound(), NIL, and NumberOfDimension().

Referenced by array_lower_upper_bounds_list().

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

◆ array_lower_upper_bounds_list()

list array_lower_upper_bounds_list ( entity  array)

of expressions

of expression

interleave both lists (just for fun:-)

Parameters
arrayrray

Definition at line 539 of file run-time.c.

540 {
541  list /* of expression */ lb = array_bounds_list(array, false),
542  lu = array_bounds_list(array, true),
543  l = lb, lnb, lnu;
544 
545  if (!l) return NIL;
546 
547  /* interleave both lists (just for fun:-)
548  */
549  for(lnb=CDR(lb), lnu=CDR(lu); lb;
550  CDR(lb)=lu, CDR(lu)=lnb,
551  lb=lnb, lnb=lnb?CDR(lnb):NIL, lu=lnu, lnu=lnu?CDR(lnu):NIL);
552 
553  return l;
554 }
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
static list array_bounds_list(entity array, bool upper)
of expressions
Definition: run-time.c:527

References array, array_bounds_list(), CDR, and NIL.

Referenced by compile_reduction(), generate_subarray_shift(), and st_generate_packing().

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

◆ bound_parameter_name()

string bound_parameter_name ( entity  array,
string  side,
int  dim 
)

returns a name for the bound of the declaration of array array, side side and dimension dim.

Parameters
arrayrray
sideide
dimim

Definition at line 488 of file run-time.c.

492 {
494  entity_local_name(array), " ",
495  side, int2a(dim), NULL));
496 }
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
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
const char * hpfc_main_entity_name(entity e)
returns the name of the entity e belongs too (common, function...)
Definition: run-time.c:479
char * strdup()
char * int2a(int)
util.c
Definition: util.c:42

References array, concatenate(), entity_local_name(), hpfc_main_entity_name(), int2a(), and strdup().

Referenced by argument_bound_entity(), create_parameters_h(), and hpfc_array_bound().

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

◆ expr_compute_local_index()

expression expr_compute_local_index ( entity  array,
int  dim,
expression  expr 
)

new index computation formula, derived from the new declarations made for the given dimension.

just to avoid a gcc warning

Parameters
arrayrray
dimim
exprxpr

Definition at line 198 of file run-time.c.

202 {
203  if (get_bool_property("HPFC_EXPAND_COMPUTE_LOCAL_INDEX"))
204  {
205  tag newdecl = new_declaration_tag(array, dim);
206  dimension the_dim = entity_ith_dimension(array, dim);
207 
208  switch(newdecl)
209  {
210  case is_hpf_newdecl_none:
211  return(expr);
213  {
214  int dl = HpfcExpressionToInt(dimension_lower(the_dim));
215  expression shift = int_to_expression(1 - dl);
216 
218  expr, shift));
219  }
220  case is_hpf_newdecl_beta:
221  {
223  entity template = align_template(a);
224  distribute d = load_hpf_distribution(template);
226  int tempdim = alignment_templatedim(al), procdim;
227  dimension template_dim = FindIthDimension(template,tempdim);
230  tempdim,
231  &procdim);
232  expression
234  rate = alignment_rate(al),
235  prod, t1, the_mod, t2;
236  int
237  iabsrate = abs(HpfcExpressionToInt(rate)),
238  ishift = (HpfcExpressionToInt(alignment_constant(al)) -
239  HpfcExpressionToInt(dimension_lower(template_dim)));
240 
241 
242  prod =
243  ((HpfcExpressionToInt(rate)==1)?
244  (expr):
245  ((iabsrate==1)?
247  expr)):
249  rate,
250  expr))));
251 
252  t1 = ((ishift==0)?
253  (prod):
254  ((ishift>0)?
256  int_to_expression(ishift))):
258  int_to_expression(abs(ishift))))));
259 
261  t1,
262  parameter);
263 
264  t2 = ((iabsrate==1)?
265  (the_mod):
267  the_mod,
268  int_to_expression(iabsrate)));
269 
271  t2,
272  int_to_expression(1)));
273  }
275  {
276  expression
277  expr1 =
279  expr2 = int_to_expression(dim);
280 
282  expr1, expr2, expr));
283  }
285  {
286  expression
288  expr2 = int_to_expression(dim);
289 
291  expr1, expr2, expr));
292  }
293  default:
294  pips_internal_error("unexpected new declaration tag");
295  }
296 
297  }
298  else
299  {
300  expression
302  expr2 = int_to_expression(dim);
303 
305  expr1, expr2, expr));
306  }
307 
308  return(expression_undefined); /* just to avoid a gcc warning */
309 }
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define alignment_templatedim(x)
Definition: hpf.h:136
#define alignment_constant(x)
Definition: hpf.h:140
#define align_template(x)
Definition: hpf.h:98
#define align_alignment(x)
Definition: hpf.h:96
#define distribute_distribution(x)
Definition: hpf.h:174
#define alignment_rate(x)
Definition: hpf.h:138
#define distribution_parameter(x)
Definition: hpf.h:212
@ is_hpf_newdecl_none
Definition: hpf_private.h:665
@ is_hpf_newdecl_delta
Definition: hpf_private.h:669
@ is_hpf_newdecl_alpha
Definition: hpf_private.h:666
@ is_hpf_newdecl_beta
Definition: hpf_private.h:667
@ is_hpf_newdecl_gamma
Definition: hpf_private.h:668
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
Definition: hpfc-util.c:569
alignment FindAlignmentOfDim(list lal, int dim)
Definition: hpfc-util.c:377
distribution FindDistributionOfDim(list ldi, int dim, int *pdim)
Definition: hpfc-util.c:401
tag new_declaration_tag(entity array, int dim)
Definition: declarations.c:229
#define LOCAL_IND_GAMMA
#define LOCAL_IND
#define LOCAL_IND_DELTA
distribute load_hpf_distribution(entity)
align load_hpf_alignment(entity)
intptr_t load_hpf_number(entity)
#define pips_internal_error
Definition: misc-local.h:149
int tag
TAG.
Definition: newgen_types.h:92
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define MOD_INTRINSIC_NAME
#define DIVIDE_OPERATOR_NAME
#define UNARY_MINUS_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
Definition: expression.c:342
expression MakeTernaryCall(entity f, expression e1, expression e2, expression e3)
Creates a call expression to a function with 3 arguments.
Definition: expression.c:367
dimension entity_ith_dimension(entity, int)
Another semantics would be: is this reference r to e a kill for e? In general, this cannot be answere...
Definition: variable.c:1228
dimension FindIthDimension(entity, int)
Definition: type.c:1180
#define dimension_lower(x)
Definition: ri.h:980
#define expression_undefined
Definition: ri.h:1223
#define abs(v)
Definition: syntax-local.h:48

References abs, align_alignment, align_template, alignment_constant, alignment_rate, alignment_templatedim, array, dimension_lower, distribute_distribution, distribution_parameter, DIVIDE_OPERATOR_NAME, entity_intrinsic(), entity_ith_dimension(), expression_undefined, FindAlignmentOfDim(), FindDistributionOfDim(), FindIthDimension(), get_bool_property(), hpfc_name_to_entity(), HpfcExpressionToInt(), int_to_expression(), is_hpf_newdecl_alpha, is_hpf_newdecl_beta, is_hpf_newdecl_delta, is_hpf_newdecl_gamma, is_hpf_newdecl_none, load_hpf_alignment(), load_hpf_distribution(), load_hpf_number(), LOCAL_IND, LOCAL_IND_DELTA, LOCAL_IND_GAMMA, MakeBinaryCall(), MakeTernaryCall(), MakeUnaryCall(), MINUS_OPERATOR_NAME, MOD_INTRINSIC_NAME, MULTIPLY_OPERATOR_NAME, new_declaration_tag(), pips_internal_error, PLUS_OPERATOR_NAME, and UNARY_MINUS_OPERATOR_NAME.

Referenced by st_compute_ith_local_index().

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

◆ find_entry_by_name()

static RunTimeSupportDescriptor* find_entry_by_name ( const char *  name)
static

Definition at line 806 of file run-time.c.

807 {
809 
810  for(current=RTSTable; current->what!=is_end; current++)
811  if (!strcmp(current->name, name))
812  return current;
813 
814  return (RunTimeSupportDescriptor *) NULL;
815 }
static RunTimeSupportDescriptor RTSTable[]
Definition: run-time.c:592
#define is_end
this file stores the table that describes run time functions and variables that may be called or refe...
Definition: run-time.c:570
static size_t current
Definition: string.c:115

References current, is_end, and RTSTable.

Referenced by hpfc_intrinsic_like_function(), hpfc_io_like_function(), and hpfc_name_to_entity().

+ Here is the caller graph for this function:

◆ hpfc_array_bound()

expression hpfc_array_bound ( entity  array,
bool  upper,
int  dim 
)
Parameters
arrayrray
upperpper
dimim

Definition at line 516 of file run-time.c.

517 {
518  /*
519  return entity_to_expression
520  (argument_bound_entity(node_module, array, upper, dim));
521  */
523  upper?UPPER:LOWER, dim));
524 }
expression MakeCharacterConstantExpression(string s)
END_EOLE.
Definition: constant.c:573

References array, bound_parameter_name(), LOWER, MakeCharacterConstantExpression(), and UPPER.

Referenced by array_bounds_list(), caller_list_of_bounds(), and declaration_with_overlaps().

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

◆ hpfc_init_run_time_entities()

void hpfc_init_run_time_entities ( void  )

to be seen from outside of this file

they are declared as variables to avoid redefinitions ??? this fools pips typing (functions/variables and so) just okay for the pretty printer...

why not

dimensions are updated

Definition at line 751 of file run-time.c.

752 {
754  int i=0;
755  list l=NIL;
756 
757  if (RTSTable_initialized_p) return;
758  RTSTable_initialized_p = true;
759 
760  for(current=RTSTable;
761  current->what!=is_end;
762  current++)
763  {
764  pips_debug(6, "initializing %s, %d\n", current->name, current->arity);
765 
766  switch(current->what)
767  {
768  case is_fun:
769  current->object = MakeRunTimeSupportFunction(current->name,
770  current->arity,
771  current->basic);
772  break;
773  case is_sub:
775  current->arity);
776  break;
777  case is_ifn:
778  /* they are declared as variables to avoid redefinitions
779  * ??? this fools pips typing (functions/variables and so)
780  * just okay for the pretty printer...
781  */
782  case is_iof:
783  case is_var:
784  current->object =
786  HPFC_PACKAGE, /* why not */
787  current->basic);
788  /* dimensions are updated
789  */
790  l = NIL;
791  for(i=1; i<=current->arity; i++)
792  l = CONS(DIMENSION,
795  NIL),
796  l);
798  (type_variable(entity_type(current->object))) = l;
799  break;
800  default:
801  pips_internal_error("unexpected what field in Descriptor");
802  }
803  }
804 }
dimension make_dimension(expression a1, expression a2, list a3)
Definition: ri.c:565
#define HPFC_PACKAGE
local definitions
Definition: hpfc-local.h:27
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define type_variable(x)
Definition: ri.h:2949
#define variable_dimensions(x)
Definition: ri.h:3122
#define entity_type(x)
Definition: ri.h:2792
#define is_iof
Definition: run-time.c:576
static bool RTSTable_initialized_p
Definition: run-time.c:590
#define is_sub
Definition: run-time.c:571
#define is_var
Definition: run-time.c:573
#define is_fun
Definition: run-time.c:572
entity MakeRunTimeSupportFunction(string local_name, _UNUSED_ int number_of_arguments, tag return_type)
entity MakeRunTimeSupportFunction (local_name, number_of_arguments, return_type)
Definition: run-time.c:61
#define is_ifn
Definition: run-time.c:575
entity MakeRunTimeSupportSubroutine(string local_name, _UNUSED_ int number_of_arguments)
Runtime Support Functions Management.
Definition: run-time.c:44

References CONS, current, DIMENSION, entity_type, find_or_create_typed_entity(), HPFC_PACKAGE, int_to_expression(), is_end, is_fun, is_ifn, is_iof, is_sub, is_var, make_dimension(), MakeRunTimeSupportFunction(), MakeRunTimeSupportSubroutine(), NIL, pips_debug, pips_internal_error, RTSTable, RTSTable_initialized_p, type_variable, and variable_dimensions.

Referenced by hpfc_directives_handler(), and set_resources_for_module().

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

◆ hpfc_intrinsic_like_function()

bool hpfc_intrinsic_like_function ( entity  e)

Definition at line 828 of file run-time.c.

830 {
832 
833  return entry ? entry->what==is_ifn : false;
834 }
static RunTimeSupportDescriptor * find_entry_by_name(const char *name)
Definition: run-time.c:806

References entity_local_name(), find_entry_by_name(), is_ifn, and RunTimeSupportDescriptor::what.

+ Here is the call graph for this function:

◆ hpfc_io_like_function()

bool hpfc_io_like_function ( entity  e)

Definition at line 836 of file run-time.c.

838 {
840 
841  return entry ? entry->what==is_iof : false;
842 }

References entity_local_name(), find_entry_by_name(), is_iof, and RunTimeSupportDescriptor::what.

Referenced by only_io_call().

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

◆ hpfc_main_entity()

entity hpfc_main_entity ( entity  e)

returns the entity to which e is attached, that is first a common, then a function...

Definition at line 462 of file run-time.c.

463 {
464  storage s = entity_storage(e);
465  bool in_common = entity_in_common_p(e),
466  in_ram = storage_ram_p(s);
467  ram r = (in_ram ? storage_ram(s) : ram_undefined);
468 
469  pips_assert("not in rom", !storage_rom_p(s));
470 
471  return(in_ram ?
472  (in_common ? ram_section(r) : ram_function(r)):
475 }
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
bool entity_in_common_p(entity e)
Definition: entity.c:1082
#define storage_formal_p(x)
Definition: ri.h:2522
#define ram_undefined
Definition: ri.h:2221
#define entity_storage(x)
Definition: ri.h:2794
#define storage_ram_p(x)
Definition: ri.h:2519
#define ram_section(x)
Definition: ri.h:2249
#define storage_formal(x)
Definition: ri.h:2524
#define formal_function(x)
Definition: ri.h:1406
#define storage_ram(x)
Definition: ri.h:2521
#define ram_function(x)
Definition: ri.h:2247
#define storage_rom_p(x)
Definition: ri.h:2525
#define storage_return_p(x)
Definition: ri.h:2516
#define storage_return(x)
Definition: ri.h:2518

References entity_in_common_p(), entity_storage, entity_undefined, formal_function, pips_assert, ram_function, ram_section, ram_undefined, storage_formal, storage_formal_p, storage_ram, storage_ram_p, storage_return, storage_return_p, and storage_rom_p.

Referenced by hpfc_main_entity_name(), and list_of_distributed_arrays_for_module().

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

◆ hpfc_main_entity_name()

const char* hpfc_main_entity_name ( entity  e)

returns the name of the entity e belongs too (common, function...)

Definition at line 479 of file run-time.c.

480 {
482 }
entity hpfc_main_entity(entity e)
returns the entity to which e is attached, that is first a common, then a function....
Definition: run-time.c:462

References hpfc_main_entity(), and module_local_name().

Referenced by bound_parameter_name().

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

◆ hpfc_make_call_statement()

statement hpfc_make_call_statement ( entity  e,
list  l 
)

statement hpfc_make_call_statement(e, l) generate a call statement to function e, with expression list l as an argument.

Definition at line 318 of file run-time.c.

319 {
320  pips_assert("defined", !entity_undefined_p(e));
322  make_call(e, l)));
323 }
call make_call(entity a1, list a2)
Definition: ri.c:269
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
Definition: statement.c:597
#define entity_undefined_p(x)
Definition: ri.h:2762
@ is_instruction_call
Definition: ri.h:1474

References entity_undefined_p, instruction_to_statement(), is_instruction_call, make_call(), make_instruction(), and pips_assert.

Referenced by add_pvm_init_and_end(), generate_subarray_shift(), hpfc_hcast(), hpfc_hmessage(), hpfc_initsend(), hpfc_message(), hpfc_nrecv(), hpfc_nsend(), hpfc_packing_of_current__buffer(), io_efficient_compile(), st_call_send_or_receive(), st_compute_current_computer(), st_compute_current_owners(), st_compute_neighbour(), st_generate_packing(), and statement_compute_bounds().

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

◆ hpfc_name_to_entity()

entity hpfc_name_to_entity ( const char *  name)

just to avoid a gcc warning

Parameters
nameame

Definition at line 817 of file run-time.c.

818 {
820 
821  if (entry) return entry->object;
822 
823  pips_internal_error("%s not found", name);
824 
825  return entity_undefined; /* just to avoid a gcc warning */
826 }
entity object
basic tag if necessary
Definition: run-time.c:587

References entity_undefined, find_entry_by_name(), RunTimeSupportDescriptor::object, and pips_internal_error.

Referenced by add_pvm_init_and_end(), broadcast(), buffer_full_condition(), define_node_processor_id(), elements_loop(), expr_compute_local_index(), gen(), generate_io_statements_for_shared_arrays(), generate_remapping_code(), generate_remapping_guard(), GENERATION(), hpfc_broadcast_if_necessary(), hpfc_buffer_entity(), hpfc_buffer_initialization(), hpfc_buffer_packing(), hpfc_compute_lid(), hpfc_generate_message(), hpfc_hcast(), hpfc_hmessage(), hpfc_initsend(), hpfc_lazy_buffer_packing(), hpfc_lazy_guard(), hpfc_lazy_message(), hpfc_lazy_packing(), hpfc_message(), hpfc_nrecv(), hpfc_nsend(), hpfc_translate_call_with_distributed_args(), if_different_pe_and_not_twin(), io_efficient_compile(), live_mapping_expression(), make_mypos_expression(), make_rectangular_area(), mylid_ne_lid(), processor_loop(), set_array_status_to_target(), set_resources_for_module(), st_compute_current_computer(), st_compute_current_owners(), st_compute_neighbour(), and statement_compute_bounds().

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

◆ make_packing_function()

static entity make_packing_function ( int  ndim,
bool  kind,
basic  base,
int  nargs 
)
static

find or create an entity for the packing function...

Definition at line 403 of file run-time.c.

408 {
409  char buffer[100], *buf = buffer;
410  sprintf(buf, "%s %s %d",
411  pvm_what_options(base), (kind ? "PACK" : "UNPACK"), ndim);
412  buf += strlen(buf);
413 
414  return MakeRunTimeSupportSubroutine(buffer, nargs);
415 }
bdt base
Current expression.
Definition: bdt_read_paf.c:100
string pvm_what_options(basic b)
string pvm_what_options(b)
Definition: run-time.c:86
static char buf[BSZ]
Definition: split_file.c:157
static string buffer
Definition: string.c:113

References base, buf, buffer, MakeRunTimeSupportSubroutine(), and pvm_what_options().

Referenced by st_generate_packing().

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

◆ MakeRunTimeSupportFunction()

entity MakeRunTimeSupportFunction ( string  local_name,
_UNUSED_ int  number_of_arguments,
tag  return_type 
)

entity MakeRunTimeSupportFunction (local_name, number_of_arguments, return_type)

this function can be used even if the function is already declared ??? an integer shouldn't always be returned

??? rough

Definition at line 61 of file run-time.c.

65 {
67  (return_type==is_basic_int ? /* ??? rough */
70  return f;
71 }
language make_language_fortran(void)
Definition: ri.c:1250
const char * local_name(const char *s)
Does not take care of block scopes and returns a pointer.
Definition: entity_names.c:221
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
type MakeOverloadedResult(void)
this function creates a default fortran operator result, i.e.
Definition: type.c:261

References f(), is_basic_int, local_name(), make_empty_function(), make_language_fortran(), MakeIntegerResult(), and MakeOverloadedResult().

Referenced by hpfc_init_run_time_entities().

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

◆ MakeRunTimeSupportSubroutine()

entity MakeRunTimeSupportSubroutine ( string  local_name,
_UNUSED_ int  number_of_arguments 
)

Runtime Support Functions Management.

Fabien Coelho, May and June 1993 entity MakeRunTimeSupportSubroutine(local_name, number_of_arguments)

modify 27/09/93, in order not to attempt to redeclare an already declared subroutine.

Definition at line 44 of file run-time.c.

47 {
49  if (entity_undefined_p(res))
51  return res;
52 }
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
entity make_empty_subroutine(const char *name, language l)
Definition: entity.c:268

References entity_undefined_p, local_name(), make_empty_subroutine(), make_language_fortran(), and module_name_to_entity().

Referenced by hpfc_init_run_time_entities(), and make_packing_function().

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

◆ pvm_what_option_expression()

expression pvm_what_option_expression ( entity  v)

Definition at line 74 of file run-time.c.

75 {
76  pips_assert("variable", entity_variable_p(v));
77 
80 }
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
Definition: entity.c:1380

References entity_basic(), entity_variable_p, MakeCharacterConstantExpression(), pips_assert, pvm_what_options(), and strdup().

Referenced by st_call_send_or_receive().

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

◆ pvm_what_options()

string pvm_what_options ( basic  b)

string pvm_what_options(b)

the pvm what option is given back as a string, fellowing the basic given.

Definition at line 86 of file run-time.c.

88 {
89  switch (basic_tag(b))
90  {
91  case is_basic_int:
92  switch (basic_int(b))
93  {
94  case 2: return(PVM_INTEGER2);
95  case 4: return(PVM_INTEGER4);
96  default:
97  pips_internal_error("unexpected integer*%d", basic_int(b));
98  }
99  case is_basic_float:
100  switch (basic_float(b))
101  {
102  case 4: return(PVM_REAL4);
103  case 8: return(PVM_REAL8);
104  default:
105  pips_internal_error("unexpected real*%d", basic_float(b));
106  }
107  case is_basic_logical:
108  switch (basic_logical(b))
109  {
110  case 2: return(PVM_INTEGER2);
111  case 4: return(PVM_INTEGER4);
112  default:
113  pips_internal_error("unexpected logical*%d", basic_logical(b));
114  }
115  case is_basic_overloaded:
116  pips_internal_error("overloaded not welcomed");
117  case is_basic_complex:
118  switch (basic_complex(b))
119  {
120  case 8: return(PVM_COMPLEX8);
121  case 16: return(PVM_COMPLEX16);
122  default:
123  pips_internal_error("unexpected complex*%d", basic_complex(b));
124  }
125  case is_basic_string:
126  return(PVM_STRING);
127  default:
128  pips_internal_error("unexpected basic tag");
129  }
130  return("ERROR");
131 }
#define PVM_REAL4
#define PVM_COMPLEX16
#define PVM_COMPLEX8
#define PVM_REAL8
#define PVM_INTEGER2
#define PVM_STRING
#define PVM_INTEGER4
@ is_basic_string
Definition: ri.h:576
@ is_basic_float
Definition: ri.h:572
@ is_basic_overloaded
Definition: ri.h:574
@ is_basic_logical
Definition: ri.h:573
@ is_basic_complex
Definition: ri.h:575
#define basic_int(x)
Definition: ri.h:616
#define basic_tag(x)
Definition: ri.h:613
#define basic_logical(x)
Definition: ri.h:622
#define basic_float(x)
Definition: ri.h:619
#define basic_complex(x)
Definition: ri.h:628

References basic_complex, basic_float, basic_int, basic_logical, basic_tag, is_basic_complex, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_string, pips_internal_error, PVM_COMPLEX16, PVM_COMPLEX8, PVM_INTEGER2, PVM_INTEGER4, PVM_REAL4, PVM_REAL8, and PVM_STRING.

Referenced by hpfc_buffer_entity(), make_new_reduction_function(), make_packing_function(), make_reduction_function(), make_shift_subroutine(), and pvm_what_option_expression().

+ Here is the caller graph for this function:

◆ rwt()

static void rwt ( call  c)
static

Definition at line 332 of file run-time.c.

333 {
334  if (call_function(c)==sub_call_o)
336 }
#define call_function(x)
Definition: ri.h:709
static entity sub_call_n
Definition: run-time.c:329
static entity sub_call_o
Definition: run-time.c:328

References call_function, sub_call_n, and sub_call_o.

Referenced by substitute_return().

+ Here is the caller graph for this function:

◆ srwt()

static void srwt ( statement  s)
static

Definition at line 337 of file run-time.c.

338 {
342  }
343 }
bool entity_return_label_p(entity e)
Definition: entity.c:673
entity entity_empty_label(void)
Definition: entity.c:1105

References entity_empty_label(), entity_return_label_p(), statement_label, and sub_ret_label.

Referenced by substitute_return().

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

◆ st_call_send_or_receive()

statement st_call_send_or_receive ( entity  f,
reference  r 
)

Sends.

Definition at line 138 of file run-time.c.

141 {
142  return
146  NIL)));
147 }
expression reference_to_expression(reference r)
Definition: expression.c:196
#define reference_variable(x)
Definition: ri.h:2326
expression pvm_what_option_expression(entity v)
Definition: run-time.c:74

References CONS, EXPRESSION, f(), hpfc_make_call_statement(), NIL, pvm_what_option_expression(), reference_to_expression(), and reference_variable.

+ Here is the call graph for this function:

◆ st_compute_current_computer()

statement st_compute_current_computer ( reference  ref)

Computes.

Parameters
refef

Definition at line 151 of file run-time.c.

153 {
154  if (get_bool_property("HPFC_EXPAND_COMPUTE_COMPUTER"))
155  {
156  list linds = reference_indices(ref),
157  largs = make_list_of_constant(0, 7-gen_length(linds));
158  int narray = load_hpf_number(reference_variable(ref));
159 
160  largs = gen_nconc(CONS(EXPRESSION, int_to_expression(narray),
161  NIL),
162  gen_nconc(lUpdateExpr(node_module, linds), largs));
163 
165  largs);
166  }
167  else
170  NIL));
171 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
entity node_module
Definition: compiler.c:47
size_t gen_length(const list l)
Definition: list.c:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
list lUpdateExpr(entity module, list l)
#define CMP_COMPUTER
list make_list_of_constant(int val, int number)
of expression
Definition: expression.c:3369
#define reference_indices(x)
Definition: ri.h:2328

References CMP_COMPUTER, CONS, EXPRESSION, gen_length(), gen_nconc(), get_bool_property(), hpfc_make_call_statement(), hpfc_name_to_entity(), int_to_expression(), load_hpf_number(), lUpdateExpr(), make_list_of_constant(), NIL, node_module, ref, reference_indices, reference_to_expression(), and reference_variable.

Referenced by generate_c1_alpha(), and generate_parallel_body().

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

◆ st_compute_current_owners()

statement st_compute_current_owners ( reference  ref)

◆ st_compute_neighbour()

statement st_compute_neighbour ( int  d)

call to the runtime support function HPFC_CMPNEIGHBOUR(d)

Definition at line 394 of file run-time.c.

395 {
398  NIL));
399 }
#define CMP_NEIGHBOUR

References CMP_NEIGHBOUR, CONS, EXPRESSION, hpfc_make_call_statement(), hpfc_name_to_entity(), int_to_expression(), and NIL.

Referenced by st_one_message().

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

◆ st_generate_packing()

statement st_generate_packing ( entity  array,
list  content,
bool  bsend 
)

statement st_generate_packing_and_passing(array, content, bsend)

dimension bounds are refered to as parameters, since we do not know yet what is the lower and upper of each dimension...

larg content:

array, dim [lower, upper]*len, range [lower, upper, increment]*len

Parameters
arrayrray
contentontent
bsendsend

Definition at line 422 of file run-time.c.

426 {
427  int len = gen_length(content);
428  list larg = NIL;
429 
430  pips_assert("valid number of dimensions",
431  len==NumberOfDimension(array) && (len<=4) && (len>=1));
432 
434 
435  MAP(RANGE, r,
436  {
437  larg = gen_nconc(larg,
441  NIL))));
442  },
443  content);
444 
446  larg);
447 
448  /* larg content:
449  *
450  * array, dim [lower, upper]*len, range [lower, upper, increment]*len
451  */
452 
454  (make_packing_function(len, bsend, entity_basic(array), 1+5*len),
455  larg);
456 
457 }
#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
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
#define range_upper(x)
Definition: ri.h:2290
#define range_increment(x)
Definition: ri.h:2292
#define RANGE(x)
RANGE.
Definition: ri.h:2257
#define range_lower(x)
Definition: ri.h:2288
list array_lower_upper_bounds_list(entity array)
of expressions
Definition: run-time.c:539
static entity make_packing_function(int ndim, bool kind, basic base, int nargs)
find or create an entity for the packing function...
Definition: run-time.c:403

References array, array_lower_upper_bounds_list(), CONS, entity_basic(), entity_to_expression(), EXPRESSION, gen_length(), gen_nconc(), hpfc_make_call_statement(), make_packing_function(), MAP, NIL, NumberOfDimension(), pips_assert, RANGE, range_increment, range_lower, and range_upper.

Referenced by st_one_message().

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

◆ substitute_return()

static void substitute_return ( entity  o,
entity  n,
statement  s 
)
static

Definition at line 345 of file run-time.c.

346 {
347  sub_call_o = o;
348  sub_call_n = n;
349 
354  NULL);
355 
358 }
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
Definition: genClib.c:3428
bool gen_false(__attribute__((unused)) gen_chunk *unused)
Return false and ignore the argument.
Definition: genClib.c:2796
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define call_domain
newgen_callees_domain_defined
Definition: ri.h:58
static void srwt(statement s)
Definition: run-time.c:337
static void rwt(call c)
Definition: run-time.c:332

References call_domain, entity_undefined, expression_domain, gen_false(), gen_multi_recurse(), gen_null(), gen_true(), rwt(), srwt(), statement_domain, sub_call_n, and sub_call_o.

Referenced by add_pvm_init_and_end().

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

Variable Documentation

◆ RTSTable

RunTimeSupportDescriptor RTSTable[]
static

Definition at line 592 of file run-time.c.

Referenced by find_entry_by_name(), and hpfc_init_run_time_entities().

◆ RTSTable_initialized_p

bool RTSTable_initialized_p = false
static

Definition at line 590 of file run-time.c.

Referenced by hpfc_init_run_time_entities().

◆ sub_call_n

entity sub_call_n = entity_undefined
static

Definition at line 329 of file run-time.c.

Referenced by rwt(), and substitute_return().

◆ sub_call_o

entity sub_call_o = entity_undefined
static

Definition at line 328 of file run-time.c.

Referenced by rwt(), and substitute_return().

◆ sub_ret_label

entity sub_ret_label = entity_undefined
static

Definition at line 330 of file run-time.c.

Referenced by add_pvm_init_and_end(), and srwt().