PIPS
scheduling.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <setjmp.h>
#include "genC.h"
#include "ri.h"
#include "constants.h"
#include "ri-util.h"
#include "misc.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "ray_dte.h"
#include "sommet.h"
#include "sg.h"
#include "sc.h"
#include "polyedre.h"
#include "union.h"
#include "matrix.h"
#include "complexity_ri.h"
#include "database.h"
#include "dg.h"
#include "parser_private.h"
#include "property.h"
#include "reduction.h"
#include "tiling.h"
#include "text.h"
#include "text-util.h"
#include "graph.h"
#include "paf_ri.h"
#include "paf-util.h"
#include "pipsdbm.h"
#include "resources.h"
#include "scheduling.h"
#include "array_dfg.h"
+ Include dependency graph for scheduling.c:

Go to the source code of this file.

Macros

#define BDT_EXT   ".bdt_file"
 

Typedefs

typedef dfg_arc_label arc_label
 lint More...
 
typedef dfg_vertex_label vertex_label
 

Functions

bool print_bdt (const string module_name)
 ================================================================= More...
 
bool scheduling (const string mod_name)
 ================================================================= More...
 

Variables

char vcid_scheduling_scheduling [] = "$Id: scheduling.c 23065 2016-03-02 09:05:50Z coelho $"
 

Macro Definition Documentation

◆ BDT_EXT

#define BDT_EXT   ".bdt_file"

Definition at line 81 of file scheduling.c.

Typedef Documentation

◆ arc_label

lint

C3 includes
Pips includes
Local defines

Definition at line 78 of file scheduling.c.

◆ vertex_label

Definition at line 79 of file scheduling.c.

Function Documentation

◆ print_bdt()

bool print_bdt ( const string  module_name)

=================================================================

void print_bdt(module_name): print the bdt of module name

AC 94/03/30

Parameters
module_nameodule

Definition at line 89 of file scheduling.c.

90 {
91  char *localfilename;
92  FILE *fd;
93  char *filename;
94  bdt the_bdt;
95 
96  debug_on( "PRINT_BDT_DEBUG_LEVEL" );
97 
98  if (get_debug_level() > 1)
99  user_log("\n\n *** PRINTING BDT for %s\n", module_name);
100 
101  the_bdt = (bdt) db_get_memory_resource(DBR_BDT, module_name, true);
102 
103  localfilename = strdup(concatenate(module_name, BDT_EXT, NULL));
105  "/", localfilename, NULL));
106 
107  fd = safe_fopen(filename, "w");
108  fprint_bdt(fd, the_bdt);
109  safe_fclose(fd, filename);
110 
111  DB_PUT_FILE_RESOURCE(DBR_BDT_FILE, strdup(module_name), localfilename);
112 
113  free(filename);
114 
115  if(get_debug_level() > 0)
116  fprintf(stderr, "\n\n *** PRINT_BDT DONE\n");
117 
118  debug_off();
119 
120  return(true);
121 }
void user_log(const char *format,...)
Definition: message.c:234
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
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
void free(void *)
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
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
void fprint_bdt(FILE *, bdt)
===========================================================================
Definition: print.c:352
struct _newgen_struct_bdt_ * bdt
Definition: paf_ri.h:72
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
bdt the_bdt
The data flow graph.
Definition: prgm_mapping.c:100
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
#define BDT_EXT
Definition: scheduling.c:81

