PIPS
phrase.h File Reference
#include "dg.h"
#include "graph.h"
+ Include dependency graph for phrase.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __PHRASEC_LOCAL_H__
 Warning! Do not modify this file that is automatically generated! More...
 

Typedefs

typedef dg_arc_label arc_label
 
typedef dg_vertex_label vertex_label
 

Functions

statement comEngine_opt_loop_interchange (statement, statement, entity)
 
expression get_fifoExp_from_ref (reference, expression, hash_table)
 comEngine_HRE_distribute.c More...
 
statement generate_fifo_stat2 (reference, bool)
 
statement generate_ind_fifo_stat2 (entity, entity, bool)
 
void generate_fifo_stats2 (list, list *, list *)
 
statement HRE_distribute (statement, string, const char *)
 
entity comEngine_make_new_scalar_variable (const char *, basic)
 
statement make_toggle_init_statement (entity)
 
statement make_toggle_inc_statement (entity, int)
 
statement generate_code_function (statement, bool)
 
statement comEngine_generate_code (statement)
 
bool phrase_remove_dependences (const char *)
 phrase_remove_dependences.c More...
 
expression get_fifo_from_ref (reference)
 
entity get_HRE_buff_ent_from_ref (reference)
 
statement make_wait_step_statement (void)
 
void replace_array_ref_with_fifos (list, expression, entity, statement *)
 
statement generate_stat_from_ref_list_HRE (list, statement)
 
list generate_stat_from_ref_list_HRE_list (list, list)
 
void get_supportedRef_HRE (statement, list *, list *)
 
void process_replacement_HRE (list, expression, statement *)
 
list process_replacement_HRE_OutRef (list, list)
 
statement get_call_stat_HRE (statement)
 
list make_loop_lStats_HRE (statement, entity, statement, entity, list, hash_table, expression)
 
statement generate_code_test_HRE (statement)
 
list process_gLoopToSync_HRE (statement, list)
 
statement comEngine_generate_HRECode (statement, string, list, list, list, list, const char *, int)
 
bool has_call_stat_inside (statement)
 comEngine_generate_procCode.c More...
 
statement make_step_inc_statement (int)
 
statement make_loop_step_stat (statement, entity)
 
statement make_toggle_mmcd (entity)
 
statement make_init_newInd_stat (statement, entity)
 
statement make_transStat (statement, entity, entity, expression)
 
void comEngine_replace_reference_in_stat (statement, reference, expression)
 
statement make_exec_mmcd (void)
 
statement generate_stat_from_ref_list_proc (list, list, statement)
 
list generate_stat_from_ref_list_proc_list (list, list)
 
void process_innerStat1_proc (statement, entity, entity, entity)
 
void get_supportedRef_proc (statement, hash_table, list *, list *)
 
statement get_call_stat_proc (statement)
 
list make_loop_lStats_proc (statement, entity, statement, entity, list, hash_table, expression)
 
list add_index_out_effect_proc (loop, list)
 
statement generate_code_test_proc (statement)
 
list process_gLoopToSync_proc (statement, list)
 
void create_realFifo_proc (statement, list)
 
statement comEngine_generate_procCode (statement, list, list)
 
list comEngine_expression_to_reference_list (expression, list)
 comEngine_feasability.c More...
 
bool code_has_write_eff_ref_p (reference, statement)
 
list reference_indices_entity_list (reference)
 
bool comEngine_feasability (statement, graph)
 
void create_HRE_module (const char *, const char *, statement, entity)
 
void comEngine_distribute (const char *, statement, entity)
 
bool phrase_comEngine_distributor (const char *)
 
string get_function_name_by_searching_tag (statement, const char *)
 phrase_distributor.c More...
 
list identify_analyzed_statements_to_distribute (statement)
 This function return a list of statements that were previously marked for externalization during phase PHRASE_DISTRIBUTOR_INIT. More...
 
entity create_private_variable_for_new_module (entity, const char *, const char *, entity)
 Creates a private variable in specified module. More...
 
void add_parameter_variable_to_module (reference, entity, statement, string, int)
 Declare in the newly created module a new variable (which will be a parameter of the module), and replace all occurences to the old variable by the new created. More...
 
void add_private_variable_to_module (reference, entity, statement, string)
 Declare in the newly created module a new variable (which will be a private to the module), and replace all occurences to the old variable by the new created. More...
 
bool phrase_distributor_init (const char *)
 
bool phrase_distributor (const char *)
 
entity create_parameter_for_new_module (variable, const char *, const char *, entity, int)
 phrase_distributor_control_code.c More...
 
entity create_integer_parameter_for_new_module (const char *, const char *, entity, int)
 Create new integer variable parameter for a newly created module. More...
 
void store_new_module (const char *, entity, statement)
 Store (PIPDBM) newly created module module with module_statement as USER_FILE by saving pretty printing. More...
 
entity create_new_common_variable (string, entity, entity, variable)
 Creates and declares a new variable for a newly created common. More...
 
entity create_new_scalar_common_variable (string, entity, entity, basic)
 Creates and declares a new scalar variable for a newly created common. More...
 
entity create_new_integer_scalar_common_variable (string, entity, entity)
 Creates and declares a new integer scalar variable for a newly created common. More...
 
void declare_common_variables_in_module (entity, entity)
 Creates all the things that need to be created in order to declare common in module (all the variable are created) More...
 
string get_controlized_statement_comment (entity)
 
string get_in_param_id_name (entity variable, entity)
 
string get_out_param_id_name (entity variable, entity)
 
string get_function_id_name (entity)
 
string get_common_param_name (entity variable, entity)
 
string get_send_parameter_module_name (variable)
 
string get_receive_parameter_module_name (variable)
 
entity entity_in_module (const char *, entity)
 Return entity named name in specified module. More...
 
bool phrase_distributor_control_code (const char *)
 
entity make_start_ru_module (hash_table, statement *, int, entity, list)
 phrase_distributor_communication.c More...
 
entity make_wait_ru_module (statement *, int, entity, list)
 
string get_dynamic_variable_name (entity)
 Return DYN_VAR_PARAM_NAME name for a dynamic variable. More...
 
string get_ref_var_param_name (entity)
 Return REF_VAR_PARAM_NAME name for a dynamic variable. More...
 
string get_send_param_module_name (entity, effect)
 
string get_receive_param_module_name (entity, effect)
 
list make_send_scalar_params_modules (hash_table, int, entity, list)
 Build and return list of modules used for INPUT communications (SEND_PARAMETERS...) More...
 
list make_receive_scalar_params_modules (hash_table, int, entity, list)
 Build and return list of modules used for OUTPUT communications (RECEIVE_PARAMETERS...) More...
 
void compute_region_variables (effect, list *, list *)
 
entity create_private_integer_variable_for_new_module (string, const char *, entity)
 Creates an integer variable in specified module. More...
 
list make_send_array_params_modules (entity, list, entity, entity, int)
 Make all SEND_PARAM communication modules for non-scalar regions for a given function. More...
 
list make_receive_array_params_modules (entity, list, entity, entity, int)
 Make all RECEIVE_PARAM communication modules for non-scalar regions for a given function. More...
 
bool compute_distribution_context (list, statement, entity, hash_table *, hash_table *, hash_table *, hash_table *, hash_table *)
 distribution_context.c More...
 
bool compute_distribution_controlization_context (list, statement, entity, hash_table *, hash_table *, hash_table *, hash_table *, hash_table *)
 This function is called during PHRASE distribution controlization. More...
 
list compute_regions_union (list, list)
 Compute union of exact regions. More...
 
bool internal_compute_distribution_context (statement, hash_table *, hash_table *, hash_table *, hash_table *, void *)
 Internally used to compute distribution context for statement externalized_code. More...
 
string get_externalizable_function_name (statement)
 Return the identified function name of the externalized portion of code by searching comment matching tag EXTERNALIZED_CODE_PRAGMA_BEGIN. More...
 
string get_externalized_function_name (statement)
 Return the identified function name of the externalized portion of code by searching comment matching tag EXTERNALIZED_CODE_PRAGMA_CALL. More...
 
string get_externalized_and_analyzed_function_name (statement, int *)
 Return the identified function name of the externalized portion of code by searching comment matching tags EXTERNALIZED_CODE_PRAGMA_ANALYZED Sets the number of statements of this externalizable statement. More...
 
string variable_to_string (variable)
 Return a unique (regarding variable_equal_p(var1,var2)) string representation of a variable var. More...
 
void register_scalar_communications (hash_table *, entity, list)
 Build an HASHTABLE where keys are VARIABLE and values are HASHTABLE where keys are modules or externalized function (ENTITY) and values are list of regions. More...
 
bool fsm_generation (const char *)
 fsm_generation.c More...
 
bool print_code_smalltalk (const char *)
 print_code_smalltalk.c More...
 
bool fsm_merge_states (const char *)
 fsm_merge_states.c More...
 
bool fsm_split_state (const char *)
 fsm_split_state.c More...
 
bool full_fsm_generation (const char *)
 full_fsm_generation.c More...
 
statement spaghettify_loop (statement, const char *)
 loop_spaghettify.c More...
 
statement spaghettify_whileloop (statement, const char *)
 whileloop_spaghettify.c More...
 
statement spaghettify_forloop (statement, const char *)
 forloop_spaghettify.c More...
 
statement spaghettify_test (statement, const char *)
 test_spaghettify.c More...
 
statement spaghettify_statement (statement, const char *)
 spaghettify.c More...
 
bool spaghettify (const char *)
 
bool full_spaghettify (const char *)
 full_spaghettify.c More...
 
expression make_expression_with_state_variable (entity, int value, string)
 fsm_tools.c More...
 
entity create_state_variable (const char *, int)
 This function creates (and add declaration) state variable. More...
 
statement make_state_variable_assignement_statement (statement, entity, int)
 This function build and return a statement representing the initial assigment of the state_variable, given the UNSTRUCTURED statement stat. More...
 
int entry_state_variable_value_for_unstructured (statement)
 Return the state variable value corresponding to the entry in a unstructured statement. More...
 
int exit_state_variable_value_for_unstructured (statement)
 Return the state variable value corresponding to the exit in a unstructured statement NB: always return 0. More...
 
statement make_reset_state_variable_statement (statement, entity)
 This function build and return a statement representing the initial assigment of the state_variable, given the UNSTRUCTURED statement stat. More...
 
statement make_transition_statement (control, statement, entity, const char *)
 This function build a transition statement (a TEST statement) corresponding to the current control current_node and the root_statement root_statement. More...
 
statement make_fsm_transitions_statement (statement, entity, const char *)
 This function build and return a statement representing the transitions computation in the FSM, given the UNSTRUCTURED statement stat. More...
 
statement make_fsm_from_statement (statement, entity, const char *)
 This function build and return a statement representing the FSM code equivalent to the given unstructured statement stat. More...
 
statement fsmize_statement (statement, entity, const char *)
 This function is recursively called during FSMization. More...
 
string statement_type_as_string (statement)
 phrase_tools.c More...
 
void debug_statement (const char *, statement, int)
 DEBUG FUNCTION: print debugging informations for a statement stat. More...
 
void debug_control (const char *, control, int)
 DEBUG FUNCTION: print debugging informations for a control a_control. More...
 
void debug_unstructured (unstructured, int)
 DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured. More...
 
void short_debug_unstructured (unstructured, int)
 DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured (short version) More...
 
entity clone_variable_with_new_name (entity, const char *, const char *)
 This function build and return new variable from a variable a_variable, with name new_name. More...
 
entity make_variable_from_name_and_entity (entity, const char *, statement, const char *)
 Build and return new entity obtained by cloning variable cloned_variable, with a name obtained by the concatenation of base_name and the statement ordering of statement stat. More...
 
statement make_binary_call_statement (const char *, expression, expression, statement)
 Build and return new statement which is a binary call with the 2 expressions expression1 and expression2, with empty label, statement number and ordering of statement stat, and empty comments. More...
 
statement make_assignement_statement (entity, expression, statement)
 Build and return new statement which is a assignement of variable a_variable with expression an_expression, with empty label, statement number and ordering of statement stat, and empty comments. More...
 
int beautify_ordering (int)
 Special function made for Ronan Keryell who likes a lot when a integer number is coded on 3 bits :-) More...
 
void clean_statement_from_tags (const char *, statement)
 
list get_statements_with_comments_containing (const char *, statement)
 
bool statement_is_contained_in_a_sequence_p (statement, statement)
 
statement sequence_statement_containing (statement, statement)
 
void replace_in_sequence_statement_with (statement, statement, statement)
 Replace statement old_stat by statement new_stat, asserting that this statement is contained in a sequence. More...
 
list references_for_regions (list)
 Return a list of references corresponding to a list of regions. More...
 

Variables

hash_table gLoopToOpt
 cproto-generated files More...
 
hash_table gLoopToOuterInd
 comEngine_generate_code.c More...
 
bool gGenHRE
 
list glToggleInitStats
 
hash_table gRefToHREVar
 comEngine_generate_HRECode.c More...
 
hash_table gLoopToRef
 comEngine_distribute.c More...
 
hash_table gStatToRef
 
hash_table gRefToEff
 
hash_table gLoopToSync
 
hash_table gLoopToSupRef
 
hash_table gLoopToUnSupRef
 
entity gHREMemory
 
expression gBufferSizeEnt
 
int gBufferSize
 
hash_table gRefToFifo
 
hash_table gRefToFifoOff
 
hash_table gRefToHREFifo
 
hash_table gStatToHtOffset
 
hash_table gRefToBuffSize
 
hash_table gIndToNum
 
hash_table gRefToInd
 
hash_table gLoopToToggleEnt
 
hash_table gEntToHREFifo
 
hash_table gRefToToggle
 
hash_table gToggleToInc
 
hash_table gIsNewLoop
 

Macro Definition Documentation

◆ __PHRASEC_LOCAL_H__

#define __PHRASEC_LOCAL_H__

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/phrase/phrase-local.h instead, to add your own modifications. header file built by cproto phrase-local.h

Definition at line 34 of file phrase.h.

Typedef Documentation

◆ arc_label

Definition at line 37 of file phrase.h.

◆ vertex_label

Definition at line 38 of file phrase.h.

Function Documentation

◆ add_index_out_effect_proc()

list add_index_out_effect_proc ( loop  curLoop,
list  lStats 
)
Parameters
curLoopurLoop
lStatsStats

Definition at line 1129 of file comEngine_generate_procCode.c.

1130 {
1131  statement assignStat =
1134 
1135  return gen_nconc(lStats, CONS(STATEMENT, assignStat, NIL));
1136 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
statement make_assign_statement(expression, expression)
Definition: statement.c:583
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 loop_range(x)
Definition: ri.h:1642
#define loop_index(x)
Definition: ri.h:1640
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CONS, copy_expression(), entity_to_expression(), gen_nconc(), loop_index, loop_range, make_assign_statement(), NIL, range_upper, and STATEMENT.

Referenced by generate_code_loop().

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

◆ add_parameter_variable_to_module()

void add_parameter_variable_to_module ( reference  ref,
entity  module,
statement  stat,
string  new_module_name,
int  param_nb 
)

Declare in the newly created module a new variable (which will be a parameter of the module), and replace all occurences to the old variable by the new created.

Assert that entity represent a value code

Get the variable name

trdup("")

Parameters
refef
moduleodule
stattat
new_module_nameew_module_name
param_nbaram_nb

Definition at line 633 of file phrase_distributor.c.

638 {
639  parameter new_parameter;
641  list module_parameters;
643  string variable_name;
644 
645  pips_debug(2, "Registering parameter: %s\n", entity_local_name(reference_variable(ref)));
646 
647  /* Assert that entity represent a value code */
648  pips_assert("It is a module", entity_module_p(module));
649 
650  /* Get the variable name */
653 
656  new_module_name,
657  module,
658  param_nb);
659 
661 
663 
666 
667  new_parameter = make_parameter (entity_type(new_variable),
669  /*strdup("")*/make_dummy_identifier(new_variable));
670 
672 
674  = CONS(PARAMETER, new_parameter, module_parameters);
675 
676 }
dummy make_dummy_identifier(entity _field_)
Definition: ri.c:620
parameter make_parameter(type a1, mode a2, dummy a3)
Definition: ri.c:1495
mode make_mode_reference(void)
Definition: ri.c:1356
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
static entity new_variable
entity to be replaced, the primary?
Definition: dynamic.c:860
void replace_reference(void *s, reference old, entity new)
Replace an old reference by a reference to a new entity in a statement.
Definition: replace.c:124
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
static string get_externalized_function_param_name(entity variable, int param_nb)
static entity create_parameter_variable_for_new_module(entity a_variable, string new_name, string new_module_name, entity module, int param_nb)
Creates a variable declared as a parameter in specified module.
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
bool entity_module_p(entity e)
Definition: entity.c:683
#define reference_variable(x)
Definition: ri.h:2326
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define type_functional(x)
Definition: ri.h:2952
#define code_declarations(x)
Definition: ri.h:784
#define functional_parameters(x)
Definition: ri.h:1442
#define PARAMETER(x)
PARAMETER.
Definition: ri.h:1788
#define value_code(x)
Definition: ri.h:3067
#define entity_type(x)
Definition: ri.h:2792
#define entity_initial(x)
Definition: ri.h:2796
char * variable_name(Variable v)
polynome_ri.c
Definition: polynome_ri.c:73
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
list module_declarations(entity m)
High-level functions about modules, using pipsdbm and ri-util and some global variables assumed prope...
Definition: module.c:58

References code_declarations, CONS, create_parameter_variable_for_new_module(), ENTITY, entity_initial, entity_local_name(), entity_module_p(), entity_type, functional_parameters, get_externalized_function_param_name(), make_dummy_identifier(), make_mode_reference(), make_parameter(), module, module_declarations(), new_variable, PARAMETER, pips_assert, pips_debug, ref, reference_variable, replace_reference(), type_functional, value_code, and variable_name().

Referenced by create_module_with_statement().

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

◆ add_private_variable_to_module()

void add_private_variable_to_module ( reference  ref,
entity  module,
statement  stat,
string  new_module_name 
)

Declare in the newly created module a new variable (which will be a private to the module), and replace all occurences to the old variable by the new created.

Assert that entity represent a value code

Get the variable name

Creates the variable

Parameters
refef
moduleodule
stattat
new_module_nameew_module_name

Definition at line 683 of file phrase_distributor.c.

687 {
690  string variable_name;
691 
692  pips_debug(2, "Registering private variable: %s\n", entity_local_name(reference_variable(ref)));
693 
694  /* Assert that entity represent a value code */
695  pips_assert("It is a module", entity_module_p(module));
696 
697  /* Get the variable name */
699 
700  /* Creates the variable */
701  new_variable
704  new_module_name,
705  module);
706 
708 
710 
713 
714 }
entity create_private_variable_for_new_module(entity a_variable, const char *new_name, const char *new_module_name, entity module)
Creates a private variable in specified module.
static string get_externalized_function_private_param_name(entity variable)

References code_declarations, CONS, create_private_variable_for_new_module(), ENTITY, entity_initial, entity_local_name(), entity_module_p(), get_externalized_function_private_param_name(), module, module_declarations(), new_variable, pips_assert, pips_debug, ref, reference_variable, replace_reference(), value_code, and variable_name().

Referenced by create_module_with_statement().

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

◆ beautify_ordering()

int beautify_ordering ( int  an_ordering)

Special function made for Ronan Keryell who likes a lot when a integer number is coded on 3 bits :-)

Parameters
an_orderingn_ordering

Definition at line 407 of file phrase_tools.c.

408 {
409  int ordering_up = (an_ordering & 0xffff0000) >> 16;
410  int ordering_down = (an_ordering & 0x0000ffff);
411  return ordering_up + ((ordering_down-1) << 16);
412 }

Referenced by entry_state_variable_value_for_unstructured(), and make_transition_statement().

+ Here is the caller graph for this function:

◆ clean_statement_from_tags()

void clean_statement_from_tags ( const char *  comment_portion,
statement  stat 
)
Parameters
comment_portionomment_portion
stattat

Definition at line 414 of file phrase_tools.c.

416 {
417  string comments;
418  char* next_line;
419  string searched_string;
420 
421  if (!statement_with_empty_comment_p(stat)) {
422 
423  string new_comments = NULL;
424 
425  searched_string = strdup(comment_portion);
426  searched_string[strcspn(comment_portion, "%s")] = '\0';
427  comments = strdup(statement_comments(stat));
428  next_line = strtok (comments, "\n");
429  if (next_line != NULL) {
430  do {
431  if (strstr(next_line,searched_string) == NULL) {
432  if (new_comments != NULL) {
433  new_comments = strdup(concatenate(new_comments, next_line, "\n", NULL));
434  }
435  else {
436  new_comments = strdup(concatenate("", next_line, "\n", NULL));
437  }
438  }
439  next_line = strtok(NULL, "\n");
440  }
441  while (next_line != NULL);
442  }
443 
444  if (new_comments != NULL) {
445  statement_comments(stat) = new_comments;
446  }
447  else {
449  }
450  }
451 
452 }
bool statement_with_empty_comment_p(statement)
Return true if the statement has an empty statement:
Definition: statement.c:126
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define empty_comments
Empty comments (i.e.
#define statement_comments(x)
Definition: ri.h:2456
char * strdup()

References concatenate(), empty_comments, statement_comments, statement_with_empty_comment_p(), and strdup().

Referenced by remove_begin_tag(), and remove_end_tag().

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

◆ clone_variable_with_new_name()

entity clone_variable_with_new_name ( entity  a_variable,
const char *  new_name,
const char *  module_name 
)

This function build and return new variable from a variable a_variable, with name new_name.

If an entity called new_name already exists, return NULL. New variable is added to declarations

Assert that module represent a value code

This entity does not exist, we can safely create it

new_variable = copy_entity (a_variable); entity_name(new_variable) = strdup(concatenate(module_name, MODULE_SEP_STRING, new_name, NULL));

ew_variable = find_or_create_scalar_entity (strdup(concatenate(module_name, MODULE_SEP_STRING, new_name, NULL)),module_name, is_basic_int);

This entity already exist, we return null

Parameters
a_variable_variable
new_nameew_name
module_nameodule_name

Definition at line 269 of file phrase_tools.c.

272 {
273  entity module;
275 
277  /* Assert that module represent a value code */
278  pips_assert("it is a code", value_code_p(entity_initial(module)));
279 
282  new_name,
283  NULL),
285  {
286  /* This entity does not exist, we can safely create it */
287 
288  /* new_variable = copy_entity (a_variable);
289  entity_name(new_variable)
290  = strdup(concatenate(module_name,
291  MODULE_SEP_STRING,
292  new_name, NULL)); */
293 
296  new_name, NULL)),
300 
301  /*new_variable
302  = find_or_create_scalar_entity (strdup(concatenate(module_name,
303  MODULE_SEP_STRING,
304  new_name, NULL)),module_name,
305  is_basic_int);*/
306 
308  return new_variable;
309  }
310  else
311  {
312  /* This entity already exist, we return null */
313  return NULL;
314  }
315 }
type copy_type(type p)
TYPE.
Definition: ri.c:2655
value copy_value(value p)
VALUE.
Definition: ri.c:2784
storage copy_storage(storage p)
STORAGE.
Definition: ri.c:2228
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
static entity a_variable
#define MODULE_SEP_STRING
Definition: naming-local.h:30
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define make_entity(n, t, s, i)
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
void AddEntityToDeclarations(entity, entity)
END_EOLE.
Definition: variable.c:108
#define value_code_p(x)
Definition: ri.h:3065
#define entity_storage(x)
Definition: ri.h:2794
#define entity_undefined
Definition: ri.h:2761
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410

◆ code_has_write_eff_ref_p()

bool code_has_write_eff_ref_p ( reference  ref,
statement  stat 
)
Parameters
refef
stattat

Definition at line 563 of file comEngine_feasability.c.

564 {
565  bool actionWrite = false;
566 
567  MAP(EFFECT, f,
568  {
569  bool effEntIsIndex = false;
570  entity effEnt = effect_entity(f);
571 
572  MAP(STATEMENT,loopStat,
573  {
574  entity index = loop_index(statement_loop(loopStat));
575 
576  if(same_entity_p(index, effEnt))
577  {
578  effEntIsIndex = true;
579  }
580 
581  }, lLoop);
582 
583  if(effEntIsIndex)
584  {
585  continue;
586  }
587 
590  {
591  actionWrite = true;
592  }
593 
595 
596  return actionWrite;
597 }
static list lLoop
list load_cumulated_rw_effects_list(statement)
entity effect_entity(effect)
cproto-generated files
Definition: effects.c:52
#define effect_action(x)
Definition: effects.h:642
#define action_write_p(x)
Definition: effects.h:314
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
#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
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321

References action_write_p, EFFECT, effect_action, effect_entity(), f(), lLoop, load_cumulated_rw_effects_list(), loop_index, MAP, ref, reference_variable, same_entity_p(), STATEMENT, and statement_loop().

Referenced by check_loop_distribution_feasability(), phrase_check_reference(), and process_ref_list().

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

◆ comEngine_distribute()

void comEngine_distribute ( const char *  module_name,
statement  module_stat,
entity  module 
)
Parameters
module_nameodule_name
module_statodule_stat
moduleodule

Definition at line 469 of file comEngine_distribute.c.

472 {
473  list l_stats;
474  hash_table ht_stats;
475  hash_table ht_params;
476  hash_table ht_private;
477  hash_table ht_in_regions;
478  hash_table ht_out_regions;
479 
480  graph dg = (graph) db_get_memory_resource(DBR_DG, module_name, true);
481 
482  l_stats = identify_analyzed_statements_to_distribute (module_stat);
483 
485  module_stat,
486  module,
487  &ht_stats,
488  &ht_params,
489  &ht_private,
490  &ht_in_regions,
491  &ht_out_regions);
492 
493  HASH_MAP (function_name, stat, {
495  function_name,
496  stat,
497  hash_get(ht_in_regions,function_name),
498  hash_get(ht_out_regions,function_name),
499  hash_get(ht_params,function_name),
500  hash_get(ht_private,function_name),
501  dg);
502  },ht_stats);
503 
504  hash_table_free(ht_stats);
505  hash_table_free(ht_params);
506  hash_table_free(ht_private);
507  hash_table_free(ht_in_regions);
508  hash_table_free(ht_out_regions);
509 }
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
static void comEngine_distribute_code(const char *module_name, string function_name, statement externalized_code, list l_in, list l_out, list l_params, list l_priv, graph dg)
tatic void create_HRE_modules(statement externalized_code, string new_module_name,...
bool compute_distribution_context(list l_stats, statement module_stat, entity module, hash_table *ht_stats, hash_table *ht_params, hash_table *ht_private, hash_table *ht_in_regions, hash_table *ht_out_regions)
This function is called during PHRASE distribution.
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
list identify_analyzed_statements_to_distribute(statement)
This function return a list of statements that were previously marked for externalization during phas...

References comEngine_distribute_code(), compute_distribution_context(), db_get_memory_resource(), dg, hash_get(), HASH_MAP, hash_table_free(), identify_analyzed_statements_to_distribute(), module, and module_name().

Referenced by phrase_comEngine_distributor().

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

◆ comEngine_expression_to_reference_list()

list comEngine_expression_to_reference_list ( expression  e,
list  lr 
)

comEngine_feasability.c

comEngine_feasability.c

references to functions and constants (which are encoded as null-ary functions) are not recorded

Parameters
lrr

Definition at line 100 of file comEngine_feasability.c.

103 {
104  syntax s = expression_syntax(e);
105  lr = local_syntax_to_reference_list(s, lr);
106  return lr;
107 }
static list local_syntax_to_reference_list(syntax s, list lr)
#define expression_syntax(x)
Definition: ri.h:1247

References expression_syntax, and local_syntax_to_reference_list().

Referenced by check_call_distribution_feasability(), check_test_distribution_feasability(), fill_gRefToEncLoop_call(), fill_gRefToEncLoop_test(), generate_code_call(), HRE_distribute_call(), HRE_distribute_test(), local_syntax_to_reference_list(), and reference_indices_entity_list().

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

◆ comEngine_feasability()

bool comEngine_feasability ( statement  externalized_code,
graph  dg 
)
Parameters
externalized_codexternalized_code
dgg

Definition at line 1177 of file comEngine_feasability.c.

1178 {
1179  bool success = false;
1180 
1181  // Initialize some global variables
1182  gDg = dg;
1183  g_externalized_code = externalized_code;
1184  gIfCount = 0;
1186  lLoop = NIL;
1187  glIndUsed = NIL;
1188 
1190 
1191  // Fill the hash_table gRefToEncLoop
1192  fill_gRefToEncLoop(externalized_code);
1193 
1194  pips_assert("lLoop == NIL", lLoop == NIL);
1195 
1196  // Perform the actual analysis
1197  success = check_distribution_feasability(externalized_code);
1198 
1200 
1201  // Free some global variables
1202  HASH_MAP(curRef, curLoopList,
1203  {
1204  gen_free_list(curLoopList);
1205  }, gRefToEncLoop);
1208 
1209  return success;
1210 }
static graph gDg
static statement g_externalized_code
static hash_table gRefToEncLoop
static void fill_gRefToEncLoop(statement stat)
static list glIndUsed
static bool check_distribution_feasability(statement stat)
static int gIfCount
bool success
Definition: gpips-local.h:59
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
void hash_dont_warn_on_redefinition(void)
Definition: hash.c:188
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void hash_warn_on_redefinition(void)
these function set the variable should_i_warn_on_redefinition to the value true or false
Definition: hash.c:183
@ hash_pointer
Definition: newgen_hash.h:32

References check_distribution_feasability(), dg, fill_gRefToEncLoop(), g_externalized_code, gDg, gen_free_list(), gIfCount, glIndUsed, gRefToEncLoop, hash_dont_warn_on_redefinition(), HASH_MAP, hash_pointer, hash_table_free(), hash_table_make(), hash_warn_on_redefinition(), lLoop, NIL, and pips_assert.

Referenced by comEngine_distribute_code().

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

◆ comEngine_generate_code()

statement comEngine_generate_code ( statement  stat)
Parameters
stattat

Definition at line 1187 of file comEngine_generate_code.c.

1188 {
1189  statement newStat = statement_undefined;
1190 
1191  // Initialize some global variables
1192  COM_OPT = true;
1193  gExecPut = false;
1196  glCurLoop = NIL;
1197  glCurRep = NIL;
1199  glOutEffStats = NIL;
1201 
1202  // Do the job
1203  newStat = generate_code_function(stat, false);
1204 
1205  if(statement_block_p(stat))
1206  {
1207  newStat = process_code_seq(newStat, stat);
1208  }
1209 
1210  // Add the loop indices statements
1211  if(glOutEffStats != NIL)
1212  {
1213  newStat =
1215  glOutEffStats));
1216  }
1217 
1218  // Add the toggle initialization statements
1219  if(glToggleInitStats != NIL)
1220  {
1221  newStat =
1223  CONS(STATEMENT, newStat, NIL)));
1224  }
1225 
1226  // Free some global variables
1230 
1231  return newStat;
1232 }
static list glCurLoop
list glToggleInitStats
static bool gExecPut
static list glCurRep
static list glOutEffStats
static hash_table gHtCurNewInd
hash_table gLoopToOuterInd
comEngine_generate_code.c
statement generate_code_function(statement stat, bool bCalledFromSeq)
static statement process_code_seq(statement newStat, statement stat)
static bool COM_OPT
hash_table gLoopToOpt
cproto-generated files
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
#define statement_block_p(stat)
#define statement_undefined
Definition: ri.h:2419

