PIPS
prettyprint.c File Reference
#include "local.h"
#include "genC.h"
+ Include dependency graph for prettyprint.c:

Go to the source code of this file.

Functions

bool print_whole_dependence_graph (const string mod_name)
 DG PRINTING FUNCTIONS
More...
 
bool print_filtered_dependence_graph (const string mod_name)
 
bool print_filtered_dependence_daVinci_graph (const string mod_name)
 
bool print_effective_dependence_graph (const string mod_name)
 
bool print_loop_carried_dependence_graph (const string mod_name)
 
static bool print_dependence_or_chains_graph (string mod_name, bool with_dg)
 
bool print_dependence_graph (string name)
 
bool print_chains_graph (string name)
 
static bool print_dot_dependence_or_chains_graph (string mod_name, bool with_dg)
 Output dependence graph in a file in graphviz dot format. More...
 
bool print_dot_chains_graph (string name)
 This pipmake pass output the chains in a file usable by the graphviz tool dot. More...
 
bool print_dot_dependence_graph (string name)
 This pipmake pass output the DG in a file usable by graphviz tool dot. More...
 

Function Documentation

◆ print_chains_graph()

bool print_chains_graph ( string  name)
Parameters
nameame

Definition at line 131 of file prettyprint.c.

132 {
133  return print_dependence_or_chains_graph(name, false);
134 }
static bool print_dependence_or_chains_graph(string mod_name, bool with_dg)
Definition: prettyprint.c:81

References print_dependence_or_chains_graph().

+ Here is the call graph for this function:

◆ print_dependence_graph()

bool print_dependence_graph ( string  name)
Parameters
nameame

Definition at line 126 of file prettyprint.c.

127 {
128  return print_dependence_or_chains_graph(name, true);
129 }

References print_dependence_or_chains_graph().

Referenced by print_effective_dependence_graph(), print_loop_carried_dependence_graph(), and print_whole_dependence_graph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_dependence_or_chains_graph()

static bool print_dependence_or_chains_graph ( string  mod_name,
bool  with_dg 
)
static

get the dg or chains...

Definition at line 81 of file prettyprint.c.

82 {
83  string dg_name = NULL;
84  string local_dg_name = NULL;
85  FILE *fp;
86  graph dg;
88 
91  db_get_memory_resource(DBR_CODE, mod_name, true) );
94 
95  /* get the dg or chains... */
97  with_dg? DBR_DG: DBR_CHAINS, mod_name, true);
98 
99  local_dg_name = db_build_file_resource_name(DBR_DG, mod_name, ".dg");
101  "/", local_dg_name, NULL));
102  fp = safe_fopen(dg_name, "w");
103 
104  debug_on("RICEDG_DEBUG_LEVEL");
105 
106  if (get_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS") ||
107  get_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS"))
109  else
111 
112  debug_off();
113 
114  safe_fclose(fp, dg_name);
115  free(dg_name);
116 
117  DB_PUT_FILE_RESOURCE(DBR_DG_FILE, strdup(mod_name), local_dg_name);
118 
122 
123  return true;
124 }
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void free(void *)
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
Definition: lowlevel.c:169
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
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...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
void prettyprint_dependence_graph(FILE *, statement, graph)
Print all edges and arcs.
Definition: util.c:177
void prettyprint_dependence_graph_view(FILE *, statement, graph)
Do not print vertices and arcs ignored by the parallelization algorithms.
Definition: util.c:833
char * strdup()

References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, dg, free(), get_bool_property(), get_current_module_statement(), local_name_to_top_level_entity(), mod_stat, prettyprint_dependence_graph(), prettyprint_dependence_graph_view(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), and strdup().

Referenced by print_chains_graph(), and print_dependence_graph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_dot_chains_graph()

bool print_dot_chains_graph ( string  name)

This pipmake pass output the chains in a file usable by the graphviz tool dot.

Parameters
nameis the name of the module, given by pipsmake
Returns
always true ? see print_dot_dependence_graph
Parameters
nameame

Definition at line 200 of file prettyprint.c.

200  {
201  return print_dot_dependence_or_chains_graph( name, false );
202 }
static bool print_dot_dependence_or_chains_graph(string mod_name, bool with_dg)
Output dependence graph in a file in graphviz dot format.
Definition: prettyprint.c:144

References print_dot_dependence_or_chains_graph().

+ Here is the call graph for this function:

