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

Go to the source code of this file.

Functions

void debug_host_node_variables (entity e)
 HPFC module by Fabien COELHO. More...
 
void store_new_node_variable (entity new, entity old)
 
void store_new_host_variable (entity new, entity old)
 
void store_new_host_node_variable (entity neh, entity nen, entity old)
 
void init_entity_status ()
 
entity_status get_entity_status ()
 
void set_entity_status (entity_status s)
 
void reset_entity_status ()
 
void close_entity_status ()
 
string hpfc_module_suffix (entity module)
 
static void update_for_module_rewrite (entity *pe)
 
static void update_reference_for_module_rewrite (reference ref)
 shift the references to the right variable, in the module More...
 
static void update_call_for_module_rewrite (call c)
 shift the calls to the right variable, in the module More...
 
static void update_code_for_module_rewrite (code c)
 
static void update_loop_for_module_rewrite (loop l)
 
void update_object_for_module (void *obj, entity module)
 
void update_list_for_module (list l, entity module)
 
expression UpdateExpressionForModule (entity module, expression ex)
 this function creates a new expression using the mapping of old to new variables map. More...
 
list lUpdateExpr_but_distributed (entity module, list l)
 used for compiling calls. More...
 
list lUpdateExpr (entity module, list l)
 
list lNewVariableForModule (entity module, list le)
 
entity NewVariableForModule (entity module, entity e)
 
statement UpdateStatementForModule (entity module, statement stat)
 

Variables

static bool(* bound_p )(entity) = (bool(*)(entity)) gen_false
 
static entity(* load )(entity) = (entity(*)(entity)) gen_identity
 

Function Documentation

◆ close_entity_status()

void close_entity_status ( void  )

Definition at line 118 of file host_node_entities.c.

119 {
120  close_new_host();
121  close_old_host();
122  close_new_node();
123  close_old_node();
124 }
void close_new_node(void)
void close_old_node(void)
void close_new_host(void)
void close_old_host(void)

References close_new_host(), close_new_node(), close_old_host(), and close_old_node().

+ Here is the call graph for this function:

◆ debug_host_node_variables()

void debug_host_node_variables ( entity  e)

HPFC module by Fabien COELHO.

HOST AND NODE ENTITIES MANAGEMENT

Definition at line 44 of file host_node_entities.c.

45 {
46  fprintf(stderr, "variable %s:\n\tnh=%s\n\toh=%s\n\tnn=%s\n\ton=%s\n",
47  entity_name(e),
48  bound_new_host_p(e)? entity_name(load_new_host(e)): "<undef>",
49  bound_old_host_p(e)? entity_name(load_old_host(e)): "<undef>",
50  bound_new_node_p(e)? entity_name(load_new_node(e)): "<undef>",
51  bound_old_node_p(e)? entity_name(load_old_node(e)): "<undef>");
52 }
bool bound_old_node_p(entity)
entity load_old_node(entity)
bool bound_new_host_p(entity)
entity load_new_node(entity)
bool bound_new_node_p(entity)
bool bound_old_host_p(entity)
entity load_new_host(entity)
entity load_old_host(entity)
#define entity_name(x)
Definition: ri.h:2790
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References bound_new_host_p(), bound_new_node_p(), bound_old_host_p(), bound_old_node_p(), entity_name, fprintf(), load_new_host(), load_new_node(), load_old_host(), and load_old_node().

+ Here is the call graph for this function:

◆ get_entity_status()

entity_status get_entity_status ( void  )

Definition at line 93 of file host_node_entities.c.

94 {
96  get_new_node(),
97  get_old_host(),
98  get_old_node(),
100 }
entity_status make_entity_status(entitymap a1, entitymap a2, entitymap a3, entitymap a4, entity_int a5)
Definition: hpf_private.c:406
entitymap get_old_node(void)
entitymap get_old_host(void)
entitymap get_new_host(void)
entitymap get_new_node(void)
#define entity_int_undefined
Definition: ri.h:1043

References entity_int_undefined, get_new_host(), get_new_node(), get_old_host(), get_old_node(), and make_entity_status().

Referenced by init_hpfc_status(), and save_hpfc_status().

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

◆ hpfc_module_suffix()

string hpfc_module_suffix ( entity  module)

else

to avoid a gcc warning

Parameters
moduleodule

Definition at line 126 of file host_node_entities.c.