References COM_OPT, CONS, gen_nconc(), generate_code_function(), gExecPut, gHtCurNewInd, glCurLoop, glCurRep, gLoopToOpt, gLoopToOuterInd, glOutEffStats, glToggleInitStats, hash_pointer, hash_table_free(), hash_table_make(), make_block_statement(), NIL, process_code_seq(), STATEMENT, statement_block_p, and statement_undefined.

Referenced by comEngine_generate_HRECode(), and comEngine_generate_procCode().

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

◆ comEngine_generate_HRECode()

statement comEngine_generate_HRECode ( statement  ,
string  ,
list  ,
list  ,
list  ,
list  ,
const char *  ,
int   
)

◆ comEngine_generate_procCode()

statement comEngine_generate_procCode ( statement  ,
list  ,
list   
)

◆ comEngine_make_new_scalar_variable()

entity comEngine_make_new_scalar_variable ( const char *  prefix,
basic  bas 
)
Parameters
prefixrefix
basas

Definition at line 94 of file comEngine_generate_code.c.

96 {
97  entity retEnt = entity_undefined;
100  bas);
101  AddEntityToCurrentModule(retEnt);
102 
103  return retEnt;
104 }
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
static const char * prefix
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
Definition: variable.c:260
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
Definition: variable.c:592

References AddEntityToCurrentModule(), entity_undefined, get_current_module_entity(), make_new_scalar_variable_with_prefix(), and prefix.

Referenced by comEngine_generate_procCode(), fill_gLoopToToggleEnt(), generate_code_loop(), regenerate_toggles(), and usual_loop_tiling().

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

◆ comEngine_opt_loop_interchange()

statement comEngine_opt_loop_interchange ( statement  stat,
statement  innerStat,
entity  newInd 
)
Parameters
stattat
innerStatnnerStat
newIndewInd

Definition at line 411 of file comEngine_optimization_function.c.

413 {
414  printf("comEngine_opt_loop_interchange\n");
415  print_statement(innerStat);
416 
417  pips_assert("innerStat is a loop statement", statement_loop_p(innerStat));
418 
419  statement body = loop_body(statement_loop(innerStat));
420 
421  if(!statement_block_p(body))
422  {
423  return innerStat;
424  }
425 
426  printf("stat\n");
427  print_statement(stat);
428 
429  bool allowedOpt = (intptr_t)hash_get(gLoopToOpt, stat);
430 
431  pips_assert("allowedOpt != HASH_UNDEFINED_VALUE",
432  allowedOpt != (intptr_t)HASH_UNDEFINED_VALUE);
433 
434  if(!allowedOpt)
435  {
436  printf("opt not all\n");
437  return innerStat;
438  }
439  else
440  {
441  printf("opt all\n");
442  }
443 
444  glSeqs = NIL;
445  glStats = NIL;
446 
448 
449  if(glStats != NIL)
450  {
451  printf("put glSeqs 3\n");
452  MAP(STATEMENT, curStat,
453  {
454  print_statement(curStat);
455  }, glStats);
456 
458 
459  glStats = NIL;
460  }
461 
462  list lStats = NIL;
463  statement loopPattern = make_loopPattern(innerStat);
464 
465  //printf("glSeqs\n");
466  MAP(LIST, curList,
467  {
468  /*
469  //printf("glSeqs it 1\n");
470  MAP(STATEMENT, curStat,
471  {
472  //printf("glSeqs it 2\n");
473  //print_statement(curStat);
474  //printf("glSeqs it 2 end\n");
475 
476  }, curList);
477  */
478 
479  statement seqStat = make_seqStat(stat, loopPattern, curList, newInd);
480 
481  lStats = gen_nconc(lStats, CONS(STATEMENT, seqStat, NIL));
482 
483  }, glSeqs);
484 
486 
487  free_statement(loopPattern);
488 
489  printf("bef 2\n");
491  printf("aft 2\n");
492 
493  free_statement(innerStat);
494 
495  statement newStat = make_block_statement(lStats);
496 
497  printf("comEngine_opt_loop_interchange newStat\n");
498  print_statement(newStat);
499 
500  return newStat;
501 }
void free_statement(statement p)
Definition: ri.c:2189
static list glStats
static statement make_loopPattern(statement innerStat)
static statement make_seqStat(statement stat, statement loopPattern, list oldCurList, entity newInd)
static list glSeqs
static void opt_loop_interchange_fill_lists(statement stat)
#define LIST(x)
Definition: genC.h:93
bool statement_loop_p(statement)
Definition: statement.c:349
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
#define loop_body(x)
Definition: ri.h:1644
int printf()
#define intptr_t
Definition: stdint.in.h:294

References CONS, free_statement(), gen_free_list(), gen_nconc(), gLoopToOpt, glSeqs, glStats, hash_get(), HASH_UNDEFINED_VALUE, intptr_t, LIST, loop_body, make_block_statement(), make_loopPattern(), make_seqStat(), MAP, NIL, opt_loop_interchange_fill_lists(), pips_assert, print_statement(), printf(), STATEMENT, statement_block_p, statement_loop(), statement_loop_p(), and statement_undefined.

Referenced by usual_loop_tiling().

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

◆ comEngine_replace_reference_in_stat()

void comEngine_replace_reference_in_stat ( statement  stat,
reference  ref,
expression  new 
)
Parameters
stattat
refef
newew

Definition at line 871 of file comEngine_generate_procCode.c.

873 {
874  gRefToReplace = ref;
875 
876  gen_context_recurse(stat, new,
878 }
static void comEngine_replace_reference_in_stat_rwt(expression exp, expression newExp)
static reference gRefToReplace
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
Definition: genClib.c:2785
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154

References comEngine_replace_reference_in_stat_rwt(), expression_domain, gen_context_recurse, gen_true2(), gRefToReplace, and ref.

Referenced by generate_code_loop(), make_lInitStats(), make_lSwitchStats(), make_mmcd_stats_from_ref(), process_innerStat1_proc(), regenerate_toggles(), replace_array_ref_with_fifos(), and replace_array_ref_with_fifos2().

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

◆ compute_distribution_context()

bool compute_distribution_context ( list  l_stats,
statement  module_stat,
entity  module,
hash_table ht_stats,
hash_table ht_params,
hash_table ht_private,
hash_table ht_in_regions,
hash_table ht_out_regions 
)

distribution_context.c

distribution_context.c

The goal here is to compute the context of the distribution from a given list of statements (after distribution initialization). Those results are stored in following hashtable:

HT_STATS: This hashtable stores the statement (values) associated to names (keys) of externalized function.

HT_PARAMS: This hashtable stores the list of regions (values) associated to names (keys) of externalized function. Those regions are computed as union of IN and OUT regions of specified statement. If two or more regions refer to the same variable (entity), those regions are transformed into ONE region (which could be converted to a MAY region). This hashtable is used to compute the parameters of specified externalized function.

HT_PRIVATE: This hashtable stores the list of privates regions (values) associated to names (keys) of externalized function. This hashtable is used to compute the private working area in specified externalized function.

HT_IN_REGIONS: This hashtable stores the list of IN regions (values) associated to names (keys) of externalized function. This hashtable is used to compute OUTPUT communication after externalized function execution.

HT_OUT_REGIONS: This hashtable stores the list of OUT regions (values) associated to names (keys) of externalized function. This hashtable is used to compute OUTPUT communication after externalized function execution.

Return true if everything is OK

NB: All lists are sorted using externalized fonction name

lazy init

lazy init

lazy init

lazy init

lazy init

Register new externalized function

Parameters
l_stats_stats
module_statodule_stat
moduleodule
ht_statst_stats
ht_paramst_params
ht_privatet_private
ht_in_regionst_in_regions
ht_out_regionst_out_regions

Definition at line 113 of file distribution_context.c.

121 {
122  bool returned_value = true;
123 
124  pips_debug(5, "[BEGIN] compute_distribution_context for %s: \n",
126 
127  *ht_stats = hash_table_make (hash_pointer, 0); /* lazy init */
128  *ht_params = hash_table_make (hash_pointer, 0); /* lazy init */
129  *ht_private = hash_table_make (hash_pointer, 0); /* lazy init */
130  *ht_in_regions = hash_table_make (hash_pointer, 0); /* lazy init */
131  *ht_out_regions = hash_table_make (hash_pointer, 0); /* lazy init */
132 
133  MAP (STATEMENT, s, {
134  statement externalized_code = NULL;
135  int stats_nb;
136  string function_name = get_externalized_and_analyzed_function_name(s, &stats_nb);
137  if (stats_nb > 1) {
138  externalized_code = sequence_statement_containing (module_stat, s);
139  }
140  else if (stats_nb == 1) {
141  externalized_code = s;
142  }
143  else {
144  pips_internal_error("Strange externalized code");
145  }
146 
147  /* Register new externalized function */
148  pips_debug(5, "Register externalized function %s: \n",
149  function_name);
150  if (!hash_defined_p(*ht_stats,function_name)) {
151  hash_put(*ht_stats,function_name,externalized_code);
152  }
153  else {
154  pips_user_warning("Multiply defined value in STATS hash_table!\n");
155  returned_value = false;
156  }
157 
158  pips_debug(3, "ANALYSING function named [%s]..................\n",
159  function_name);
160 
161  if (!internal_compute_distribution_context (externalized_code,
162  ht_params,
163  ht_private,
164  ht_in_regions,
165  ht_out_regions,
166  function_name)) {
167  returned_value = false;
168  }
169  }, l_stats);
170 
171  pips_debug(5, "[END] compute_distribution_context for %s: \n",
173 
174  return returned_value;
175 }
bool internal_compute_distribution_context(statement externalized_code, hash_table *ht_params, hash_table *ht_private, hash_table *ht_in_regions, hash_table *ht_out_regions, void *key_value)
Internally used to compute distribution context for statement externalized_code.
string get_externalized_and_analyzed_function_name(statement stat, int *stats_nb)
Return the identified function name of the externalized portion of code by searching comment matching...
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
bool hash_defined_p(const hash_table htp, const void *key)
true if key has e value in htp.
Definition: hash.c:484
#define pips_user_warning
Definition: misc-local.h:146
#define pips_internal_error
Definition: misc-local.h:149
statement sequence_statement_containing(statement, statement)
Definition: phrase_tools.c:536

◆ compute_distribution_controlization_context()

bool compute_distribution_controlization_context ( list  l_calls,
statement  module_stat,
entity  module,
hash_table ht_calls,
hash_table ht_params,
hash_table ht_private,
hash_table ht_in_regions,
hash_table ht_out_regions 
)

This function is called during PHRASE distribution controlization.

The goal here is to compute the context of the distribution from a given list of call statements (after distribution). Those results are stored in following hashtable:

HT_CALLS: This hashtable stores the list of call statements (values) associated to entity representing the external function (keys). This is a list because a same function can be called from multiple points of original program

HT_PARAMS: This hashtable stores the list of regions (values) associated to entity representing the external function (keys). Those regions are computed as union of IN and OUT regions of specified statement. If two or more regions refer to the same variable (entity), those regions are transformed into ONE region (which could be converted to a MAY region). This hashtable is used to compute the parameters of specified externalized function.

HT_PRIVATE: This hashtable stores the list of privates regions (values) associated to entity representing the external function (keys). This hashtable is used to compute the private working area in specified externalized function.

HT_IN_REGIONS: This hashtable stores the list of IN regions (values) associated to entity representing the external function (keys). This hashtable is used to compute OUTPUT communication after externalized function execution.

HT_OUT_REGIONS: This hashtable stores the list of OUT regions (values) associated to entity representing the external function (keys). This hashtable is used to compute OUTPUT communication after externalized function execution.

Return true if everything is OK

NB: All lists are sorted using externalized fonction name

lazy init

lazy init

lazy init

lazy init

lazy init

Register new externalized function

This function has NOT been already defined, Register it

This function has already been defined, add this statement to the list

Check that IN and OUT regions match !

NOT IMPLEMENTED Yet !

Parameters
l_calls_calls
module_statodule_stat
moduleodule
ht_callst_calls
ht_paramst_params
ht_privatet_private
ht_in_regionst_in_regions
ht_out_regionst_out_regions

Definition at line 216 of file distribution_context.c.

224 {
225  bool returned_value = true;
226  string function_name;
227  entity externalized_function;
228 
229  pips_debug(5, "[BEGIN] compute_distribution_controlization_context for %s: \n",
231  ifdebug(9) {
232  print_statement(module_stat);
233  }
234 
235  *ht_calls = hash_table_make (hash_pointer, 0); /* lazy init */
236  *ht_params = hash_table_make (hash_pointer, 0); /* lazy init */
237  *ht_private = hash_table_make (hash_pointer, 0); /* lazy init */
238  *ht_in_regions = hash_table_make (hash_pointer, 0); /* lazy init */
239  *ht_out_regions = hash_table_make (hash_pointer, 0); /* lazy init */
240 
241 
242  MAP (STATEMENT, s, {
243 
244  function_name = get_externalized_function_name(s);
245 
246  pips_debug(5, "Register statement calling externalized function %s: \n",
247  function_name);
248 
249  externalized_function = module_name_to_entity(function_name);
250 
251  /* Register new externalized function */
252 
253  if (!hash_defined_p(*ht_calls,externalized_function)) {
254  /* This function has NOT been already defined,
255  Register it */
256  pips_debug(2, "Register statement for NEW function %s\n", function_name);
257  hash_put(*ht_calls,externalized_function,CONS(STATEMENT, s, NIL));
259  ht_params,
260  ht_private,
261  ht_in_regions,
262  ht_out_regions,
263  externalized_function)) {
264  returned_value = false;
265  }
266  }
267  else {
268  /* This function has already been defined,
269  add this statement to the list */
270  list l_stats = (list)hash_get(*ht_calls,externalized_function);
271  hash_put(*ht_calls,externalized_function,CONS(STATEMENT, s, l_stats));
272  /* Check that IN and OUT regions match ! */
273  /* NOT IMPLEMENTED Yet ! */
274  pips_debug(2, "Adding statement to function %s\n", function_name);
275  }
276 
277  pips_debug(3, "ANALYSING function named [%s]..................\n",
278  function_name);
279 
280  }, l_calls);
281 
282  pips_debug(5, "[END] compute_distribution_controlization_context for %s: \n",
284 
285  return returned_value;
286 }
string get_externalized_function_name(statement stat)
Return the identified function name of the externalized portion of code by searching comment matching...
struct cons * list
Definition: newgen_types.h:106
#define ifdebug(n)
Definition: sg.c:47

◆ compute_region_variables()

void compute_region_variables ( effect  ,
list ,
list  
)

Referenced by controlize_distribution().

+ Here is the caller graph for this function:

◆ compute_regions_union()

list compute_regions_union ( list  l_in,
list  l_out 
)

Compute union of exact regions.

Parameters
l_in_in
l_out_out

Definition at line 291 of file distribution_context.c.

292 {
293  list l_union = gen_copy_seq (l_in);
294 
295  pips_debug(4, "BEGIN of computing regions UNION\n");
296  MAP (REGION, reg, {
297  entity e = region_entity (reg);
298  bool is_already_present = false;
299  region reg_already_present = NULL;
300  MAP (REGION, union_reg, {
301  entity e2 = region_entity (union_reg);
302  if (same_entity_p(e, e2)) {
303  is_already_present = true;
304  reg_already_present = union_reg;
305  }
306  }, l_union);
307  if (is_already_present) {
308  if (region_scalar_p(reg)) {
309  pips_debug(6, "Found SCALAR region already present [%s]. Ignored.\n",
310  entity_local_name(e));
311  }
312  else {
313  list new_regions;
314  pips_debug(6, "Found ARRAY region already present [%s].\n",
315  entity_local_name(e));
316  pips_debug(6, "Making UNION of:\n");
317  print_region(reg);
318  pips_debug(6, "and:\n");
319  print_region(reg_already_present);
320  new_regions = region_must_union(reg,reg_already_present);
321  pips_debug(6, "Getting:\n");
322  print_regions(new_regions);
323  if (gen_length(new_regions) > 1) {
324  pips_internal_error("Regions union must refer to only ONE region !");
325  }
326  else {
327  gen_remove (&l_union, reg_already_present);
328  l_union = CONS (REGION, REGION(gen_nth(0,new_regions)), l_union);
329  }
330  }
331  }
332  else {
333  pips_debug(6, "Adding region for [%s]\n", entity_local_name(e));
334  l_union = CONS(REGION, reg, l_union);
335  }
336  }, l_out);
337 
338  pips_debug(4, "END of computing regions UNION\n");
339  return l_union;
340 }
#define region_entity(reg)
#define REGION
#define region
simulation of the type region
#define region_scalar_p(reg)
list region_must_union(region r1, region r2)
computes the must union of two combinable array regions
void print_regions(list)
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
size_t gen_length(const list l)
Definition: list.c:150
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
Definition: list.c:710
#define print_region(x)
Definition: print.c:343

References CONS, entity_local_name(), gen_copy_seq(), gen_length(), gen_nth(), gen_remove(), MAP, pips_debug, pips_internal_error, print_region, print_regions(), region, REGION, region_entity, region_must_union(), region_scalar_p, and same_entity_p().

Referenced by internal_compute_distribution_context().

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

◆ create_HRE_module()

void create_HRE_module ( const char *  new_module_name,
const char *  module_name,
statement  stat,
entity  new_fun 
)

builds some kind of module / statement for the clone.

add some comments before the code.

give the clonee a user file.

Parameters
new_module_nameew_module_name
module_nameodule_name
stattat
new_funew_fun

Definition at line 283 of file comEngine_distribute.c.

286 {
287  //printf("new HRE module\n");
288  //print_statement(stat);
289 
291 
293 
295  const char* name = entity_local_name(cloned);
296  const char* new_name;
297  string comments;
298  //entity new_fun;
299  //statement stat;
300  bool saved_b1, saved_b2;
301  text t;
302 
303  /* builds some kind of module / statement for the clone.
304  */
305  new_name = new_module_name;
306  //new_fun = make_empty_subroutine(new_name);
307 
308  saved_b1 = get_bool_property(ALL_DECLS);
309  saved_b2 = get_bool_property(STAT_ORDER);
312 
313  //stat = comEngine_generate_HRECode(externalized_code, new_fun, l_in, l_out);
314 
315  //add_variables_to_module(l_params, l_priv,
316  // new_fun, stat);
317 
318  move_declarations(new_fun, stat);
319 
321 
323 
324  t = text_named_module(new_fun, cloned, stat);
325 
326  set_bool_property(ALL_DECLS, saved_b1);
327  set_bool_property(STAT_ORDER, saved_b2);
328 
329  /* add some comments before the code.
330  */
331  comments = strdup(concatenate(
332  "//\n"
333  "// PIPS: please caution!\n"
334  "//\n"
335  "// this routine has been generated as a clone of ", name, "\n"
336  "// the code may change significantly with respect to the original\n"
337  "// version, especially after program transformations such as dead\n"
338  "// code elimination and partial evaluation, hence the function may\n"
339  "// not have the initial behavior, if called under some other context.\n"
340  "//\n", 0));
341  text_sentences(t) =
343  text_sentences(t));
344 
345  make_text_resource_and_free(new_name, DBR_C_SOURCE_FILE, ".c", t);
346  free_statement(stat);
347 
348  /* give the clonee a user file.
349  */
350  DB_PUT_MEMORY_RESOURCE(DBR_USER_FILE, new_name,
351  strdup(db_get_memory_resource(DBR_USER_FILE, name, true)));
352 
353 }
sentence make_sentence(enum sentence_utype tag, void *val)
Definition: text.c:59
#define ALL_DECLS
static void move_declarations(entity new_fun, statement stat)
#define STAT_ORDER
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
text text_named_module(entity, entity, statement)
bool make_text_resource_and_free(const char *, const char *, const char *, text)
Definition: print.c:82
void set_bool_property(const char *, bool)
#define SENTENCE(x)
newgen_unformatted_domain_defined
Definition: text.h:36
#define text_sentences(x)
Definition: text.h:113
@ is_sentence_formatted
Definition: text.h:57

References ALL_DECLS, concatenate(), CONS, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, entity_local_name(), free_statement(), get_bool_property(), get_current_module_entity(), is_sentence_formatted, make_sentence(), make_text_resource_and_free(), module_name(), module_name_to_entity(), move_declarations(), reset_current_module_entity(), SENTENCE, set_bool_property(), set_current_module_entity(), STAT_ORDER, strdup(), text_named_module(), and text_sentences.

Referenced by comEngine_generate_HRECode(), and fill_HRE_module().

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

◆ create_integer_parameter_for_new_module()

entity create_integer_parameter_for_new_module ( const char *  parameter_name,
const char *  module_name,
entity  module,
int  param_nb 
)

Create new integer variable parameter for a newly created module.

Parameters
parameter_namearameter_name
module_nameodule_name
moduleodule
param_nbaram_nb

Definition at line 126 of file phrase_distributor_control_code.c.

130 {
133  parameter_name,
134  module_name,
135  module,
136  param_nb);
137 }
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
entity create_parameter_for_new_module(variable var, const char *parameter_name, const char *module_name, entity module, int param_nb)
Create new variable parameter for a newly created module.
basic MakeBasic(int)
END_EOLE.
Definition: type.c:128
@ is_basic_int
Definition: ri.h:571

References create_parameter_for_new_module(), is_basic_int, make_variable(), MakeBasic(), module, module_name(), and NIL.

Referenced by make_array_communication_module(), make_scalar_communication_module(), make_start_ru_module(), and make_wait_ru_module().

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

◆ create_new_common_variable()

entity create_new_common_variable ( string  name,
entity  module,
entity  common,
variable  var 
)

Creates and declares a new variable for a newly created common.

gen_nreverse(CONS(ENTITY,e,old_layout));

Parameters
nameame
moduleodule
commonommon
varar

Definition at line 194 of file phrase_distributor_control_code.c.

195 {
196  int old_size, variable_size;
197 
198  string var_global_name = strdup(concatenate(module_local_name(module),MODULE_SEP_STRING,
199  name,NULL));
200  type var_type = make_type(is_type_variable, var);
201  storage var_storage = storage_undefined;
202  value var_value = make_value_unknown();
203  entity e = make_entity(var_global_name,var_type,var_storage,var_value);
204  list old_layout = area_layout(type_area(entity_type(common)));
205  old_size = area_size(type_area(entity_type(common)));
206  variable_size = storage_space_of_variable(e);
207  pips_debug(2, "New variable %s created with size %d (old_size was:%d)\n", name, variable_size, old_size);
209  (make_ram(module,common,old_size,NIL)));
210  area_layout(type_area(entity_type(common))) = gen_nconc(old_layout,CONS(ENTITY,e,NIL));
211  /* gen_nreverse(CONS(ENTITY,e,old_layout)); */
212  area_size(type_area(entity_type(common))) = old_size+variable_size;
214  return e;
215 }
value make_value_unknown(void)
Definition: ri.c:2847
storage make_storage(enum storage_utype tag, void *val)
Definition: ri.c:2273
ram make_ram(entity a1, entity a2, intptr_t a3, list a4)
Definition: ri.c:1999
type make_type(enum type_utype tag, void *val)
Definition: ri.c:2706
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
int storage_space_of_variable(entity)
Definition: size.c:656
#define area_size(x)
Definition: ri.h:544
@ is_storage_ram
Definition: ri.h:2492
#define area_layout(x)
Definition: ri.h:546
#define type_area(x)
Definition: ri.h:2946
@ is_type_variable
Definition: ri.h:2900
#define storage_undefined
Definition: ri.h:2476

References AddEntityToDeclarations(), area_layout, area_size, concatenate(), CONS, ENTITY, entity_storage, entity_type, gen_nconc(), is_storage_ram, is_type_variable, make_entity, make_ram(), make_storage(), make_type(), make_value_unknown(), module, module_local_name(), MODULE_SEP_STRING, NIL, pips_debug, storage_space_of_variable(), storage_undefined, strdup(), and type_area.

Referenced by create_externalized_function_common(), and create_new_scalar_common_variable().

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

◆ create_new_integer_scalar_common_variable()

entity create_new_integer_scalar_common_variable ( string  name,
entity  module,
entity  common 
)

Creates and declares a new integer scalar variable for a newly created common.

Parameters
nameame
moduleodule
commonommon

Definition at line 228 of file phrase_distributor_control_code.c.

229 {
231 }
entity create_new_scalar_common_variable(string name, entity module, entity common, basic b)
Creates and declares a new scalar variable for a newly created common.

References create_new_scalar_common_variable(), is_basic_int, MakeBasic(), and module.

Referenced by make_global_common_and_initialize().

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

◆ create_new_scalar_common_variable()

entity create_new_scalar_common_variable ( string  name,
entity  module,
entity  common,
basic  b 
)

Creates and declares a new scalar variable for a newly created common.