References BDT_EXT, concatenate(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, fprint_bdt(), fprintf(), free(), get_debug_level(), module_name(), safe_fclose(), safe_fopen(), strdup(), the_bdt, and user_log().

+ Here is the call graph for this function:

◆ scheduling()

bool scheduling ( const string  mod_name)

=================================================================

void scheduling(mod_name ): this is the main function to calculate the schedules of the node of a dfg. It first reverse the graph to have each node in function of its predecessors, then calculates the strongly connected components by the Trajan algorithm, then calls the function that really find the schedules.

AC 93/10/30

We get the required data: module entity, code, static_control, dataflow graph, timing function.

Read the DFG

Parameters
mod_nameodule

Definition at line 133 of file scheduling.c.

134 {
135  graph dfg, rdfg;
136  sccs rgraph;
137  bdt bdt_list;
138  entity ent;
140  static_control stco;
142 
143  debug_on("SCHEDULING_DEBUG_LEVEL");
144  if (get_debug_level() > 0)
145  {
146  fprintf(stderr,"\n\nBegin scheduling\n");
147  fprintf(stderr,"DEBUT DU PROGRAMME\n");
148  fprintf(stderr,"==================\n\n");
149  }
150 
151  /* We get the required data: module entity, code, static_control, dataflow
152  * graph, timing function.
153  */
154  ent = local_name_to_top_level_entity(mod_name);
155 
157 
158  mod_stat = (statement)db_get_memory_resource(DBR_CODE, mod_name, true);
159  STS = (statement_mapping) db_get_memory_resource(DBR_STATIC_CONTROL,
160  mod_name, true);
162 
164 
165  if (stco == static_control_undefined)
166  pips_internal_error("This is an undefined static control !");
167 
168  if (!static_control_yes(stco))
169  pips_internal_error("This is not a static control program !");
170 
171  /* Read the DFG */
172  dfg = (graph)db_get_memory_resource(DBR_ADFG, mod_name, true);
173  dfg = adg_pure_dfg(dfg);
174  rdfg = dfg_reverse_graph(dfg);
175  if (get_debug_level() > 5) fprint_dfg(stderr, rdfg);
176  rgraph = dfg_find_sccs(rdfg);
177 
178  if (get_debug_level() > 0) fprint_sccs(stderr, rgraph);
179 
180  bdt_list = search_graph_bdt(rgraph);
181 
182  if (get_debug_level() > 0)
183  {
184  fprintf(stderr,"\n==============================================");
185  fprintf(stderr,"\nBase de temps trouvee :\n");
186  fprint_bdt_with_stat(stderr, bdt_list);
187  fprintf(stderr,"\nEnd of scheduling\n");
188  }
189 
190  DB_PUT_MEMORY_RESOURCE(DBR_BDT, strdup(mod_name), bdt_list);
191 
194 
195  debug_off();
196 
197  return(true);
198 }
graph adg_pure_dfg(graph in_gr)
======================================================================
Definition: adg_graph.c:56
void fprint_dfg(FILE *fp, graph obj)
===========================================================================
static hash_table STS
The "STS" global variable is the hash table that maps the static_control on the statements.
Definition: adg_read_paf.c:155
graph dfg
Global variables
Definition: adg_read_paf.c:138
void fprint_bdt_with_stat(FILE *fp, bdt obj)
===========================================================================
Definition: bdt_utils.c:115
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
bdt search_graph_bdt(sccs rgraph)
=================================================================
Definition: makebdt.c:3001
#define pips_internal_error
Definition: misc-local.h:149
#define GET_STATEMENT_MAPPING(map, stat)
Definition: newgen-local.h:49
hash_table statement_mapping
these macros are obsolete! newgen functions (->) should be used instead
Definition: newgen-local.h:42
void reset_current_stco_map(void)
========================================================================
Definition: utils.c:2423
void set_current_stco_map(statement_mapping)
========================================================================
Definition: utils.c:2408
struct _newgen_struct_static_control_ * static_control
Definition: paf_ri.h:184
#define static_control_yes(x)
Definition: paf_ri.h:753
#define static_control_undefined
Definition: paf_ri.h:727
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
graph dfg_reverse_graph(graph g)
======================================================================
Definition: sccdfg.c:339
sccs dfg_find_sccs(graph g)
=================================================================
Definition: sccdfg.c:223
void fprint_sccs(FILE *fp, sccs obj)
===========================================================================
Definition: sccdfg.c:258

References adg_pure_dfg(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dfg, dfg_find_sccs(), dfg_reverse_graph(), fprint_bdt_with_stat(), fprint_dfg(), fprint_sccs(), fprintf(), get_debug_level(), GET_STATEMENT_MAPPING, local_name_to_top_level_entity(), mod_stat, pips_internal_error, reset_current_module_entity(), reset_current_stco_map(), search_graph_bdt(), set_current_module_entity(), set_current_stco_map(), static_control_undefined, static_control_yes, strdup(), and STS.

+ Here is the call graph for this function:

Variable Documentation

◆ vcid_scheduling_scheduling

char vcid_scheduling_scheduling[] = "$Id: scheduling.c 23065 2016-03-02 09:05:50Z coelho $"

Definition at line 29 of file scheduling.c.