25 #include "pips_config.h"
207 pips_debug(5,
"building entity %s\n", new_name);
234 bool similar_found =
false;
256 similar_found =
true;
334 if (e1==e2)
return true;
340 for (; ndim>0; ndim--)
345 if (l1!=l2 || u1!=u2)
return false;
531 #define RETAL(msg, res) \
532 { pips_debug(7, "%d because %s\n", res, msg); return res;}
544 RETAL(
"some undefined", b);
547 pips_debug(7,
"considering %s[dim=%"PRIdPTR
"] and %s[dim=%"PRIdPTR
"]\n",
554 RETAL(
"diff. array dim",
false);
557 RETAL(
"different rate",
false);
561 RETAL(
"different template size",
false);
574 #define RET(msg, what) \
575 { pips_debug(6, "not similar because %s\n", msg); return what;}
604 RET(
"different processors",
false);
606 for (i=1; i<=ndimdist; i++)
622 RET(
"different distribution",
false);
632 RET(
"different alignment",
false);
702 for (i=1; i<=len; i++,
POP(args))
705 pips_debug(7,
"considering argument %d\n", i);
808 init_alive_synonym();
809 init_used_dynamics();
810 init_modified_dynamics();
811 init_reaching_mappings();
812 init_leaving_mappings();
814 init_remapping_graph();
819 close_alive_synonym();
820 close_used_dynamics();
821 close_modified_dynamics();
822 close_reaching_mappings();
823 close_leaving_mappings();
836 get_remapping_graph());
838 close_remapping_graph();
872 if (!bound_remapping_graph_p(s))
875 if (!bound_used_dynamics_p(s))
878 if (!bound_modified_dynamics_p(s))
906 entities es = load_used_dynamics(s);
924 if (!bound_alive_synonym_p(s))
927 es = load_alive_synonym(s);
957 pips_debug(8,
"statement %p, array %s, rw proper %d\n",
986 #define ret(why, what) \
987 { pips_debug(9, "ret %d because %s\n", what, why); return what; }
999 ret(
"not a call",
true);
1020 ret(
"rename to the same",
false);
1039 ret(
"template of realign",
true);
1047 ret(
"realign array",
false);
1067 ret(
"processors of distribute",
true);
1077 ret(
"redistribute template",
false);
1091 ret(
"default",
true);
1106 is_array?
"array":
"template");
1168 entities leaving = load_leaving_mappings(s);
1201 entities er = load_reaching_mappings(s);
1231 bool modified =
false;
1282 (s, ls, load_reaching_mappings, load_used_dynamics,
false,
true);
1312 entities remapped = load_remapped(s),
1313 reaching = load_reaching_mappings(s),
1314 leaving = load_leaving_mappings(s);
1350 bool some_source_found =
false;
1359 some_source_found =
true;
1367 if (!some_source_found)
1391 get_remapping_graph());
1401 fprintf(stderr,
"(%d:%d:%" PRIdPTR
"), ",
1406 #define elst_ifdef(what, name, s) \
1407 if (bound_##name##_p(s)){DEBUG_ELST(1, what, entities_list(load_##name(s)));}\
1408 else pips_debug(1, "no " what "\n");
1412 control c = load_remapping_graph(s);
1416 fprintf(stderr,
"predecessors: ");
1418 fprintf(stderr,
"\nsuccessors: ");
1424 elst_ifdef(
"modified", modified_dynamics, s);
1425 elst_ifdef(
"reaching", reaching_mappings, s);
1427 elst_ifdef(
"maybe useful", maybeuseful_mappings, s);
1435 fprintf(stderr,
"[dump_remapping_graph] for %s\n", when);
1437 fprintf(stderr,
"[dump_remapping_graph] done\n");
1485 pips_debug(4,
"may be useful mapping propagation\n");
1515 if (!bound_alive_synonym_p(s))
1608 for(; ndims>0;
POP(dims),
POP(indexes), ndims--)
void free_distribute(distribute p)
align copy_align(align p)
ALIGN.
dynamic_status make_dynamic_status(entity_entities a1, entitymap a2, statement_renamings a3, statement_entities a4)
entities copy_entities(entities p)
ENTITIES.
entities make_entities(list a)
renaming make_renaming(entity a1, entity a2)
execution make_execution(enum execution_utype tag, void *val)
call make_call(entity a1, list a2)
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
storage make_storage(enum storage_utype tag, void *val)
ram make_ram(entity a1, entity a2, intptr_t a3, list a4)
expression copy_expression(expression p)
EXPRESSION.
reference make_reference(entity a1, list a2)
void free_storage(storage p)
control make_control(statement a1, list a2, list a3)
range make_range(expression a1, expression a2, expression a3)
struct _newgen_struct_entity_ * entity
bool next_ctrl_graph_travel(statement *)
void init_ctrl_graph_travel(statement, bool(*)(statement))
void close_ctrl_graph_travel(void)
void print_align(align a)
this is a set of functions to help hpfc debugging
bool array_distribution_similar_p(entity a1, entity a2)
void close_dynamic_locals()
static void ref_rwt(reference r)
static void remove_from_entities(entity primary, entities es)
static void lazy_initialize_for_statement(statement s)
starting point
static void initialize_maybeuseful_mappings(statement s)
must be called after useless leaving mappings removal
void close_dynamic_status()
static bool same_alignment_in_list_p(alignment a, list l)
comparison of ALIGN.
static void dump_remapping_graph(string when, list ls)
static void add_dynamic_synonym(entity new_e, entity e)
what: new_e is stored as a synonym of e.
list alive_arrays(statement s, entity t)
what: returns the list of alive arrays for statement s and template t.
static list propagate_used_arrays(statement s, list ls)
of statements
static entity new_synonym(entity e)
builds a synonym for entity e.
static entity new_variable
entity to be replaced, the primary?
void init_dynamic_locals()
DYNAMIC LOCAL DATA.
static entity new_synonym_template(entity t, distribute di)
builds a new synonym for template t, the distribution of which will be di.
static bool same_distribute_p(distribute d1, distribute d2)
comparison of DISTRIBUTE.
static void dump_remapping_graph_info(statement s)
void set_dynamic_status(dynamic_status d)
void set_similar_mappings_for_updates(void)
static list add_once_to_renaming_list(list l, entity o, entity n)
of renaming
static list list_of_remapping_statements()
of statements
bool same_primary_entity_p(entity e1, entity e2)
static bool continue_propagation_p(statement s)
void init_dynamic_status()
DYNAMIC STATUS management.
void reset_dynamic_status()
void hpfc_translate_call_with_distributed_args(statement s, call c)
??? only simple calls are handled.
dynamic_status get_dynamic_status()
static void add_alive_synonym(statement s, entity a)
static void simple_switch_old_to_new(statement s)
static bool same_distribution_p(distribution d1, distribution d2)
array_distribution_similar_p
bool conformant_templates_p(entity t1, entity t2)
#define ret(why, what)
true if not a remapping for old.
static void add_as_a_modified_variable(entity e)
static void print_control_ordering(control c)
functions used for debug.
bool(* dynamic_entity_p)(entity)
as expected, true if entity e is dynamic.
void dump_current_remapping_graph(string when)
void simplify_remapping_graph(void)
void simplify_remapping_graph()
void propagate_synonym(statement s, entity old, entity new, bool is_array)
static list propagate_maybeuseful_mappings(statement s, list ls)
of statements
bool hpfc_call_with_distributed_args_p(call c)
whether call c inplies a distributed argument
static void regenerate_renamings(statement s)
regenerate the renaming structures after the optimizations performed on the remapping graph.
static void initialize_reaching_propagation(statement s)
for statement s
void set_entity_as_dynamic(entity e)
a new dynamic entity is stored.
static void add_as_a_used_variable(entity e)
static list propagation_on_remapping_graph(statement s, list ls, entities(*built)(statement), entities(*condition)(statement), bool local, bool forward)
more options, such as may or must?
static entity new_synonym_array(entity a, align al)
builds a new synonym for array a, the alignment of which will be al.
void hpfc_check_for_similarities(list le)
check all dynamic arrays for some similars...
static entity old_variable
void propagate_synonym(s, old, new) statement s; entity old, new;
static bool same_align_p(align a1, align a2)
entity safe_load_primary_entity(entity e)
HPFC module by Fabien COELHO.
static bool rename_directive_p(entity f)
static bool same_alignment_p(entity e1, entity t1, alignment a1, entity e2, entity t2, alignment a2)
void add_as_a_used_dynamic_to_statement(statement s, entity e)
align new_align_with_template(align a, entity t)
static void remove_not_remapped_leavings(statement s)
entity template_synonym_distributed_as(entity temp, distribute d)
what: finds or creates a new entity distributed as needed.
static bool array_used
true if an array is propagated, false if template
static void remove_unused_remappings(statement s)
static bool array_modified
true if the array was actually used
statement generate_copy_loop_nest(entity src, entity trg)
statement generate_copy_loop_nest(src, trg) entity src, trg;
static statement initial_statement
true if the array may be modified...
static bool conformant_entities_p(entity e1, entity e2)
static bool array_propagation
replacement
static void add_as_a_closing_statement(statement s)
static void check_for_similarity(entity a, list others)
entity array_synonym_aligned_as(entity array, align a)
entity array_synonym_aligned_as(array, a) entity array; align a;
static void reinitialize_reaching_mappings(statement s)
#define elst_ifdef(what, name, s)
list load_proper_rw_effects_list(statement)
bool bound_proper_rw_effects_p(statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
bool store_effect_p(effect)
void gen_free(gen_chunk *obj)
version without shared_pointers.
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
statement get_current_module_statement(void)
Get the current module statement.
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
bool gen_false(__attribute__((unused)) gen_chunk *unused)
Return false and ignore the argument.
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.
#define ENDP(l)
Test if a list is empty.
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
void gen_map(gen_iter_func_t fp, const list l)
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
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)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#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
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#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_closure(list(*iterate)(), list(*initial)())
void gen_closure(iterate, initial) list [of X] (*iterate)([ X, list of X ]), initial;
statement make_assign_statement(expression, expression)
void fix_sequence_statement_attributes(statement)
Since blocks are not represented in Fortran, they cannot carry a label.
void store_new_node_variable(entity new, entity old)
#define alignment_templatedim(x)
#define DISTRIBUTION(x)
DISTRIBUTION.
#define distribution_style(x)
#define alignment_constant(x)
#define align_template(x)
#define align_alignment(x)
#define distribute_distribution(x)
#define ALIGNMENT(x)
ALIGNMENT.
#define alignment_rate(x)
#define alignment_undefined_p(x)
#define alignment_arraydim(x)
#define distribute_processors(x)
#define distribution_parameter(x)
#define dynamic_status_dynamics(x)
#define dynamic_status_renamings(x)
#define RENAMING(x)
RENAMING.
#define dynamic_status_tokeep(x)
#define dynamic_status_primary(x)
void get_entity_dimensions(entity e, int dim, int *plow, int *pup)
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
distribution FindDistributionOfProcessorDim(list ldi, int dim, int *tdim)
alignment FindAlignmentOfTemplateDim(list lal, int dim)
#define src(name, suf)
HPFC by Fabien Coelho, May 1993 and later...
entity hpfc_new_variable(entity module, basic b)
#define what_stat_debug(level, stat)
#define DEBUG_ELST(D, W, L)
#define DEBUG_STAT(D, W, S)
#define primary_entity_p(a)
void add_a_dynamic(entity c)
local primary dynamics
entities load_dynamic_hpf(entity)
entity hpfc_name_to_entity(const char *)
void store_hpf_distribution(entity, distribute)
entity load_similar_mapping(entity)
entity load_new_node(entity)
void close_dynamic_hpf(void)
list load_renamings(statement)
bool entity_template_p(entity)
void set_template(entity)
void store_similar_mapping(entity, entity)
void store_hpf_alignment(entity, align)
void update_renamings(statement, list)
void set_dynamic_hpf(entity_entities)
distribute load_hpf_distribution(entity)
void init_maybeuseful_mappings(void)
void init_similar_mapping(void)
void reset_maybeuseful_mappings(void)
void close_similar_mapping(void)
void init_renamings(void)
entity load_primary_entity(entity)
statement_entities get_maybeuseful_mappings(void)
void reset_dynamic_hpf(void)
statement_renamings get_renamings(void)
void set_maybeuseful_mappings(statement_entities)
bool bound_new_node_p(entity)
void close_primary_entity(void)
bool bound_similar_mapping_p(entity)
align load_hpf_alignment(entity)
void init_primary_entity(void)
entity_entities get_dynamic_hpf(void)
void close_maybeuseful_mappings(void)
bool bound_dynamic_hpf_p(entity)
void set_primary_entity(entitymap)
void store_primary_entity(entity, entity)
entitymap get_primary_entity(void)
void reset_renamings(void)
list list_of_distributed_arrays(void)
void set_renamings(statement_renamings)
void set_array_as_distributed(entity)
void store_dynamic_hpf(entity, entities)
void reset_primary_entity(void)
void close_renamings(void)
bool bound_primary_entity_p(entity)
void store_maybeuseful_mappings(statement, entities)
bool array_distributed_p(entity)
void init_dynamic_hpf(void)
entities load_maybeuseful_mappings(statement)
#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 DYNAMIC_AREA_LOCAL_NAME
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define GENERIC_GLOBAL_FUNCTION(name, type)
#define same_string_p(s1, s2)
list(* gen_closure_func_t)(gen_chunk *, list)
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
void(* gen_iter_func_t)(void *)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
#define HPF_PREFIX
moved here because needed by syntax:-(
#define loop_to_statement(l)
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define call_to_statement(c)
#define make_empty_statement
An alias for make_empty_block_statement.
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...
list entities_to_expressions(list l_ent)
build a list of expressions from a list of entities
entity entity_empty_label(void)
const char * entity_module_name(entity e)
See comments about module_name().
entity FindOrCreateEntityLikeModel(const char *package, const char *name, entity model)
hmmm...
expression reference_to_expression(reference r)
reference expression_to_reference(expression e)
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
bool expression_reference_p(expression e)
Test if an expression is a reference.
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
bool realign_directive_p(entity f)
bool dead_fcd_directive_p(entity f)
bool redistribute_directive_p(entity f)
bool hpf_directive_entity_p(entity e)
basic MakeBasic(int)
END_EOLE.
dimension FindIthDimension(entity, int)
void AddEntityToDeclarations(entity, entity)
END_EOLE.
int SizeOfIthDimension(entity, int)
this function returns the size of the ith dimension of a variable e.
int NumberOfDimension(entity)
entity find_ith_parameter(entity, int)
#define unstructured_domain
newgen_type_domain_defined
#define storage_formal_p(x)
#define reference_variable(x)
#define control_predecessors(x)
#define value_intrinsic_p(x)
#define CONTROLMAP_MAP(k, v, c, f)
#define statement_ordering(x)
#define dimension_lower(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define CONTROL(x)
CONTROL.
#define EXPRESSION(x)
EXPRESSION.
#define reference_domain
newgen_range_domain_defined
#define dimension_upper(x)
#define control_successors(x)
#define instruction_call_p(x)
#define variable_dimensions(x)
#define statement_instruction(x)
#define instruction_call(x)
#define call_arguments(x)
#define control_statement(x)
#define type_variable_p(x)
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
Value b1
booleen indiquant quel membre est en cours d'analyse
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
The structure used to build lists in NewGen.