Parameters
nameame
moduleodule
commonommon

Definition at line 220 of file phrase_distributor_control_code.c.

221 {
222  return create_new_common_variable( name, module, common, make_variable(b, NIL,NIL));
223 }
entity create_new_common_variable(string name, entity module, entity common, variable var)
Creates and declares a new variable for a newly created common.

References create_new_common_variable(), make_variable(), module, and NIL.

Referenced by create_new_integer_scalar_common_variable().

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

◆ create_parameter_for_new_module()

entity create_parameter_for_new_module ( variable  var,
const char *  parameter_name,
const char *  module_name,
entity  module,
int  param_nb 
)

phrase_distributor_control_code.c

phrase_distributor_control_code.c

This entity does not exist, we can safely create it

G used to be strdup("")

Parameters
varar
parameter_namearameter_name
module_nameodule_name
moduleodule
param_nbaram_nb

Definition at line 74 of file phrase_distributor_control_code.c.

79 {
81  parameter new_parameter;
83  list module_parameters;
84 
87  parameter_name,
88  NULL),
90  {
91  /* This entity does not exist, we can safely create it */
92 
95  parameter_name, NULL)),
99 
101 
104 
105  new_parameter = make_parameter (entity_type(new_variable),
107  make_dummy_identifier(new_variable)/*SG used to be strdup("")*/);
108 
110 
112  = CONS(PARAMETER, new_parameter, module_parameters);
113 
114  return new_variable;
115  }
116  else
117  {
118  pips_internal_error("Entity already exist: %s", parameter_name);
119  return NULL;
120  }
121 }
type make_type_variable(variable _field_)
Definition: ri.c:2715
variable copy_variable(variable p)
VARIABLE.
Definition: ri.c:2859
storage make_storage_formal(formal _field_)
Definition: ri.c:2282
formal make_formal(entity a1, intptr_t a2)
Definition: ri.c:1067

References code_declarations, concatenate(), CONS, copy_variable(), ENTITY, entity_domain, entity_initial, entity_type, entity_undefined, functional_parameters, gen_find_tabulated(), make_dummy_identifier(), make_entity, make_formal(), make_mode_reference(), make_parameter(), make_storage_formal(), make_type_variable(), make_value_unknown(), module, module_declarations(), module_name(), MODULE_SEP_STRING, new_variable, PARAMETER, pips_internal_error, strdup(), type_functional, and value_code.

Referenced by make_array_communication_module(), and make_scalar_communication_module().

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

◆ create_private_integer_variable_for_new_module()

entity create_private_integer_variable_for_new_module ( string  new_name,
const char *  new_module_name,
entity  module 
)

Creates an integer variable in specified module.

This entity does not exist, we can safely create it

Add to declarations....

Parameters
new_nameew_name
new_module_nameew_module_name
moduleodule

Definition at line 775 of file phrase_distributor_communication.c.

778 {
780  entity a;
781  basic base;
782 
783  if ((gen_find_tabulated(concatenate(new_module_name,
785  new_name,
786  NULL),
788  {
789  /* This entity does not exist, we can safely create it */
790 
791  new_variable = make_entity (strdup(concatenate(new_module_name,
793  new_name, NULL)),
797  a = FindEntity(new_module_name, DYNAMIC_AREA_LOCAL_NAME);
801  make_ram(module, a,
804  NIL));
805  /* Add to declarations.... */
807  pips_debug(2, "Created new private variable: %s\n", entity_global_name(new_variable));
808  return new_variable;
809  }
810  else
811  {
812  pips_internal_error("Entity already exist: %s", new_name);
813  return NULL;
814  }
815 }
bdt base
Current expression.
Definition: bdt_read_paf.c:100
#define DYNAMIC_AREA_LOCAL_NAME
Definition: naming-local.h:69
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
Definition: entity.c:1503
string entity_global_name(entity e)
Used instead of the macro to pass as formal argument.
Definition: entity.c:464
int add_variable_to_area(entity, entity)
Definition: variable.c:1376
type MakeTypeVariable(basic, cons *)
BEGIN_EOLE.
Definition: type.c:116
#define value_undefined
Definition: ri.h:3016
@ is_basic_overloaded
Definition: ri.h:574
#define basic_tag(x)
Definition: ri.h:613
#define type_variable(x)
Definition: ri.h:2949
#define variable_basic(x)
Definition: ri.h:3120

References add_variable_to_area(), AddEntityToDeclarations(), base, basic_tag, concatenate(), DYNAMIC_AREA_LOCAL_NAME, entity_domain, entity_global_name(), entity_storage, entity_type, entity_undefined, FindEntity(), gen_find_tabulated(), is_basic_int, is_basic_overloaded, is_storage_ram, make_entity, make_ram(), make_storage(), MakeBasic(), MakeTypeVariable(), module, MODULE_SEP_STRING, new_variable, NIL, pips_debug, pips_internal_error, storage_undefined, strdup(), type_variable, value_undefined, and variable_basic.

Referenced by make_array_communication_module().

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

◆ create_private_variable_for_new_module()

entity create_private_variable_for_new_module ( entity  a_variable,
const char *  new_name,
const char *  new_module_name,
entity  module 
)

Creates a private variable in specified module.

This entity does not exist, we can safely create it

Parameters
a_variable_variable
new_nameew_name
new_module_nameew_module_name
moduleodule

Definition at line 586 of file phrase_distributor.c.

590 {
592  entity a;
593  basic base;
594 
595  if ((gen_find_tabulated(concatenate(new_module_name,
597  new_name,
598  NULL),
600  {
601  /* This entity does not exist, we can safely create it */
602 
603  new_variable = make_entity (strdup(concatenate(new_module_name,
605  new_name, NULL)),
609  a = FindEntity(new_module_name, DYNAMIC_AREA_LOCAL_NAME);
613  make_ram(module, a,
616  NIL));
617  pips_debug(2, "Created new private variable: %s\n", entity_global_name(new_variable));
618  return new_variable;
619  }
620  else
621  {
622  pips_internal_error("Entity already exist: %s", new_name);
623  return NULL;
624  }
625 }

References a_variable, add_variable_to_area(), base, basic_tag, concatenate(), copy_type(), copy_value(), DYNAMIC_AREA_LOCAL_NAME, entity_domain, entity_global_name(), entity_initial, entity_storage, entity_type, entity_undefined, FindEntity(), gen_find_tabulated(), is_basic_overloaded, is_storage_ram, make_entity, make_ram(), make_storage(), module, MODULE_SEP_STRING, new_variable, NIL, pips_debug, pips_internal_error, storage_undefined, strdup(), type_variable, and variable_basic.

+ Here is the call graph for this function:

◆ create_realFifo_proc()

void create_realFifo_proc ( statement  stat,
list  lRef 
)
Parameters
stattat
lRefRef

Definition at line 1210 of file comEngine_generate_procCode.c.

1211 {
1212  list lDone = NIL;
1213 
1214  pips_assert("true", stat==stat);
1215 
1216  //bool readAndWrite = false;
1217 
1218  MAP(REFERENCE, curRef1,
1219  {
1220  bool bDone = false;
1221 
1222  MAP(REFERENCE, refDone,
1223  {
1224  if(reference_equal_p(curRef1, refDone))
1225  {
1226  hash_put(gRefToFifoOff, hash_get(gRefToFifo, refDone), (void *)3);
1227  bDone = true;
1228  break;
1229  }
1230  }, lDone);
1231 
1232  if(bDone)
1233  continue;
1234 
1235  void* fifoNum = hash_get(gRefToFifo, curRef1);
1236 
1237  pips_assert("fifoNum != HASH_UNDEFINED_VALUE",
1238  fifoNum != HASH_UNDEFINED_VALUE);
1239 
1240  hash_put(gRefToFifoOff, fifoNum, (void *)2);
1241 
1242  MAP(REFERENCE, curRef2,
1243  {
1244  if(reference_equal_p(curRef1, curRef2))
1245  {
1246  string effAction1 = hash_get(gRefToEff, curRef1);
1247 
1248  pips_assert("effAction1 != HASH_UNDEFINED_VALUE",
1249  effAction1 != HASH_UNDEFINED_VALUE);
1250 
1251  string effAction2 = hash_get(gRefToEff, curRef2);
1252 
1253  pips_assert("effAction2 != HASH_UNDEFINED_VALUE",
1254  effAction2 != HASH_UNDEFINED_VALUE);
1255 
1256  if(strcmp(effAction1, effAction2))
1257  {
1258  hash_put(gRefToFifoOff, fifoNum, (void *)3);
1259 
1260  lDone = CONS(REFERENCE, curRef1, lDone);
1261 
1262  break;
1263  }
1264  }
1265  }, lRef);
1266  }, lRef);
1267 
1268  gen_free_list(lDone);
1269 
1270  printf("create_realFifo_proc\n");
1271  MAP(REFERENCE, curRef,
1272  {
1273  printf("create_realFifo_proc it\n");
1274  print_reference(curRef);printf("\n");
1275  intptr_t fifoNum = (intptr_t)hash_get(gRefToFifo, curRef);
1276 
1277  pips_assert("fifoNum != HASH_UNDEFINED_VALUE",
1278  fifoNum != (intptr_t)HASH_UNDEFINED_VALUE);
1279 
1280  get_realFifoNum(fifoNum);
1281  }, lRef);
1282 
1283  printf("create_realFifo_proc end\n");
1284 }
hash_table gRefToFifoOff
hash_table gRefToFifo
hash_table gRefToEff
static intptr_t get_realFifoNum(intptr_t fifoNum)
void print_reference(reference r)
Definition: expression.c:142
bool reference_equal_p(reference r1, reference r2)
Definition: expression.c:1500
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296

References CONS, gen_free_list(), get_realFifoNum(), gRefToEff, gRefToFifo, gRefToFifoOff, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, intptr_t, MAP, NIL, pips_assert, print_reference(), printf(), REFERENCE, and reference_equal_p().

Referenced by generate_code_loop().

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

◆ create_state_variable()

entity create_state_variable ( const char *  module_name,
int  name_identifier 
)

This function creates (and add declaration) state variable.

The name of this variable is obtained by the concatenation of string STATE_VARIABLE_NAME and name identifier. If the variable doesn't exist with this name, then the variable is created, added to declarations, and returned. If this variable exists, then this functions search a new name by incrementing the integer name_identifier

Assert that module represent a value code

This variable doesn't exist

Parameters
module_nameodule_name
name_identifierame_identifier

Definition at line 84 of file fsm_tools.c.

86 {
87  entity module;
88  entity new_state_variable;
89  string state_variable_name;
90  //char *buffer;
91 
93 
94  /* Assert that module represent a value code */
95  pips_assert("it is a code", value_code_p(entity_initial(module)));
96 
97  if (name_identifier == 0) {
98  state_variable_name = strdup (STATE_VARIABLE_NAME_NO_REF);
99  }
100  else {
101  asprintf(&state_variable_name, STATE_VARIABLE_NAME, name_identifier);
102  }
103 
106  state_variable_name,
107  NULL),
109 
110  /* This variable doesn't exist */
111 
112  new_state_variable = find_or_create_scalar_entity (state_variable_name,
113  module_name,
114  is_basic_int);
115  AddEntityToDeclarations( new_state_variable,module);
116  return new_state_variable;
117  }
118  else {
120  name_identifier+1);
121  }
122 }
#define STATE_VARIABLE_NAME_NO_REF
#define STATE_VARIABLE_NAME
entity create_state_variable(const char *module_name, int name_identifier)
This function creates (and add declaration) state variable.
Definition: fsm_tools.c:84
#define asprintf
Definition: misc-local.h:225
entity find_or_create_scalar_entity(const char *, const char *, tag)
Looks for an entity which should be a scalar of the specified basic.
Definition: variable.c:1025

Referenced by create_state_variable(), and fsmize_statement().

+ Here is the caller graph for this function:

◆ debug_control()

void debug_control ( const char *  comments,
control  a_control,
int  debug_level 
)

DEBUG FUNCTION: print debugging informations for a control a_control.

Parameters
commentsomments
a_control_control
debug_levelebug_level

Definition at line 134 of file phrase_tools.c.

134  {
135 
136  debug_statement (comments, control_statement(a_control), debug_level);
137  pips_debug(debug_level," predecessors = %zd\n", gen_length(control_predecessors(a_control)));
138  pips_debug(debug_level," successors = %zd\n", gen_length(control_successors(a_control)));
139 
140 }
void debug_statement(const char *comments, statement stat, int debug_level)
DEBUG FUNCTION: print debugging informations for a statement stat.
Definition: phrase_tools.c:111
#define control_predecessors(x)
Definition: ri.h:943
#define control_successors(x)
Definition: ri.h:945
#define control_statement(x)
Definition: ri.h:941

References control_predecessors, control_statement, control_successors, debug_statement(), gen_length(), and pips_debug.

Referenced by flatten_unstructured(), full_spaghettify_module(), and make_transition_statement().

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

◆ debug_statement()

void debug_statement ( const char *  comments,
statement  stat,
int  debug_level 
)

DEBUG FUNCTION: print debugging informations for a statement stat.

Parameters
commentsomments
stattat
debug_levelebug_level

Definition at line 111 of file phrase_tools.c.

112 {
114  pips_debug(debug_level,"%s\n",comments);
115  print_statement(stat);
116  pips_debug(debug_level,"domain number = %"PRIdPTR"\n", statement_domain_number(stat));
117  pips_debug(debug_level,"entity = UNDEFINED\n");
118  pips_debug(debug_level,"statement number = %"PRIdPTR"\n", statement_number(stat));
119  pips_debug(debug_level,"statement ordering = %"PRIdPTR"\n", statement_ordering(stat));
120  if (statement_with_empty_comment_p(stat)) {
121  pips_debug(debug_level,"statement comments = EMPTY\n");
122  }
123  else {
124  pips_debug(debug_level,"statement comments = %s\n", statement_comments(stat));
125  }
126  pips_debug(debug_level,"statement instruction = %s\n", statement_type_as_string(stat));
127  }
128 }
string statement_type_as_string(statement stat)
DEBUG FUNCTION: return a string representing the type of the statement (SEQUENCE, CALL,...
Definition: phrase_tools.c:65
#define statement_ordering(x)
Definition: ri.h:2454
#define statement_domain_number(x)
Definition: ri.h:2448
#define statement_number(x)
Definition: ri.h:2452

References ifdebug, pips_debug, print_statement(), statement_comments, statement_domain_number, statement_number, statement_ordering, statement_type_as_string(), and statement_with_empty_comment_p().

Referenced by full_spaghettify_statement().

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

◆ debug_unstructured()

void debug_unstructured ( unstructured  an_unstructured,
int  debug_level 
)

DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured.

f (ordering > 65535) ordering = ordering >> 16;

f (ordering > 65535) ordering = ordering >> 16;

f (ordering > 65535) ordering = ordering >> 16;

Parameters
an_unstructuredn_unstructured
debug_levelebug_level

Definition at line 146 of file phrase_tools.c.

148 {
149  list blocs = NIL ;
150  string line = "***********************************************************************\n";
151 
152  ifdebug (debug_level) {
153  CONTROL_MAP (current_control, {
154  statement s = control_statement (current_control);
155  string next_nodes_as_string = "";
156  string previous_nodes_as_string = "";
157  char *title;
158  list predecessors = control_predecessors(current_control);
159  list successors = control_successors(current_control);
160  char *temp;
161  size_t i;
162  int ordering = 0;
163 
164  for (i=0; i<gen_length(predecessors); i++) {
167  ordering = beautify_ordering (ordering);
168  /*if (ordering > 65535) ordering = ordering >> 16;*/
169  asprintf (&temp, "[%d] ",ordering);
170  previous_nodes_as_string = strdup (concatenate(previous_nodes_as_string,
171  temp,
172  NULL));
173  free(temp);
174  }
175 
176  for (i=0; i<gen_length(successors); i++) {
178  (CONTROL(gen_nth(i,successors))));
179  ordering = beautify_ordering (ordering);
180  /*if (ordering > 65535) ordering = ordering >> 16;*/
181  asprintf (&temp, "[%d] ",ordering);
182  next_nodes_as_string = strdup (concatenate(next_nodes_as_string,
183  (temp),
184  NULL));
185  free(temp);
186  }
187 
188  ordering = beautify_ordering (ordering);
189  ordering = statement_ordering(s);
190  /*if (ordering > 65535) ordering = ordering >> 16;*/
192  asprintf (&title, "CONTROL: %d\n", ordering);
193  pips_debug(debug_level, "%s\n",
194  strdup(concatenate("\n", line,
195  "* ", (title),
196  line, NULL)));
197  print_statement(s);
198  pips_debug(debug_level, "%s\n",
199  strdup(concatenate("\n", line,
200  "NEXT: ", next_nodes_as_string, "\n",
201  "PREVIOUS: ", previous_nodes_as_string, "\n",
202  line, NULL)));
203  free(title);
204  }
205  }, unstructured_entry(an_unstructured), blocs);
206  }
207 }
static list predecessors(statement st, graph tg)
static list successors(list l)
void free(void *)
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
int beautify_ordering(int an_ordering)
Special function made for Ronan Keryell who likes a lot when a integer number is coded on 3 bits :-)
Definition: phrase_tools.c:407
#define CONTROL(x)
CONTROL.
Definition: ri.h:910
#define unstructured_entry(x)
Definition: ri.h:3004
static int line
FLEX_SCANNER.
Definition: scanner.c:852

References asprintf, beautify_ordering(), concatenate(), CONTROL, CONTROL_MAP, control_predecessors, control_statement, control_successors, free(), gen_length(), gen_nth(), ifdebug, line, NIL, pips_debug, predecessors(), print_statement(), statement_ordering, strdup(), successors(), and unstructured_entry.

+ Here is the call graph for this function:

◆ declare_common_variables_in_module()

void declare_common_variables_in_module ( entity  common,
entity  module 
)

Creates all the things that need to be created in order to declare common in module (all the variable are created)

Compute the primary variables

We iterate on the primary variables declared in the common and create a new variable mapping the one declared in common

Creates the name for the new variable

Copy type of variable

Create storage for new variable

Copy initial value of variable

Build the new variable

Mark for addition

Add to declarations....

Add those new variable to common layout

Parameters
commonommon
moduleodule

Definition at line 237 of file phrase_distributor_control_code.c.

238 {
239  list new_variables = NIL;
240  list primary_variables = NIL;
241  bool is_primary_area = true;
242  int totalized_offset = -1;
243 
244  /* Compute the primary variables */
245  MAP (ENTITY, v, {
246  if (is_primary_area) {
248  if (offset > totalized_offset) {
249  totalized_offset = offset;
250  primary_variables = CONS (ENTITY,v,primary_variables);
251  }
252  else {
253  is_primary_area = false;
254  }
255  }
256  }, area_layout(type_area(entity_type(common))));
257 
258  primary_variables = gen_nreverse(primary_variables);
259 
260  ifdebug(4) {
261  pips_debug(4, "Current layout for %s\n", entity_global_name(common));
262  MAP(ENTITY, v, {
263  pips_debug(4, "[%s] offset %"PRIdPTR"\n", entity_global_name(v),ram_offset(storage_ram(entity_storage(v))));
264  }, area_layout(type_area(entity_type(common))));
265  pips_debug(4, "Primary variables for %s\n", entity_global_name(common));
266  MAP(ENTITY, v, {
267  pips_debug(4, "[%s] offset %"PRIdPTR" PRIMARY\n", entity_global_name(v),ram_offset(storage_ram(entity_storage(v))));
268  }, primary_variables);
269  }
270 
271  MAP (ENTITY, v, {
272 
273  /* We iterate on the primary variables declared in the common and
274  create a new variable mapping the one declared in common */
275 
277  const char* name = entity_local_name(v);
278  int v_offset = ram_offset(storage_ram(entity_storage(v)));
279 
280  /* Creates the name for the new variable */
281  string var_global_name = strdup(concatenate(module_local_name(module),
283  name,NULL));
284 
285  /* Copy type of variable */
286  type var_type = copy_type(entity_type(v));
287 
288  /* Create storage for new variable */
289  storage var_storage = make_storage(is_storage_ram,
290  (make_ram(module,
291  common,
292  v_offset,
293  NIL)));
294  /* Copy initial value of variable */
295  value var_value = copy_value(entity_initial(v));
296 
297  pips_debug(7, "Build variable %s\n", var_global_name);
298 
299  /* Build the new variable */
300  new_variable = make_entity(var_global_name,var_type,var_storage,var_value);
301 
302  /* Mark for addition */
303  new_variables = gen_nconc(new_variables,CONS(ENTITY,new_variable,NIL));
304 
305  pips_debug(7, "Add to declarations %s\n", var_global_name);
306 
307  /* Add to declarations.... */
309 
310  pips_debug(7, "New common variable %s declared\n", var_global_name);
311 
312  }, primary_variables);
313 
314  /* Add those new variable to common layout */
315  {
316  list old_layout = area_layout(type_area(entity_type(common)));
317  area_layout(type_area(entity_type(common))) = gen_nconc(old_layout,new_variables);
318  }
319 
321  pips_debug(3, "Common %s declared in module %s\n",
322  entity_local_name(common),
324 }
static Value offset
Definition: translation.c:283
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define storage_ram(x)
Definition: ri.h:2521
#define ram_offset(x)
Definition: ri.h:2251

References AddEntityToDeclarations(), area_layout, concatenate(), CONS, copy_type(), copy_value(), ENTITY, entity_global_name(), entity_initial, entity_local_name(), entity_storage, entity_type, gen_nconc(), gen_nreverse(), ifdebug, is_storage_ram, make_entity, make_ram(), make_storage(), MAP, module, module_local_name(), MODULE_SEP_STRING, new_variable, NIL, offset, pips_debug, ram_offset, storage_ram, strdup(), and type_area.

Referenced by make_array_communication_module(), make_scalar_communication_module(), make_start_ru_module(), and make_wait_ru_module().

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

◆ entity_in_module()

entity entity_in_module ( const char *  name,
entity  module 
)

Return entity named name in specified module.

Is it the main module ?

Parameters
nameame
moduleodule

Definition at line 434 of file phrase_distributor_control_code.c.

435 {
436  /* Is it the main module ? */
437  if (strchr(entity_local_name(module),'%') != NULL) {
438  return FindEntity(entity_local_name(module)+1,name);
439  }
440  else {
441  return FindEntity(entity_local_name(module),name);
442  }
443 
444 }

References entity_local_name(), FindEntity(), and module.

Referenced by controlize_distribution(), make_array_communication_statement(), make_communication_statement(), make_scalar_communication_module(), and make_start_ru_module().

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

◆ entry_state_variable_value_for_unstructured()

int entry_state_variable_value_for_unstructured ( statement  stat)

Return the state variable value corresponding to the entry in a unstructured statement.

Parameters
stattat

Definition at line 162 of file fsm_tools.c.

163 {
164  unstructured u;
165 
166  pips_assert("Statement is UNSTRUCTURED in FSM_GENERATION",
169 
171 
173 }
int beautify_ordering(int)
Special function made for Ronan Keryell who likes a lot when a integer number is coded on 3 bits :-)
Definition: phrase_tools.c:407
@ is_instruction_unstructured
Definition: ri.h:1475
#define instruction_tag(x)
Definition: ri.h:1511
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_unstructured(x)
Definition: ri.h:1532

Referenced by make_reset_state_variable_statement().

+ Here is the caller graph for this function:

◆ exit_state_variable_value_for_unstructured()

int exit_state_variable_value_for_unstructured ( statement  stat)

Return the state variable value corresponding to the exit in a unstructured statement NB: always return 0.

Parameters
stattat

Definition at line 180 of file fsm_tools.c.

181 {
182  pips_assert("Statement is UNSTRUCTURED in FSM_GENERATION",
185 
186  return 0;
187 }

Referenced by make_fsm_from_statement(), and make_transition_statement().

+ Here is the caller graph for this function:

◆ fsm_generation()

bool fsm_generation ( const char *  module_name)

fsm_generation.c

get the resources

dependence_graph = (graph) db_get_memory_resource(DBR_DG, module_name, true);

Now do the job

If property FSMIZE_WITH_GLOBAL_VARIABLE is set to true, we declare here the state variable which will be used in the whole module

Reorder the module, because new statements have been added

update/release resources

Parameters
module_nameodule_name

Definition at line 103 of file fsm_generation.c.

104 {
105  entity state_variable = NULL;
106 
107  /* get the resources */
108  statement stat = (statement) db_get_memory_resource(DBR_CODE,
109  module_name,
110  true);
111 
112 
115  /* dependence_graph =
116  (graph) db_get_memory_resource(DBR_DG, module_name, true); */
117 
118  debug_on("FSM_GENERATION_DEBUG_LEVEL");
119 
120  /* Now do the job */
121 
122  /* If property FSMIZE_WITH_GLOBAL_VARIABLE is set to true, we
123  * declare here the state variable which will be used in the whole
124  * module */
125  if (get_bool_property("FSMIZE_WITH_GLOBAL_VARIABLE")) {
126  state_variable = create_state_variable(module_name, 0);
127  }
128 
129  stat = fsmize_statement(stat, state_variable, module_name);
130 
131  pips_assert("Statement is consistent after FSM_GENERATION",
132  statement_consistent_p(stat));
133 
134  /* Reorder the module, because new statements have been added */
135  module_reorder(stat);
136  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
137  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
138  compute_callees(stat));
139 
140  /* update/release resources */
143 
144  debug_off();
145 
146  return true;
147 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
Definition: callgraph.c:355
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
statement fsmize_statement(statement stat, entity state_variable, const char *module_name)
This function is recursively called during FSMization.
Definition: fsm_tools.c:536
entity create_state_variable(const char *module_name, int name_identifier)
This function creates (and add declaration) state variable.
Definition: fsm_tools.c:84
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244

References compute_callees(), create_state_variable(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, fsmize_statement(), get_bool_property(), module_name(), module_name_to_entity(), module_reorder(), pips_assert, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ fsm_merge_states()

bool fsm_merge_states ( const char *  module_name)

fsm_merge_states.c

get the resources

Now do the job

Reorder the module, because new statements have been added

update/release resources

Parameters
module_nameodule_name

Definition at line 54 of file fsm_merge_states.c.

55 {
56  /* get the resources */
57  statement stat = (statement) db_get_memory_resource(DBR_CODE,
58  module_name,
59  true);
60 
63 
64  debug_on("FSM_MERGE_STATES_DEBUG_LEVEL");
65  /* Now do the job */
66 
67  pips_assert("Statement is consistent after FSM_MERGE_STATES",
69 
70  /* Reorder the module, because new statements have been added */
71  module_reorder(stat);
72  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
73  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
74  compute_callees(stat));
75 
76  /* update/release resources */
79 
80  debug_off();
81 
82  return true;
83 }

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, module_name(), module_name_to_entity(), module_reorder(), pips_assert, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ fsm_split_state()

bool fsm_split_state ( const char *  module_name)

fsm_split_state.c

get the resources

Now do the job

Reorder the module, because new statements have been added

update/release resources

Parameters
module_nameodule_name

Definition at line 54 of file fsm_split_state.c.

55 {
56  /* get the resources */
57  statement stat = (statement) db_get_memory_resource(DBR_CODE,
58  module_name,
59  true);
60 
63 
64  debug_on("FSM_SPLIT_STATE_DEBUG_LEVEL");
65  /* Now do the job */
66 
67  pips_assert("Statement is consistent after FSM_SPLIT_STATE",
69 
70  /* Reorder the module, because new statements have been added */
71  module_reorder(stat);
72  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
73  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
74  compute_callees(stat));
75 
76  /* update/release resources */
79 
80  debug_off();
81 
82  return true;
83 }

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, module_name(), module_name_to_entity(), module_reorder(), pips_assert, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ fsmize_statement()

statement fsmize_statement ( statement  stat,
entity  state_variable,
const char *  module_name 
)

This function is recursively called during FSMization.

It takes the statement to fsmize stat as parameter, while module_name is the name of the module where FSMization is applied. If global variable is used for the whole module, state_variable contains this element. If state_variable is null, then new state_variable is created for this statement.

= beautify_ordering (statement_ordering(stat));

Parameters
stattat
state_variabletate_variable
module_nameodule_name

Definition at line 536 of file fsm_tools.c.

539 {
540  // Defaut behaviour is to return parameter statement stat
541  statement returned_statement = stat;
543 
544  pips_debug(2,"\nFSMize: Module statement: =====================================\n");
545  ifdebug(2) {
546  print_statement(stat);
547  }
548  pips_debug(2,"domain number = %"PRIdPTR"\n", statement_domain_number(stat));
549  pips_debug(2,"entity = UNDEFINED\n");
550  pips_debug(2,"statement number = %"PRIdPTR"\n", statement_number(stat));
551  pips_debug(2,"statement ordering = %"PRIdPTR"\n", statement_ordering(stat));
552  if (statement_with_empty_comment_p(stat)) {
553  pips_debug(2,"statement comments = EMPTY\n");
554  }
555  else {
556  pips_debug(2,"statement comments = %s\n", statement_comments(stat));
557  }
558  pips_debug(2,"statement instruction = %s\n", statement_type_as_string(stat));
559  switch (instruction_tag(i)) {
560  case is_instruction_test:
561  {
562  // Declare the test data structure which will be used
563  test current_test = instruction_test(i);
564  statement true_statement, new_true_statement;
565  statement false_statement, new_false_statement;
566 
567  pips_debug(2, "TEST\n");
568 
569  // Compute new statement for true statement, and replace
570  // the old one by the new one
571  true_statement = test_true (current_test);
572  new_true_statement = fsmize_statement(true_statement, state_variable, module_name);
573  if (new_true_statement != NULL) {
574  test_true (current_test) = new_true_statement;
575  }
576 
577  // Do the same for the false statement
578  false_statement = test_false (current_test);
579  new_false_statement = fsmize_statement(false_statement, state_variable, module_name);
580  if (new_false_statement != NULL) {
581  test_false (current_test) = new_false_statement;
582  }
583 
584  break;
585  }
587  {
589  pips_debug(2, "SEQUENCE\n");
590  MAP(STATEMENT, current_stat,
591  {
592  statement new_stat = fsmize_statement(current_stat, state_variable, module_name);
593  if (new_stat != NULL) {
594  gen_list_patch (sequence_statements(seq), current_stat, new_stat);
595  }
596  }, sequence_statements(seq));
597  break;
598  }
599  case is_instruction_loop: {
600  pips_debug(2, "LOOP\n");
601  break;
602  }
604  pips_debug(2, "WHILELOOP\n");
605  break;
606  }
607  case is_instruction_forloop: {
608  pips_debug(2, "FORLOOP\n");
609  break;
610  }
611  case is_instruction_call: {
612  pips_debug(2, "CALL\n");
613  break;
614  }
616  pips_debug(2, "UNSTRUCTURED\n");
617  if (state_variable == NULL) {
618  entity new_state_variable;
619  int state_variable_identifier
620  /* = beautify_ordering (statement_ordering(stat)); */
621  = statement_ordering(stat);
622 
623  pips_debug(2, "Creating state variable with identifier %d\n",
624  state_variable_identifier);
625  new_state_variable
627  state_variable_identifier);
628  returned_statement = make_fsm_from_statement (stat,
629  new_state_variable,
630  module_name);
631  }
632  else {
633  returned_statement = make_fsm_from_statement (stat,
634  state_variable,
635  module_name);
636  }
637  pips_debug(2, "Displaying statement\n");
638  ifdebug(2) {
639  print_statement (returned_statement);
640  }
641  break;
642  }
643  case is_instruction_goto: {
644  pips_debug(2, "GOTO\n");
645  break;
646  }
647  default:
648  pips_debug(2, "UNDEFINED\n");
649  break;
650  }
651 
652  return returned_statement;
653 }
statement fsmize_statement(statement stat, entity state_variable, const char *module_name)
This function is recursively called during FSMization.
Definition: fsm_tools.c:536
statement make_fsm_from_statement(statement stat, entity state_variable, const char *module_name)
This function build and return a statement representing the FSM code equivalent to the given unstruct...
Definition: fsm_tools.c:447
void gen_list_patch(list l, const void *x, const void *y)
Replace all the reference to x in list l by a reference to y:
Definition: list.c:985
string statement_type_as_string(statement)
phrase_tools.c
Definition: phrase_tools.c:65
#define test_false(x)
Definition: ri.h:2837
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_sequence
Definition: ri.h:1469
@ is_instruction_forloop
Definition: ri.h:1477
@ is_instruction_loop
Definition: ri.h:1471
#define test_true(x)
Definition: ri.h:2835
#define sequence_statements(x)
Definition: ri.h:2360
#define instruction_sequence(x)
Definition: ri.h:1514
#define instruction_test(x)
Definition: ri.h:1517

