27 #if defined(BUILDER_ARRAY_PRIVATIZER) || \
28 defined(BUILDER_ARRAY_SECTION_PRIVATIZER) || \
29 defined(BUILDER_PRINT_CODE_PRIVATIZED_REGIONS) || \
30 defined(BUILDER_DECLARATIONS_PRIVATIZER)
33 #include "pips_config.h"
82 static bool store_as_regions =
false;
83 static bool store_as_loop_locals =
true;
84 static bool privatize_sections =
false;
85 static bool copy_in =
false;
86 static bool copy_out =
false;
88 static void array_privatization_error_handler(
void)
90 error_reset_current_stmt_stack();
91 store_as_regions =
false;
92 store_as_loop_locals =
true;
93 privatize_sections =
false;
101 static void private_regions_of_module_statement(
statement module_stat);
102 static void private_regions_of_module_loops(
statement module_stat);
113 store_as_regions =
false;
114 store_as_loop_locals =
true;
115 privatize_sections =
false;
130 store_as_regions =
true;
131 store_as_loop_locals =
true;
132 privatize_sections =
true;
149 pips_assert(
"Copy-in not implemented.\n", !copy_in);
151 " if we do not store as regions.\n",
152 store_as_regions || ! privatize_sections);
154 " if we do not privatize array sections.\n",
155 privatize_sections || (!copy_in && !copy_out) );
162 "Do not expect wonderful results\n");
206 if (store_as_regions)
208 init_private_effects();
209 init_copy_out_effects();
212 debug_on(
"ARRAY_PRIVATIZATION_DEBUG_LEVEL");
216 private_regions_of_module_statement(module_stat);
217 private_regions_of_module_loops(module_stat);
222 if (store_as_regions)
250 if (store_as_regions)
252 reset_private_effects();
253 reset_copy_out_effects();
262 static void private_regions_of_module_statement(
statement module_stat)
264 list l_priv, l_cand, l_out_cand;
283 if (store_as_regions)
285 store_private_effects(module_stat,
make_effects(l_priv));
294 static void private_regions_of_statement(
statement s);
295 static bool private_regions_of_loop(
loop l);
304 static void private_regions_of_module_loops(
statement module_stat)
307 make_current_stmt_stack();
320 free_current_stmt_stack();
330 current_stmt_push(s);
335 static void private_regions_of_statement(s)
340 if (store_as_regions && !bound_private_effects_p(s))
342 pips_debug(6,
"non-loop body statement, storing NIL regions.\n");
354 static bool private_regions_of_loop(l)
359 list l_cand, l_loc, l_out_priv, l_out_priv_tmp, l_locals,
360 l_loc_i, l_loc_i_prime;
361 list l_write, l_in, l_out, l_tmp, l_cand_tmp;
392 if (privatize_sections)
413 pips_debug(3,
"LOC(i) = W(i) -entities_inf IN(i)\n");
453 pips_debug(3,
"regions on arrays that really induce "
454 "false dependences:\n");
459 if (privatize_sections)
475 pips_debug(3,
"CAND(i) = LOC(i) -inf proj_i'[IN(i')]\n");
496 pips_debug(3,
"OUT_PRIV(i) = CAND(i) inter OUT(i)\n");
503 l_out_priv_tmp = l_out_priv;
504 while(!
ENDP(l_out_priv_tmp))
510 l_out_priv_tmp =
CDR(l_out_priv_tmp);
516 while(!found && !
ENDP(l_cand_tmp))
519 l_cand_tmp =
CDR(l_cand_tmp);
543 pips_debug(3,
"No copy-out: OUT_PRIV(i) = NIL\n");
552 while(!
ENDP(l_cand_tmp))
561 l_cand_tmp =
CDR(l_cand_tmp);
571 for(l_tmp = l_com_ent; !
ENDP(l_tmp) && !found; l_tmp =
CDR(l_tmp))
583 (
"\nCOMMON %s not declared in subroutine %s:\n\t"
584 "variable %s cannot be privatized in loop "
600 if (store_as_loop_locals)
637 if (store_as_regions)
653 bool ok, blks_tmp, priv_tmp, scal_tmp;
695 #define PRIVATE_VARIABLE_SUFFIX "_P"
702 current_old_entity = e_old;
703 current_new_entity = e_new;
707 get_current_old_entity()
709 return current_old_entity;
713 get_current_new_entity()
715 return current_new_entity;
719 reset_current_entities()
729 entity e_old = get_current_old_entity();
730 entity e_new = get_current_new_entity();
739 privatize_entity(
entity ent)
757 PRIVATE_VARIABLE_SUFFIX, NULL));
780 set_current_entities(ent, new_ent);
783 reset_current_entities();
789 list l_priv =
NIL, l_in, l_out, l_write;
796 " COPY OUT not implemented.\n" );
802 "Do not expect wonderful results\n");
829 debug_on(
"ARRAY_PRIVATIZATION_DEBUG_LEVEL");
effects make_effects(list a)
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)
value copy_value(value p)
VALUE.
static reference ref
Current stmt (an integer)
static bool stmt_filter(statement s)
modifies global var current_caller_stmt
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
#define region_entity(reg)
#define region
simulation of the type region
#define region_exact_p(reg)
list RegionsInfDifference(list l1, list l2, bool(*difference_combinable_p)(effect, effect))
list RegionsInfDifference(list l1, l2) input : two lists of regions output : a list of region,...
list RegionsEntitiesIntersection(list l1, list l2, bool(*intersection_combinable_p)(effect, effect))
list RegionsEntitiesIntersection(list l1,l2, bool (*intersection_combinable_p)(effect,...
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 RegionsIntersection(list l1, list l2, bool(*intersection_combinable_p)(effect, effect))
list RegionsIntersection(list l1,l2, bool (*intersection_combinable_p)(effect, effect)) input : outpu...
static statement current_stmt
void print_copyinout_regions(list)
list regions_write_regions(list)
Psysteme sc_loop_proper_precondition(loop)
text text_copyinout_array_regions(list)
void set_methods_for_convex_effects(void)
methods.c
void get_regions_properties(void)
void print_private_regions(list)
list regions_to_write_regions(list)
void array_regions_variable_rename(list, entity, entity)
void project_regions_with_transformer_inverse(list, transformer, list)
void project_regions_along_loop_index(list, entity, range)
void project_regions_along_loop_index(list l_reg, entity index, l_range) input : a list l_reg of regi...
text text_private_array_regions(list)
list array_regions_sc_append(list, Psysteme, bool)
void(* generic_attachment_function)(text)
void set_invariant_in_effects(statement_effects)
void set_rw_effects(statement_effects)
void reset_invariant_in_effects(void)
list load_statement_inv_regions(statement)
void add_a_generic_prettyprint(string, bool, generic_text_function, generic_prettyprint_function, generic_attachment_function)
bool w_r_combinable_p(effect, effect)
void reset_out_effects(void)
bool print_source_or_code_effects_engine(const char *, string, bool)
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)
bool w_w_combinable_p(effect, effect)
void reset_generic_prettyprints(void)
void reset_invariant_rw_effects(void)
list load_statement_out_regions(statement)
void generic_effects_reset_all_methods(void)
list load_statement_in_regions(statement)
void set_invariant_rw_effects(statement_effects)
void reset_cumulated_rw_effects(void)
list load_statement_local_regions(statement)
void reset_rw_effects(void)
list load_statement_inv_in_regions(statement)
const char * module_name(const char *s)
Return the module part of an entity name.
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.
void reset_current_module_statement(void)
Reset the current module statement.
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 gen_multi_recurse(void *o,...)
Multi recursion visitor function.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
void sort_all_loop_locals(statement s)
#define ENDP(l)
Test if a list is empty.
#define list_undefined_p(c)
Return if a list is undefined.
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)
#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.
#define CDR(pcons)
Get the list less its first element.
#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 current_stmt_head()
We want to keep track of the current statement inside the recurse.
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
void reset_hooks_unregister(reset_func_t)
remove registered cleanup hook.
void reset_hooks_register(reset_func_t)
reset_hooks.c
#define DYNAMIC_AREA_LOCAL_NAME
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define DEFINE_LOCAL_STACK(name, type)
#define same_string_p(s1, s2)
static entity dynamic_area
rule find_rule_by_resource(const char *rname)
This function returns the active rule to produce resource rname.
void set_bool_property(const char *, bool)
static bool reference_filter(reference r)
======================================================================
#define make_entity(n, t, s, i)
bool dynamic_area_p(entity aire)
int current_offset_of_area(entity a, entity v)
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...
bool entity_in_list_p(entity ent, list ent_l)
look for ent in ent_l
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.
const char * module_local_name(entity e)
Returns the module local user name.
void print_entities(list l)
const char * entity_module_name(entity e)
See comments about module_name().
void AddEntityToDeclarations(entity, entity)
END_EOLE.
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define entity_undefined_p(x)
#define reference_domain
newgen_range_domain_defined
#define statement_number(x)
#define storage_undefined
#define entity_initial(x)
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
void set_transformer_map(statement_mapping)
transformer load_statement_transformer(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
void reset_transformer_map(void)
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
The structure used to build lists in NewGen.
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
#define BASE_NULLE
MACROS SUR LES BASES.
Pvecteur vect_make(Pvecteur v, Variable var, Value val,...)
Pvecteur vect_make(v, [var, val,]* 0, val) Pvecteur v; // may be NULL, use assigne anyway Variable va...