25 #include "pips_config.h"
35 #include "resources.h"
75 const char* parameter_name,
83 list module_parameters;
95 parameter_name, NULL)),
176 pips_debug(5,
"Source file : [%s]\n", source_file);
196 int old_size, variable_size;
207 pips_debug(2,
"New variable %s created with size %d (old_size was:%d)\n", name, variable_size, old_size);
241 bool is_primary_area =
true;
242 int totalized_offset = -1;
246 if (is_primary_area) {
248 if (
offset > totalized_offset) {
249 totalized_offset =
offset;
250 primary_variables =
CONS (
ENTITY,v,primary_variables);
253 is_primary_area =
false;
268 }, primary_variables);
297 pips_debug(7,
"Build variable %s\n", var_global_name);
305 pips_debug(7,
"Add to declarations %s\n", var_global_name);
310 pips_debug(7,
"New common variable %s declared\n", var_global_name);
312 }, primary_variables);
321 pips_debug(3,
"Common %s declared in module %s\n",
455 int number_of_deployment_units,
465 const char* function_name;
466 int id_function, id_param;
468 entity functions_nb_variable;
480 if (number_of_deployment_units > 1) {
481 for (i=1; i<= number_of_deployment_units; i++) {
494 functions_nb_variable =
500 (functions_nb_variable,
506 HASH_MAP (externalized_function, l_calls_for_function, {
509 entity function_id_variable;
511 pips_debug(2,
"Function [%s]\n",function_name);
513 function_id_variable =
519 (function_id_variable,
534 entity param_id_variable =
548 entity param_id_variable =
579 entity externalized_function,
581 int number_of_deployment_units)
594 if (number_of_deployment_units > 1) {
608 return returned_common;
618 statement returned_statement = module_stat;
620 const char* function_name;
628 entity externalized_fonction_common;
640 int number_of_deployment_units;
665 resp =
user_request(
"Deployment on how many externalized units ?\n"
666 "(give its number > 0): ");
668 if (sscanf(resp,
"%d",&number_of_deployment_units) > 0) {
670 pips_debug(2,
"Deployment on %d units\n", number_of_deployment_units);
677 number_of_deployment_units,
687 HASH_MAP (externalized_function, calls_for_f, {
694 pips_debug(2,
"Found %zd calls for externalized function %s\n",
700 externalized_fonction_common =
704 number_of_deployment_units);
709 pips_debug(2,
"Register input communications\n");
714 pips_debug(2,
"Register output communications\n");
719 pips_debug(2,
"Register and create ARRAY input communications\n");
723 externalized_fonction_common,
724 number_of_deployment_units);
726 pips_debug(2,
"Register and create ARRAY output communications\n");
730 externalized_fonction_common,
731 number_of_deployment_units);
737 &start_ru_module_statement,
738 number_of_deployment_units,
744 number_of_deployment_units,
751 number_of_deployment_units,
757 number_of_deployment_units,
765 HASH_MAP (externalized_function, calls_for_f, {
770 entity unit_id_variable = NULL;
785 if (number_of_deployment_units > 1) {
789 asprintf (&question,
"Deployment of function %s on which units ?\n(give its number 1-%d):", function_name, number_of_deployment_units);
791 sscanf(resp,
"%d",&unit_id);
794 while ((unit_id <1) || (unit_id > number_of_deployment_units));
797 pips_debug(2,
"Externalized function [%s] being executed on unit %d:\n", function_name, unit_id);
833 if (number_of_deployment_units > 1) {
853 list l_reg_variables;
894 start_ru_call_params)),
914 wait_ru_call_params)),
925 entity receive_param_module;
938 if (number_of_deployment_units > 1) {
958 list l_reg_variables;
995 pips_debug(7,
"After controlization, statement is\n");
999 }, (
list)calls_for_f);
1014 },ht_in_communications);
1019 },ht_out_communications);
1025 pips_debug(2,
"Invalid number. Operation aborted\n");
1029 return returned_statement;
1071 debug_on(
"PHRASE_DISTRIBUTOR_DEBUG_LEVEL");
1084 pips_debug(2,
"BEGIN of PHRASE_DISTRIBUTOR_CONTROL_CODE\n");
1086 pips_debug(2,
"END of PHRASE_DISTRIBUTOR_CONTROL_CODE\n");
1095 pips_assert(
"Statement structure is consistent after PHRASE_DISTRIBUTOR_CONTROL_CODE",
1098 pips_assert(
"Statement is consistent after PHRASE_DISTRIBUTOR_CONTROL_CODE",
dummy make_dummy_identifier(entity _field_)
call make_call(entity a1, list a2)
value make_value_unknown(void)
parameter make_parameter(type a1, mode a2, dummy a3)
type make_type_variable(variable _field_)
mode make_mode_reference(void)
type copy_type(type p)
TYPE.
storage make_storage(enum storage_utype tag, void *val)
ram make_ram(entity a1, entity a2, intptr_t a3, list a4)
variable copy_variable(variable p)
VARIABLE.
bool statement_consistent_p(statement p)
dimension make_dimension(expression a1, expression a2, list a3)
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
variable make_variable(basic a1, list a2, list a3)
value copy_value(value p)
VALUE.
storage make_storage_formal(formal _field_)
instruction make_instruction(enum instruction_utype tag, void *val)
synchronization make_synchronization_none(void)
sequence make_sequence(list a)
type make_type(enum type_utype tag, void *val)
formal make_formal(entity a1, intptr_t a2)
struct _newgen_struct_entity_ * entity
static reference ref
Current stmt (an integer)
static statement module_statement
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
struct _newgen_struct_statement_ * statement
string variable_to_string(variable var)
Return a unique (regarding variable_equal_p(var1,var2)) string representation of a variable var.
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 externa...
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.
static entity new_variable
entity to be replaced, the primary?
#define region_entity(reg)
#define region_scalar_p(reg)
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)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
const char * module_name(const char *s)
Return the module part of an entity name.
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
statement set_current_module_statement(statement)
Set the current module statement.
entity set_current_module_entity(entity)
static.c
entity get_current_module_entity(void)
Get the entity of the current module.
list gen_nreverse(list cp)
reverse a list in place
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
#define DB_PUT_NEW_FILE_RESOURCE(res_name, own_name, res_val)
Put a new file resource into the current workspace database.
hash_table hash_table_make(hash_key_type key_type, size_t size)
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.
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
int hash_table_entry_count(hash_table htp)
now we define observers in order to hide the hash_table type...
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
string user_request(const char *,...)
#define DYNAMIC_AREA_LOCAL_NAME
#define MODULE_SEP_STRING
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define HASH_MAP(k, v, code, ht)
void * gen_find_tabulated(const char *, int)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
entity make_start_ru_module(hash_table, statement *, int, entity, list)
phrase_distributor_communication.c
list get_statements_with_comments_containing(const char *, statement)
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.
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.
list make_send_scalar_params_modules(hash_table, int, entity, list)
Build and return list of modules used for INPUT communications (SEND_PARAMETERS......
list make_receive_scalar_params_modules(hash_table, int, entity, list)
Build and return list of modules used for OUTPUT communications (RECEIVE_PARAMETERS....
string get_send_param_module_name(entity, effect)
statement make_assignement_statement(entity, expression, statement)
Build and return new statement which is a assignement of variable a_variable with expression an_expre...
void compute_region_variables(effect, list *, list *)
entity make_wait_ru_module(statement *, int, entity, list)
string get_receive_param_module_name(entity, effect)
#define COMMON_PARAM_NAME
#define RECEIVE_PARAMETER_MODULE_NAME
#define EXTERNALIZED_CODE_PRAGMA_CALL
#define FUNCTIONS_NB_NAME
#define CONTROLIZED_STATEMENT_COMMENT
#define CONTROL_DATA_COMMON_NAME
#define FUNCTION_COMMON_NAME
#define SEND_PARAMETER_MODULE_NAME
#define OUT_PARAM_ID_NAME
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.
entity entity_in_module(const char *name, entity module)
Return entity named name in specified module.
static entity dynamic_area
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.
bool phrase_distributor_control_code(const char *module_name)
string get_common_param_name(entity variable, entity function)
entity create_new_common_variable(string name, entity module, entity common, variable var)
Creates and declares a new variable for a newly created common.
static string get_function_common_name(entity function)
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.
dg_vertex_label vertex_label
string get_controlized_statement_comment(entity function)
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 printi...
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...
static string get_unit_id_name(int unit)
string get_out_param_id_name(entity variable, entity function)
string get_send_parameter_module_name(variable var)
static statement controlize_distribution(statement module_stat, entity module)
Main function for PHRASE_DISTRIBUTION_CONTROL_CODE.
static entity create_externalized_function_common(entity main_module, entity externalized_function, list params_regions, int number_of_deployment_units)
Creates and returns a common used to store variable for communications between control code and exter...
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.
string get_function_id_name(entity function)
string get_in_param_id_name(entity variable, entity function)
string get_receive_parameter_module_name(variable var)
static statement make_global_common_and_initialize(entity main_module, statement module_stat, entity *global_common, int number_of_deployment_units, hash_table ht_calls, hash_table ht_in_regions, hash_table ht_out_regions)
Build and return CONTROL_DATA global common used to store global information on phrase distribution c...
text empty_text(entity __attribute__((unused)) e, int __attribute__((unused)) m, statement __attribute__((unused)) s)
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
text text_module(entity, statement)
void print_statement(statement)
Print a statement on stderr.
bool make_text_resource(const char *, const char *, const char *, text)
print.c
void set_bool_property(const char *, bool)
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define make_entity(n, t, s, i)
#define STATEMENT_NUMBER_UNDEFINED
default values
#define empty_comments
Empty comments (i.e.
void fprint_environment(FILE *fd, entity m)
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
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...
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...
string entity_global_name(entity e)
Used instead of the macro to pass as formal argument.
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
entity entity_empty_label(void)
entity make_new_common(string name, entity mod)
This function creates a common for a given name in a given module.
const char * module_local_name(entity e)
Returns the module local user name.
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
extensions empty_extensions(void)
extension.c
int storage_space_of_variable(entity)
basic MakeBasic(int)
END_EOLE.
void AddEntityToDeclarations(entity, entity)
END_EOLE.
#define reference_variable(x)
#define type_functional(x)
#define entity_storage(x)
#define code_declarations(x)
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
@ is_instruction_sequence
#define functional_parameters(x)
#define PARAMETER(x)
PARAMETER.
#define variable_dimensions(x)
#define statement_instruction(x)
#define statement_comments(x)
struct _newgen_struct_code_ * code
#define entity_domain
newgen_syntax_domain_defined
#define STATEMENT(x)
STATEMENT.
#define storage_undefined
#define entity_initial(x)
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
The structure used to build lists in NewGen.
A gen_chunk is used to store every object.
list module_declarations(entity m)
High-level functions about modules, using pipsdbm and ri-util and some global variables assumed prope...