Referenced by fsmize_statement(), and make_transition_statement().

+ Here is the caller graph for this function:

◆ full_fsm_generation()

bool full_fsm_generation ( const char *  module_name)

full_fsm_generation.c

get the resources

Now do the job

In fact, there is nothing to do because this phase is the succession of the two phases FULL_SPAGHETTIFY and FSM_GENERATION

Reorder the module, because new statements have been added

update/release resources

Parameters
module_nameodule_name

Definition at line 64 of file full_fsm_generation.c.

65 {
66  /* get the resources */
67  statement stat = (statement) db_get_memory_resource(DBR_CODE,
68  module_name,
69  true);
70 
73 
74  debug_on("FSM_GENERATION_DEBUG_LEVEL");
75 
76  /* Now do the job */
77 
78  /* In fact, there is nothing to do because this phase is the
79  * succession of the two phases FULL_SPAGHETTIFY and FSM_GENERATION
80  */
81 
82  pips_assert("Statement is consistent after FULL_FSM_GENERATION",
84 
85  /* Reorder the module, because new statements have been added */
86  module_reorder(stat);
87  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
88  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
89  compute_callees(stat));
90 
91  /* update/release resources */
94 
95  debug_off();
96 
97  return true;
98 }

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, module_name(), module_name_to_entity(), module_reorder(), pips_assert, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ full_spaghettify()

bool full_spaghettify ( const char *  module_name)

full_spaghettify.c

get the resources

Now do the job

Reorder the module, because new statements have been added

Restructure the module

Reorder the module, because new statements have been added

ATTENTION after simple_restructure_statement, statement stat is not longer a unstructured, but may be a sequence !!!

update/release resources

Parameters
module_nameodule_name

Definition at line 603 of file full_spaghettify.c.

604 {
605  /* get the resources */
606  statement stat = (statement) db_get_memory_resource(DBR_CODE,
607  module_name,
608  true);
609 
612 
613  debug_on("SPAGUETTIFY_DEBUG_LEVEL");
614 
615  /* Now do the job */
616  stat = full_spaghettify_module(stat, module_name);
617 
618  pips_assert("Statement is consistent after FULL_SPAGUETTIFY",
619  statement_consistent_p(stat));
620 
621  pips_assert("Unstructured is consistent after FULL_SPAGUETTIFY",
623 
624  /* Reorder the module, because new statements have been added */
625  module_reorder(stat);
626 
627  ifdebug(5) {
628  pips_debug(5,"====================================================\n");
629  pips_debug(5,"Statement BEFORE simple_restructure_statement\n");
630  print_statement (stat);
631  }
632 
633  /* Restructure the module */
635 
636  ifdebug(5) {
637  pips_debug(5,"====================================================\n");
638  pips_debug(5,"Statement AFTER simple_restructure_statement\n");
639  print_statement (stat);
640  }
641 
642  /* Reorder the module, because new statements have been added */
643  module_reorder(stat);
644 
645  pips_assert("Statement is consistent after FULL_SPAGUETTIFY",
646  statement_consistent_p(stat));
647 
648  /**
649  * ATTENTION
650  * after simple_restructure_statement, statement stat is
651  * not longer a unstructured, but may be a sequence !!!
652  */
653 
654  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
655  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
656  compute_callees(stat));
657 
658  /* update/release resources */
661 
662  debug_off();
663 
664  return true;
665 }
bool unstructured_consistent_p(unstructured p)
Definition: ri.c:2751
void simple_restructure_statement(statement)
A simple cleaning of the control graph without major topological restructuring.
static statement full_spaghettify_module(statement module_statement, const char *module_name)
unstructured statement_unstructured(statement stat)
Get the unstructured of a statement.
Definition: statement.c:1416

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, full_spaghettify_module(), ifdebug, module_name(), module_name_to_entity(), module_reorder(), pips_assert, pips_debug, print_statement(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), simple_restructure_statement(), statement_consistent_p(), statement_unstructured(), and unstructured_consistent_p().

+ Here is the call graph for this function:

◆ generate_code_function()

statement generate_code_function ( statement  stat,
bool  bCalledFromSeq 
)
Parameters
stattat
bCalledFromSeqCalledFromSeq

Definition at line 1137 of file comEngine_generate_code.c.

1138 {
1139  statement newStat = statement_undefined;
1140 
1141  instruction instr = statement_instruction(stat);
1142 
1143  switch(instruction_tag(instr))
1144  {
1146  {
1147  newStat = generate_code_seq(stat);
1148 
1149  break;
1150  }
1151  case is_instruction_loop:
1152  {
1153  newStat = generate_code_loop(stat);
1154  break;
1155  }
1156  case is_instruction_call:
1157  {
1158  newStat = generate_code_call(stat, bCalledFromSeq);
1159  break;
1160  }
1161  case is_instruction_test:
1162  {
1163  if(gGenHRE)
1164  {
1165  newStat = generate_code_test_HRE(stat);
1166  }
1167  else
1168  {
1169  newStat = generate_code_test_proc(stat);
1170  }
1171  break;
1172  }
1173  default:
1174  {
1175  pips_assert("FALSE", false);
1176  break;
1177  }
1178  }
1179 
1180  return newStat;
1181 }
statement generate_code_test_HRE(statement stat)
static statement generate_code_loop(statement stat)
static statement generate_code_call(statement stat, bool bCalledFromSeq)
bool gGenHRE
static statement generate_code_seq(statement stat)
statement generate_code_test_proc(statement stat)

References generate_code_call(), generate_code_loop(), generate_code_seq(), generate_code_test_HRE(), generate_code_test_proc(), gGenHRE, instruction_tag, is_instruction_call, is_instruction_loop, is_instruction_sequence, is_instruction_test, pips_assert, statement_instruction, and statement_undefined.

Referenced by comEngine_generate_code(), generate_code_loop(), generate_code_seq(), generate_code_test_HRE(), and generate_code_test_proc().

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

◆ generate_code_test_HRE()

statement generate_code_test_HRE ( statement  stat)
Parameters
stattat

Definition at line 547 of file comEngine_generate_HRECode.c.

548 {
549  //printf("generate_code_test\n");
550  //print_statement(stat);printf("\n");
551  statement newStat = statement_undefined;
552 
553  newStat = get_call_stat_HRE(stat);
554 
555  test newTest = statement_test(newStat);
556 
557  if(test_true(newTest) != statement_undefined)
558  {
559  free_statement(test_true(newTest));
560 
561  test_true(newTest) = make_empty_statement();
562  }
563 
564  if(test_false(newTest) != statement_undefined)
565  {
566  free_statement(test_false(newTest));
567 
568  test_false(newTest) = make_empty_statement();
569  }
570 
571  list lRef = hash_get(gStatToRef, stat);
572 
573  if(lRef != HASH_UNDEFINED_VALUE)
574  {
576 
577  newStat = generate_stat_from_ref_list_HRE(lRef, newStat);
578  }
579 
580  // Get the new statements for the true statement
581  statement trueStat = generate_code_function(test_true(statement_test(stat)), false);
582 
583  // Get the new statements for the false statement
584  statement falseStat = generate_code_function(test_false(statement_test(stat)), false);
585 
586  free_statement(test_true(newTest));
587  free_statement(test_false(newTest));
588 
589  if(trueStat != statement_undefined)
590  {
591  test_true(newTest) = trueStat;
592  }
593  else
594  {
595  test_true(newTest) = make_empty_statement();
596  }
597 
598  if(falseStat != statement_undefined)
599  {
600  test_false(newTest) = falseStat;
601  }
602  else
603  {
604  test_false(newTest) = make_empty_statement();
605  }
606 
607  return newStat;
608 }
hash_table gStatToRef
statement get_call_stat_HRE(statement stat)
statement generate_stat_from_ref_list_HRE(list lRef, statement stat)
void process_replacement_HRE(list lRef, expression buffIndExp, statement *stat)
test statement_test(statement)
Get the test of a statement.
Definition: statement.c:1348
#define make_empty_statement
An alias for make_empty_block_statement.
#define expression_undefined
Definition: ri.h:1223

References expression_undefined, free_statement(), generate_code_function(), generate_stat_from_ref_list_HRE(), get_call_stat_HRE(), gStatToRef, hash_get(), HASH_UNDEFINED_VALUE, make_empty_statement, process_replacement_HRE(), statement_test(), statement_undefined, test_false, and test_true.

Referenced by generate_code_function().

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

◆ generate_code_test_proc()

statement generate_code_test_proc ( statement  stat)
Parameters
stattat

Definition at line 1142 of file comEngine_generate_procCode.c.

1143 {
1144  printf("generate_code_test\n");
1145  print_statement(stat);printf("\n");
1146  statement newStat = statement_undefined;
1147 
1148  newStat = get_call_stat_proc(stat);
1149 
1150  list lRef = hash_get(gStatToRef, stat);
1151 
1152  if(lRef != HASH_UNDEFINED_VALUE)
1153  {
1154  newStat = generate_stat_from_ref_list_proc(lRef, NIL, newStat);
1155  }
1156 
1157  // Get the new statements for the true statement
1158  statement trueStat = generate_code_function(test_true(statement_test(stat)), false);
1159 
1160  // Get the new statements for the false statement
1161  statement falseStat = generate_code_function(test_false(statement_test(stat)), false);
1162 
1163  list lStats = NIL;
1164 
1165  if(newStat != statement_undefined)
1166  {
1167  lStats = gen_nconc(lStats, CONS(STATEMENT, newStat, NIL));
1168  }
1169 
1170  if(trueStat != statement_undefined)
1171  {
1172  lStats = gen_nconc(lStats, CONS(STATEMENT, trueStat, NIL));
1173  }
1174 
1175  if(falseStat != statement_undefined)
1176  {
1177  lStats = gen_nconc(lStats, CONS(STATEMENT, falseStat, NIL));
1178  }
1179 
1180  newStat = make_block_statement(lStats);
1181 
1182  return newStat;
1183 }
statement get_call_stat_proc(_UNUSED_ statement stat)
statement generate_stat_from_ref_list_proc(list lRef, list lToggleEnt, statement stat)

References CONS, gen_nconc(), generate_code_function(), generate_stat_from_ref_list_proc(), get_call_stat_proc(), gStatToRef, hash_get(), HASH_UNDEFINED_VALUE, make_block_statement(), NIL, print_statement(), printf(), STATEMENT, statement_test(), statement_undefined, test_false, and test_true.

Referenced by generate_code_function().

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

◆ generate_fifo_stat2()

statement generate_fifo_stat2 ( reference  curRef,
bool  bRead 
)
Parameters
curRefurRef
bReadRead

Definition at line 336 of file comEngine_HRE_distribute.c.

337 {
338  statement newStat = statement_undefined;
339 
340  string name = NULL;
341 
342  expression buffExp = get_fifo_from_ref(curRef);
343 
344  //printf("generate_fifo_stat2\n");
345  //print_reference(curRef);printf("\n");
346 
347  if(buffExp == expression_undefined)
348  {
349  return statement_undefined;
350  }
351 
352  bool innerInd = false;
353 
354  expression indExp = get_indExp_from_ref(curRef, gRefToInd, &innerInd);
355 
356  expression fifoExp = get_fifoExp_from_ref(curRef, buffExp, gRefToToggle);
357 
358  entity hreBuffEnt = get_HRE_buff_ent_from_ref(curRef);
359 
360  pips_assert("hreBuffEnt != entity_undefined",
361  hreBuffEnt != entity_undefined);
362 
363  if(bRead)
364  {
365  name = strdup(READ_FIFO);
366  }
367  else
368  {
369  name = strdup(WRITE_FIFO);
370  }
371 
372  newStat = make_read_write_fifo_stat(name, fifoExp, indExp,
373  entity_to_expression(hreBuffEnt));
374 
375  if(!innerInd)
376  {
377  if(bRead)
378  {
379  glReadStats = CONS(STATEMENT, newStat, glReadStats);
380  }
381  else
382  {
384  }
385 
386  return statement_undefined;
387  }
388 
389  return newStat;
390 }
#define WRITE_FIFO
Definition: comEngine.h:36
#define READ_FIFO
Definition: comEngine.h:35
static list glWriteStats
expression get_fifoExp_from_ref(reference curRef, expression buffExp, hash_table ht)
comEngine_HRE_distribute.c
static expression get_indExp_from_ref(reference curRef, hash_table ht, bool *innerInd)
static list glReadStats
static statement make_read_write_fifo_stat(string name, expression fifoExp, expression indExp, expression hreBuffExp)
hash_table gRefToInd
hash_table gRefToToggle
expression get_fifo_from_ref(reference ref)
entity get_HRE_buff_ent_from_ref(reference ref)

References CONS, entity_to_expression(), entity_undefined, expression_undefined, get_fifo_from_ref(), get_fifoExp_from_ref(), get_HRE_buff_ent_from_ref(), get_indExp_from_ref(), glReadStats, glWriteStats, gRefToInd, gRefToToggle, make_read_write_fifo_stat(), pips_assert, READ_FIFO, STATEMENT, statement_undefined, strdup(), and WRITE_FIFO.

Referenced by generate_fifo_stats2().

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

◆ generate_fifo_stats2()

void generate_fifo_stats2 ( list  lRef,
list lReadStats,
list lWriteStats 
)
Parameters
lRefRef
lReadStatsReadStats
lWriteStatsWriteStats

Definition at line 432 of file comEngine_HRE_distribute.c.

434 {
435  list lReadDone = NIL;
436  list lWriteDone = NIL;
437 
438  MAP(REFERENCE, curRef,
439  {
440  string effAction = hash_get(gRefToEff, curRef);
441 
442  pips_assert("effAction != HASH_UNDEFINED_VALUE",
443  effAction != HASH_UNDEFINED_VALUE);
444 
445  //printf("fifo ref %d\n", (int)curRef);
446  //print_reference(curRef);printf("\n");
447 
448  if(!strcmp(effAction, R_EFFECT))
449  {
450  bool alreadyDone = false;
451 
452  MAP(REFERENCE, doneRef,
453  {
454  if(reference_equal_p(curRef, doneRef))
455  {
456  alreadyDone = true;
457  break;
458  }
459  }, lReadDone);
460 
461  if(!alreadyDone)
462  {
463  //printf("read eff\n");
464 
465  lReadDone = gen_nconc(lReadDone, CONS(REFERENCE, curRef, NIL));
466 
467  statement readStat = generate_fifo_stat2(curRef, true);
468 
469  if(readStat == statement_undefined)
470  {
471  continue;
472  }
473 
474  *lReadStats = gen_nconc(*lReadStats, CONS(STATEMENT, readStat, NIL));
475  //print_statement(readStat);
476  }
477  }
478  else
479  {
480  bool alreadyDone = false;
481 
482  MAP(REFERENCE, doneRef,
483  {
484  if(reference_equal_p(curRef, doneRef))
485  {
486  alreadyDone = true;
487  break;
488  }
489  }, lWriteDone);
490 
491  if(!alreadyDone)
492  {
493  //printf("write eff\n");
494 
495  lWriteDone = gen_nconc(lWriteDone, CONS(REFERENCE, curRef, NIL));
496 
497  statement writeStat = generate_fifo_stat2(curRef, false);
498 
499  if(writeStat == statement_undefined)
500  {
501  continue;
502  }
503 
504  *lWriteStats = gen_nconc(*lWriteStats, CONS(STATEMENT, writeStat, NIL));
505 
506  //print_statement(writeStat);
507  }
508  }
509 
510  }, lRef);
511 
512  gen_free_list(lReadDone);
513  gen_free_list(lWriteDone);
514 }
#define R_EFFECT
Definition: comEngine.h:29
statement generate_fifo_stat2(reference curRef, bool bRead)

References CONS, gen_free_list(), gen_nconc(), generate_fifo_stat2(), gRefToEff, hash_get(), HASH_UNDEFINED_VALUE, MAP, NIL, pips_assert, R_EFFECT, REFERENCE, reference_equal_p(), STATEMENT, and statement_undefined.

Referenced by replace_array_ref_with_fifos2().

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

◆ generate_ind_fifo_stat2()

statement generate_ind_fifo_stat2 ( entity  oldInd,
entity  newInd,
bool  bRead 
)
Parameters
oldIndldInd
newIndewInd
bReadRead

Definition at line 396 of file comEngine_HRE_distribute.c.

397 {
398  statement newStat = statement_undefined;
399 
400  string name = NULL;
401 
402  intptr_t indNum = (intptr_t)hash_get(gIndToNum, oldInd);
403 
404  pips_assert("indNum != HASH_UNDEFINED_VALUE",
405  indNum != (intptr_t)HASH_UNDEFINED_VALUE);
406 
407  if(bRead)
408  {
409  name = strdup(READ_FIFO);
410  }
411  else
412  {
413  name = strdup(WRITE_FIFO);
414  }
415 
416  intptr_t fifoNum = (intptr_t)hash_get(gEntToHREFifo, oldInd);
417 
418  pips_assert("fifoNum != HASH_UNDEFINED_VALUE",
419  fifoNum != (intptr_t)HASH_UNDEFINED_VALUE);
420 
421  newStat =
423  int_to_expression(fifoNum),
424  int_to_expression(indNum),
425  entity_to_expression(newInd));
426  return newStat;
427 }
hash_table gIndToNum
hash_table gEntToHREFifo
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

References entity_to_expression(), gEntToHREFifo, gIndToNum, hash_get(), HASH_UNDEFINED_VALUE, int_to_expression(), intptr_t, make_read_write_fifo_stat(), pips_assert, READ_FIFO, statement_undefined, strdup(), and WRITE_FIFO.

Referenced by add_index_statements().

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

◆ generate_stat_from_ref_list_HRE()

statement generate_stat_from_ref_list_HRE ( list  lRef,
statement  stat 
)
Parameters
lRefRef
stattat

Definition at line 382 of file comEngine_generate_HRECode.c.

383 {
384  bool writeFound = false;
385 
386  MAP(REFERENCE, curRef,
387  {
388  string effAction = hash_get(gRefToEff, curRef);
389 
390  pips_assert("effAction != HASH_UNDEFINED_VALUE",
391  effAction != HASH_UNDEFINED_VALUE);
392 
393  if(!strcmp(effAction, W_EFFECT))
394  {
395  writeFound = true;
396  break;
397  }
398 
399  }, lRef);
400 
401  statement stepStat = make_wait_step_statement();
402 
403  list lStats = NIL;
404 
405  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
406  if(stat != statement_undefined)
407  {
408  lStats = gen_nconc(lStats, CONS(STATEMENT, stat, NIL));
409  }
410 
411  if(writeFound)
412  {
413  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
414  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
415  }
416 
417  free_statement(stepStat);
418 
419  return make_block_statement(lStats);
420 }
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
#define W_EFFECT
Definition: comEngine.h:30
statement make_wait_step_statement()

References CONS, copy_statement(), free_statement(), gen_nconc(), gRefToEff, hash_get(), HASH_UNDEFINED_VALUE, make_block_statement(), make_wait_step_statement(), MAP, NIL, pips_assert, REFERENCE, STATEMENT, statement_undefined, and W_EFFECT.

Referenced by generate_code_call(), generate_code_loop(), generate_code_test_HRE(), process_code_seq(), and usual_loop_tiling().

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

◆ generate_stat_from_ref_list_HRE_list()

list generate_stat_from_ref_list_HRE_list ( list  lRef,
list  lInStats 
)
Parameters
lRefRef
lInStatsInStats

Definition at line 425 of file comEngine_generate_HRECode.c.

426 {
427  bool writeFound = false;
428 
429  MAP(REFERENCE, curRef,
430  {
431  string effAction = hash_get(gRefToEff, curRef);
432 
433  pips_assert("effAction != HASH_UNDEFINED_VALUE",
434  effAction != HASH_UNDEFINED_VALUE);
435 
436  if(!strcmp(effAction, W_EFFECT))
437  {
438  writeFound = true;
439  break;
440  }
441 
442  }, lRef);
443 
444  statement stepStat = make_wait_step_statement();
445 
446  list lStats = NIL;
447 
448  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
449 
450  lStats = gen_nconc(lStats, lInStats);
451 
452  if(writeFound)
453  {
454  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
455  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
456  }
457 
458  free_statement(stepStat);
459 
460  return lStats;
461 }

References CONS, copy_statement(), free_statement(), gen_nconc(), gRefToEff, hash_get(), HASH_UNDEFINED_VALUE, make_wait_step_statement(), MAP, NIL, pips_assert, REFERENCE, STATEMENT, and W_EFFECT.

Referenced by generate_code_loop().

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

◆ generate_stat_from_ref_list_proc()

statement generate_stat_from_ref_list_proc ( list  lRef,
list  lToggleEnt,
statement  stat 
)
Parameters
lRefRef
lToggleEntToggleEnt
stattat

Definition at line 989 of file comEngine_generate_procCode.c.

991 {
992  list lStats = NIL;
993 
994  list lReadStats = NIL;
995  list lWriteStats = NIL;
996 
997  generate_mmcd_stats_from_ref(lRef, NULL,
999  lToggleEnt,
1000  &lReadStats, &lWriteStats);
1001 
1002  statement stepStat1 = make_step_inc_statement(1);
1003  statement stepStat2 = make_step_inc_statement(2);
1004 
1005  lStats = gen_nconc(CONS(STATEMENT, stepStat1, NIL), lReadStats);
1006  if(stat != statement_undefined)
1007  {
1008  lStats = gen_nconc(lStats, CONS(STATEMENT, stat, NIL));
1009  }
1010  lStats = gen_nconc(lStats, lWriteStats);
1011 
1012  if(lWriteStats != NIL)
1013  {
1014  lStats = gen_nconc(lStats, CONS(STATEMENT, stepStat2, NIL));
1015  }
1016 
1017  return make_block_statement(lStats);
1018 }
static void generate_mmcd_stats_from_ref(list lRef, hash_table htOffset, expression count, list lToggleEnt, list *lReadStats, list *lWriteStats)
statement make_step_inc_statement(int incNum)

References CONS, gen_nconc(), generate_mmcd_stats_from_ref(), int_to_expression(), make_block_statement(), make_step_inc_statement(), NIL, STATEMENT, and statement_undefined.

Referenced by generate_code_call(), generate_code_loop(), generate_code_test_proc(), process_code_seq(), and usual_loop_tiling().

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

◆ generate_stat_from_ref_list_proc_list()

list generate_stat_from_ref_list_proc_list ( list  lRef,
list  lInStats 
)
Parameters
lRefRef
lInStatsInStats

Definition at line 1025 of file comEngine_generate_procCode.c.

1026 {
1027  list lStats = NIL;
1028 
1029  list lReadStats = NIL;
1030  list lWriteStats = NIL;
1031 
1032  generate_mmcd_stats_from_ref(lRef, NULL,
1033  int_to_expression(1),
1034  NIL,
1035  &lReadStats, &lWriteStats);
1036 
1037  statement stepStat1 = make_step_inc_statement(1);
1038  statement stepStat2 = make_step_inc_statement(2);
1039 
1040  lStats = gen_nconc(CONS(STATEMENT, stepStat1, NIL), lReadStats);
1041 
1042  lStats = gen_nconc(lStats, lInStats);
1043 
1044  lStats = gen_nconc(lStats, lWriteStats);
1045 
1046  if(lWriteStats != NIL)
1047  {
1048  lStats = gen_nconc(lStats, CONS(STATEMENT, stepStat2, NIL));
1049  }
1050 
1051  return lStats;
1052 }

References CONS, gen_nconc(), generate_mmcd_stats_from_ref(), int_to_expression(), make_step_inc_statement(), NIL, and STATEMENT.

Referenced by generate_code_loop().

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

◆ get_call_stat_HRE()

