25 #include "pips_config.h"
63 #include "pips-libs.h"
81 #define MAKE_STATEMENT_SET() (set_make( set_pointer ))
85 #define INIT_STATEMENT_SIZE 20
86 #define INIT_ENTITY_SIZE 10
93 #define GEN(st) ((set)hash_get( Gen, (char *)st ))
97 #define REF(st) ((set)hash_get( Ref, (char *)st ))
106 #define DEF_IN(st) ((set)hash_get(Def_in, (char *)st))
111 #define DEF_OUT(st) ((set)hash_get(Def_out, (char *)st))
116 #define REF_IN(st) ((set)hash_get(Ref_in, (char *)st))
121 #define REF_OUT(st) ((set)hash_get(Ref_out, (char *)st))
145 fprintf( stderr,
"\t%s ", msg );
179 "Init statement %td with effects %p, ordering %tx\n",
289 pips_assert(
"Effect isn't map to this statement !",
300 "neither a read nor a write !");
586 "Result genref_one_statement for Statement %p [%s]:\n",
599 "Result for Statement %p [%s]:\n",
807 static int indent = 0;
811 "%*s> Computing DEF and REF for statement %p (%td %td):\n"
812 "current_defs %p, current_refs %p\n",
836 "%*s> After add conflicts for statement %p (%td %td):\n"
837 "current_defs %p, current_refs %p\n",
884 "%*s> Statement %p (%td %td):\n"
885 "current_defs %p, current_refs %p\n",
919 fprintf( stderr,
"Computing DEF_IN and OUT of control %p entering", ct );
933 for ( change =
true; change; ) {
935 fprintf( stderr,
"Iterating on %p ...\n", ct );
1063 "Conflicts %td (%td,%td) (%p) -> %td (%td,%td) (%p) %s"
1073 ( which ==
ud ) ?
"ud" :
"dd_du",
1103 bool add_conflict_p =
true;
1110 if(ein_abstract_location_p) {
1116 add_conflict_p =
true;
1131 add_conflict_p =
true;
1132 }
else if(din < dout) {
1154 }
else if(dout < din) {
1161 if(add_conflict_p) {
1162 pips_debug(2,
"add_conflicts_p is true; checking conflicts with loop indices\n");
1163 bool remove_this_conflict_p =
false;
1175 if(!remove_this_conflict_p) {
1253 #define TABLE_FREE(t) \
1254 {HASH_MAP( k, v, {set_free( (set)v ) ;}, t ) ; hash_table_free(t);}
1321 #ifdef HAVE_PIPS_effects_simple_LIBRARY
1333 #ifdef HAVE_PIPS_effects_convex_LIBRARY
1411 pips_debug(1,
"finding enclosing loops ...\n");
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
dg_arc_label make_dg_arc_label(list a)
conflict make_conflict(effect a1, effect a2, cone a3)
dg_vertex_label make_dg_vertex_label(intptr_t a1, sccflags a2)
successor make_successor(arc_label a1, vertex a2)
vertex make_vertex(vertex_label a1, list a2)
static reference ref
Current stmt (an integer)
bool entity_abstract_location_p(entity al)
entity variable_to_abstract_location(entity v)
returns the smallest abstract locations containing the location of variable v.
bool abstract_locations_may_conflict_p(entity al1, entity al2)
Do these two abstract locations MAY share some real memory locations ?
chain_type
To choose the concepts used to compute dependence chains.
static void inout_block(_UNUSED_ statement st, cons *sts)
Propagates in sets of ST (which is inherited) to compute the out sets.
static void genref_forloop(forloop l, statement st)
Compute Gen and Ref set for a "for" loop @description see genref_any_loop()
static bool dd_du(effect fin, effect fout)
DD_DU detects Def/Def, Def/Use conflicts between effects FIN and FOUT.
static void genref_any_loop(statement body, statement st, list locals, _UNUSED_ bool one_trip_do_p)
Compute Gen and Ref set for any loop (do, for, while,...) @description It has to deal specially with ...
static void genref_test(test t, statement s)
Compute Gen and Ref set for a test.
static void inout_any_loop(statement st, statement body, bool one_trip_do_p, bool __attribute__((unused)) never_executed_p)
Propagates in sets of ST (which is inherited) to compute the out sets.
static hash_table Vertex_statement
Vertex_statement maps each statement to its vertex in the dependency graph.
graph statement_dependence_graph(statement s)
Compute from a given statement, the dependency graph.
static vertex vertex_statement(statement st)
static void mask_effects(set s, list l)
MASK_EFFECTS masks the effects in S according to the locals L.
static cons * pushnew_conflict(effect fin, effect fout, cons *cfs)
adds the conflict FIN->FOUT in the list CFS @description adds the conflict FIN->FOUT in the list CFS ...
bool region_chains(const string module_name)
Phase to compute atomic chains based on array regions.
static void set_effects(char *module_name, enum chain_type use)
Select the type of effects used to compute dependence chains.
#define INIT_STATEMENT_SIZE
Default sizes for corresponding sets.
static bool chains(char *module_name, enum chain_type use)
Compute chain dependence for a module according different kinds of store-like effects.
static void inout_call(statement st, call __attribute__((unused)) c)
Propagates in sets of ST (which is inherited) to compute the out sets.
static void kill_effects(set gen, set killers)
The genref_xxx functions implement the computation of GEN and REF sets from Aho, Sethi and Ullman "Co...
static void local_print_statement_set(string msg, set s)
Access functions for debug only.
static void inout_control()
static bool init_one_statement(statement st)
Initializes the global data structures needed for usedef computation of one statement.
static bool rgch
functions for effects maps
static bool dataflow_dependence_only_p
static void inout_unstructured(statement st, unstructured u)
Propagates in sets of ST (which is inherited) to compute the out sets.
static void genref_block(cons *sts, statement st)
Compute Gen and Ref set for a block @description The Dragon book only deals with a sequence of two st...
static void genref_unstructured(unstructured u, statement st)
Compute Gen and Ref set for an unstructured @description computes the gens, refs, and kills set of th...
static void genref_whileloop(whileloop l, statement st)
Compute Gen and Ref set for a "while" loop @description see genref_any_loop()
static hash_table Def_out
Def_out maps each statement to the statements that are out-coming the statement It's only used for un...
static list load_statement_effects(statement s)
static hash_table Ref_in
Ref_in maps each statement to the effects that are in-coming the statement It's only used for unstruc...
static void genref_loop(loop l, statement st)
Compute Gen and Ref set for a "do" loop @description see genref_any_loop()
static hash_table effects2statement
Mapping from effects to the associated statement.
bool in_out_regions_chains(const string module_name)
Phase to compute atomic chains based on in-out array regions.
static hash_table Def_in
Def_in maps each statement to the statements that are in-coming the statement It's only used for unst...
static set current_defs
current_defs is the set of DEF at the current point of the computation
static void inout_whileloop(statement st, whileloop wl)
Propagates in sets of ST (which is inherited) to compute the out sets.
static void add_conflicts(effect fin, statement stout, vertex vout, cons *effect_outs, bool(*which)())
adds conflict arcs to the dependence graph dg between the in-coming statement STIN and the out-going ...
static void inout_loop(statement st, loop lo)
Propagates in sets of ST (which is inherited) to compute the out sets.
static void inout_forloop(statement st, forloop fl)
Propagates in sets of ST (which is inherited) to compute the out sets.
#define MAKE_STATEMENT_SET()
Macro to create set.
static hash_table Gen
Gen maps each statement to the effects it generates.
static void inout_statement()
static void genref_one_statement(statement st)
Compute Gen and Ref set for a single statement.
static hash_table Ref
Refs maps each statement to the effects it references.
static void genref_statement()
static void inout_test(_UNUSED_ statement s, test t)
Propagates in sets of ST (which is inherited) to compute the out sets.
static hash_table Ref_out
Ref_out maps each statement to the effects that are out-coming the statement It's only used for unstr...
static bool mask_effects_p
void * arc_label
– usedef.c
static void reset_effects()
Some forward declarations.
static bool ud(effect fin, effect fout)
UD detects Use/Def conflicts between effects FIN and FOUT.
static void genref_instruction(instruction i, statement st)
Does the dispatch and recursion loop @description.
bool atomic_chains(const string module_name)
Phase to compute atomic chains based on proper effects (simple memory accesses)
static bool keep_read_read_dependences_p
static bool one_trip_do_p
Some properties.
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
#define sccflags_undefined
#define CONFLICT(x)
CONFLICT.
struct _newgen_struct_vertex_ * vertex
list load_proper_rw_effects_list(statement)
void reset_out_effects(void)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_out_effects(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
list load_statement_out_regions(statement)
list load_statement_in_regions(statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_exact_p(eff)
entity effect_entity(effect)
cproto-generated files
bool store_effect_p(effect)
bool effect_scalar_p(effect)
entity effect_to_entity(effect)
Returns the entity corresponding to the mutation.
#define action_write_p(x)
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....
#define gen_recurse(start, domain_number, flt, rwt)
#define successor_vertex(x)
#define successor_undefined
#define successor_arc_label(x)
#define vertex_successors(x)
#define SUCCESSOR(x)
SUCCESSOR.
#define graph_vertices(x)
#define successor_undefined_p(x)
bool entities_may_conflict_p(entity e1, entity e2)
Check if two entities may conflict.
bool first_exact_scalar_effect_certainly_includes_second_effect_p(effect eff1, effect eff2)
bool effects_might_conflict_even_read_only_p(effect eff1, effect eff2)
Check if two effect might conflict, even if they are read only @description Two effects may conflict ...
void set_conflict_testing_properties()
conflicts.c
bool effect_may_read_or_write_memory_paths_from_entity_p(effect ef, entity e)
misc functions
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
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
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool loop_executed_never_p(loop l)
Check if loop bound are constant and then if upper < lower.
bool loop_executed_at_least_once_p(loop l)
Check if loop bound are constant and then if upper >= lower.
void clean_enclosing_loops(void)
statement_mapping loops_mapping_of_statement(statement stat)
#define ENDP(l)
Test if a list is empty.
#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)
bool gen_once_p(list l)
FC: ARGH...O(n^2)!
#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
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
list gen_append(list l1, const list l2)
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.
loop statement_loop(statement)
Get the loop of a statement.
string statement_identification(statement)
Like external_statement_identification(), but with internal information, the hexadecimal address of t...
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_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
#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
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
string bool_to_string(bool)
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
set set_del_element(set, const set, const void *)
set set_assign(set, const set)
Assign a set with the content of another set.
bool set_equal_p(const set, const set)
returns whether s1 == s2
set set_difference(set, const set, const set)
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
set set_clear(set)
Assign the empty set to s s := {}.
set set_union(set, const set, const set)
#define set_undefined_p(s)
set set_make(set_type)
Create an empty set of any type but hash_private.
set set_add_element(set, const set, const void *)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
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.
static statement gen(int what, entity src, entity trg, entity lid, entity proc, entity(*create_src)(), entity(*create_trg)(), Psysteme sr, list ldiff)
arguments: all that may be useful to generate some code
#define instruction_block_p(i)
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
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 local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
list load_statement_enclosing_loops(statement)
bool pointer_type_p(type)
Check for scalar pointers.
void set_enclosing_loops_map(statement_mapping)
#define control_predecessors(x)
#define instruction_loop(x)
#define statement_ordering(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define CONTROL(x)
CONTROL.
@ is_instruction_unstructured
@ is_instruction_whileloop
@ is_instruction_expression
#define instruction_tag(x)
#define reference_indices(x)
#define instruction_forloop(x)
#define unstructured_exit(x)
#define instruction_expression(x)
#define instruction_whileloop(x)
#define whileloop_body(x)
#define statement_declarations(x)
#define statement_instruction(x)
#define instruction_call(x)
#define control_statement(x)
#define instruction_test(x)
#define statement_number(x)
#define instruction_unstructured(x)
#define entity_initial(x)
void prettyprint_dependence_graph(FILE *, statement, graph)
Print all edges and arcs.
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
@ empty
b1 < bj -> h1/hj = empty