32 #include "pips_config.h"
76 pips_debug(7,
"\tSuccessor list: %p for statement ordering %lld\n",
85 return ordering_to_dg_mapping;
90 "\n *********************** Use-Def Chains *********************\n",
91 "\n **************** Effective Dependence Graph ****************\n",
92 "\n ********* Dependence Graph (ill. option combination) *******\n",
93 "\n ********* Dependence Graph (ill. option combination) *******\n",
94 "\n ******** Whole Dependence Graph with Dependence Cones ******\n",
95 "\n ********* Dependence Graph (ill. option combination) *******\n",
96 "\n ********* Dependence Graph (ill. option combination) *******\n",
97 "\n **** Loop Carried Dependence Graph with Dependence Cones ***\n"
147 r_value = strcmp(
s1, s2 );
151 if ( r_value == 0 ) {
157 r_value = strcmp(
s1, s2 );
161 if ( r_value == 0 ) {
167 r_value = strcmp(
s1, s2 );
183 int banner_number = 0;
253 if ( nb_conflicts > 1 ) {
380 "syst. lin. correspondant au syst. gen.:\n" );
400 "\n****************** End of Dependence Graph ******************\n" );
427 #define dot_nodes_recurse( ctx, s ) { \
429 gen_context_recurse( s, \
432 prettyprint_dot_nodes, \
439 #define dot_print_label_string( fd, str ) \
442 if ( c == '"' ) { /* some char must be escaped */ \
443 (void) putc( '\\', fd); \
446 (void) putc( c, fd); \
457 static void prettyprint_dot_label( FILE *fd, statement s, bool print_statement ) {
459 if( ! print_statement ) {
460 // Print only ordering
461 long int o = statement_ordering(s);
462 fprintf( fd, "(%ld,%ld)", ORDERING_NUMBER(o), ORDERING_STATEMENT(o));
467 string i_comments = statement_comments(s);
470 statement_comments(s) = string_undefined;
472 // Get the text without comments
474 text_sentences(Text_Statement_Enclosed(entity_undefined,0,s,false,true ));
476 // Restoring comments
477 statement_comments(s) = i_comments;
479 // Print the first sentence
481 sentence sent = SENTENCE(CAR( sentences ));
482 if(sentence_formatted_p(sent)) {
483 string str = sentence_formatted(sent);
484 dot_print_label_string( fd, str );
486 unformatted u = sentence_unformatted(sent);
487 cons *lw = unformatted_words(u);
489 string str = STRING(CAR(lw));
490 dot_print_label_string( fd, str )
509 static bool prettyprint_dot_nodes( statement s, dot_ctx ctx ) {
510 bool gen_recurse = true;
512 // We ignore the current statement (infinite recursion) and blocks
513 if(ctx->current != s && ! statement_block_p( s ) ) {
514 int ordering = statement_ordering(s);
516 if ( ctx->ordered ) {
517 // When we have produced a previous statement,
518 // we chain it with current one with a very high weight
519 if ( ctx->previous_ordering > 0 ) {
521 " \"%d\" -> \"%d\";\n",
525 ctx->previous_ordering = ordering;
529 fprintf( ctx->fd,
" %d [label=\"", ordering);
565 fprintf( ctx->fd,
"\"];\n\n" );
612 " /* graph style */\n");
619 fprintf(
fd,
" labelloc=\"%s\";\n", title_position);
623 fprintf(
fd,
" bgcolor=\"%s\";\n", background);
635 " /* Nodes style */\n"
636 " node [shape=\"%s\",color=\"%s\",fillcolor=\"%s\","
637 "fontcolor=\"%s\",fontsize=\"%s\",fontname=\"%s\"];\n\n",
655 "\n {\n /* Print nodes for statements %s order them */\n\n",
656 ordered ?
"and" :
"but don't" );
660 " /* ordering edges must be invisible, so set background color */\n"
661 " edge [weight=100,color=%s];\n\n",
679 fprintf(
fd,
" /* Print arcs between statements */\n\n" );
680 fprintf(
fd,
" /* Dependence arcs won't constrain node positions */\nedge [constraint=false];\n\n" );
693 bool mask_loop_carried =
get_bool_property(
"PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS");
694 bool mask_loop_privatized =
get_bool_property(
"PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS");
714 const char* color = inputdep_color;
715 const char*
style = inputdep_style;
721 bool keep_this_conflict =
true;
724 keep_this_conflict =
false;
726 if(
level > nbrcomloops ) {
727 keep_this_conflict =
true;
732 bool keep_this_conflict_privatized =
true;
735 keep_this_conflict_privatized =
true;
738 keep_this_conflict_privatized=
false;
744 keep_this_conflict = keep_this_conflict && keep_this_conflict_privatized;
747 keep_this_conflict=
false;
749 if(!keep_this_conflict) {
757 color = antidep_color;
758 style = antidep_style;
760 color = outputdep_color;
761 style = outputdep_style;
763 color = flowdep_color;
764 style = flowdep_style;
767 "%d -> %d [color=%s,style=%s,label=\"",
839 int banner_number = 0;
844 (
"PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS") +
846 (
"PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES");
870 if ( nb_conflicts > 1 ) {
898 if (
level <= nbrcomloops) {
905 (
"PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS")) {
912 if (llsred ==
NIL)
continue;
917 fprintf(
fd,
"\t%02td --> %02td with conflicts\n",
933 (
"PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES")) {
941 (void)
fprintf(
fd,
"syst. lin. correspondant au syst. gen.:\n");
954 fprintf(
fd,
"\n****************** End of Dependence Graph "
955 "******************\n");
965 for(; b!=NULL; b=b->
succ) {
988 for(; v!=NULL; v= v->
succ) {
intptr_t apply_persistant_statement_to_int(persistant_statement_to_int f, statement k)
void free_persistant_statement_to_int(persistant_statement_to_int p)
void list_to_array(list l, gen_array_t a)
args.c
void fprint_string_Value(FILE *, char *, Value)
size_t gen_array_nitems(const gen_array_t a)
gen_array_t gen_array_make(size_t size)
declarations...
void ** gen_array_pointer(const gen_array_t a)
Observers...
void gen_array_free(gen_array_t a)
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Psysteme sg_to_sc_chernikova(Ptsg sg)
static list successors(list l)
#define cone_generating_system(x)
#define dg_vertex_label_statement(x)
struct _newgen_struct_dg_arc_label_ * dg_arc_label
#define CONFLICT(x)
CONFLICT.
#define dg_arc_label_conflicts(x)
#define conflict_source(x)
struct _newgen_struct_dg_vertex_label_ * dg_vertex_label
list words_effect(effect)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
list effect_words_reference(reference)
prettyprint.c
string full_action_to_short_string(action)
bool store_effect_p(effect)
#define action_write_p(x)
char * get_string_property(const char *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#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)
#define vertex_vertex_label(x)
#define vertex_successors(x)
#define SUCCESSOR(x)
SUCCESSOR.
#define graph_vertices(x)
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
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)
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.
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define CDR(pcons)
Get the list less its first element.
void * gen_find_eq(const void *item, const list seq)
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
persistant_statement_to_int statement_to_line_number(statement)
hash_table hash_table_make(hash_key_type key_type, size_t size)
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.
static statement mod_stat
We want to keep track of the current statement inside the recurse.
void base_fprint(FILE *f, Pbase b, get_variable_name_t variable_name)
void base_fprint(FILE * f, Pbase b, char * (*variable_name)()): impression d'une base sur le fichier ...
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define GEN_ARRAY_FOREACH(type, s, array)
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define HASH_DEFAULT_SIZE
#define same_string_p(s1, s2)
int(* gen_cmp_func_t)(const void *, const void *)
void print_ordering_to_statement(void)
Dump the ordering with the corresponding statement address.
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
void print_statement(statement)
Print a statement on stderr.
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
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...
string safe_entity_name(entity e)
predicates and functions for entities
int module_to_declaration_length(entity func)
Number of user declaration lines for a module.
list load_statement_enclosing_loops(statement)
void reset_enclosing_loops_map(void)
void set_enclosing_loops_map(statement_mapping)
#define statement_ordering(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
@ is_instruction_unstructured
@ is_instruction_whileloop
@ is_instruction_expression
@ is_instruction_sequence
#define instruction_tag(x)
#define instruction_call_p(x)
#define statement_instruction(x)
#define persistant_statement_to_int_undefined
#define instruction_call(x)
#define statement_undefined_p(x)
#define statement_number(x)
bool ignore_this_conflict(vertex v1, vertex v2, conflict c, int l)
This function checks if conflict c between vertices v1 and v2 should be ignored at level l.
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
void prettyprint_dependence_graph_view(FILE *fd, statement mod_stat, graph mod_graph)
Do not print vertices and arcs ignored by the parallelization algorithms.
#define dot_nodes_recurse(ctx, s)
Recurse on statement s with context ctx Intended to be called while already on a gen_recurse recursio...
void prettyprint_dependence_graph(FILE *fd, statement mod_stat, graph mod_graph)
Print all edges and arcs.
static void prettyprint_dot_label(FILE *fd, statement s, bool print_statement)
Print the label for a statement.
hash_table compute_ordering_to_dg_mapping(graph dependance_graph)
Define a mapping from the statement ordering to the dependence graph vertices:
hash_table statements_to_successors(list statements, graph dg)
creates a hash_table containing statements from statements as keys and their respective succesors acc...
struct prettyprint_dot_context * dot_ctx
static bool prettyprint_dot_nodes(statement s, dot_ctx ctx)
Print nodes for statements, the recursion is quite complicated.
void print_vect_in_vertice_val(FILE *fd, Pvecteur v, Pbase b)
static string dependence_graph_banner[8]
int vertex_sort_callback(const vertex *v1, const vertex *v2)
This is a callback for qsort function, it compares two vertex.
int vertex_ordering(vertex v)
void prettyprint_dot_dependence_graph(FILE *fd, statement mod_stat, graph mod_graph)
Output dependence graph in a file in graphviz dot format.
int compare_vertex(const void *v0, const void *v1)
compare two vertices based on their ordering
int conflicts_sort_callback(conflict *c1, conflict *c2)
This is a callback for qsort function, it compares two conflicts.
void print_dependence_cone(FILE *fd, Ptsg dc, Pbase basis)
int successor_sort_callback(const successor *succ1, const successor *succ2)
This is a callback for qsort function, it compares two successor.
int FindMaximumCommonLevel(cons *, cons *)
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define sg_sommets(sg)
vieilles definitions des fonctions d'impression void sg_fprint(); #define print_sg(sg) sg_fprint(stdo...
#define sg_rayons(sg)
acces au premier rayon de la liste des rayons d'un systeme generateur defini par un pointeur: sg_rayo...
struct type_sg * Ptsg
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
#define sg_nbre_sommets(sg)
nombre de sommets: int sg_nbre_sommets(Ptsg)
#define SG_UNDEFINED_P(sg)
#define sg_nbre_droites(sg)
nombre de droites: int sg_nbre_droites(Ptsg)
#define sg_nbre_rayons(sg)
nombre de rayons: int sg_nbre_rayons(Ptsg)
#define sg_droites(sg)
acces a la premiere droite de la liste des droites d'un systeme generateur defini par un pointeur: sg...
void sg_fprint_as_dense(FILE *f, Ptsg sg, Pbase b)
void sg_fprint_as_dense(FILE * f, Ptsg sg): impression d'un systeme generateur
void sg_fprint_as_ddv(FILE *fd, Ptsg sg)
void fprint_lsom_as_dense(FILE *f, Psommet ls, Pbase b)
void fprint_lsom_as_dense(FILE * f, Psommet s): impression d'une liste de sommets
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
The structure used to build lists in NewGen.
Context structure used by gen recurse.
struct Svecteur * vecteur
structure de donnees Sommet
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
string words_to_string(cons *lw)
void print_words(FILE *fd, cons *lw)
char *(* get_variable_name_t)(Variable)
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...