statement get_call_stat_HRE ( statement  stat)
Parameters
stattat

Definition at line 513 of file comEngine_generate_HRECode.c.

514 {
515  statement newStat = copy_statement(stat);
516 
518 
519  return newStat;
520 }
#define string_undefined
Definition: newgen_types.h:40

References copy_statement(), statement_comments, and string_undefined.

Referenced by generate_code_call(), and generate_code_test_HRE().

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

◆ get_call_stat_proc()

statement get_call_stat_proc ( statement  )

◆ get_common_param_name()

string get_common_param_name ( entity  variable,
entity  function 
)
Parameters
functionunction

Definition at line 391 of file phrase_distributor_control_code.c.

392 {
393  char *buffer;
394  asprintf(&buffer,
397  entity_local_name(function));
398  return strdup(buffer);
399 }
#define COMMON_PARAM_NAME
static string buffer
Definition: string.c:113

References asprintf, buffer, COMMON_PARAM_NAME, entity_local_name(), and strdup().

Referenced by make_array_communication_statement(), make_communication_statement(), and make_start_ru_module().

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

◆ get_controlized_statement_comment()

string get_controlized_statement_comment ( entity  function)
Parameters
functionunction

Definition at line 329 of file phrase_distributor_control_code.c.

330 {
331  char *buffer;
332  asprintf(&buffer,
334  entity_local_name(function));
335  return (buffer);
336 }
#define CONTROLIZED_STATEMENT_COMMENT

References asprintf, buffer, CONTROLIZED_STATEMENT_COMMENT, and entity_local_name().

Referenced by controlize_distribution().

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

◆ get_dynamic_variable_name()

string get_dynamic_variable_name ( entity  dynamic_variable)

Return DYN_VAR_PARAM_NAME name for a dynamic variable.

Parameters
dynamic_variableynamic_variable

Definition at line 501 of file phrase_distributor_communication.c.

502 {
503  char *buffer;
504  asprintf(&buffer,
506  entity_local_name(dynamic_variable));
507  return (buffer);
508 }
#define DYN_VAR_PARAM_NAME

References asprintf, buffer, DYN_VAR_PARAM_NAME, and entity_local_name().

Referenced by make_array_communication_module(), and make_array_communication_statement().

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

◆ get_externalizable_function_name()

string get_externalizable_function_name ( statement  stat)

Return the identified function name of the externalized portion of code by searching comment matching tag EXTERNALIZED_CODE_PRAGMA_BEGIN.

Parameters
stattat

Definition at line 449 of file distribution_context.c.

450 {
453 }
string get_function_name_by_searching_tag(statement, const char *)
phrase_distributor.c
#define EXTERNALIZED_CODE_PRAGMA_BEGIN

◆ get_externalized_and_analyzed_function_name()

string get_externalized_and_analyzed_function_name ( statement  stat,
int stats_nb 
)

Return the identified function name of the externalized portion of code by searching comment matching tags EXTERNALIZED_CODE_PRAGMA_ANALYZED Sets the number of statements of this externalizable statement.

Parameters
stattat
stats_nbtats_nb

Definition at line 470 of file distribution_context.c.

472 {
473  string comments;
474  string searched_string;
475  string comment_portion = strdup(EXTERNALIZED_CODE_PRAGMA_ANALYZED);
476  char* function_name = NULL;
477  char* next_line;
479 
482  }
483 
484  if (!statement_with_empty_comment_p(stat)) {
485  searched_string = strdup(comment_portion);
486  searched_string[strcspn(comment_portion, "%s")] = '\0';
487  comments = strdup(statement_comments(stat));
488  next_line = strtok (comments, "\n");
489  if (next_line != NULL) {
490  do {
491  string first_occurence = strstr(next_line,searched_string);
492  if (first_occurence != NULL) {
493  function_name = malloc(256);
494  pips_debug(5, "Scanning: [%s] with [%s]", first_occurence, comment_portion);
495  sscanf (first_occurence, comment_portion, function_name, stats_nb);
496  pips_debug(5, "Found function: [%s] and %d stats \n", function_name, *stats_nb);
497  }
498  next_line = strtok(NULL, "\n");
499  }
500  while (next_line != NULL);
501  }
502  }
503 
504  return function_name;
505 }
void * malloc(YYSIZE_T)
#define EXTERNALIZED_CODE_PRAGMA_ANALYZED

◆ get_externalized_function_name()

string get_externalized_function_name ( statement  stat)

Return the identified function name of the externalized portion of code by searching comment matching tag EXTERNALIZED_CODE_PRAGMA_CALL.

Parameters
stattat

Definition at line 459 of file distribution_context.c.

460 {
463 }
#define EXTERNALIZED_CODE_PRAGMA_CALL

◆ get_fifo_from_ref()

expression get_fifo_from_ref ( reference  ref)
Parameters
refef

Definition at line 74 of file comEngine_generate_HRECode.c.

75 {
77 
79 
80  if(fifoNum != (intptr_t)HASH_UNDEFINED_VALUE)
81  {
82  retExp = int_to_expression(fifoNum);
83  }
84 
85  return retExp;
86 }
hash_table gRefToHREFifo

References expression_undefined, gRefToHREFifo, hash_get(), HASH_UNDEFINED_VALUE, int_to_expression(), intptr_t, and ref.

Referenced by generate_fifo_stat(), and generate_fifo_stat2().

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

◆ get_fifoExp_from_ref()

expression get_fifoExp_from_ref ( reference  curRef,
expression  buffExp,
hash_table  ht 
)

comEngine_HRE_distribute.c

Parameters
curRefurRef
buffExpuffExp
htt

Definition at line 260 of file comEngine_HRE_distribute.c.

262 {
263  entity ind = entity_undefined;
264 
265  HASH_MAP(ref1, ind1,
266  {
267  if(reference_equal_p(curRef, ref1))
268  {
269  ind = ind1;
270  break;
271  }
272  }, ht);
273 
274  expression fifoExp;
275 
276  if(ind == entity_undefined)
277  {
278  fifoExp = buffExp;
279  }
280  else
281  {
282  entity new_ent = find_or_create_newInd(ind, false);
283 
285  buffExp,
286  entity_to_expression(new_ent),
287  NULL);
288 
289  fifoExp =
291  addArg));
292  }
293 
294  return fifoExp;
295 }
call make_call(entity a1, list a2)
Definition: ri.c:269
static entity find_or_create_newInd(entity ind, bool bIsInd)
list gen_make_list(int domain,...)
Definition: list.c:851
#define PLUS_OPERATOR_NAME
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
expression call_to_expression(call c)
Build an expression that call a function or procedure.
Definition: expression.c:309

References call_to_expression(), entity_intrinsic(), entity_to_expression(), entity_undefined, expression_domain, find_or_create_newInd(), gen_make_list(), HASH_MAP, make_call(), PLUS_OPERATOR_NAME, and reference_equal_p().

Referenced by generate_fifo_stat2().

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

◆ get_function_id_name()

string get_function_id_name ( entity  function)
Parameters
functionunction

Definition at line 367 of file phrase_distributor_control_code.c.

368 {
369  char *buffer;
370  asprintf(&buffer,
372  entity_local_name(function));
373  return strdup(buffer);
374 }
#define FUNCTION_ID_NAME

References asprintf, buffer, entity_local_name(), FUNCTION_ID_NAME, and strdup().

Referenced by make_scalar_communication_module(), and make_start_ru_module().

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

◆ get_function_name_by_searching_tag()

string get_function_name_by_searching_tag ( statement  stat,
const char *  tag 
)

phrase_distributor.c

phrase_distributor.c

Parameters
stattat
tagag

Definition at line 82 of file phrase_distributor.c.

84 {
85  string comments;
86  string searched_string;
87  string comment_portion = strdup(tag);
88  char* function_name = NULL;
89  char* next_line;
91 
92  ifdebug(5) {
93  pips_debug(5, "BEGIN get_function_name_by_searching_tag [%s] on \n", tag);
94  print_statement(stat);
95  }
96 
99  }
100 
101  if (!statement_with_empty_comment_p(stat)) {
102  searched_string = strdup(comment_portion);
103  searched_string[strcspn(comment_portion, "%s")] = '\0';
104  comments = strdup(statement_comments(stat));
105  next_line = strtok (comments, "\n");
106  if (next_line != NULL) {
107  do {
108  string first_occurence = strstr(next_line,searched_string);
109  if (first_occurence != NULL) {
110  function_name = malloc(256);
111  sscanf (first_occurence, comment_portion, function_name);
112  pips_debug(5, "Found function: [%s]\n", function_name);
113  }
114  next_line = strtok(NULL, "\n");
115  }
116  while (next_line != NULL);
117  }
118  }
119 
120  pips_debug(5, "END get_function_name_by_searching_tag [%s] on \n", tag);
121  return function_name;
122 }
int tag
TAG.
Definition: newgen_types.h:92

References gen_nth(), ifdebug, instruction_sequence, instruction_tag, is_instruction_sequence, malloc(), pips_debug, print_statement(), sequence_statements, STATEMENT, statement_comments, statement_instruction, statement_with_empty_comment_p(), and strdup().

Referenced by get_externalizable_function_name(), and get_externalized_function_name().

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

◆ get_HRE_buff_ent_from_ref()

entity get_HRE_buff_ent_from_ref ( reference  ref)
Parameters
refef

Definition at line 91 of file comEngine_generate_HRECode.c.

92 {
93  entity buffEnt = entity_undefined;
94 
95  HASH_MAP(curRef, hreBuff,
96  {
97  if(reference_equal_p(curRef, ref))
98  {
99  buffEnt = hreBuff;
100  break;
101  }
102 
103  }, gRefToHREVar);
104 
105  return buffEnt;
106 }
hash_table gRefToHREVar
comEngine_generate_HRECode.c

References entity_undefined, gRefToHREVar, HASH_MAP, ref, and reference_equal_p().

Referenced by generate_fifo_stat(), generate_fifo_stat2(), replace_array_ref_with_fifos(), and replace_array_ref_with_fifos2().

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

◆ get_in_param_id_name()

string get_in_param_id_name ( entity  variable,
entity  function 
)
Parameters
functionunction

Definition at line 341 of file phrase_distributor_control_code.c.

342 {
343  char *buffer;
344  asprintf(&buffer,
347  entity_local_name(function));
348  return (buffer);
349 }
#define IN_PARAM_ID_NAME

References asprintf, buffer, entity_local_name(), and IN_PARAM_ID_NAME.

Referenced by make_scalar_communication_module().

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

◆ get_out_param_id_name()

string get_out_param_id_name ( entity  variable,
entity  function 
)
Parameters
functionunction

Definition at line 354 of file phrase_distributor_control_code.c.

355 {
356  char *buffer;
357  asprintf(&buffer,
360  entity_local_name(function));
361  return (buffer);
362 }
#define OUT_PARAM_ID_NAME

References asprintf, buffer, entity_local_name(), and OUT_PARAM_ID_NAME.

Referenced by make_scalar_communication_module().

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

◆ get_receive_param_module_name()

string get_receive_param_module_name ( entity  ,
effect   
)

Referenced by controlize_distribution().

+ Here is the caller graph for this function:

◆ get_receive_parameter_module_name()

string get_receive_parameter_module_name ( variable  var)
Parameters
varar

Definition at line 424 of file phrase_distributor_control_code.c.

425 {
426  char *buffer;
428  return strdup(buffer);
429 }
string variable_to_string(variable var)
Return a unique (regarding variable_equal_p(var1,var2)) string representation of a variable var.
#define RECEIVE_PARAMETER_MODULE_NAME

References asprintf, buffer, RECEIVE_PARAMETER_MODULE_NAME, strdup(), and variable_to_string().

Referenced by get_receive_param_module_name(), and make_scalar_communication_modules().

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

◆ get_ref_var_param_name()

string get_ref_var_param_name ( entity  reference_param)

Return REF_VAR_PARAM_NAME name for a dynamic variable.

Parameters
reference_parameference_param

Definition at line 513 of file phrase_distributor_communication.c.

514 {
515  char *buffer;
516  asprintf(&buffer,
518  entity_local_name(reference_param));
519  return (buffer);
520 }
#define REF_VAR_PARAM_NAME

References asprintf, buffer, entity_local_name(), and REF_VAR_PARAM_NAME.

Referenced by make_array_communication_module(), and make_array_communication_statement().

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

◆ get_send_param_module_name()

string get_send_param_module_name ( entity  ,
effect   
)

Referenced by controlize_distribution().

+ Here is the caller graph for this function:

◆ get_send_parameter_module_name()

string get_send_parameter_module_name ( variable  var)
Parameters
varar

Definition at line 414 of file phrase_distributor_control_code.c.

415 {
416  char *buffer;
418  return strdup(buffer);
419 }
#define SEND_PARAMETER_MODULE_NAME

References asprintf, buffer, SEND_PARAMETER_MODULE_NAME, strdup(), and variable_to_string().

Referenced by get_send_param_module_name(), and make_scalar_communication_modules().

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

◆ get_statements_with_comments_containing()

list get_statements_with_comments_containing ( const char *  comment_portion,
statement  stat 
)

First, set searched_string (we remove format information)

Reset list

fdebug(5) { pips_debug(5, "Searching statements with comments: %s\n", context.searched_string);
pips_debug(5, "In statement:\n");
print_statement(stat); }

Parameters
comment_portionomment_portion
stattat

Definition at line 481 of file phrase_tools.c.

483 {
485 
486  /* First, set searched_string (we remove format information)*/
487  context.searched_string = strdup(comment_portion);
488  context.searched_string[strcspn(comment_portion, "%s")] = '\0';
489 
490  /* Reset list */
491  context.list_of_statements = NIL;
492 
493  /*ifdebug(5) {
494  pips_debug(5, "Searching statements with comments: %s\n",
495  context.searched_string);
496  pips_debug(5, "In statement:\n");
497  print_statement(stat);
498  }*/
499 
502 
503  return context.list_of_statements;
504 
505 }
static void check_if_statement_contains_comment(statement s, void *a_context)
Definition: phrase_tools.c:459
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
Definition: delay.c:253

References check_if_statement_contains_comment(), gen_context_recurse, gen_true2(), NIL, statement_domain, and strdup().

Referenced by controlize_distribution(), identify_analyzed_statements_to_distribute(), and identify_statements_to_distribute().

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

◆ get_supportedRef_HRE()

void get_supportedRef_HRE ( statement  stat,
list lSupportedRef,
list lUnSupportedRef 
)
Parameters
stattat
lSupportedRefSupportedRef
lUnSupportedRefUnSupportedRef

Definition at line 467 of file comEngine_generate_HRECode.c.

469 {
470  *lSupportedRef = hash_get(gLoopToSupRef, stat);
471  *lUnSupportedRef = hash_get(gLoopToUnSupRef, stat);
472 
473  pips_assert("*lSupportedRef != HASH_UNDEFINED_VALUE",
474  *lSupportedRef != HASH_UNDEFINED_VALUE);
475 
476  pips_assert("*lUnSupportedRef != HASH_UNDEFINED_VALUE",
477  *lUnSupportedRef != HASH_UNDEFINED_VALUE);
478 }
hash_table gLoopToSupRef
hash_table gLoopToUnSupRef

References gLoopToSupRef, gLoopToUnSupRef, hash_get(), HASH_UNDEFINED_VALUE, and pips_assert.

Referenced by generate_code_loop().

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

◆ get_supportedRef_proc()

void get_supportedRef_proc ( statement  stat,
hash_table  htOffset,
list lSupportedRef,
list lUnSupportedRef 
)
Parameters
stattat
htOffsettOffset
lSupportedRefSupportedRef
lUnSupportedRefUnSupportedRef

Definition at line 1077 of file comEngine_generate_procCode.c.

1079 {
1080  loop curLoop = statement_loop(stat);
1081 
1082  list lRef = hash_get(gLoopToRef, stat);
1083 
1084  if(lRef == HASH_UNDEFINED_VALUE)
1085  {
1086  lRef = NIL;
1087  }
1088 
1089  MAP(REFERENCE, curRef,
1090  {
1091  //printf("loop ref\n");
1092  //print_reference(curRef);printf("\n");
1093 
1094  if(supported_ref_p(curRef, loop_index(curLoop), htOffset))
1095  {
1096  *lSupportedRef = gen_nconc(*lSupportedRef, CONS(REFERENCE, curRef, NIL));
1097  }
1098  else
1099  {
1100  *lUnSupportedRef = gen_nconc(*lUnSupportedRef, CONS(REFERENCE, curRef, NIL));
1101  }
1102 
1103  }, lRef);
1104 
1105  hash_put(gLoopToSupRef, stat, *lSupportedRef);
1106  hash_put(gLoopToUnSupRef, stat, *lUnSupportedRef);
1107 }
hash_table gLoopToRef
comEngine_distribute.c
static bool supported_ref_p(reference ref, entity index, hash_table htOffset)

References CONS, gen_nconc(), gLoopToRef, gLoopToSupRef, gLoopToUnSupRef, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, loop_index, MAP, NIL, REFERENCE, statement_loop(), and supported_ref_p().

Referenced by do_HRE_memory_mapping_loop().

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

◆ has_call_stat_inside()

bool has_call_stat_inside ( statement  stat)

comEngine_generate_procCode.c

Parameters
stattat

Definition at line 260 of file comEngine_generate_procCode.c.

261 {
262  bool bHasCallStat = false;
263 
264  gen_context_recurse(stat, &bHasCallStat, statement_domain,
266 
267  return bHasCallStat;
268 }
static bool has_call_stat_inside_flt(statement stat, bool *bHasCallStat)
static void has_call_stat_inside_rwt(_UNUSED_ statement stat, _UNUSED_ bool *bHasCallStat)

References gen_context_recurse, has_call_stat_inside_flt(), has_call_stat_inside_rwt(), and statement_domain.

+ Here is the call graph for this function:

◆ HRE_distribute()

statement HRE_distribute ( statement  stat,
string  new_module_name,
const char *  module_name 
)
Parameters
stattat
new_module_nameew_module_name
module_nameodule_name

Definition at line 955 of file comEngine_HRE_distribute.c.

956 {
957  printf("stat bef HRE_distribute\n");
958  print_statement(stat);
959 
960  // Global variables initialization
961  g_new_module_name = new_module_name;
963  gCurStats = NIL;
964  glCurRep = NIL;
965  gIfCount = 0;
966  glCurLoop = NIL;
970  glReadStats = NIL;
971  glWriteStats = NIL;
972 
973  HRE_distribute_stat(stat, true);
974 
975  loop_enter();
976 
977  // Free some global variables
980 
981  return make_block_statement(NIL);
982 }
static list glCurLoop
static void loop_enter()
static const char * g_module_name
static list glCurRep
static entity gNewInd
static hash_table gOldIndToNewInd
static const char * g_new_module_name
static hash_table gIsIndex
static int gIfCount
static statement HRE_distribute_stat(statement stat, bool calledFromLoop)
static list gCurStats

References entity_undefined, g_module_name, g_new_module_name, gCurStats, gIfCount, gIsIndex, glCurLoop, glCurRep, glReadStats, glWriteStats, gNewInd, gOldIndToNewInd, hash_pointer, hash_table_free(), hash_table_make(), HRE_distribute_stat(), loop_enter(), make_block_statement(), module_name(), NIL, print_statement(), and printf().

Referenced by comEngine_generate_HRECode().

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

◆ identify_analyzed_statements_to_distribute()

list identify_analyzed_statements_to_distribute ( statement  stat)

This function return a list of statements that were previously marked for externalization during phase PHRASE_DISTRIBUTOR_INIT.

We identify all the statement containing an analyzed tag

Parameters
stattat

Definition at line 288 of file phrase_distributor.c.

289 {
290  /* We identify all the statement containing an analyzed tag */
292  stat);
293 
294 }
list get_statements_with_comments_containing(const char *, statement)
Definition: phrase_tools.c:481

References EXTERNALIZED_CODE_PRAGMA_ANALYZED, and get_statements_with_comments_containing().

Referenced by comEngine_distribute(), and distribute().

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

◆ internal_compute_distribution_context()

bool internal_compute_distribution_context ( statement  externalized_code,
hash_table ht_params,
hash_table ht_private,
hash_table ht_in_regions,
hash_table ht_out_regions,
void *  key_value 
)

Internally used to compute distribution context for statement externalized_code.

Storing results in hash_tables

Parameters
externalized_codexternalized_code
ht_paramst_params
ht_privatet_private
ht_in_regionst_in_regions
ht_out_regionst_out_regions
key_valueey_value

Definition at line 346 of file distribution_context.c.

352 {
353  bool returned_value = true;
354 
355  list l_read, l_write, l_in, l_out;
356  list l_params = NIL;
357  list l_priv = NIL;
358 
359  pips_debug(6, "Compute regions\n");
360 
361  l_write = regions_dup
363  l_read = regions_dup
364  (regions_read_regions(load_statement_local_regions(externalized_code)));
365  l_in = regions_dup(load_statement_in_regions(externalized_code));
366  l_out = regions_dup(load_statement_out_regions(externalized_code));
367 
368  ifdebug(6) {
369  pips_debug(6, "READ regions: \n");
370  print_regions(l_read);
371  pips_debug(6, "WRITE regions: \n");
372  print_regions(l_write);
373  }
374 
375  l_params = compute_regions_union (l_in, l_out);
376 
377  l_in = regions_dup(load_statement_in_regions(externalized_code));
378  l_out = regions_dup(load_statement_out_regions(externalized_code));
379  l_priv = RegionsEntitiesInfDifference(l_write, l_in, w_r_combinable_p);
380  l_priv = RegionsEntitiesInfDifference(l_priv, l_out, w_w_combinable_p);
381 
382  l_in = regions_dup(load_statement_in_regions(externalized_code));
383  l_out = regions_dup(load_statement_out_regions(externalized_code));
384 
389 
390  ifdebug(2)
391  {
392  pips_debug(2, "IN regions: \n");
393  print_regions(l_in);
394  pips_debug(2, "OUT regions: \n");
395  print_regions(l_out);
396  pips_debug(2, "Params regions: \n");
397  print_regions(l_params);
398  pips_debug(2, "Private regions: \n");
399  print_regions(l_priv);
400  }
401 
402  /* Storing results in hash_tables */
403 
404  pips_debug(2, "Storing in hash_tables with key %s: \n", (string)key_value);
405 
406  pips_debug(5, "Storing in ht_param: \n");
407  if (!hash_defined_p(*ht_params,key_value)) {
408  hash_put(*ht_params,key_value,l_params);
409  }
410  else {
411  pips_user_warning("Multiply defined value in PARAMS hash_table!\n");
412  returned_value = false;
413  }
414 
415  pips_debug(5, "Storing in ht_private: \n");
416  if (!hash_defined_p(*ht_private,key_value)) {
417  hash_put(*ht_private,key_value,l_priv);
418  }
419  else {
420  pips_user_warning("Multiply defined value in PRIVATE hash_table!\n");
421  returned_value = false;
422  }
423 
424  pips_debug(5, "Storing in ht_in_regions: \n");
425  if (!hash_defined_p(*ht_in_regions,key_value)) {
426  hash_put(*ht_in_regions,key_value,l_in);
427  }
428  else {
429  pips_user_warning("Multiply defined value in IN_REGIONS hash_table!\n");
430  returned_value = false;
431  }
432 
433  pips_debug(5, "Storing in ht_out_regions: \n");
434  if (!hash_defined_p(*ht_out_regions,key_value)) {
435  hash_put(*ht_out_regions,key_value,l_out);
436  }
437  else {
438  pips_user_warning("Multiply defined value in OUT_REGIONS hash_table!\n");
439  returned_value = false;
440  }
441 
442  return returned_value;
443 }
int compare_effect_reference(effect *e1, effect *e2)
int compare_effect_reference(e1, e2):
Definition: compare.c:210
list compute_regions_union(list l_in, list l_out)
Compute union of exact regions.
list RegionsEntitiesInfDifference(list l1, list l2, bool(*difference_combinable_p)(effect, effect))
list RegionsEntitiesInfDifference(list l1, l2) input : two lists of regions output : a list of region...
list regions_write_regions(list)
list regions_read_regions(list)
list regions_dup(list)
bool w_r_combinable_p(effect, effect)
bool w_w_combinable_p(effect, effect)
list load_statement_out_regions(statement)
list load_statement_in_regions(statement)
list load_statement_local_regions(statement)
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
Definition: list.c:796
int(* gen_cmp_func_t)(const void *, const void *)
Definition: newgen_types.h:114

References compare_effect_reference(), compute_regions_union(), gen_sort_list(), hash_defined_p(), hash_put(), ifdebug, load_statement_in_regions(), load_statement_local_regions(), load_statement_out_regions(), NIL, pips_debug, pips_user_warning, print_regions(), regions_dup(), regions_read_regions(), regions_write_regions(), RegionsEntitiesInfDifference(), w_r_combinable_p(), and w_w_combinable_p().

Referenced by compute_distribution_context(), and compute_distribution_controlization_context().

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

◆ make_assignement_statement()

statement make_assignement_statement ( entity  a_variable,
expression  an_expression,
statement  stat 
)

Build and return new statement which is a assignement of variable a_variable with expression an_expression, with empty label, statement number and ordering of statement stat, and empty comments.

Parameters
a_variable_variable
an_expressionn_expression
stattat

Definition at line 392 of file phrase_tools.c.

395 {
398  an_expression,
399  stat);
400 }
statement make_binary_call_statement(const char *operator_name, expression expression1, expression expression2, statement stat)
Build and return new statement which is a binary call with the 2 expressions expression1 and expressi...
Definition: phrase_tools.c:354
#define ASSIGN_OPERATOR_NAME
Definition: ri-util-local.h:95

References a_variable, ASSIGN_OPERATOR_NAME, entity_to_expression(), and make_binary_call_statement().

Referenced by make_body_from_loop(), make_global_common_and_initialize(), and make_initialization_from_loop().

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

◆ make_binary_call_statement()

statement make_binary_call_statement ( const char *  operator_name,
expression  expression1,
expression  expression2,
statement  stat 
)

Build and return new statement which is a binary call with the 2 expressions expression1 and expression2, with empty label, statement number and ordering of statement stat, and empty comments.

Parameters
operator_nameperator_name
expression1xpression1
expression2xpression2
stattat

Definition at line 354 of file phrase_tools.c.

358 {
359  call assignment_call
360  = make_call (entity_intrinsic(operator_name),
362  expression1,
363  CONS(EXPRESSION, expression2, NIL)));
364 
365  if (stat == NULL) {
371  assignment_call),
372  NIL,NULL,
374  }
375  else {
377  statement_number(stat),
378  statement_ordering(stat),
381  assignment_call),
382  NIL,NULL,
384  }
385 }
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 STATEMENT_NUMBER_UNDEFINED
default values
entity entity_empty_label(void)
Definition: entity.c:1105
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define statement_extensions(x)
Definition: ri.h:2464

References CONS, empty_comments, empty_extensions(), entity_empty_label(), entity_intrinsic(), EXPRESSION, is_instruction_call, make_call(), make_instruction(), make_statement(), make_synchronization_none(), NIL, statement_extensions, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.

Referenced by make_array_communication_statement(), and make_communication_statement().

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

◆ make_exec_mmcd()

statement make_exec_mmcd ( void  )

Definition at line 967 of file comEngine_generate_procCode.c.

968 {
969  static int number = 0;
970 
973  int_to_expression(number++),
974  NULL);
975 
976  statement mmcdStat =
979  arg));
980 
981  return mmcdStat;
982 }
static entity gStepEnt
#define call_to_statement(c)
entity module_name_to_runtime_entity(const char *name)
similar to module_name_to_entity but generates a warning and a stub if the entity is not found
Definition: entity.c:1485

References call_to_statement, entity_to_expression(), expression_domain, gen_make_list(), gStepEnt, int_to_expression(), make_call(), module_name_to_runtime_entity(), and strdup().

Referenced by add_exec_mmcd().

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

◆ make_expression_with_state_variable()

expression make_expression_with_state_variable ( entity  state_variable,
int  value,
string  intrinsic_name 
)

fsm_tools.c

fsm_tools.c

state = 23), given an entity state_variable, an int value value, and an intrinsic name

