37 #include "pips_config.h"
45 #include "resources.h"
388 bool tfound =
false,ffound=
false;
395 if(tfound && !ffound ) {
399 if(!tfound && ffound ) {
503 pips_assert(
"true", caller==caller && caller_statement==caller_statement);
570 for(
list citer=callers,siter=callers_statement;!
ENDP(citer);
POP(citer),
POP(siter)) {
577 for(
list citer=callers,siter=callers_statement;!
ENDP(citer);
POP(citer),
POP(siter)) {
624 debug_on(
"DELAY_COMMUNICATIONS_DEBUG_LEVEL");
693 debug_on(
"DELAY_COMMUNICATIONS_DEBUG_LEVEL");
698 context c = {
true,
NIL,
false,
false, NULL, NULL };
852 bool need_flatten=
false;
857 while(!
ENDP(iordered) &&
859 bool skipped_declarations= (iordered != b);
867 bool did_something=
false;
895 if(did_something && skipped_declarations)
915 bool need_flatten=
false;
942 debug_on(
"DELAY_COMMUNICATIONS_DEBUG_LEVEL");
basic copy_basic(basic p)
BASIC.
void free_preference(preference p)
statement copy_statement(statement p)
STATEMENT.
bool statement_consistent_p(statement p)
reference copy_reference(reference p)
REFERENCE.
bool delay_communications_intra(const char *module_name)
bool simd_load_stat_p(statement stat)
bool simd_stat_p(statement stat)
This function returns true if the statement is a simd statement.
bool delay_communications_inter(const char *module_name)
bool delay_store_communications_intra(char *module_name)
static void do_remove_redundant_communications_in_whileloop(whileloop l, bool *need_flatten)
static bool delay_communications(const char *module_name)
static void delay_communications_intraprocedurally(statement module_stat, context *c)
transform each caller into a load / call /store sequence
static void delay_communications_reset()
static void create_block_if_needed(statement *s, list **block)
static void delay_communications_statement(statement, context *, list *block)
static void manage_conflicts(statement s, context *c, bool before, list *block)
static void do_remove_redundant_communications_in_loop(loop l, bool *need_flatten)
bool simd_store_stat_p(statement stat)
static bool simd_work_call_p(call c)
bool simd_dma_stat_p(statement stat)
This function returns true if the statement is a simd loadsave statement.
bool delay_load_communications_intra(char *module_name)
static void delay_communications_test(statement s, context *c, list *block)
static bool remove_redundant_communications(statement s)
static void delay_communications_interprocedurally(context *c)
dg_vertex_label vertex_label
static void do_delay_communications_interprocedurally(call ca, context *c)
static bool statements_conflict_relaxed_p(statement s0, statement s1, bool load_p)
same as statements_conflict_p but W-* conflicts are ignored if load_p, R-* conflicts are ignored if n...
static bool dmas_invert_p(statement s0, statement s1)
bool delay_store_communications(char *module_name)
static bool statements_conflict_p(statement s0, statement s1)
checks if there exist a conflict between s0 and s1 according to the dependency graph
static void delay_communications_call(statement s, context *c, list *block)
bool simd_work_stat_p(statement stat)
static void select_independent_dmas(list *stats, statement parent)
static bool dma_conflict_p(conflict c)
bool delay_store_communications_inter(char *module_name)
static bool recurse_statements_conflict_p(statement s, statement in)
checks if there is a conflict between s and any statement in in
static void do_recurse_statements_conflict_p(statement s, conflict_t *c)
helper for recurse_statements_conflict_p
static bool do_remove_redundant_communications_in_anyloop(statement parent, statement body)
static bool simd_store_call_p(call c)
static void promote_local_entities(statement s, entity caller, statement caller_statement)
if some local variables are going to be accessed inter procedurally, promote them to global variables
static context context_dup(context *c)
static bool simd_load_call_p(call c)
static void delay_communications_init()
static graph dependence_graph
bool delay_load_communications_inter(char *module_name)
static statement translate_arguments(call ca, statement s)
bool delay_load_communications(char *module_name)
This phase looks for load or save statements that can be put out of the loop body and move these stat...
void remove_preferences(void *obj)
entry point to transform preferences in references
static void insert_statement_in_block(statement s, statement inserted, bool before, list *block)
static void do_remove_redundant_communications_in_forloop(forloop l, bool *need_flatten)
static void do_remove_redundant_communications_in_sequence(sequence s, bool *need_flatten)
static bool __delay_communications_patch_properties
static void delay_communications_sequence(sequence s, context *c, list *block)
static void delay_communications_anyloop(statement s, context *c, list *block)
static bool delay_communications_interprocedurally_p
static bool dma_statements_conflict_p(statement s0, statement s1)
static bool do_remove_preference(cell c)
helper to transform preferences in references
static const char * caller_name
list callers_to_statements(list callers)
given a list callers of module name calling module called module return a list of their body
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
bool clean_up_sequences(statement s)
Recursively clean up the statement sequences by fusing them if possible and by removing useless one.
struct _newgen_struct_statement_ * statement
#define CONFLICT(x)
CONFLICT.
#define dg_arc_label_conflicts(x)
struct _newgen_struct_conflict_ * conflict
#define conflict_source(x)
#define region_any_reference(reg)
To be avoided.
#define region_write_p(reg)
#define region_system(reg)
#define region
simulation of the type region
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
list load_cumulated_rw_effects_list(statement)
void reset_cumulated_rw_effects(void)
statement_effects get_proper_rw_effects(void)
#define effect_write_p(eff)
#define effect_read_p(eff)
#define effect_scalar_p(eff) entity_scalar_p(effect_entity(eff))
#define cell_reference(x)
#define cell_preference(x)
#define cell_domain
newgen_cell_interpretation_domain_defined
#define descriptor_convex_p(x)
#define effect_descriptor(x)
#define descriptor_convex(x)
#define cell_preference_p(x)
const char * module_name(const char *s)
Return the module part of an entity name.
char * get_string_property(const char *)
void statement_split_initializations(statement s)
Recurse through the statements of s and split local declarations.
bool statement_flatten_declarations(entity module, statement s)
flatten_code.c
#define gen_chunk_undefined_p(c)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
#define gen_recurse(start, domain_number, flt, rwt)
#define successor_vertex(x)
#define successor_arc_label(x)
struct _newgen_struct_graph_ * graph
#define vertex_successors(x)
#define graph_undefined_p(x)
#define SUCCESSOR(x)
SUCCESSOR.
#define graph_vertices(x)
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
const char * get_current_module_name(void)
Get the name of the current module.
statement set_current_module_statement(statement)
Set the current module statement.
statement get_current_module_statement(void)
Get 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.
void replace_entity(void *s, entity old, entity new)
per variable version of replace_entities.
void replace_entity_by_expression(void *s, entity ent, expression exp)
replace all reference to entity ent by expression exp in s.
void gen_recurse_stop(void *obj)
Tells the recursion not to go in this object.
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
gen_chunk * gen_get_ancestor(int, const void *)
return the first ancestor object found of the given type.
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
instruction make_continue_instruction()
Creates a CONTINUE instruction, that is the FORTRAN nop, the ";" in C or the "pass" in Python for exa...
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
#define POP(l)
Modify a list pointer to point on the next element of the list.
void gen_remove_once(list *pl, const void *o)
Remove the first occurence of o in list pl:
#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 CAR(pcons)
Get the value of the first element of a list.
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
void * gen_find_eq(const void *item, const list seq)
list gen_full_copy_list(list l)
Copy a list structure with element copy.
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
void gen_insert_after(const void *no, const void *o, list l)
list gen_insert_before(const void *no, const void *o, list l)
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.
sequence statement_sequence(statement)
Get the sequence of a statement sequence.
list statement_block(statement)
Get the list of block statements of a statement sequence.
loop statement_loop(statement)
Get the loop of a statement.
test statement_test(statement)
Get the test of a statement.
call statement_call(statement)
Get the call of a statement.
whileloop statement_whileloop(statement)
Get the whileloop of a statement.
forloop statement_forloop(statement)
Get the forloop of a statement.
bool statement_whileloop_p(statement)
bool statement_call_p(statement)
bool statement_forloop_p(statement)
bool statement_loop_p(statement)
statement update_statement_instruction(statement, instruction)
Replace the instruction in statement s by instruction i.
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
void insert_statement(statement, statement, bool)
This is the normal entry point.
bool empty_comments_p(const char *)
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
#define pips_user_warning
#define same_stringn_p(a, b, c)
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
set set_assign_list(set, const list)
assigns a list contents to a set all duplicated elements are lost
bool set_intersection_p(const set, const set)
returns whether s1 n s2 <> 0 complexity of the intersection
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
bool set_belong_p(const set, const void *)
set set_make(set_type)
Create an empty set of any type but hash_private.
int(* gen_cmp_func_t)(const void *, const void *)
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define statement_block_p(stat)
#define empty_comments
Empty comments (i.e.
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
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...
int compare_entities(const entity *pe1, const entity *pe2)
Comparison function for qsort.
bool entity_array_p(entity e)
Is e a variable with an array type?
bool same_entity_p(entity e1, entity e2)
predicates on entities
bool local_entity_of_module_p(entity e, entity module)
This test shows that "e" has been declared in "module".
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
const char * module_local_name(entity e)
Returns the module local user name.
set get_referenced_entities(void *elem)
retrieves the set of entities used in elem beware that this entities may be formal parameters,...
bool reference_equal_p(reference r1, reference r2)
bool array_reference_p(reference r)
predicates on references
list module_formal_parameters(entity func)
list module_formal_parameters(entity func) input : an entity representing a function.
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
entity make_new_array_variable_with_prefix(const char *, entity, basic, list)
J'ai ameliore la fonction make_new_scalar_variable_with_prefix
void RemoveLocalEntityFromDeclarations(entity, entity, statement)
bool formal_parameter_p(entity)
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
#define forloop_domain
newgen_extensions_domain_defined
#define callees_callees(x)
#define loop_domain
newgen_language_domain_defined
#define statement_ordering(x)
#define value_unknown_p(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define instruction_undefined
@ is_instruction_whileloop
@ is_instruction_expression
@ is_instruction_sequence
#define instruction_tag(x)
#define sequence_statements(x)
#define instruction_sequence(x)
#define preference_reference(x)
#define variable_dimensions(x)
#define whileloop_body(x)
#define whileloop_domain
newgen_variable_domain_defined
#define statement_declarations(x)
#define statement_instruction(x)
#define statement_comments(x)
#define call_arguments(x)
#define statement_undefined_p(x)
#define sequence_domain
newgen_reference_domain_defined
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
FI: I do not understand why the type is duplicated at the set level.
helper for do_recurse_statements_conflict_p
The structure used to build lists in NewGen.
statement caller_statement
#define sc_inclusion_p(ps1, ps2)
#define sc_equal_p(ps1, ps2)
void AddEntityToModuleCompilationUnit(entity e, entity module)
entity module_entity_to_compilation_unit_entity(entity m)
Retrieve the compilation unit containing a module definition.