128 {
129  if (module==node_module) return(NODE_NAME);
130  if (module==host_module) return(HOST_NAME);
131  /* else
132  */
133  pips_internal_error("unexpected module");
134  return string_undefined; /* to avoid a gcc warning */
135 }
entity host_module
HPFC - Fabien Coelho, May 1993 and later...
Definition: compiler.c:47
entity node_module
Definition: compiler.c:47
#define NODE_NAME
#define HOST_NAME
Constants.
#define pips_internal_error
Definition: misc-local.h:149
#define string_undefined
Definition: newgen_types.h:40
static char * module
Definition: pips.c:74

References host_module, HOST_NAME, module, node_module, NODE_NAME, pips_internal_error, and string_undefined.

◆ init_entity_status()

void init_entity_status ( void  )

Definition at line 85 of file host_node_entities.c.

86 {
87  init_new_host();
88  init_old_host();
89  init_new_node();
90  init_old_node();
91 }
void init_old_node(void)
void init_new_host(void)
void init_old_host(void)
void init_new_node(void)

References init_new_host(), init_new_node(), init_old_host(), and init_old_node().

Referenced by init_hpfc_status().

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

◆ lNewVariableForModule()

list lNewVariableForModule ( entity  module,
list  le 
)
Parameters
moduleodule
lee

Definition at line 263 of file host_node_entities.c.

266 {
267  list result, last;
268 
269  if (ENDP(le)) return(NIL);
270 
271  for (result = CONS(ENTITY,
273  NIL),
274  last = result, le = CDR(le);
275  !ENDP(le);
276  le = CDR(le), last = CDR(last))
278  NIL);
279 
280  return(result);
281 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#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 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
entity NewVariableForModule(entity module, entity e)
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References CAR, CDR, CONS, ENDP, ENTITY, module, NewVariableForModule(), and NIL.

Referenced by hpf_compile_sequential_loop().

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

◆ lUpdateExpr()

list lUpdateExpr ( entity  module,
list  l 
)
Parameters
moduleodule
lof anything

Definition at line 256 of file host_node_entities.c.

257 {
258  list new = gen_full_copy_list(l);
260  return new;
261 }
list gen_full_copy_list(list l)
Copy a list structure with element copy.
Definition: list.c:535
void update_list_for_module(list l, entity module)

References gen_full_copy_list(), module, and update_list_for_module().

Referenced by generate_c1_beta(), hpf_compile_call(), st_compute_current_computer(), and st_compute_current_owners().

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

◆ lUpdateExpr_but_distributed()

list lUpdateExpr_but_distributed ( entity  module,
list  l 
)

used for compiling calls.

Parameters
moduleodule
lof expression

Definition at line 237 of file host_node_entities.c.

240 {
241  list new = NIL;
242 
243  MAP(EXPRESSION, e,
244  {
246  new = CONS(EXPRESSION, copy_expression(e), new);
247  },
248  l);
249 
250  new = gen_nreverse(new);
252  return new;
253 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
bool array_distributed_p(entity)
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
Definition: expression.c:3140
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217

References array_distributed_p(), CONS, copy_expression(), EXPRESSION, expression_to_entity(), gen_nreverse(), MAP, module, NIL, and update_list_for_module().

Referenced by hpf_compile_call().

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

◆ NewVariableForModule()

entity NewVariableForModule ( entity  module,
entity  e 
)
Parameters
moduleodule

Definition at line 283 of file host_node_entities.c.

286 {
287  if (module==host_module)
288  {
289  if (bound_new_host_p(e))
290  return load_new_host(e);
291  }
292  else
293  {
294  if (bound_new_node_p(e))
295  return load_new_node(e);
296  }
297 
298  pips_internal_error("unexpected entity %s", entity_name(e));
299 
300  return entity_undefined;
301 }
#define entity_undefined
Definition: ri.h:2761

References bound_new_host_p(), bound_new_node_p(), entity_name, entity_undefined, host_module, load_new_host(), load_new_node(), module, and pips_internal_error.

Referenced by hpf_compile_parallel_loop(), hpf_compile_sequential_loop(), and lNewVariableForModule().

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

◆ reset_entity_status()

void reset_entity_status ( void  )

Definition at line 110 of file host_node_entities.c.

111 {
112  reset_new_host();
113  reset_old_host();
114  reset_new_node();
115  reset_old_node();
116 }
void reset_new_node(void)
void reset_old_node(void)
void reset_old_host(void)
void reset_new_host(void)

References reset_new_host(), reset_new_node(), reset_old_host(), and reset_old_node().

Referenced by reset_hpfc_status().

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

◆ set_entity_status()

void set_entity_status ( entity_status  s)

Definition at line 102 of file host_node_entities.c.

103 {
108 }
#define entity_status_new_node(x)
Definition: hpf_private.h:535
#define entity_status_old_node(x)
Definition: hpf_private.h:539
#define entity_status_new_host(x)
Definition: hpf_private.h:533
#define entity_status_old_host(x)
Definition: hpf_private.h:537
void set_old_host(entitymap)
void set_new_node(entitymap)
void set_new_host(entitymap)
void set_old_node(entitymap)

References entity_status_new_host, entity_status_new_node, entity_status_old_host, entity_status_old_node, set_new_host(), set_new_node(), set_old_host(), and set_old_node().

Referenced by load_hpfc_status().

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

◆ store_new_host_node_variable()

void store_new_host_node_variable ( entity  neh,
entity  nen,
entity  old 
)
Parameters
nehhost version
nennode version
oldinitial entity

Definition at line 73 of file host_node_entities.c.

77 {
78  store_new_host_variable(neh, old);
79  store_new_host_variable(neh, nen);
80  store_new_node_variable(nen, old);
81  store_new_node_variable(nen, neh);
82 }
void store_new_node_variable(entity new, entity old)
void store_new_host_variable(entity new, entity old)

References store_new_host_variable(), and store_new_node_variable().

Referenced by make_host_and_node_modules().

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

◆ store_new_host_variable()

void store_new_host_variable ( entity  new,
entity  old 
)
Parameters
newew
oldld

Definition at line 64 of file host_node_entities.c.

65 {
66  pips_assert("defined", !entity_undefined_p(new)&&!entity_undefined_p(old));
67 
68  store_or_update_new_host(old, new);
69  store_or_update_old_host(new, old);
70 }
void store_or_update_new_host(entity, entity)
void store_or_update_old_host(entity, entity)
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define entity_undefined_p(x)
Definition: ri.h:2762

References entity_undefined_p, pips_assert, store_or_update_new_host(), and store_or_update_old_host().

Referenced by add_declaration_to_host_and_link(), AddCommonToHostAndNodeModules(), AddEntityToHostAndNodeModules(), automatic_translation(), hpfc_compile(), make_host_and_node_modules(), and store_new_host_node_variable().

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

◆ store_new_node_variable()

void store_new_node_variable ( entity  new,
entity  old 
)
Parameters
newew
oldld

Definition at line 55 of file host_node_entities.c.

56 {
57  pips_assert("defined", !entity_undefined_p(new)&&!entity_undefined_p(old));
58 
59  store_or_update_new_node(old, new);
60  store_or_update_old_node(new, old);
61 }
void store_or_update_new_node(entity, entity)
void store_or_update_old_node(entity, entity)

References entity_undefined_p, pips_assert, store_or_update_new_node(), and store_or_update_old_node().

Referenced by AddCommonToHostAndNodeModules(), AddEntityToHostAndNodeModules(), automatic_translation(), hpfc_compile(), make_host_and_node_modules(), set_similar_mappings_for_updates(), and store_new_host_node_variable().

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

◆ update_call_for_module_rewrite()

static void update_call_for_module_rewrite ( call  c)
static

shift the calls to the right variable, in the module

Definition at line 163 of file host_node_entities.c.

164 {
166 }
static void update_for_module_rewrite(entity *pe)
#define call_function(x)
Definition: ri.h:709

References call_function, and update_for_module_rewrite().

Referenced by update_object_for_module().

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

◆ update_code_for_module_rewrite()

static void update_code_for_module_rewrite ( code  c)
static

Definition at line 168 of file host_node_entities.c.

169 {
170  MAPL(ce,
171  update_for_module_rewrite((entity*) &(CAR(ce).p)),
172  code_declarations(c));
173 }
#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
#define code_declarations(x)
Definition: ri.h:784

References CAR, code_declarations, MAPL, and update_for_module_rewrite().

Referenced by update_object_for_module().

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

◆ update_for_module_rewrite()

static void update_for_module_rewrite ( entity pe)
static

Definition at line 143 of file host_node_entities.c.

145 {
146  if (bound_p(*pe))
147  {
148  entity n = load(*pe);
149  pips_debug(10, "%s -> %s\n", entity_name(*pe), entity_name(n));
150  *pe = n;
151  }
152 }
static entity(* load)(entity)
static bool(* bound_p)(entity)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145

References bound_p, entity_name, load, and pips_debug.

Referenced by update_call_for_module_rewrite(), update_code_for_module_rewrite(), update_loop_for_module_rewrite(), and update_reference_for_module_rewrite().

+ Here is the caller graph for this function:

◆ update_list_for_module()

void update_list_for_module ( list  l,
entity  module 
)
Parameters
moduleodule

Definition at line 215 of file host_node_entities.c.

216 {
218 }
#define CHUNK(x)
Definition: genC.h:90
void update_object_for_module(void *obj, entity module)

References CAR, CHUNK, MAPL, module, and update_object_for_module().

Referenced by lUpdateExpr(), and lUpdateExpr_but_distributed().

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

◆ update_loop_for_module_rewrite()

static void update_loop_for_module_rewrite ( loop  l)
static

Definition at line 175 of file host_node_entities.c.

176 {
178 }
#define loop_index(x)
Definition: ri.h:1640

References loop_index, and update_for_module_rewrite().

Referenced by update_object_for_module().

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

◆ update_object_for_module()

void update_object_for_module ( void *  obj,
entity  module 
)

push the current functions

pop the initial functions

Parameters
objbj
moduleloosely typed, indeed

Definition at line 180 of file host_node_entities.c.

183 {
184  bool (*saved_bound)(entity);
185  entity (*saved_load)(entity);
186 
187  pips_debug(8, "updating (%s) %p\n", gen_domain_name(gen_type(obj)), obj);
188 
189  saved_bound = bound_p, saved_load = load; /* push the current functions */
190 
191  if (module==host_module)
192  {
193  pips_debug(8, "for host\n");
196  }
197  else
198  {
199  pips_debug(8, "for node\n");
202  }
203 
205  (obj,
210  NULL);
211 
212  bound_p = saved_bound, load = saved_load; /* pop the initial functions */
213 }
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
string gen_domain_name(int t)
GEN_DOMAIN_NAME returns the domain name, and may be used for debug purposes.
Definition: genClib.c:97
int gen_type(gen_chunk *obj)
GEN_TYPE returns the domain number for the object in argument.
Definition: genClib.c:82
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
Definition: genClib.c:3428
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
static void update_call_for_module_rewrite(call c)
shift the calls to the right variable, in the module
static void update_loop_for_module_rewrite(loop l)
static void update_code_for_module_rewrite(code c)
static void update_reference_for_module_rewrite(reference ref)
shift the references to the right variable, in the module
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
Definition: newgen_types.h:78
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define call_domain
newgen_callees_domain_defined
Definition: ri.h:58
#define reference_domain
newgen_range_domain_defined
Definition: ri.h:338
#define code_domain
newgen_cast_domain_defined
Definition: ri.h:74

References bound_new_host_p(), bound_new_node_p(), bound_p, call_domain, code_domain, gen_domain_name(), gen_multi_recurse(), gen_true(), gen_type(), host_module, load, load_new_host(), load_new_node(), loop_domain, module, pips_debug, reference_domain, update_call_for_module_rewrite(), update_code_for_module_rewrite(), update_loop_for_module_rewrite(), and update_reference_for_module_rewrite().

Referenced by compile_module(), generate_hpf_remapping_file(), hpf_compile_call(), update_list_for_module(), UpdateExpressionForModule(), and UpdateStatementForModule().

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

◆ update_reference_for_module_rewrite()

static void update_reference_for_module_rewrite ( reference  ref)
static

shift the references to the right variable, in the module

Definition at line 156 of file host_node_entities.c.

157 {
159 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
#define reference_variable(x)
Definition: ri.h:2326

References ref, reference_variable, and update_for_module_rewrite().

Referenced by update_object_for_module().

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

◆ UpdateExpressionForModule()

expression UpdateExpressionForModule ( entity  module,
expression  ex 
)

this function creates a new expression using the mapping of old to new variables map.

some of the structures generated may be shared...

Parameters
moduleodule
exx

Definition at line 225 of file host_node_entities.c.

228 {
229  expression new = copy_expression(ex);
231  return(new);
232 }

References copy_expression(), module, and update_object_for_module().

Referenced by generate_c1_alpha(), generate_compute_local_indices(), hpf_compile_parallel_loop(), hpf_compile_sequential_loop(), hpf_compile_test(), and st_compute_ith_local_index().

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

◆ UpdateStatementForModule()

statement UpdateStatementForModule ( entity  module,
statement  stat 
)
Parameters
moduleodule
stattat

Definition at line 303 of file host_node_entities.c.

306 {
307  statement new_stat = copy_statement(stat);
308  update_object_for_module(new_stat, module);
309  return(new_stat);
310 }
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186

References copy_statement(), module, and update_object_for_module().

Referenced by generate_parallel_body().

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

Variable Documentation

◆ bound_p

bool(* bound_p) (entity) ( entity  ) = (bool(*)(entity)) gen_false
static

◆ load