Parameters
state_variabletate_variable
intrinsic_namentrinsic_name

Definition at line 66 of file fsm_tools.c.

69 {
70  return MakeBinaryCall (entity_intrinsic(intrinsic_name),
71  entity_to_expression (state_variable),
73 }
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354

Referenced by make_fsm_from_statement(), and make_transition_statement().

+ Here is the caller graph for this function:

◆ make_fsm_from_statement()

statement make_fsm_from_statement ( statement  stat,
entity  state_variable,
const char *  module_name 
)

This function build and return a statement representing the FSM code equivalent to the given unstructured statement stat.

tring comment; char buffer[256];

Assert that given stat is UNSTRUCTURED

Create loop condition: state variable is not equal to exit value

Evaluation is done BEFORE to enter the loop

No label for loop

Computes the statement representing the transitions

Build the loop

printf (buffer, FSM_BEGIN_COMMENT, entity_local_name(state_variable)); comment = strdup(buffer);

tatement_instruction(loop_body) = make_instruction_block(CONS(STATEMENT,returned_statement,NIL));

Parameters
stattat
state_variabletate_variable
module_nameodule_name

Definition at line 447 of file fsm_tools.c.

450 {
451  statement returned_statement;
452  statement loop_statement;
453  whileloop new_whileloop;
454  expression loop_condition;
456  entity loop_entity = NULL;
457  evaluation loop_evaluation = NULL;
458  instruction loop_instruction;
459  instruction sequence_instruction;
460  sequence new_sequence;
461  /*string comment;
462  char buffer[256];*/
463 
464  /* Assert that given stat is UNSTRUCTURED */
465  pips_assert("Statement is UNSTRUCTURED in FSM_GENERATION",
468 
469  /* Create loop condition: state variable is not equal to exit value */
470  loop_condition
472  (state_variable,
475 
476  /* Evaluation is done BEFORE to enter the loop */
477  loop_evaluation = make_evaluation_before();
478 
479  /* No label for loop */
480  loop_entity = entity_empty_label();
481 
482  /* Computes the statement representing the transitions */
484  state_variable,
485  module_name);
486 
487  /* Build the loop */
488  new_whileloop = make_whileloop(loop_condition,
489  loop_body,
490  loop_entity,
491  loop_evaluation);
492 
493  loop_instruction = make_instruction(is_instruction_whileloop,new_whileloop);
494 
495  /*sprintf (buffer, FSM_BEGIN_COMMENT, entity_local_name(state_variable));
496  comment = strdup(buffer);*/
497 
498  loop_statement = make_statement(statement_label(stat),
499  statement_number(stat),
500  statement_ordering(stat),
502  loop_instruction,NIL,NULL,
504 
505 
506  new_sequence
509  state_variable),
510  CONS(STATEMENT, loop_statement, NIL)));
511 
512  sequence_instruction
514  new_sequence);
515 
516  returned_statement = make_statement(entity_empty_label(),
517  statement_number(stat),
518  statement_ordering(stat),
520  sequence_instruction,NIL,NULL,
522  /*statement_instruction(loop_body)
523  = make_instruction_block(CONS(STATEMENT,returned_statement,NIL));
524  */
525  return returned_statement;
526 }
evaluation make_evaluation_before(void)
Definition: ri.c:786
whileloop make_whileloop(expression a1, statement a2, entity a3, evaluation a4)
Definition: ri.c:2937
sequence make_sequence(list a)
Definition: ri.c:2125
statement make_fsm_transitions_statement(statement stat, entity state_variable, const char *module_name)
This function build and return a statement representing the transitions computation in the FSM,...
Definition: fsm_tools.c:400
int exit_state_variable_value_for_unstructured(statement stat)
Return the state variable value corresponding to the exit in a unstructured statement NB: always retu...
Definition: fsm_tools.c:180
statement make_reset_state_variable_statement(statement stat, entity state_variable)
This function build and return a statement representing the initial assigment of the state_variable,...
Definition: fsm_tools.c:194
expression make_expression_with_state_variable(entity state_variable, int value, string intrinsic_name)
Build and return an expression (eg.
Definition: fsm_tools.c:66
#define NON_EQUAL_OPERATOR_NAME
#define statement_label(x)
Definition: ri.h:2450

Referenced by fsmize_statement().

+ Here is the caller graph for this function:

◆ make_fsm_transitions_statement()

statement make_fsm_transitions_statement ( statement  stat,
entity  state_variable,
const char *  module_name 
)

This function build and return a statement representing the transitions computation in the FSM, given the UNSTRUCTURED statement stat.

en_recurse(unstructured_entry(nodes_graph), control_domain, transitions_filter, transitions_statements);

Parameters
stattat
state_variabletate_variable
module_nameodule_name

Definition at line 400 of file fsm_tools.c.

403 {
404  statement returned_statement = NULL;
406  unstructured nodes_graph;
407  list blocs = NIL ;
408 
409  pips_assert("Statement is UNSTRUCTURED in FSM_GENERATION",
412 
413  nodes_graph = instruction_unstructured(statement_instruction(stat));
414 
415  /*gen_recurse(unstructured_entry(nodes_graph), control_domain,
416  transitions_filter, transitions_statements);*/
417  CONTROL_MAP (current_control, {
418  statement transition_statement;
419  transition_statement = make_transition_statement (current_control,
420  stat,
421  state_variable,
422  module_name);
423  if (returned_statement == NULL) {
424  returned_statement = transition_statement;
425  current_statement = returned_statement;
426  }
427  else {
429  test t;
430  pips_assert("Statement is TEST in FSM_GENERATION transitions",
432  t = instruction_test(i);
433  test_false (t) = transition_statement;
434  current_statement = transition_statement;
435  }
436  }, unstructured_entry(nodes_graph), blocs);
437 
438  pips_debug(2,"blocs count = %zd\n", gen_length(blocs));
439 
440  return returned_statement;
441 }
statement make_transition_statement(control current_node, statement root_statement, entity state_variable, const char *module_name)
This function build a transition statement (a TEST statement) corresponding to the current control cu...
Definition: fsm_tools.c:212
static statement current_statement

Referenced by make_fsm_from_statement().

+ Here is the caller graph for this function:

◆ make_init_newInd_stat()

statement make_init_newInd_stat ( statement  stat,
entity  newInd 
)
Parameters
stattat
newIndewInd

Definition at line 701 of file comEngine_generate_procCode.c.

702 {
703  //printf("make_init_newInd_stat beg\n");
704 
705  list lUnSupportedRef = hash_get(gLoopToUnSupRef, stat);
706 
707  pips_assert("lUnSupportedRef != HASH_UNDEFINED_VALUE",
708  lUnSupportedRef != HASH_UNDEFINED_VALUE);
709 
710  if((!has_loop_inside(loop_body(statement_loop(stat)))) &&
711  (lUnSupportedRef == NIL))
712  {
713  return statement_undefined;
714  }
715 
716  int fifoNum = find_or_create_slot(loop_index(statement_loop(stat)));
717 
718  statement newStat =
720  int_to_expression(fifoNum),
721  entity_to_expression(newInd),
723  int_to_expression(1));
724 
725  //printf("make_init_newInd_stat end\n");
726  return newStat;
727 }
#define GEN_LOAD_MMCD
Definition: comEngine.h:40
static int find_or_create_slot(entity ent)
static statement make_mmcd_load_store_stat(string name, expression hreBuff, expression refExp, expression offExp, expression countExp)
static bool has_loop_inside(statement stat)

References entity_to_expression(), find_or_create_slot(), GEN_LOAD_MMCD, gLoopToUnSupRef, has_loop_inside(), hash_get(), HASH_UNDEFINED_VALUE, int_to_expression(), loop_body, loop_index, make_mmcd_load_store_stat(), NIL, pips_assert, statement_loop(), statement_undefined, and strdup().

Referenced by add_toggle_inc_statements().

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

◆ make_loop_lStats_HRE()

list make_loop_lStats_HRE ( statement  ,
entity  ,
statement  ,
entity  ,
list  ,
hash_table  ,
expression   
)

◆ make_loop_lStats_proc()

list make_loop_lStats_proc ( statement  stat,
entity  transferSize,
statement  innerStat,
entity  newOuterInd,
list  lSupportedRef,
hash_table  htOffset,
expression  bufferSizeExp 
)
Parameters
stattat
transferSizeransferSize
innerStatnnerStat
newOuterIndewOuterInd
lSupportedRefSupportedRef
htOffsettOffset
bufferSizeExpufferSizeExp

Definition at line 1114 of file comEngine_generate_procCode.c.

1118 {
1119  return make_lStats(stat, transferSize,
1120  innerStat, newOuterInd,
1121  lSupportedRef, htOffset,
1122  bufferSizeExp);
1123 }
static list make_lStats(statement stat, entity transferSize, statement innerStat, entity newOuterInd, list lSupportedRef, hash_table htOffset, expression bufferSizeExp)

References make_lStats().

Referenced by make_loopStat1().

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

◆ make_loop_step_stat()

statement make_loop_step_stat ( statement  stat,
entity  newOuterInd 
)
Parameters
stattat
newOuterIndewOuterInd

Definition at line 554 of file comEngine_generate_procCode.c.

555 {
556  loop curLoop = statement_loop(stat);
557 
558  statement stepStat;
559 
560  if(gGenHRE)
561  {
562  stepStat = make_wait_step_statement();
563  }
564  else
565  {
566  stepStat = make_step_inc_statement(1);
567  }
568 
570  entity_to_expression(newOuterInd),
572  NULL);
573 
574  expression neExp =
576  neArg));
577 
578  test t = make_test(neExp, stepStat, make_empty_statement());
579 
580  stepStat = make_statement(entity_empty_label(),
585  NIL,NULL,
587 
588  return stepStat;
589 }
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
#define C_GREATER_THAN_OPERATOR_NAME
#define range_lower(x)
Definition: ri.h:2288

References C_GREATER_THAN_OPERATOR_NAME, call_to_expression(), copy_expression(), empty_comments, empty_extensions(), entity_empty_label(), entity_intrinsic(), entity_to_expression(), expression_domain, gen_make_list(), gGenHRE, is_instruction_test, loop_range, make_call(), make_empty_statement, make_instruction(), make_statement(), make_step_inc_statement(), make_synchronization_none(), make_test(), make_wait_step_statement(), NIL, range_lower, statement_loop(), STATEMENT_NUMBER_UNDEFINED, and STATEMENT_ORDERING_UNDEFINED.

+ Here is the call graph for this function:

◆ make_receive_array_params_modules()

list make_receive_array_params_modules ( entity  function,
list  l_regions,
entity  global_common,
entity  externalized_fonction_common,
int  number_of_deployment_units 
)

Make all RECEIVE_PARAM communication modules for non-scalar regions for a given function.

Parameters
functionunction
l_regions_regions
global_commonlobal_common
externalized_fonction_commonxternalized_fonction_common
number_of_deployment_unitsumber_of_deployment_units

Definition at line 961 of file phrase_distributor_communication.c.

966 {
967  return make_array_communication_modules (function,
968  l_regions,
969  global_common,
970  externalized_fonction_common,
971  number_of_deployment_units,
972  true);
973 }
static list make_array_communication_modules(entity function, list l_regions, entity global_common, entity externalized_fonction_common, int number_of_deployment_units, bool is_receiving)
Internally used for making all communication modules for non-scalar IN or OUT regions for a given fun...

References make_array_communication_modules().

Referenced by controlize_distribution().

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

◆ make_receive_scalar_params_modules()

list make_receive_scalar_params_modules ( hash_table  ht_out_communications,
int  number_of_deployment_units,
entity  global_common,
list  l_commons 
)

Build and return list of modules used for OUTPUT communications (RECEIVE_PARAMETERS...)

Parameters
ht_out_communicationst_out_communications
number_of_deployment_unitsumber_of_deployment_units
global_commonlobal_common
l_commons_commons

Definition at line 609 of file phrase_distributor_communication.c.

613 {
614  return make_scalar_communication_modules (ht_out_communications,
615  number_of_deployment_units,
616  global_common,
617  l_commons,
618  true);
619 }
static list l_commons
static list make_scalar_communication_modules(hash_table ht_communications, int number_of_deployment_units, entity global_common, list l_commons, bool is_receiving)
Internally used for building communication modules.

References l_commons, and make_scalar_communication_modules().

Referenced by controlize_distribution().

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

◆ make_reset_state_variable_statement()

statement make_reset_state_variable_statement ( statement  stat,
entity  state_variable 
)

This function build and return a statement representing the initial assigment of the state_variable, given the UNSTRUCTURED statement stat.

Parameters
stattat
state_variabletate_variable

Definition at line 194 of file fsm_tools.c.

196 {
198  (stat,
199  state_variable,
201 }
statement make_state_variable_assignement_statement(statement stat, entity state_variable, int assignement_value)
This function build and return a statement representing the initial assigment of the state_variable,...
Definition: fsm_tools.c:129
int entry_state_variable_value_for_unstructured(statement stat)
Return the state variable value corresponding to the entry in a unstructured statement.
Definition: fsm_tools.c:162

Referenced by make_fsm_from_statement().

+ Here is the caller graph for this function:

◆ make_send_array_params_modules()

list make_send_array_params_modules ( entity  function,
list  l_regions,
entity  global_common,
entity  externalized_fonction_common,
int  number_of_deployment_units 
)

Make all SEND_PARAM communication modules for non-scalar regions for a given function.

Parameters
functionunction
l_regions_regions
global_commonlobal_common
externalized_fonction_commonxternalized_fonction_common
number_of_deployment_unitsumber_of_deployment_units

Definition at line 943 of file phrase_distributor_communication.c.

948 {
949  return make_array_communication_modules (function,
950  l_regions,
951  global_common,
952  externalized_fonction_common,
953  number_of_deployment_units,
954  false);
955 }

References make_array_communication_modules().

Referenced by controlize_distribution().

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

◆ make_send_scalar_params_modules()

list make_send_scalar_params_modules ( hash_table  ht_in_communications,
int  number_of_deployment_units,
entity  global_common,
list  l_commons 
)

Build and return list of modules used for INPUT communications (SEND_PARAMETERS...)

Parameters
ht_in_communicationst_in_communications
number_of_deployment_unitsumber_of_deployment_units
global_commonlobal_common
l_commons_commons

Definition at line 593 of file phrase_distributor_communication.c.

597 {
598  return make_scalar_communication_modules (ht_in_communications,
599  number_of_deployment_units,
600  global_common,
601  l_commons,
602  false);
603 }

References l_commons, and make_scalar_communication_modules().

Referenced by controlize_distribution().

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

◆ make_start_ru_module()

entity make_start_ru_module ( hash_table  ht_params,
statement module_statement,
int  number_of_deployment_units,
entity  global_common,
list  l_commons 
)

phrase_distributor_communication.c

phrase_distributor_communication.c

Build and store new module START_RU. Create statement module_statement

Declare CONTROL_DATA common to be visible here

Declare commons for all externalized functions to be visible here

Compute the parameters of call function

Processing PARAMS regions

Make the CALL statement

Parameters
ht_paramst_params
module_statementodule_statement
number_of_deployment_unitsumber_of_deployment_units
global_commonlobal_common
l_commons_commons

Definition at line 71 of file phrase_distributor_communication.c.

76 {
77  entity start_ru_module;
78  entity func_id;
79  entity unit_id = NULL;
80  const char* function_name;
81  list stat_seq = NIL;
82  sequence new_sequence;
83  instruction sequence_instruction;
84  entity set_entity = get_current_module_entity();
85 
87  pips_debug(2, "Creating module %s\n", entity_global_name(start_ru_module));
89  set_current_module_entity(start_ru_module);
92  start_ru_module,
93  1);
94  if (number_of_deployment_units > 1) {
97  start_ru_module,
98  2);
99  }
100 
101  /* Declare CONTROL_DATA common to be visible here */
102  declare_common_variables_in_module (global_common, start_ru_module);
103 
104  /* Declare commons for all externalized functions to be visible here */
105  MAP (ENTITY, com, {
106  declare_common_variables_in_module (com, start_ru_module);
107  },l_commons);
108 
109  ifdebug(7) {
110  pips_debug(7, "Declarations for START_RU module: \n");
111  fprint_environment(stderr, start_ru_module);
112  }
113 
114  HASH_MAP (externalized_function, l_params, {
115 
116  entity function = (entity)externalized_function;
118  test new_test;
119  instruction test_instruction;
120  statement test_statement;
121  statement call_statement;
122  list call_params ;
123 
124  function_name = entity_local_name(function);
125 #if 0
126  statement called_module_stat = (statement) db_get_memory_resource(DBR_CODE,
127  function_name,
128  true);
129 
130 #endif
131  entity called_module = local_name_to_top_level_entity(function_name);
132 
133  /* Compute the parameters of call function */
134  call_params = NIL;
135 
136  /* Processing PARAMS regions */
137  MAP (REGION, reg, {
140  entity local_variable
141  = entity_in_module (get_common_param_name(reference_variable(ref), function), start_ru_module);
142  list indices = NIL;
143  if (number_of_deployment_units > 1) {
144  list primary_indices = variable_dimensions(type_variable(entity_type(local_variable)));
145  expression to_be_replaced = NULL;
146  MAP (DIMENSION, dim, {
148  dimension_lower(dim),
149  indices);
150  to_be_replaced=dimension_lower(dim);
151  }, primary_indices);
152  gen_list_patch (indices,to_be_replaced,entity_to_expression(unit_id));
154  }
155  new_param = make_entity_expression (local_variable, indices);
156  call_params = CONS(EXPRESSION, new_param, call_params);
157  }, (list)l_params);
158 
159  call_params = gen_nreverse(call_params);
160 
161  /* Make the CALL statement */
162  call_statement = make_statement(entity_empty_label(),
167  make_call(called_module,call_params)),
168  NIL,NULL,
170 
173  entity_to_expression (func_id),
174  entity_to_expression (entity_in_module (get_function_id_name(function), start_ru_module)));
175 
176  new_test = make_test (test_condition, call_statement,
178 
179  test_instruction = make_instruction (is_instruction_test,new_test);
180 
181  test_statement = make_statement (entity_empty_label(),
185  test_instruction,NIL,NULL,
187 
188  stat_seq = CONS (STATEMENT, test_statement, stat_seq);
189 
190  }, ht_params);
191 
192  stat_seq = gen_nreverse(CONS(STATEMENT, make_return_statement(start_ru_module), stat_seq));
193 
194  new_sequence
195  = make_sequence (stat_seq);
196 
197  sequence_instruction
199  new_sequence);
200 
205  sequence_instruction,NIL,NULL,
207 
209 
211  set_current_module_entity(set_entity);
212  return start_ru_module;
213 }
language make_language_unknown(void)
Definition: ri.c:1259
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
void new_param(string s)
===========================================================================
Definition: adg_read_paf.c:262
static statement module_statement
Definition: alias_check.c:125
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
statement make_return_statement(entity)
Definition: statement.c:779
statement make_continue_statement(entity)
Definition: statement.c:953
static list indices
Definition: icm.c:204
entity entity_in_module(const char *, entity)
Return entity named name in specified module.
string get_common_param_name(entity variable, entity)
entity create_integer_parameter_for_new_module(const char *, const char *, entity, int)
Create new integer variable parameter for a newly created module.
void store_new_module(const char *, entity, statement)
Store (PIPDBM) newly created module module with module_statement as USER_FILE by saving pretty printi...
void declare_common_variables_in_module(entity, entity)
Creates all the things that need to be created in order to declare common in module (all the variable...
string get_function_id_name(entity)
#define START_RU_PARAM1_NAME
#define START_RU_PARAM2_NAME
#define START_RU_MODULE_NAME
Stuff for START_RU(...) subroutine generation.
#define EQUAL_OPERATOR_NAME
void fprint_environment(FILE *fd, entity m)
Definition: declarations.c:287
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 make_empty_subroutine(const char *name, language l)
Definition: entity.c:268
expression make_entity_expression(entity e, cons *inds)
Definition: expression.c:176
#define dimension_lower(x)
Definition: ri.h:980
#define test_condition(x)
Definition: ri.h:2833
#define variable_dimensions(x)
Definition: ri.h:3122

References CONS, create_integer_parameter_for_new_module(), db_get_memory_resource(), declare_common_variables_in_module(), DIMENSION, dimension_lower, effect_any_reference, empty_comments, empty_extensions(), ENTITY, entity_empty_label(), entity_global_name(), entity_in_module(), entity_intrinsic(), entity_local_name(), entity_to_expression(), entity_type, entity_undefined, EQUAL_OPERATOR_NAME, EXPRESSION, fprint_environment(), gen_list_patch(), gen_nreverse(), get_common_param_name(), get_current_module_entity(), get_function_id_name(), HASH_MAP, ifdebug, indices, is_instruction_call, is_instruction_sequence, is_instruction_test, l_commons, local_name_to_top_level_entity(), make_call(), make_continue_statement(), make_empty_subroutine(), make_entity_expression(), make_instruction(), make_language_unknown(), make_return_statement(), make_sequence(), make_statement(), make_synchronization_none(), make_test(), MakeBinaryCall(), MAP, module_statement, new_param(), NIL, pips_debug, ref, reference_variable, REGION, reset_current_module_entity(), set_current_module_entity(), START_RU_MODULE_NAME, START_RU_PARAM1_NAME, START_RU_PARAM2_NAME, STATEMENT, STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, store_new_module(), strdup(), test_condition, type_variable, and variable_dimensions.

Referenced by controlize_distribution().

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

◆ make_state_variable_assignement_statement()

statement make_state_variable_assignement_statement ( statement  stat,
entity  state_variable,
int  assignement_value 
)

This function build and return a statement representing the initial assigment of the state_variable, given the UNSTRUCTURED statement stat.

tatement_label(stat),

Parameters
stattat
state_variabletate_variable
assignement_valuessignement_value

Definition at line 129 of file fsm_tools.c.

132 {
133  statement returned_statement;
134  instruction new_instruction;
135  call assignment_call;
136 
137  assignment_call = make_call (entity_intrinsic(ASSIGN_OPERATOR_NAME),
139  entity_to_expression(state_variable),
140  CONS(EXPRESSION, int_to_expression (assignement_value), NIL)));
141 
142  new_instruction
144  assignment_call);
145 
146  returned_statement = make_statement(entity_empty_label(),
147  /*statement_label(stat),*/
148  statement_number(stat),
149  statement_ordering(stat),
151  new_instruction,
152  NIL,NULL,
154 
155  return returned_statement;
156 }

Referenced by make_reset_state_variable_statement(), and make_transition_statement().

+ Here is the caller graph for this function:

◆ make_step_inc_statement()

statement make_step_inc_statement ( int  incNum)

◆ make_toggle_inc_statement()

statement make_toggle_inc_statement ( entity  toggleEnt,
int  val 
)
Parameters
toggleEntoggleEnt
valal

Definition at line 222 of file comEngine_generate_code.c.

223 {
225  entity_to_expression(toggleEnt),
226  int_to_expression(val),
227  NULL);
228 
229  expression modExp =
231  modArg));
232 
234  modExp);
235 }
#define C_MODULO_OPERATOR_NAME

References C_MODULO_OPERATOR_NAME, call_to_expression(), entity_intrinsic(), entity_to_expression(), expression_domain, gen_make_list(), int_to_expression(), make_assign_statement(), and make_call().

Referenced by add_toggle_inc_statements(), and regenerate_toggles().

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

◆ make_toggle_init_statement()

statement make_toggle_init_statement ( entity  toggleEnt)
Parameters
toggleEntoggleEnt

Definition at line 189 of file comEngine_generate_code.c.

190 {
192  int_to_expression(0));
193 }

References entity_to_expression(), int_to_expression(), and make_assign_statement().

Referenced by regenerate_toggles(), and update_toggle_init_stats_list().

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

◆ make_toggle_mmcd()

statement make_toggle_mmcd ( entity  ent)
Parameters
entnt

Definition at line 668 of file comEngine_generate_procCode.c.

669 {
670  int fifoNum = alloc_new_slot(ent);
671 
672  statement newStat =
674  int_to_expression(fifoNum),
677  int_to_expression(1));
678 
679  return newStat;
680 }
static int alloc_new_slot(entity ent)

References alloc_new_slot(), entity_to_expression(), GEN_LOAD_MMCD, int_to_expression(), make_mmcd_load_store_stat(), and strdup().

Referenced by add_toggle_inc_statements(), and regenerate_toggles().

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

◆ make_transition_statement()

statement make_transition_statement ( control  current_node,
statement  root_statement,
entity  state_variable,
const char *  module_name 
)

This function build a transition statement (a TEST statement) corresponding to the current control current_node and the root_statement root_statement.

This TEST statement takes a condition on the state_variable having the value matching the statement ordering value, and the control statement for the test_true value. The test_false value is set with a continue statement, before to be eventually replaced in next control node by a new statement.

tring comment; char buffer[50];

This is the exit node, or a non-test statement

This is the exit node, just generate exit code for state_variable

successors_nb == 1

This is a "normal" node, ie not a TEST statement, just add assignement for state_variable with new value

NULL here because we will generate a new state variable, since the potential other FSMs are deeper

This is a "test" node, ie with a TEST statement, just add assignement for state_variable with new value after each statement in TEST

:-)

printf (buffer, FSM_TRANSITION_COMMENT, entity_local_name(state_variable), current_transition_number); comment = strdup(buffer);

tatement_label(root_statement),

Parameters
current_nodeurrent_node
root_statementoot_statement
state_variabletate_variable
module_nameodule_name

Definition at line 212 of file fsm_tools.c.

216 {
217  statement returned_statement = NULL;
218  statement transition_statement = NULL;
219  statement stat = control_statement (current_node);
220  instruction test_instruction;
221  instruction transition_instruction;
222  sequence transition_sequence;
223  test new_test;
225  int successors_nb;
226  int current_transition_number;
227  /*string comment;
228  char buffer[50];*/
229 
230  debug_control ("TRANSITION: Module statement", current_node, 2);
231 
232  current_transition_number = beautify_ordering (statement_ordering(stat));
233 
235  = make_expression_with_state_variable (state_variable,
236  current_transition_number,
238 
239  successors_nb = gen_length(control_successors(current_node));
240 
241  if ((successors_nb == 0) || (successors_nb == 1)) {
242  /* This is the exit node, or a non-test statement */
243  int next_value;
244  statement state_variable_assignement;
245 
246  if (successors_nb == 0) {
247  /* This is the exit node, just generate exit code for state_variable */
248  next_value = exit_state_variable_value_for_unstructured (root_statement);
249  }
250  else { /* successors_nb == 1 */
251  /* This is a "normal" node, ie not a TEST statement, just add
252  assignement for state_variable with new value */
253  next_value
256  (CONTROL(gen_nth(0,control_successors(current_node))))));
257  }
258 
259  state_variable_assignement
261  (stat, state_variable, next_value);
262 
263  transition_sequence
265  fsmize_statement(stat, NULL, module_name),
266  /* NULL here because we will generate
267  * a new state variable, since the potential
268  * other FSMs are deeper */
269  CONS(STATEMENT, state_variable_assignement, NIL)));
270 
271  transition_instruction
273  transition_sequence);
274 
275  transition_statement = make_statement(entity_empty_label(),
276  statement_number(stat),
277  statement_ordering(stat),
279  transition_instruction,NIL,NULL,
281  }
282  else if (successors_nb == 2) {
283  /* This is a "test" node, ie with a TEST statement, just add
284  assignement for state_variable with new value after each
285  statement in TEST */
286  int value_if_true = beautify_ordering (statement_ordering
288  (CONTROL(gen_nth(0,control_successors(current_node))))));
289  int value_if_false = beautify_ordering (statement_ordering
291  (CONTROL(gen_nth(1,control_successors(current_node))))));
292  statement transition_statement_if_true;
293  statement transition_statement_if_false;
294  sequence transition_sequence_if_true;
295  sequence transition_sequence_if_false;
296  instruction transition_instruction_if_true;
297  instruction transition_instruction_if_false;
298  statement state_variable_assignement_if_true;
299  statement state_variable_assignement_if_false;
300  statement old_statement_if_true;
301  statement old_statement_if_false;
302  test current_test;
303 
304  pips_assert("Statement with 2 successors is a TEST in FSM_GENERATION",
307 
308  current_test = instruction_test (statement_instruction(stat));
309 
310  // Begin computing for the true statement
311 
312  old_statement_if_true = test_true(current_test);
313 
314  state_variable_assignement_if_true
316  (stat, state_variable, value_if_true);
317 
318  transition_sequence_if_true
320  old_statement_if_true,
321  CONS(STATEMENT, state_variable_assignement_if_true, NIL)));
322 
323  transition_instruction_if_true
325  transition_sequence_if_true);
326 
327  transition_statement_if_true = make_statement (entity_empty_label(),
328  statement_number(stat),
329  statement_ordering(stat),
331  transition_instruction_if_true,
332  NIL,NULL,
334 
335  test_true(current_test) = transition_statement_if_true;
336 
337  // Begin computing for the false statement
338 
339  old_statement_if_false = test_false(current_test);
340 
341  state_variable_assignement_if_false
343  (stat, state_variable, value_if_false);
344 
345  transition_sequence_if_false
347  old_statement_if_false,
348  CONS(STATEMENT, state_variable_assignement_if_false, NIL)));
349 
350  transition_instruction_if_false
352  transition_sequence_if_false);
353 
354  transition_statement_if_false
357  statement_number(stat),
358  statement_ordering(stat),
360  transition_instruction_if_false,NIL,NULL,
362 
363  test_false(current_test) = transition_statement_if_false;
364 
365  transition_statement = stat;
366 
367  }
368  else {
369  pips_assert("I should NOT be there :-)", 2+2 != 4); /* :-) */
370  }
371 
372  new_test = make_test (test_condition, transition_statement,
374 
375  test_instruction = make_instruction (is_instruction_test,new_test);
376 
377  /*sprintf (buffer,
378  FSM_TRANSITION_COMMENT,
379  entity_local_name(state_variable),
380  current_transition_number);
381  comment = strdup(buffer);*/
382 
383  returned_statement = make_statement (entity_empty_label(),
384  /*statement_label(root_statement),*/
385  statement_number(root_statement),
386  statement_ordering(root_statement),
388  test_instruction,NIL,NULL,
390 
391  return returned_statement;
392 
393 }
void debug_control(const char *, control, int)
DEBUG FUNCTION: print debugging informations for a control a_control.
Definition: phrase_tools.c:134

Referenced by make_fsm_transitions_statement().

+ Here is the caller graph for this function:

◆ make_transStat()

statement make_transStat ( statement  stat,
entity  newOuterInd,
entity  transferSize,
expression  bufferSizeExp 
)

tatement stepStat = make_loop_step_stat(stat, newOuterInd);

newStat = make_block_statement(gen_nconc(CONS(STATEMENT, stepStat, NIL), CONS(STATEMENT, newStat, NIL)));

f(!gGenHRE) { statement indStat = make_init_newInd_stat(stat, newOuterInd);

if(indStat != statement_undefined) { newStat = make_block_statement(gen_nconc(CONS(STATEMENT, newStat, NIL), CONS(STATEMENT, indStat, NIL))); } }

Parameters
stattat
newOuterIndewOuterInd
transferSizeransferSize
bufferSizeExpufferSizeExp

Definition at line 733 of file comEngine_generate_procCode.c.

735 {
736  statement newStat = statement_undefined;
737 
738  loop curLoop = statement_loop(stat);
739 
740  list rgSizeArg1 = gen_make_list(expression_domain,
742  copy_expression(bufferSizeExp),
743  NULL);
744 
745  expression rgSizeExp1 =
747  rgSizeArg1));
748 
749 
751  copy_expression(bufferSizeExp),
752  rgSizeExp1,
753  NULL);
754 
756  arg2Arg));
757 
759  arg2,
760  entity_to_expression(newOuterInd),
761  NULL);
762 
763  expression leExp =
765  leArg));
766 
769  copy_expression(bufferSizeExp),
770  NULL);
771 
772  expression modExp =
774  modArg));
775 
777  modExp,
779  NULL);
780 
781  expression addExp =
783  addArg));
784 
785  statement trueStat = make_assign_statement(entity_to_expression(transferSize),
786  addExp);
787 
788  statement falseStat = make_assign_statement(entity_to_expression(transferSize),
789  copy_expression(bufferSizeExp));
790 
791  expression rgUpper = range_upper(loop_range(curLoop));
792  intptr_t upVal = -1;
793  intptr_t rate = -1;
794  expression_integer_value(rgUpper, &upVal);
795  expression_integer_value(bufferSizeExp, &rate);
796 
797  if((upVal != -1) &&
798  (rate != -1) &&
799  ((upVal+1)%rate == 0))
800  {
801  free_expression(leExp);
802  free_statement(trueStat);
803  newStat = falseStat;
804  }
805  else if((upVal+1) < rate)
806  {
807  free_expression(leExp);
808  free_statement(falseStat);
809  newStat = trueStat;
810  }
811  else
812  {
813  test t = make_test(leExp, trueStat, falseStat);
814 
815  newStat = make_statement(entity_empty_label(),
820  NIL,NULL,
822  }
823 
824  /*statement stepStat = make_loop_step_stat(stat, newOuterInd);
825 
826  newStat = make_block_statement(gen_nconc(CONS(STATEMENT, stepStat, NIL),
827  CONS(STATEMENT, newStat, NIL)));
828  */
829  /*if(!gGenHRE)
830  {
831  statement indStat = make_init_newInd_stat(stat, newOuterInd);
832 
833  if(indStat != statement_undefined)
834  {
835  newStat =
836  make_block_statement(gen_nconc(CONS(STATEMENT, newStat, NIL),
837  CONS(STATEMENT, indStat, NIL)));
838  }
839  }
840 */
841  return newStat;
842 }
void free_expression(expression p)
Definition: ri.c:853
#define C_LESS_OR_EQUAL_OPERATOR_NAME
#define DIVIDE_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
#define PLUS_C_OPERATOR_NAME
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792

References C_LESS_OR_EQUAL_OPERATOR_NAME, C_MODULO_OPERATOR_NAME, call_to_expression(), copy_expression(), DIVIDE_OPERATOR_NAME, empty_comments, empty_extensions(), entity_empty_label(), entity_intrinsic(), entity_to_expression(), expression_domain, expression_integer_value(), free_expression(), free_statement(), gen_make_list(), int_to_expression(), intptr_t, is_instruction_test, loop_range, make_assign_statement(), make_call(), make_instruction(), make_statement(), make_synchronization_none(), make_test(), MULTIPLY_OPERATOR_NAME, NIL, PLUS_C_OPERATOR_NAME, range_upper, statement_loop(), STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, and statement_undefined.

Referenced by make_loop_lStats_HRE(), and make_lStats().

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

◆ make_variable_from_name_and_entity()

entity make_variable_from_name_and_entity ( entity  cloned_variable,
const char *  base_name,
statement  stat,
const char *  module_name 
)

Build and return new entity obtained by cloning variable cloned_variable, with a name obtained by the concatenation of base_name and the statement ordering of statement stat.

If such entity already exist, increment statement ordering to get first free name. We assume then that created entity's name is unique.

Parameters
cloned_variableloned_variable
base_namease_name
stattat
module_nameodule_name

Definition at line 325 of file phrase_tools.c.

329 {
330  string variable_name;
331  entity returned_variable = NULL;
332  int index = statement_ordering(stat);
333  //char *buffer;
334 
335  while (returned_variable == NULL) {
336 
337  asprintf(&variable_name, base_name, index++);
338  returned_variable
339  = clone_variable_with_new_name (cloned_variable,
341  module_name);
342  }
343 
344  return returned_variable;
345 
346 }
entity clone_variable_with_new_name(entity a_variable, const char *new_name, const char *module_name)
This function build and return new variable from a variable a_variable, with name new_name.
Definition: phrase_tools.c:269

References asprintf, clone_variable_with_new_name(), module_name(), statement_ordering, and variable_name().

Referenced by make_begin_variable(), make_end_variable(), make_increment_variable(), and make_index_variable().

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

◆ make_wait_ru_module()

entity make_wait_ru_module ( statement ,
int  ,
entity  ,
list   
)

Referenced by controlize_distribution().

+ Here is the caller graph for this function:

◆ make_wait_step_statement()

statement make_wait_step_statement ( void  )

Definition at line 113 of file comEngine_generate_HRECode.c.

114 {
115  statement newStat = statement_undefined;
116 
117  newStat = call_to_statement(
119  NIL));
120 
121  return newStat;
122 }
#define WAIT_FOR_NEXT_STEP
Definition: comEngine.h:39

References call_to_statement, make_call(), module_name_to_runtime_entity(), NIL, statement_undefined, and WAIT_FOR_NEXT_STEP.

Referenced by generate_code_call(), generate_stat_from_ref_list_HRE(), generate_stat_from_ref_list_HRE_list(), make_loop_step_stat(), and process_gLoopToSync_HRE().

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

◆ phrase_comEngine_distributor()

bool phrase_comEngine_distributor ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 511 of file comEngine_distribute.c.

512 {
513  statement module_stat;
514  entity module;
515 
517 
518  // set and get the current properties concerning regions
519  set_bool_property("MUST_REGIONS", true);
520  set_bool_property("EXACT_REGIONS", true);
522 
523  // get the resources
524  module_stat = (statement) db_get_memory_resource(DBR_CODE,
525  module_name,
526  true);
527 
529 
530  set_current_module_statement(module_stat);
531  set_current_module_entity(module_name_to_entity(module_name)); // FI: a bit redundant since module is already available
532 
534  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
536  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
538 
539  // sets dynamic_area
543  }
544 
545  debug_on("PHRASE_COMENGINE_DISTRIBUTOR_DEBUG_LEVEL");
546 
547  // Get the READ, WRITE, IN and OUT regions of the module
549  db_get_memory_resource(DBR_REGIONS, module_name, true));
551  db_get_memory_resource(DBR_IN_REGIONS, module_name, true));
553  db_get_memory_resource(DBR_OUT_REGIONS, module_name, true));
554 
555  // Now do the job
556 
557  pips_debug(2, "BEGIN of PHRASE_DISTRIBUTOR\n");
558  comEngine_distribute(module_name, module_stat, module);
559  pips_debug(2, "END of PHRASE_DISTRIBUTOR\n");
560 
561  //print_statement(module_stat);
562 
563  pips_assert("Statement structure is consistent after PHRASE_DISTRIBUTOR",
564  gen_consistent_p((gen_chunk*)module_stat));
565 
566  pips_assert("Statement is consistent after PHRASE_DISTRIBUTOR",
567  statement_consistent_p(module_stat));
568 
569  // Reorder the module, because new statements have been added
570  module_reorder(module_stat);
571  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, module_stat);
572  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
573  compute_callees(module_stat));
574 
575  // update/release resources
585 
586  debug_off();
587 
588  return true;
589 }
void comEngine_distribute(const char *module_name, statement module_stat, entity module)
void get_regions_properties(void)
void set_rw_effects(statement_effects)
void reset_out_effects(void)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void set_out_effects(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
void reset_cumulated_rw_effects(void)
void reset_rw_effects(void)
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
Definition: genClib.c:2398
static entity dynamic_area
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
#define entity_undefined_p(x)
Definition: ri.h:2762
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
Definition: mappings.c:624
void free_value_mappings(void)
Normal call to free the mappings.
Definition: value.c:1212
A gen_chunk is used to store every object.
Definition: genC.h:58

References comEngine_distribute(), compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dynamic_area, DYNAMIC_AREA_LOCAL_NAME, entity_undefined, entity_undefined_p, FindOrCreateEntity(), free_value_mappings(), gen_consistent_p(), get_regions_properties(), module, module_local_name(), module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), pips_assert, pips_debug, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_out_effects(), reset_proper_rw_effects(), reset_rw_effects(), set_bool_property(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_out_effects(), set_proper_rw_effects(), set_rw_effects(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ phrase_distributor()

bool phrase_distributor ( const char *  module_name)

set and get the current properties concerning regions

get the resources

sets dynamic_area

Get the READ, WRITE, IN and OUT regions of the module

Now do the job

Reorder the module, because new statements have been added

update/release resources

Parameters
module_nameodule_name

Definition at line 816 of file phrase_distributor.c.

817 {
818  statement module_stat;
819  entity module;
820 
821  /* set and get the current properties concerning regions */
822  set_bool_property("MUST_REGIONS", true);
823  set_bool_property("EXACT_REGIONS", true);
825 
826  /* get the resources */
827  module_stat = (statement) db_get_memory_resource(DBR_CODE,
828  module_name,
829  true);
830 
832 
833  set_current_module_statement(module_stat);
835 
837  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
839  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
841 
842  /* sets dynamic_area */
846  }
847 
848  debug_on("PHRASE_DISTRIBUTOR_DEBUG_LEVEL");
849 
850  /* Get the READ, WRITE, IN and OUT regions of the module
851  */
853  db_get_memory_resource(DBR_REGIONS, module_name, true));
855  db_get_memory_resource(DBR_IN_REGIONS, module_name, true));
857  db_get_memory_resource(DBR_OUT_REGIONS, module_name, true));
858 
859  /* Now do the job */
860 
861  pips_debug(2, "BEGIN of PHRASE_DISTRIBUTOR\n");
862  distribute (module_stat, module);
863  pips_debug(2, "END of PHRASE_DISTRIBUTOR\n");
864 
865  //print_statement(module_stat);
866 
867  pips_assert("Statement structure is consistent after PHRASE_DISTRIBUTOR",
868  gen_consistent_p((gen_chunk*)module_stat));
869 
870  pips_assert("Statement is consistent after PHRASE_DISTRIBUTOR",
871  statement_consistent_p(module_stat));
872 
873  /* Reorder the module, because new statements have been added */
874  module_reorder(module_stat);
875  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, module_stat);
876  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
877  compute_callees(module_stat));
878 
879  /* update/release resources */
889 
890  debug_off();
891 
892  return true;
893 }
static void distribute(statement module_stat, entity module)
Main function for PHRASE_DISTRIBUTION: phrase distribution for main module module,...

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, distribute(), dynamic_area, DYNAMIC_AREA_LOCAL_NAME, entity_undefined, entity_undefined_p, FindOrCreateEntity(), free_value_mappings(), gen_consistent_p(), get_regions_properties(), module, module_local_name(), module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), pips_assert, pips_debug, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_out_effects(), reset_proper_rw_effects(), reset_rw_effects(), set_bool_property(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_out_effects(), set_proper_rw_effects(), set_rw_effects(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ phrase_distributor_control_code()

bool phrase_distributor_control_code ( const char *  module_name)

set and get the current properties concerning regions

get the resources

sets dynamic_area

Get the READ, WRITE, IN and OUT regions of the module

Now do the job

Display the statement before to check consistency

Check the coherency of data

Reorder the module, because new statements have been added

update/release resources

Parameters
module_nameodule_name

Definition at line 1039 of file phrase_distributor_control_code.c.

1040 {
1041  statement module_stat;
1042  entity module;
1043 
1044  /* set and get the current properties concerning regions */
1045  set_bool_property("MUST_REGIONS", true);
1046  set_bool_property("EXACT_REGIONS", true);
1048 
1049  /* get the resources */
1050  module_stat = (statement) db_get_memory_resource(DBR_CODE,
1051  module_name,
1052  true);
1053 
1055 
1056  set_current_module_statement(module_stat);
1058 
1060  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
1062  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
1064 
1065  /* sets dynamic_area */
1069  }
1070 
1071  debug_on("PHRASE_DISTRIBUTOR_DEBUG_LEVEL");
1072 
1073  /* Get the READ, WRITE, IN and OUT regions of the module
1074  */
1076  db_get_memory_resource(DBR_REGIONS, module_name, true));
1078  db_get_memory_resource(DBR_IN_REGIONS, module_name, true));
1080  db_get_memory_resource(DBR_OUT_REGIONS, module_name, true));
1081 
1082  /* Now do the job */
1083 
1084  pips_debug(2, "BEGIN of PHRASE_DISTRIBUTOR_CONTROL_CODE\n");
1085  module_stat = controlize_distribution (module_stat, module);
1086  pips_debug(2, "END of PHRASE_DISTRIBUTOR_CONTROL_CODE\n");
1087 
1088  /* Display the statement before to check consistency */
1089  ifdebug(4) {
1090  print_statement(module_stat);
1091  }
1092 
1093  /* Check the coherency of data */
1094 
1095  pips_assert("Statement structure is consistent after PHRASE_DISTRIBUTOR_CONTROL_CODE",
1096  gen_consistent_p((gen_chunk*)module_stat));
1097 
1098  pips_assert("Statement is consistent after PHRASE_DISTRIBUTOR_CONTROL_CODE",
1099  statement_consistent_p(module_stat));
1100 
1101 
1102  /* Reorder the module, because new statements have been added */
1103  module_reorder(module_stat);
1104  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, module_stat);
1105  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
1106  compute_callees(module_stat));
1107 
1108  /* update/release resources */
1114  reset_rw_effects();
1115  reset_in_effects();
1118 
1119  debug_off();
1120 
1121  return true;
1122 }
static entity dynamic_area
static statement controlize_distribution(statement module_stat, entity module)
Main function for PHRASE_DISTRIBUTION_CONTROL_CODE.

References compute_callees(), controlize_distribution(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dynamic_area, DYNAMIC_AREA_LOCAL_NAME, entity_undefined, entity_undefined_p, FindOrCreateEntity(), free_value_mappings(), gen_consistent_p(), get_regions_properties(), ifdebug, module, module_local_name(), module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), pips_assert, pips_debug, print_statement(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_out_effects(), reset_proper_rw_effects(), reset_rw_effects(), set_bool_property(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_out_effects(), set_proper_rw_effects(), set_rw_effects(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ phrase_distributor_init()

bool phrase_distributor_init ( const char *  module_name)

get the resources

Now do the job

Reorder the module, because new statements have been added

update/release resources

Parameters
module_nameodule_name

Definition at line 768 of file phrase_distributor.c.

769 {
770 
771  /* get the resources */
772  statement stat = (statement) db_get_memory_resource(DBR_CODE,
773  module_name,
774  true);
775 
776 
779 
780  debug_on("PHRASE_DISTRIBUTOR_DEBUG_LEVEL");
781 
782  /* Now do the job */
783 
784  pips_debug(2, "BEGIN of PHRASE_DISTRIBUTOR_INIT\n");
785  prepare_distribute (stat);
786  pips_debug(2, "END of PHRASE_DISTRIBUTOR_INIT\n");
787 
788  pips_assert("Statement structure is consistent after PHRASE_DISTRIBUTOR_INIT",
789  gen_consistent_p((gen_chunk*)stat));
790 
791  pips_assert("Statement is consistent after PHRASE_DISTRIBUTOR_INIT",
792  statement_consistent_p(stat));
793 
794 
795  /* Reorder the module, because new statements have been added */
796  module_reorder(stat);
797  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
798  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
799  compute_callees(stat));
800 
801  /* update/release resources */
804 
805  debug_off();
806 
807  return true;
808 }
static void prepare_distribute(statement module_stat)
Main function for PHRASE_DISTRIBUTION_INIT: phrase distribution for module module_stat.

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, gen_consistent_p(), module_name(), module_name_to_entity(), module_reorder(), pips_assert, pips_debug, prepare_distribute(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ phrase_remove_dependences()

bool phrase_remove_dependences ( const char *  module_name)

phrase_remove_dependences.c

Get the code of the module.

Parameters
module_nameodule_name

Definition at line 603 of file phrase_remove_dependences.c.

604 {
605  statement module_stat;
606 
607  /* Get the code of the module. */
610  db_get_memory_resource(DBR_CODE, module_name, true) );
611  module_stat = get_current_module_statement();
613  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
614 
615  debug_on("SIMD_LOOP_CONST_ELIM_SCALAR_EXPANSION_DEBUG_LEVEL");
616 
617  graph dg = (graph) db_get_memory_resource(DBR_DG, module_name, true);
618 
619  gLConflicts = NIL;
620 
621  MAP(VERTEX, a_vertex,
622  {
623  MAP(SUCCESSOR, suc,
624  {
625  MAP(CONFLICT, c,
626  {
627 
629 
631 
632  }, vertex_successors(a_vertex));
633 
634  },graph_vertices(dg));
635 
637 
638  // Go through all the statements
639  gen_recurse(module_stat, statement_domain,
641 
643 
644  pips_assert("Statement is consistent after SIMD_SCALAR_EXPANSION",
645  statement_consistent_p(module_stat));
646 
647  module_reorder(module_stat);
648  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, module_stat);
649 
650  debug_off();
651 
655 
656  return true;
657 }
#define CONFLICT(x)
CONFLICT.
Definition: dg.h:134
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
#define successor_arc_label(x)
Definition: graph.h:116
#define vertex_successors(x)
Definition: graph.h:154
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
static void phrase_remove_dependences_rwt(statement stat)
static list gLConflicts

References CONFLICT, CONS, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dg, dg_arc_label_conflicts, gen_recurse, gen_true(), get_current_module_statement(), gLConflicts, graph_vertices, hash_dont_warn_on_redefinition(), hash_warn_on_redefinition(), MAP, module_name(), module_name_to_entity(), module_reorder(), NIL, phrase_remove_dependences_rwt(), pips_assert, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), statement_consistent_p(), statement_domain, SUCCESSOR, successor_arc_label, VERTEX, and vertex_successors.

+ Here is the call graph for this function:

◆ print_code_smalltalk()

bool print_code_smalltalk ( const char *  module_name)

print_code_smalltalk.c

We first build the future resource file, with a .st

save to file

Parameters
module_nameodule_name

Definition at line 1670 of file print_code_smalltalk.c.

1671 {
1672  FILE * out;
1673  string ppt, smalltalkcode, dir, filename;
1674  entity module;
1675  statement stat;
1676 
1677  /* We first build the future resource file, with a .st */
1678  smalltalkcode = db_build_file_resource_name(DBR_SMALLTALK_CODE_FILE, module_name, STPRETTY);
1681  filename = strdup(concatenate(dir, "/", smalltalkcode, NULL));
1682  stat = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
1683 
1686 
1687  debug_on("SMALLTALK_PRETTYPRINTER_DEBUG_LEVEL");
1688  pips_debug(1, "Begin SMALLTALK prettyprinter for %s\n", entity_name(module));
1689  ppt = smalltalk_code_string(module, stat);
1690  pips_debug(1, "End SMALLTALK prettyprinter for %s\n", entity_name(module));
1691 
1692  pips_debug(3, "What i got is \n%s\n", ppt);
1693 
1694  /* save to file */
1695  out = safe_fopen(filename, "w");
1696  fprintf(out, "/* SMALLTALK pretty print for module %s. */\n%s", module_name, ppt);
1697  safe_fclose(out, filename);
1698 
1699  free(ppt);
1700  free(dir);
1701  free(filename);
1702 
1703  DB_PUT_FILE_RESOURCE(DBR_SMALLTALK_CODE_FILE, module_name, smalltalkcode);
1704 
1707 
1708  return true;
1709 }
static FILE * out
Definition: alias_check.c:128
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
Definition: lowlevel.c:169
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
static string smalltalk_code_string(entity module, statement stat)
#define STPRETTY
This phase is used for PHRASE project.
#define entity_name(x)
Definition: ri.h:2790
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_on, entity_name, fprintf(), free(), module, module_name(), module_name_to_entity(), out, pips_debug, s_ppt::ppt, reset_current_module_entity(), reset_current_module_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), smalltalk_code_string(), STPRETTY, and strdup().

+ Here is the call graph for this function:

◆ process_gLoopToSync_HRE()

list process_gLoopToSync_HRE ( statement  stat,
list  lInStats 
)
Parameters
stattat
lInStatsInStats

Definition at line 613 of file comEngine_generate_HRECode.c.

614 {
615  bool loopSync = (intptr_t)hash_get(gLoopToSync, stat);
616 
617  if(loopSync == (intptr_t)HASH_UNDEFINED_VALUE)
618  {
619  return lInStats;
620  }
621 
622  statement stepStat = make_wait_step_statement();
623 
624  list lStats = NIL;
625 
626  lStats = gen_nconc(lStats, lInStats);
627  lStats = gen_nconc(lStats, CONS(STATEMENT, stepStat, NIL));
628  lStats = gen_nconc(lStats, CONS(STATEMENT, copy_statement(stepStat), NIL));
629 
630  return lStats;
631 }
hash_table gLoopToSync

References CONS, copy_statement(), gen_nconc(), gLoopToSync, hash_get(), HASH_UNDEFINED_VALUE, intptr_t, make_wait_step_statement(), NIL, and STATEMENT.

Referenced by generate_code_loop().

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

◆ process_gLoopToSync_proc()

list process_gLoopToSync_proc ( statement  stat,
list  lInStats 
)
Parameters
stattat
lInStatsInStats

Definition at line 1188 of file comEngine_generate_procCode.c.

1189 {
1190  bool loopSync = (intptr_t)hash_get(gLoopToSync, stat);
1191 
1192  if(loopSync == (intptr_t)HASH_UNDEFINED_VALUE)
1193  {
1194  return lInStats;
1195  }
1196 
1197  statement stepStat = make_step_inc_statement(2);
1198 
1199  list lStats = NIL;
1200 
1201  lStats = gen_nconc(lStats, lInStats);
1202  lStats = gen_nconc(lStats, CONS(STATEMENT, stepStat, NIL));
1203 
1204  return lInStats;
1205 }

References CONS, gen_nconc(), gLoopToSync, hash_get(), HASH_UNDEFINED_VALUE, intptr_t, make_step_inc_statement(), NIL, and STATEMENT.

Referenced by generate_code_loop().

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

◆ process_innerStat1_proc()

void process_innerStat1_proc ( statement  stat,
entity  oldInd,
entity  newOuterInd,
entity  newInnerInd 
)
Parameters
stattat
oldIndldInd
newOuterIndewOuterInd
newInnerIndewInnerInd

Definition at line 1057 of file comEngine_generate_procCode.c.

1059 {
1061  entity_to_expression(newOuterInd),
1062  entity_to_expression(newInnerInd),
1063  NULL);
1064 
1066  addArg));
1067 
1069  make_reference(oldInd, NIL),
1070  arg2);
1071 }
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
void comEngine_replace_reference_in_stat(statement stat, reference ref, expression new)

References call_to_expression(), comEngine_replace_reference_in_stat(), entity_intrinsic(), entity_to_expression(), expression_domain, gen_make_list(), make_call(), make_reference(), NIL, and PLUS_OPERATOR_NAME.

Referenced by usual_loop_tiling().

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

◆ process_replacement_HRE()

void process_replacement_HRE ( list  lRef,
expression  buffIndExp,
statement stat 
)
Parameters
lRefRef
buffIndExpuffIndExp
stattat

Definition at line 483 of file comEngine_generate_HRECode.c.

485 {
486  replace_array_ref_with_fifos(lRef, buffIndExp, entity_undefined, stat);
487 }
void replace_array_ref_with_fifos(list lRef, expression buffIndExp, entity ind, statement *newStat)

References entity_undefined, and replace_array_ref_with_fifos().

Referenced by generate_code_call(), generate_code_loop(), generate_code_test_HRE(), make_loopStat1(), process_code_seq(), process_opt_replace(), and usual_loop_tiling().

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

◆ process_replacement_HRE_OutRef()

list process_replacement_HRE_OutRef ( list  lRef,
list  lStats 
)
Parameters
lRefRef
lStatsStats

Definition at line 493 of file comEngine_generate_HRECode.c.

494 {
495  statement stat = STATEMENT(CAR(lStats));
496 
497  list savedList = CDR(lStats);
498 
499  CDR(lStats) = NIL;
500  gen_free_list(lStats);
501 
503  entity_undefined, &stat);
504 
505  lStats = gen_nconc(CONS(STATEMENT, stat, NIL), savedList);
506 
507  return lStats;
508 }
#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

References CAR, CDR, CONS, entity_undefined, expression_undefined, gen_free_list(), gen_nconc(), NIL, replace_array_ref_with_fifos(), and STATEMENT.

Referenced by generate_code_loop().

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

◆ reference_indices_entity_list()

list reference_indices_entity_list ( reference  ref)
Parameters
refef