◆ print_dot_dependence_graph()

bool print_dot_dependence_graph ( string  name)

This pipmake pass output the DG in a file usable by graphviz tool dot.

Parameters
nameis the name of the module, given by pipsmake
Returns
always true ? see print_dot_dependence_graph
Parameters
nameame

Definition at line 210 of file prettyprint.c.

210  {
211  return print_dot_dependence_or_chains_graph( name, true );
212 }

References print_dot_dependence_or_chains_graph().

+ Here is the call graph for this function:

◆ print_dot_dependence_or_chains_graph()

static bool print_dot_dependence_or_chains_graph ( string  mod_name,
bool  with_dg 
)
static

Output dependence graph in a file in graphviz dot format.

Parameters
mod_nameis the name of the module
with_dgis a flag indicating if it should use the chains or the dg
Returns
always true (pipsmake will be happy)

Definition at line 144 of file prettyprint.c.

146 {
147  string dg_name = NULL;
148  string local_dg_name = NULL;
149  FILE *fp;
150  graph dg;
152 
155  mod_name,
156  true ) );
159 
160  // get the dg or chains...
161  dg = (graph) db_get_memory_resource( with_dg ? DBR_DG : DBR_CHAINS,
162  mod_name,
163  true );
164 
165  // Prepare the output file
166  local_dg_name = db_build_file_resource_name( DBR_DG, mod_name, ".dot" );
168  "/",
169  local_dg_name,
170  NULL ) );
171  fp = safe_fopen( dg_name, "w" );
172 
173 
174  debug_on( "RICEDG_DEBUG_LEVEL" );
175 
176  // Print the graph in the file
178 
179  debug_off( );
180 
181  safe_fclose( fp, dg_name );
182  free( dg_name );
183 
184  // FIXME strdup result should be freed,
185  DB_PUT_FILE_RESOURCE( DBR_DOTDG_FILE, strdup( mod_name ), local_dg_name );
186 
190 
191  return true;
192 }
void prettyprint_dot_dependence_graph(FILE *, statement, graph)
Output dependence graph in a file in graphviz dot format.
Definition: util.c:583

References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, dg, free(), get_current_module_statement(), local_name_to_top_level_entity(), mod_stat, prettyprint_dot_dependence_graph(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), and strdup().

Referenced by print_dot_chains_graph(), and print_dot_dependence_graph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_effective_dependence_graph()

bool print_effective_dependence_graph ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 59 of file prettyprint.c.

60 {
61  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS",
62  true);
63  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS",
64  false);
65  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
66  false);
67  return print_dependence_graph(mod_name);
68 }
void set_bool_property(const char *, bool)
bool print_dependence_graph(string name)
Definition: prettyprint.c:126

References print_dependence_graph(), and set_bool_property().

+ Here is the call graph for this function:

◆ print_filtered_dependence_daVinci_graph()

bool print_filtered_dependence_daVinci_graph ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 52 of file prettyprint.c.

53 {
54  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
55  true);
56  return print_filtered_dg_or_dvdg(mod_name, true);
57 }
bool print_filtered_dg_or_dvdg(string, bool)
Definition: trace.c:202

References print_filtered_dg_or_dvdg(), and set_bool_property().

+ Here is the call graph for this function:

◆ print_filtered_dependence_graph()

bool print_filtered_dependence_graph ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 45 of file prettyprint.c.

46 {
47  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
48  true);
49  return print_filtered_dg_or_dvdg(mod_name, false);
50 }

References print_filtered_dg_or_dvdg(), and set_bool_property().

+ Here is the call graph for this function:

◆ print_loop_carried_dependence_graph()

bool print_loop_carried_dependence_graph ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 70 of file prettyprint.c.

71 {
72  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS",
73  true);
74  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS",
75  true);
76  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
77  true);
78  return print_dependence_graph(mod_name);
79 }

References print_dependence_graph(), and set_bool_property().

+ Here is the call graph for this function:

◆ print_whole_dependence_graph()

bool print_whole_dependence_graph ( const string  mod_name)

DG PRINTING FUNCTIONS

prettyprint.c

Parameters
mod_nameod_name

Definition at line 34 of file prettyprint.c.

35 {
36  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS",
37  false);
38  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS",
39  false);
40  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
41  true);
42  return print_dependence_graph(mod_name);
43 }

References print_dependence_graph(), and set_bool_property().

+ Here is the call graph for this function: