25 #include "pips_config.h"
40 #include "resources.h"
122 bool returned_value =
true;
124 pips_debug(5,
"[BEGIN] compute_distribution_context for %s: \n",
140 else if (stats_nb == 1) {
141 externalized_code = s;
148 pips_debug(5,
"Register externalized function %s: \n",
151 hash_put(*ht_stats,function_name,externalized_code);
155 returned_value =
false;
158 pips_debug(3,
"ANALYSING function named [%s]..................\n",
167 returned_value =
false;
171 pips_debug(5,
"[END] compute_distribution_context for %s: \n",
174 return returned_value;
225 bool returned_value =
true;
226 string function_name;
227 entity externalized_function;
229 pips_debug(5,
"[BEGIN] compute_distribution_controlization_context for %s: \n",
246 pips_debug(5,
"Register statement calling externalized function %s: \n",
256 pips_debug(2,
"Register statement for NEW function %s\n", function_name);
263 externalized_function)) {
264 returned_value =
false;
274 pips_debug(2,
"Adding statement to function %s\n", function_name);
277 pips_debug(3,
"ANALYSING function named [%s]..................\n",
282 pips_debug(5,
"[END] compute_distribution_controlization_context for %s: \n",
285 return returned_value;
295 pips_debug(4,
"BEGIN of computing regions UNION\n");
298 bool is_already_present =
false;
299 region reg_already_present = NULL;
303 is_already_present =
true;
304 reg_already_present = union_reg;
307 if (is_already_present) {
309 pips_debug(6,
"Found SCALAR region already present [%s]. Ignored.\n",
314 pips_debug(6,
"Found ARRAY region already present [%s].\n",
338 pips_debug(4,
"END of computing regions UNION\n");
353 bool returned_value =
true;
355 list l_read, l_write, l_in, l_out;
404 pips_debug(2,
"Storing in hash_tables with key %s: \n", (
string)key_value);
408 hash_put(*ht_params,key_value,l_params);
412 returned_value =
false;
417 hash_put(*ht_private,key_value,l_priv);
421 returned_value =
false;
424 pips_debug(5,
"Storing in ht_in_regions: \n");
426 hash_put(*ht_in_regions,key_value,l_in);
430 returned_value =
false;
433 pips_debug(5,
"Storing in ht_out_regions: \n");
435 hash_put(*ht_out_regions,key_value,l_out);
439 returned_value =
false;
442 return returned_value;
474 string searched_string;
476 char* function_name = NULL;
485 searched_string =
strdup(comment_portion);
486 searched_string[strcspn(comment_portion,
"%s")] =
'\0';
488 next_line = strtok (comments,
"\n");
489 if (next_line != NULL) {
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);
498 next_line = strtok(NULL,
"\n");
500 while (next_line != NULL);
504 return function_name;
513 string returned_value;
517 (strchr(returned_value,
'*'))[0] =
'\0';
530 return returned_value;
548 bool already_present =
false;
549 variable already_registered_variable = NULL;
560 already_present =
true;
561 already_registered_variable = var2;
563 },*ht_communications);
565 if (already_present) {
568 already_registered_variable);
574 pips_debug(2,
"Add region for existing function\n");
579 pips_debug(2,
"New region for existing function\n");
585 hash_put(new_ht_for_variable,
function,
587 hash_put(*ht_communications,var,new_ht_for_variable);
int compare_effect_reference(effect *e1, effect *e2)
int compare_effect_reference(e1, e2):
string get_externalizable_function_name(statement stat)
Return the identified function name of the externalized portion of code by searching comment matching...
string variable_to_string(variable var)
Return a unique (regarding variable_equal_p(var1,var2)) string representation of a variable var.
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.
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...
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...
dg_vertex_label vertex_label
dg_arc_label arc_label
General computation for PHRASE distribution DISTRIBUTION CONTEXT.
string get_externalized_function_name(statement stat)
Return the identified function name of the externalized portion of code by searching comment matching...
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.
list compute_regions_union(list l_in, list l_out)
Compute union of exact regions.
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.
#define region_entity(reg)
#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
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)
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_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
#define NIL
The empty list (nil in Lisp)
list gen_copy_seq(list l)
Copy a list structure.
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)
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
bool statement_with_empty_comment_p(statement)
Return true if the statement has an empty statement:
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_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.
void hash_update(hash_table htp, const void *key, const void *val)
update key->val in htp, that MUST be pre-existent.
bool hash_defined_p(const hash_table htp, const void *key)
true if key has e value in htp.
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_internal_error
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define HASH_MAP(k, v, code, ht)
struct __hash_table * hash_table
Define hash_table structure which is hidden.
int(* gen_cmp_func_t)(const void *, const void *)
statement sequence_statement_containing(statement, statement)
string get_function_name_by_searching_tag(statement, const char *)
phrase_distributor.c
#define EXTERNALIZED_CODE_PRAGMA_BEGIN
#define EXTERNALIZED_CODE_PRAGMA_CALL
#define EXTERNALIZED_CODE_PRAGMA_ANALYZED
#define VARIABLE_NAME_FORMAT
Stuff for SEND_PARAM....
string basic_to_string(basic)
void print_statement(statement)
Print a statement on stderr.
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...
bool same_entity_p(entity e1, entity e2)
predicates on entities
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
bool expression_integer_value(expression e, intptr_t *pval)
bool variable_equal_p(variable, variable)
#define dimension_lower(x)
@ is_instruction_sequence
#define instruction_tag(x)
#define sequence_statements(x)
#define dimension_upper(x)
#define instruction_sequence(x)
#define variable_dimensions(x)
#define statement_instruction(x)
#define statement_comments(x)
#define variable_basic(x)
#define STATEMENT(x)
STATEMENT.
The structure used to build lists in NewGen.