Definition at line 603 of file comEngine_feasability.c.

604 {
605  list lIndRef = NIL;
606 
607  MAP(EXPRESSION, index,
608  {
609  list old = lIndRef;
610  list new = NIL;
611  new = comEngine_expression_to_reference_list(index, new);
612 
613  lIndRef = gen_concatenate(old, new);
614 
615  gen_free_list(old);
616  gen_free_list(new);
617 
618  }, reference_indices(ref));
619 
620  return lIndRef;
621 }
list comEngine_expression_to_reference_list(expression e, list lr)
conversion of an expression into a list of references; references are appended to list lr as they are...
list gen_concatenate(const list l1x, const list l2x)
concatenate two lists.
Definition: list.c:436
#define reference_indices(x)
Definition: ri.h:2328

References comEngine_expression_to_reference_list(), EXPRESSION, gen_concatenate(), gen_free_list(), MAP, NIL, ref, and reference_indices.

Referenced by phrase_check_reference(), and process_ref_list().

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

◆ references_for_regions()

list references_for_regions ( list  l_regions)

Return a list of references corresponding to a list of regions.

Parameters
l_regions_regions

Definition at line 603 of file phrase_tools.c.

604 {
605  list l_ref = NIL;
606 
607  MAP (EFFECT, reg, {
609  l_ref = CONS (REFERENCE, ref, l_ref);
611  pips_debug(4,"Entity: %s\n", entity_local_name(reference_variable(ref)));
612  },l_regions);
613 
614  return l_ref;
615 }

References CONS, EFFECT, effect_any_reference, entity_local_name(), MAP, NIL, pips_debug, print_reference(), ref, REFERENCE, and reference_variable.

Referenced by create_module_with_statement(), and distribute_code().

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

◆ register_scalar_communications()

void register_scalar_communications ( hash_table ht_communications,
entity  function,
list  l_regions 
)

Build an HASHTABLE where keys are VARIABLE and values are HASHTABLE where keys are modules or externalized function (ENTITY) and values are list of regions.

Iterate on all regions of the given list

Get the variable type

Look if this variable is already registered

Parameters
ht_communicationst_communications
functionunction
l_regions_regions

Definition at line 538 of file distribution_context.c.

541 {
542 
543  /* Iterate on all regions of the given list */
544  MAP (REGION, reg, {
545 
546  if (region_scalar_p(reg)) {
547 
548  bool already_present = false;
549  variable already_registered_variable = NULL;
550 
551  /* Get the variable type */
553 
554  pips_debug(2, "Variable %s %zd \n", basic_to_string(variable_basic(var)), gen_length(variable_dimensions(var)));
555  print_region(reg);
556 
557  /* Look if this variable is already registered */
558  HASH_MAP (var2, l2, {
559  if (variable_equal_p(var,var2)) {
560  already_present = true;
561  already_registered_variable = var2;
562  }
563  },*ht_communications);
564 
565  if (already_present) {
566  hash_table ht_for_variable
567  = (hash_table)hash_get(*ht_communications,
568  already_registered_variable);
569  if (hash_defined_p(ht_for_variable,function)) {
570  list old_regs = hash_get(ht_for_variable,
571  function);
572  hash_update(ht_for_variable, function,
573  CONS(REGION,reg,old_regs));
574  pips_debug(2, "Add region for existing function\n");
575  }
576  else {
577  hash_put(ht_for_variable, function,
578  CONS(REGION,reg,NIL));
579  pips_debug(2, "New region for existing function\n");
580  }
581  }
582  else {
583  hash_table new_ht_for_variable
585  hash_put(new_ht_for_variable, function,
586  CONS(REGION,reg,NIL));
587  hash_put(*ht_communications,var,new_ht_for_variable);
588  pips_debug(2, "New function\n");
589  }
590  }
591  }, l_regions);
592 }
void hash_update(hash_table htp, const void *key, const void *val)
update key->val in htp, that MUST be pre-existent.
Definition: hash.c:491
struct __hash_table * hash_table
Define hash_table structure which is hidden.
Definition: newgen_hash.h:43
string basic_to_string(basic)
Definition: type.c:87
bool variable_equal_p(variable, variable)
Definition: type.c:819

◆ replace_array_ref_with_fifos()

void replace_array_ref_with_fifos ( list  lRef,
expression  buffIndExp,
entity  ind,
statement newStat 
)
Parameters
lRefRef
buffIndExpuffIndExp
indnd
newStatewStat

Definition at line 286 of file comEngine_generate_HRECode.c.

288 {
289  list lStats = NIL;
290 
291  list lReadStats = NIL;
292  list lWriteStats = NIL;
293 
294  // Generate the read or write fifo statements
295  generate_fifo_stats(lRef, buffIndExp, ind, &lReadStats, &lWriteStats);
296 
297  // Replace the references by the private variables
298  MAP(REFERENCE, curRef,
299  {
300  //printf("replace_array_ref %d\n", (int)curRef);
301  //print_reference(curRef);printf("\n");
302 
303  entity hreBuffEnt = get_HRE_buff_ent_from_ref(curRef);
304 
305  pips_assert("hreBuffEnt != entity_undefined",
306  hreBuffEnt != entity_undefined);
307 
308  reference hreBuffRef = make_reference(hreBuffEnt, NIL);
309 
310  comEngine_replace_reference_in_stat(*newStat, curRef, reference_to_expression(hreBuffRef));
311 
312  }, lRef);
313 
314  lStats = lReadStats;
315  if(*newStat != statement_undefined)
316  {
317  lStats = gen_nconc(lStats, CONS(STATEMENT, *newStat, NIL));
318  }
319  lStats = gen_nconc(lStats, lWriteStats);
320 
321  *newStat = make_block_statement(lStats);
322 }
static void generate_fifo_stats(list lRef, expression buffIndExp, entity ind, list *lReadStats, list *lWriteStats)
expression reference_to_expression(reference r)
Definition: expression.c:196

References comEngine_replace_reference_in_stat(), CONS, entity_undefined, gen_nconc(), generate_fifo_stats(), get_HRE_buff_ent_from_ref(), make_block_statement(), make_reference(), MAP, NIL, pips_assert, REFERENCE, reference_to_expression(), STATEMENT, and statement_undefined.

Referenced by process_replacement_HRE(), and process_replacement_HRE_OutRef().

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

◆ replace_in_sequence_statement_with()

void replace_in_sequence_statement_with ( statement  old_stat,
statement  new_stat,
statement  root_stat 
)

Replace statement old_stat by statement new_stat, asserting that this statement is contained in a sequence.

en_insert_after (new_stat, old_stat, stats_list); gen_remove (&stats_list, old_stat);

Parameters
old_statld_stat
new_statew_stat
root_statoot_stat

Definition at line 554 of file phrase_tools.c.

557 {
558  statement sequence_statement = sequence_statement_containing (root_stat,
559  old_stat);
560  list stats_list;
561  list new_stats_list = NIL;
562 
563  pips_debug(5, "BEGIN replace_in_sequence_statement_with:\n");
564 
565  pips_assert("Statement is contained in a sequence",
566  sequence_statement != NULL);
567 
568  stats_list = sequence_statements(instruction_sequence(statement_instruction(sequence_statement)));
569 
570  MAP (STATEMENT, s, {
571  ifdebug(7) {
572  pips_debug(7, "Iterate on statement:\n");
573  print_statement(s);
574  }
575  if (s == old_stat) {
576  pips_debug(7, "Replace this statement:\n");
577  new_stats_list = CONS(STATEMENT,new_stat,new_stats_list);
578  }
579  else {
580  pips_debug(7, "Keep this statement:\n");
581  new_stats_list = CONS(STATEMENT,s,new_stats_list);
582  }
583  }, stats_list);
584 
585  sequence_statements(instruction_sequence(statement_instruction(sequence_statement))) = gen_nreverse(new_stats_list);
586 
587  /*gen_insert_after (new_stat, old_stat, stats_list);
588  gen_remove (&stats_list, old_stat);*/
589 
590  ifdebug(7) {
591  pips_debug(7, "I've got this for the sequence\n");
592  print_statement(sequence_statement);
593  pips_debug(7, "I've got this for the root statement\n");
594  print_statement(root_stat);
595  }
596 
597  pips_debug(5, "END replace_in_sequence_statement_with:\n");
598 }
statement sequence_statement_containing(statement root_statement, statement searched_stat)
Definition: phrase_tools.c:536

References CONS, gen_nreverse(), ifdebug, instruction_sequence, MAP, NIL, pips_assert, pips_debug, print_statement(), sequence_statement_containing(), sequence_statements, STATEMENT, and statement_instruction.

Referenced by distribute_code().

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

◆ sequence_statement_containing()

statement sequence_statement_containing ( statement  root_statement,
statement  searched_stat 
)
Parameters
root_statementoot_statement
searched_statearched_stat

Definition at line 536 of file phrase_tools.c.

538 {
540 
541  context.searched_statement = searched_stat;
542  context.found_sequence_statement = NULL;
543 
544  gen_context_recurse(root_statement, &context,
546 
547  return context.found_sequence_statement;
548 }
static void search_sequence_containing(statement s, void *a_context)
Definition: phrase_tools.c:520

References gen_context_recurse, gen_true2(), search_sequence_containing(), and statement_domain.

Referenced by compute_distribution_context(), and identify_statements_to_distribute().

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

◆ short_debug_unstructured()

void short_debug_unstructured ( unstructured  an_unstructured,
int  debug_level 
)

DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured (short version)

Parameters
an_unstructuredn_unstructured
debug_levelebug_level

Definition at line 213 of file phrase_tools.c.

215 {
216  ifdebug (debug_level) {
217 
218  list blocs = NIL;
219  string entry_as_string, exit_as_string, temp;
220  asprintf (&temp, "[%p] ",unstructured_entry(an_unstructured));
221  entry_as_string = strdup(temp);
222  asprintf (&temp, "[%p] ",unstructured_exit(an_unstructured));
223  exit_as_string = strdup(temp);
224  pips_debug(debug_level, "%s\n",
225  strdup(concatenate("UNSTRUCTURED\n",
226  "ENTRY: ", entry_as_string, "\n",
227  "PREVIOUS: ", exit_as_string, "\n",
228  NULL)));
229 
230  CONTROL_MAP (current_control, {
231  string next_nodes_as_string = "";
232  string previous_nodes_as_string = "";
233  char *title;
234 
235  MAP(CONTROL, c, {
236  asprintf (&temp, "[%p] ",c);
237  previous_nodes_as_string = strdup (concatenate(previous_nodes_as_string,
238  (temp),
239  NULL));
240  free(temp);
241  }, control_predecessors(current_control));
242 
243  MAP(CONTROL, c, {
244  asprintf (&temp, "[%p] ",c);
245  next_nodes_as_string = strdup (concatenate(next_nodes_as_string,
246  (temp),
247  NULL));
248  free(temp);
249  }, control_successors(current_control));
250 
251  asprintf (&title, "CONTROL: %p\n", current_control);
252  pips_debug(debug_level, "%s\n",
253  strdup(concatenate(title,
254  "NEXT: ", next_nodes_as_string, "\n",
255  "PREVIOUS: ", previous_nodes_as_string, "\n",
256  NULL)));
257  free(title);
258  }, unstructured_entry(an_unstructured), blocs);
259  }
260 }
#define unstructured_exit(x)
Definition: ri.h:3006

References asprintf, concatenate(), CONTROL, CONTROL_MAP, control_predecessors, control_successors, free(), ifdebug, MAP, NIL, pips_debug, strdup(), unstructured_entry, and unstructured_exit.

Referenced by flatten_unstructured().

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

◆ spaghettify()

bool spaghettify ( const char *  module_name)

get the resources

Now do the job

Reorder the module, because new statements have been added

update/release resources

Parameters
module_nameodule_name

Definition at line 173 of file spaghettify.c.

174 {
175  /* get the resources */
176  statement stat = (statement) db_get_memory_resource(DBR_CODE,
177  module_name,
178  true);
179 
182 
183  debug_on("SPAGUETTIFY_DEBUG_LEVEL");
184 
185  /* Now do the job */
186  stat = spaghettify_statement(stat,module_name);
187 
188  pips_assert("Statement is consistent after SPAGUETTIFY",
189  statement_consistent_p(stat));
190 
191  /* Reorder the module, because new statements have been added */
192  module_reorder(stat);
193  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
194  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
195  compute_callees(stat));
196 
197  /* update/release resources */
200 
201  debug_off();
202 
203  return true;
204 }
statement spaghettify_statement(statement stat, const char *module_name)
The spaghettifier is used in context of PHRASE project while creating "Finite State Machine"-like cod...
Definition: spaghettify.c:85

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, local_name_to_top_level_entity(), module_name(), module_reorder(), pips_assert, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), spaghettify_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ spaghettify_forloop()

statement spaghettify_forloop ( statement  stat,
const char *  module_name 
)

forloop_spaghettify.c

forloop_spaghettify.c

Parameters
stattat
module_nameodule_name

Definition at line 135 of file forloop_spaghettify.c.

136 {
137  statement returned_statement = stat;
138  instruction unstructured_instruction;
139  unstructured new_unstructured;
140 
141  pips_assert("Statement is FORLOOP in FSM_GENERATION",
144 
145  pips_debug(2, "spaghettify_forloop, module %s\n", module_name);
146 
147  new_unstructured
150  stat,
151  module_name);
152 
153  unstructured_instruction = make_instruction(is_instruction_unstructured,
154  new_unstructured);
155 
156  statement_instruction(returned_statement) = unstructured_instruction;
157 
158  return returned_statement;
159 }
static unstructured make_unstructured_from_forloop(forloop curLoop, statement stat, const char *module_name)
#define instruction_forloop(x)
Definition: ri.h:1538

◆ spaghettify_loop()

statement spaghettify_loop ( statement  stat,
const char *  module_name 
)

loop_spaghettify.c

loop_spaghettify.c

Parameters
stattat
module_nameodule_name

Definition at line 391 of file loop_spaghettify.c.

392 {
393  statement returned_statement = stat;
394  instruction unstructured_instruction;
395  unstructured new_unstructured;
396 
397  pips_assert("Statement is LOOP in FSM_GENERATION",
400 
401  pips_debug(2, "spaghettify_loop, module %s\n", module_name);
402  new_unstructured = make_unstructured_from_loop (statement_loop(stat),
403  stat,
404  module_name);
405 
406  unstructured_instruction = make_instruction(is_instruction_unstructured,
407  new_unstructured);
408 
409  statement_instruction(returned_statement) = unstructured_instruction;
410 
411  return returned_statement;
412 }
static unstructured make_unstructured_from_loop(loop the_loop, statement stat, const char *module_name)
Build and return a new unstructured coding the "destructured" loop.

◆ spaghettify_statement()

statement spaghettify_statement ( statement  stat,
const char *  module_name 
)

spaghettify.c

spaghettify.c

This phase transforms structured code portions (eg. loops) in unstructured statements.

To add flexibility, the behavior of \texttt{spaghettifier} is controlled by the properties

  • DESTRUCTURE_TESTS
  • DESTRUCTURE_LOOPS
  • DESTRUCTURE_WHILELOOPS
  • DESTRUCTURE_FORLOOPS to allow more or less destruction power !

spaghettify > MODULE.code < PROGRAM.entities < MODULE.code This function is recursively called during spaghettization. It takes the statement stat as parameter and return a new spaghettized statement (or the same if nothing has been done). Spaguettization is done:

  • on Tests (if property DESTRUCTURE_TESTS set to true)
  • on Loops (if property DESTRUCTURE_LOOPS set to true)
  • on WhileLoops (if property DESTRUCTURE_WHILELOOPS set to true)
  • on ForLoops (if property DESTRUCTURE_FORLOOPS set to true)
Parameters
stattat
module_nameodule_name

Definition at line 85 of file spaghettify.c.

86 {
87  // Defaut behaviour is to return parameter statement stat
88  statement returned_statement = stat;
90 
91  pips_debug(2,"\nSPAGHETTIFY: Module statement: =====================================\n");
92  ifdebug(2) {
93  print_statement(stat);
94  }
95  pips_debug(2,"domain number = %"PRIdPTR"\n", statement_domain_number(stat));
96  pips_debug(2,"entity = UNDEFINED\n");
97  pips_debug(2,"statement number = %"PRIdPTR"\n", statement_number(stat));
98  pips_debug(2,"statement ordering = %"PRIdPTR"\n", statement_ordering(stat));
100  pips_debug(2,"statement comments = EMPTY\n");
101  }
102  else {
103  pips_debug(2,"statement comments = %s\n", statement_comments(stat));
104  }
105  pips_debug(2,"statement instruction = %s\n", statement_type_as_string(stat));
106  switch (instruction_tag(i)) {
107  case is_instruction_test:
108  {
109  pips_debug(2, "TEST\n");
110  if (get_bool_property("DESTRUCTURE_TESTS")) {
111  returned_statement = spaghettify_test (stat, module_name);
112  }
113  break;
114  }
116  {
118  pips_debug(2, "SEQUENCE\n");
119  MAP(STATEMENT, current_stat,
120  {
121  statement new_stat = spaghettify_statement(current_stat, module_name);
122  if (new_stat != NULL) {
123  gen_list_patch (sequence_statements(seq), current_stat, new_stat);
124  }
125  }, sequence_statements(seq));
126  break;
127  }
128  case is_instruction_loop: {
129  pips_debug(2, "LOOP\n");
130  if (get_bool_property("DESTRUCTURE_LOOPS")) {
131  returned_statement = spaghettify_loop (stat, module_name);
132  }
133  break;
134  }
136  pips_debug(2, "WHILELOOP\n");
137  if (get_bool_property("DESTRUCTURE_WHILELOOPS")) {
138  returned_statement = spaghettify_whileloop (stat, module_name);
139  }
140  break;
141  }
142  case is_instruction_forloop: {
143  pips_debug(2, "FORLOOP\n");
144  if (get_bool_property("DESTRUCTURE_FORLOOPS")) {
145  returned_statement = spaghettify_forloop (stat, module_name);
146  }
147  break;
148  }
149  case is_instruction_call: {
150  pips_debug(2, "CALL\n");
151  break;
152  }
154  pips_debug(2, "UNSTRUCTURED\n");
155  break;
156  }
157  case is_instruction_goto: {
158  pips_debug(2, "GOTO\n");
159  break;
160  }
161  default:
162  pips_debug(2, "UNDEFINED\n");
163  break;
164  }
165 
166  return returned_statement;
167 }
statement spaghettify_forloop(statement stat, const char *module_name)
This function takes the statement stat as parameter and return a new spaghettized statement,...
statement spaghettify_loop(statement stat, const char *module_name)
This function takes the statement stat as parameter and return a new spaghettized statement,...
statement spaghettify_test(statement, const char *)
test_spaghettify.c
statement spaghettify_whileloop(statement, const char *)
whileloop_spaghettify.c

References gen_list_patch(), get_bool_property(), ifdebug, instruction_sequence, instruction_tag, is_instruction_call, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, MAP, module_name(), pips_debug, print_statement(), sequence_statements, spaghettify_forloop(), spaghettify_loop(), spaghettify_statement(), spaghettify_test(), spaghettify_whileloop(), STATEMENT, statement_comments, statement_domain_number, statement_instruction, statement_number, statement_ordering, statement_type_as_string(), and statement_with_empty_comment_p().

Referenced by make_body_from_forloop(), make_body_from_loop(), make_body_from_whileloop(), make_if_false_from_test(), and make_if_true_from_test().

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

◆ spaghettify_test()

statement spaghettify_test ( statement  stat,
const char *  module_name 
)

test_spaghettify.c

Parameters
stattat
module_nameodule_name

Definition at line 142 of file test_spaghettify.c.

143 {
144  statement returned_statement = stat;
145  instruction unstructured_instruction;
146  unstructured new_unstructured;
147 
148  pips_assert("Statement is TEST in FSM_GENERATION",
151 
152  pips_debug(2, "spaghettify_test, module %s\n", module_name);
153 
154  new_unstructured
157  stat,
158  module_name);
159 
160  unstructured_instruction = make_instruction(is_instruction_unstructured,
161  new_unstructured);
162 
163  statement_instruction(returned_statement) = unstructured_instruction;
164  return returned_statement;
165 }
static unstructured make_unstructured_from_test(test the_test, statement stat, const char *module_name)
Build and return a new unstructured coding the "destructured" test.

References instruction_tag, instruction_test, is_instruction_test, is_instruction_unstructured, make_instruction(), make_unstructured_from_test(), module_name(), pips_assert, pips_debug, and statement_instruction.

Referenced by full_spaghettify_statement(), and spaghettify_statement().

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

◆ spaghettify_whileloop()

statement spaghettify_whileloop ( statement  stat,
const char *  module_name 
)

whileloop_spaghettify.c

Parameters
stattat
module_nameodule_name

Definition at line 142 of file whileloop_spaghettify.c.

143 {
144  statement returned_statement = stat;
145  instruction unstructured_instruction;
146  unstructured new_unstructured;
147 
148  pips_assert("Statement is WHILELOOP in FSM_GENERATION",
151 
152  pips_debug(2, "spaghettify_whileloop, module %s\n", module_name);
153  new_unstructured
156  stat,
157  module_name);
158 
159  unstructured_instruction = make_instruction(is_instruction_unstructured,
160  new_unstructured);
161 
162  statement_instruction(returned_statement) = unstructured_instruction;
163 
164  return returned_statement;
165 }
#define instruction_whileloop(x)
Definition: ri.h:1523
static unstructured make_unstructured_from_whileloop(whileloop the_whileloop, statement stat, const char *module_name)
Build and return a new unstructured coding the "destructured" whileloop.

References instruction_tag, instruction_whileloop, is_instruction_unstructured, is_instruction_whileloop, make_instruction(), make_unstructured_from_whileloop(), module_name(), pips_assert, pips_debug, and statement_instruction.

Referenced by full_spaghettify_statement(), and spaghettify_statement().

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

◆ statement_is_contained_in_a_sequence_p()

bool statement_is_contained_in_a_sequence_p ( statement  root_statement,
statement  searched_stat 
)
Parameters
root_statementoot_statement
searched_statearched_stat

Definition at line 507 of file phrase_tools.c.

509 {
510  return (sequence_statement_containing (root_statement,
511  searched_stat) != NULL);
512 }

References sequence_statement_containing().

Referenced by identify_statements_to_distribute().

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

◆ statement_type_as_string()

string statement_type_as_string ( statement  stat)

phrase_tools.c

phrase_tools.c

Parameters
stattat

Definition at line 65 of file phrase_tools.c.

66 {
68  switch (instruction_tag(i)) {
69  case is_instruction_test: {
70  return strdup("TEST");
71  break;
72  }
74  return strdup("SEQUENCE");
75  break;
76  }
77  case is_instruction_loop: {
78  return strdup("LOOP");
79  break;
80  }
82  return strdup("WHILELOOP");
83  break;
84  }
86  return strdup("FORLOOP");
87  break;
88  }
89  case is_instruction_call: {
90  return strdup("CALL");
91  break;
92  }
94  return strdup("UNSTRUCTURED");
95  break;
96  }
97  case is_instruction_goto: {
98  return strdup("GOTO");
99  break;
100  }
101  default:
102  return strdup("UNDEFINED");
103  break;
104  }
105 }

References instruction_tag, is_instruction_call, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, statement_instruction, and strdup().

Referenced by fsmize_statement(), and spaghettify_statement().

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

◆ store_new_module()

void store_new_module ( const char *  module_name,
entity  module,
statement  module_statement 
)

Store (PIPDBM) newly created module module with module_statement as USER_FILE by saving pretty printing.

Parameters
module_nameodule_name
moduleodule
module_statementodule_statement

Definition at line 143 of file phrase_distributor_control_code.c.

146 {
147  string source_file;
148  text code;
149 
150  pips_debug(2, "[BEGIN] store_new_module [%s]\n", module_name);
151  ifdebug(2) {
152  entity set_entity = get_current_module_entity();
155  pips_debug(2, "Statement for module: ");
157  pips_debug(7, "Declarations for module: \n");
158  MAP (ENTITY, e, {
159  pips_debug(2, "Declared entity %s\n", entity_global_name(e));
161  fprint_environment(stderr, module);
163  set_current_module_entity(set_entity);
164  }
165 
169  DBR_SOURCE_FILE,
170  ".f",
171  code);
173 
174  source_file = db_build_file_resource_name(DBR_SOURCE_FILE, module_name, ".f");
175 
176  pips_debug(5, "Source file : [%s]\n", source_file);
177 
178  DB_PUT_NEW_FILE_RESOURCE (DBR_USER_FILE, module_name, source_file);
179  DB_PUT_NEW_FILE_RESOURCE (DBR_INITIAL_FILE, module_name, source_file);
180 
183  DBR_INITIAL_FILE,
184  ".f_initial",
185  code);
187 
188  pips_debug(2, "[END] store_new_module [%s]\n", module_name);
189 }
#define DB_PUT_NEW_FILE_RESOURCE(res_name, own_name, res_val)
Put a new file resource into the current workspace database.
text empty_text(entity __attribute__((unused)) e, int __attribute__((unused)) m, statement __attribute__((unused)) s)
Definition: misc.c:219
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
Definition: misc.c:242
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
Definition: misc.c:231
text text_module(entity, statement)
bool make_text_resource(const char *, const char *, const char *, text)
print.c
Definition: print.c:55
struct _newgen_struct_code_ * code
Definition: ri.h:79

References close_prettyprint(), code_declarations, db_build_file_resource_name(), DB_PUT_NEW_FILE_RESOURCE, empty_text(), ENTITY, entity_global_name(), entity_initial, fprint_environment(), get_current_module_entity(), ifdebug, init_prettyprint(), make_text_resource(), MAP, module, module_name(), module_statement, pips_debug, print_statement(), reset_current_module_entity(), set_current_module_entity(), text_module(), and value_code.

Referenced by make_array_communication_module(), make_scalar_communication_module(), make_start_ru_module(), and make_wait_ru_module().

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

◆ variable_to_string()

string variable_to_string ( variable  var)

Return a unique (regarding variable_equal_p(var1,var2)) string representation of a variable var.

Parameters
varar

Definition at line 511 of file distribution_context.c.

512 {
513  string returned_value;
514  intptr_t low, up;
515 
516  returned_value = basic_to_string(variable_basic(var));
517  (strchr(returned_value,'*'))[0] = '\0';
519  if ((expression_integer_value(dimension_lower(dim), &low))
520  && (expression_integer_value(dimension_upper(dim), &up))) {
521  char buffer[256];
522  sprintf (buffer, VARIABLE_NAME_FORMAT, low, up);
523  returned_value = strdup(concatenate(returned_value,strdup(buffer),NULL));
524  }
525  else {
526  returned_value = strdup(concatenate(returned_value,":UNDEFINED",NULL));
527  }
528  }
529 
530  return returned_value;
531 }
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define VARIABLE_NAME_FORMAT
Stuff for SEND_PARAM....
#define dimension_upper(x)
Definition: ri.h:982

Variable Documentation

◆ gBufferSize

int gBufferSize
extern

Definition at line 74 of file comEngine_distribute.c.

Referenced by compute_HRE_memory_mapping().

◆ gBufferSizeEnt

◆ gEntToHREFifo

◆ gGenHRE

◆ gHREMemory

entity gHREMemory
extern

Definition at line 72 of file comEngine_distribute.c.

◆ gIndToNum

hash_table gIndToNum
extern

◆ gIsNewLoop

◆ gLoopToOpt

◆ gLoopToOuterInd

hash_table gLoopToOuterInd
extern

◆ gLoopToRef

◆ gLoopToSupRef

◆ gLoopToSync

◆ gLoopToToggleEnt

◆ gLoopToUnSupRef

◆ glToggleInitStats

list glToggleInitStats
extern

◆ gRefToBuffSize

hash_table gRefToBuffSize
extern

◆ gRefToEff

◆ gRefToFifo

◆ gRefToFifoOff

◆ gRefToHREFifo

◆ gRefToHREVar

◆ gRefToInd

hash_table gRefToInd
extern

◆ gRefToToggle

◆ gStatToHtOffset

hash_table gStatToHtOffset
extern

◆ gStatToRef

◆ gToggleToInc