PIPS
pipsmake.h File Reference
#include "makefile.h"
+ Include dependency graph for pipsmake.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef bool(* pipsmake_callback_handler_type) (void)
 Warning! Do not modify this file that is automatically generated! More...
 

Functions

void pipsmake_error (const char *)
 symbols exported by lex / yacc More...
 
int pipsmake_lex (void)
 
int pipsmake_parse (void)
 
void yyerror (const char *)
 work around cproto 4.7t issue More...
 
void fprint_virtual_resources (FILE *, const char *, list)
 
void fprint_makefile (FILE *, makefile)
 
makefile parse_makefile (void)
 
rule find_rule_by_phase (const char *)
 this function returns the rule that defines builder pname More...
 
void add_rule (rule)
 
makefile open_makefile (const char *)
 
void save_makefile (const char *)
 
bool close_makefile (const char *)
 
int yywrap (void)
 symbols form lexer.l More...
 
int init_lex (void)
 
void yyerror_lex_part (const char *)
 
void set_current_phase_context (const char *, const char *)
 cproto-generated files More...
 
void reset_current_phase_context (void)
 
void reset_make_cache (void)
 
void init_make_cache (void)
 
bool make_cache_p (void)
 Can the make cache be used? More...
 
void reinit_make_cache_if_necessary (void)
 
bool make_cache_hit_p (void *)
 
void add_resource_to_make_cache (void *)
 
void remove_resource_from_make_cache (void *)
 
void print_make_cache (void)
 Debug function, to be tested... More...
 
bool make_cache_consistent_p (void)
 Debug function: make sure that up-to-date resources do exist in the resource database. More...
 
void reset_static_phase_variables (void)
 Static variables used by phases must be reset on error although pipsmake does not know which ones are used. More...
 
rule find_rule_by_resource (const char *)
 This function returns the active rule to produce resource rname. More...
 
bool rmake (const char *, const char *)
 recursive make resource. More...
 
int delete_obsolete_resources (void)
 
void delete_some_resources (void)
 this is quite ugly, but I wanted to put the enumeration down to pipsdbm. More...
 
bool check_resource_up_to_date (const char *, const char *)
 To be used in a rule. More...
 
void delete_named_resources (const char *)
 Delete from up_to_date_resources make cache all the resources with a given resource name. More...
 
void delete_all_resources (void)
 
string get_first_main_module (void)
 Should be able to handle Fortran applications, C applications and mixed Fortran/C applications. More...
 
void do_resource_usage_check (const char *, rule)
 check the usage of resources More...
 
bool safe_make (const char *, const char *)
 
bool safe_apply (const char *, const char *)
 
bool safe_concurrent_apply (const char *, gen_array_t)
 
bool safe_set_property (const char *, const char *)
 
gen_array_t get_callers (string)
 Get all the callers of the specified module. More...
 
gen_array_t get_callees (string)
 Get all the callers of the specified module. More...
 
void save_active_phases (void)
 activate.c More...
 
void retrieve_active_phases (void)
 
bool active_phase_p (const char *)
 
bool saved_active_phase_p (const char *)
 Debugging function. More...
 
void fprint_activated (FILE *)
 
string active_phase_for_resource (string)
 return the phase which would be used to build a given resource. More...
 
const char * activate_phase (const char *)
 
const char * activate (const char *)
 
bool activate_phases (void)
 Use property ACTIVE_PHASES to active the phases required by the user. More...
 
void activate_language (language)
 Choose the right combination of activate and setproperty for a given language. More...
 
bool rule_use_resource_produced (rule)
 Test if a rule uses a resource it produces. More...
 
string build_pgm_makefile (const char *)
 openclose.c More...
 
string make_open_workspace (const char *)
 
bool make_close_workspace (bool)
 FI->GO: could be in top-level, no? More...
 
void checkpoint_workspace (void)
 checkpoint the current workspace, i.e. More...
 
void set_pipsmake_callback (pipsmake_callback_handler_type)
 callback.c More...
 
void reset_pipsmake_callback (void)
 
bool run_pipsmake_callback (void)
 
bool unsplit (const string)
 unsplit.c More...
 
bool unsplit_parsed (const string)
 
bool array_dfg (string)
 stubs.c More...
 
bool print_array_dfg (string)
 
bool scheduling (string)
 ================================================================= More...
 
bool print_bdt (string)
 ================================================================= More...
 
bool prgm_mapping (string)
 ========================================================================= More...
 
bool print_plc (string)
 
bool reindexing (string)
 ====================================================================== More...
 
bool print_parallelizedCMF_code (string)
 ====================================================================== More...
 
bool print_parallelizedCRAFT_code (string)
 ====================================================================== More...
 
string build_view_file (const char *)
 view.c More...
 
string get_dont_build_view_file (const char *)
 
void reset_pips_timeout (void)
 signal.c More...
 
void set_pips_timeout (unsigned int)
 set pips timeout on delay setting to 0 removes the current timeout. More...
 
void set_pips_timeout_from_env (void)
 set pips timeout using PIPS_TIMEOUT environment variable More...
 
void initialize_signal_catcher (void)
 
void pipsmake_restart (FILE *)
 
void pipsmake_pop_buffer_state (void)
 
int pipsmake_get_lineno (void)
 
FILE * pipsmake_get_in (void)
 
FILE * pipsmake_get_out (void)
 
int pipsmake_get_leng (void)
 
char * pipsmake_get_text (void)
 
void pipsmake_set_lineno (int)
 
void pipsmake_set_in (FILE *)
 
void pipsmake_set_out (FILE *)
 
int pipsmake_get_debug (void)
 
void pipsmake_set_debug (int)
 
int pipsmake_lex_destroy (void)
 
void * pipsmake_alloc (yy_size_t)
 
void * pipsmake_realloc (void *, yy_size_t)
 
void pipsmake_free (void *)
 
int pipsmake_wrap (void)
 

Variables

FILE * pipsmake_in
 
int pipsmake_char
 readmakefile.c More...
 
int pipsmake_nerrs
 
int pipsmake_leng
 lexer.c More...
 
FILE * pipsmake_out
 
int pipsmake_lineno
 
int pipsmake__flex_debug
 
char * pipsmake_text
 

Typedef Documentation

◆ pipsmake_callback_handler_type

typedef bool(* pipsmake_callback_handler_type) (void)

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/pipsmake/pipsmake-local.h instead, to add your own modifications. header file built by cproto pipsmake-local.h

Definition at line 33 of file pipsmake.h.

Function Documentation

◆ activate()

const char* activate ( const char *  phase)
Parameters
phasehase

Definition at line 214 of file activate.c.

215 {
216  const char* r = activate_phase(phase);
217  if(!r)
218  pips_user_error("Phase activation error: check the phase names\n");
219  return r;
220 }
const char * activate_phase(const char *phase)
Definition: activate.c:124
#define pips_user_error
Definition: misc-local.h:147

References activate_phase(), and pips_user_error.

Referenced by activate_language(), make_pre_post_transformation(), options_select(), select_rule(), and update_options().

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

◆ activate_language()

void activate_language ( language  l)

Choose the right combination of activate and setproperty for a given language.

This is not really compatible with the litterate programming of pipsmake-rc.tex, where this information should be encoded.

Usual properties for Fortran

Usual properties for Fortran 90/95

Usual properties for C

The language is unknown

Definition at line 254 of file activate.c.

255 {
256  if(language_fortran_p(l)) {
257  /* Usual properties for Fortran */
258  set_bool_property("PRETTYPRINT_STATEMENT_NUMBER", true);
259  set_bool_property("FOR_TO_WHILE_LOOP_IN_CONTROLIZER", false);
260  set_bool_property("FOR_TO_DO_LOOP_IN_CONTROLIZER", false);
261 
262  if(!active_phase_p("PARSER"))
263  activate("PARSER");
264  } else if(language_fortran95_p(l)) {
265  /* Usual properties for Fortran 90/95 */
266  set_bool_property("PRETTYPRINT_STATEMENT_NUMBER", false);
267  set_bool_property("FOR_TO_WHILE_LOOP_IN_CONTROLIZER", false);
268  set_bool_property("FOR_TO_DO_LOOP_IN_CONTROLIZER", false);
269 
270  // Temporary fix for autogenerated file
271  if(!active_phase_p("PARSER"))
272  activate("PARSER");
273  } else if(language_c_p(l)) {
274  /* Usual properties for C */
275  set_bool_property("PRETTYPRINT_STATEMENT_NUMBER", false);
276  set_bool_property("FOR_TO_WHILE_LOOP_IN_CONTROLIZER", true);
277  set_bool_property("FOR_TO_DO_LOOP_IN_CONTROLIZER", true);
278 
279  if(!active_phase_p("C_PARSER"))
280  activate("C_PARSER");
281  // No longer useful
282  //if(!active_phase_p("C_SYMBOL_TABLE"))
283  // activate("C_SYMBOL_TABLE");
284  }
285  else {
286  /* The language is unknown*/
287  pips_user_warning("Unknown language initialization\n");
288  }
289 }
bool active_phase_p(const char *phase)
Definition: activate.c:80
const char * activate(const char *phase)
Definition: activate.c:214
#define pips_user_warning
Definition: misc-local.h:146
void set_bool_property(const char *, bool)
#define language_fortran95_p(x)
Definition: ri.h:1597
#define language_c_p(x)
Definition: ri.h:1594
#define language_fortran_p(x)
Definition: ri.h:1591

References activate(), active_phase_p(), language_c_p, language_fortran95_p, language_fortran_p, pips_user_warning, and set_bool_property().

Referenced by add_a_file(), and create_workspace().

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

◆ activate_phase()

const char* activate_phase ( const char *  phase)

find rule that describes phase

Parameters
phasehase

Definition at line 124 of file activate.c.

125 {
126  makefile current_makefile = parse_makefile();
127  bool rule_cyclic_p = true;
128  const char * status = phase;
129 
130  debug_on("PIPSMAKE_DEBUG_LEVEL");
131  pips_debug(1, "%s - requested\n", phase);
132 
133  pips_assert("a current workspace is defined",
135 
136  /* find rule that describes phase */
137  rule r = find_rule_by_phase(phase);
138 
139  if (r == rule_undefined) {
140  if (get_bool_property("PIPSMAKE_WARNINGS"))
141  pips_user_warning("Rule `%s' undefined.\n"
142  "Check spelling and/or ACTIVE_PHASE property.\n",
143  phase);
144  status = NULL;
145  }
146  else if (active_phase_p(phase)) {
147  if (get_bool_property("PIPSMAKE_WARNINGS"))
148  pips_user_warning ("Rule `%s' already active\n", phase);
149  }
150  else if (!gen_length(rule_produced(r))) {
151  // if (get_bool_property("PIPSMAKE_WARNINGS"))
152  pips_user_warning("Phase %s produces no resource\n", phase);
153  status = NULL;
154  }
155  else {
156  // GO: for many produced resources we loop over them
157  // with the same 'old' code
158  // find resource res that is produced by phase
160  bool require_produced_rule_p = false;
161  string vrn = virtual_resource_name(res);
162 
164  string vrn2 = virtual_resource_name(vr);
165  owner vro = virtual_resource_owner(vr);
166 
167  // We do not check callers and callees
168  // I dropped select also, just in case... FC
169  if (!(owner_callers_p(vro) || owner_callees_p(vro) ||
170  owner_select_p(vro)) && same_string_p(vrn, vrn2))
171  require_produced_rule_p = true;
172  }
173 
174  // If the current produced resource is not required by the new rule
175  if (!require_produced_rule_p) {
176  rule_cyclic_p = false;
177  // find current active phase old_phase that produces res
178  string old_phase = rule_phase(find_rule_by_resource(vrn));
179 
180  // replace old_phase by phase in active phase list
181  if (old_phase != NULL) {
182  pips_debug(5, "replacing %s by %s for %s\n", old_phase, phase, vrn);
183  MAPL(pa, {
184  string s = STRING(CAR(pa));
185 
186  if (strcmp(s, old_phase) == 0) {
187  free(STRING(CAR(pa)));
188  STRING(CAR(pa)) = strdup(phase);
189  }
190  }, makefile_active_phases(current_makefile));
191  }
192 
193  // this generates many warnings when called from select...
194  if (get_bool_property("ACTIVATE_DEL_DERIVED_RES"))
196  else
198  // remove resources with the same name as res
199  // to maintain consistency in the database
200  db_unput_resources(vrn);
201  }
202  }
203  }
204 
205  if (rule_cyclic_p == true) {
206  pips_user_warning("Phase %s is cyclic\n", phase);
207  status = NULL;
208  }
209  }
210  debug_off();
211  return status;
212 }
int db_unput_resources(const char *rname)
Delete all the resources of a given type "rname".
Definition: database.c:915
static void delete_derived_resources()
struct _newgen_struct_status_ * status
Definition: database.h:31
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define STRING(x)
Definition: genC.h:87
void free(void *)
size_t gen_length(const list l)
Definition: list.c:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
#define rule_phase(x)
Definition: makefile.h:244
#define virtual_resource_owner(x)
Definition: makefile.h:292
#define rule_required(x)
Definition: makefile.h:246
#define owner_callers_p(x)
Definition: makefile.h:158
#define rule_undefined
Definition: makefile.h:215
#define virtual_resource_name(x)
Definition: makefile.h:290
#define makefile_active_phases(x)
Definition: makefile.h:84
#define rule_produced(x)
Definition: makefile.h:248
#define owner_callees_p(x)
Definition: makefile.h:155
#define VIRTUAL_RESOURCE(x)
VIRTUAL_RESOURCE.
Definition: makefile.h:260
#define owner_select_p(x)
Definition: makefile.h:164
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define debug_off()
Definition: misc-local.h:160
#define same_string_p(s1, s2)
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82
rule find_rule_by_phase(const char *)
this function returns the rule that defines builder pname
makefile parse_makefile(void)
rule find_rule_by_resource(const char *rname)
This function returns the active rule to produce resource rname.
Definition: pipsmake.c:694
char * strdup()

References active_phase_p(), CAR, db_get_current_workspace_name(), db_unput_resources(), debug_off, debug_on, delete_derived_resources(), find_rule_by_phase(), find_rule_by_resource(), FOREACH, free(), gen_length(), get_bool_property(), makefile_active_phases, MAPL, owner_callees_p, owner_callers_p, owner_select_p, parse_makefile(), pips_assert, pips_debug, pips_user_warning, rule_phase, rule_produced, rule_required, rule_undefined, same_string_p, strdup(), STRING, VIRTUAL_RESOURCE, virtual_resource_name, and virtual_resource_owner.

Referenced by activate(), and activate_phases().

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

◆ activate_phases()

bool activate_phases ( void  )

Use property ACTIVE_PHASES to active the phases required by the user.

Definition at line 224 of file activate.c.

225 {
226  string d = " ,\t\n";
227  // strtok breaks its first argument string
228  string ap = strdup(get_string_property("ACTIVE_PHASES"));
229  string cap = strtok(ap, d);
230  bool pips_special =
231  !same_string_p("full", get_string_property("PIPS_VERSION"));
232  bool result = true;
233 
234  while (cap!=NULL) {
235  pips_debug(1, "Phase to activate: %s\n", cap);
236  if (!active_phase_p(cap)) {
237  const char* r = activate_phase(cap);
238  result = r!=NULL;
239  }
240  cap = strtok(NULL, d);
241  }
242  free(ap);
243 
244  // for a specialized pips, accept invalid phase names
245  return pips_special? true: result;
246 }
char * get_string_property(const char *)

References activate_phase(), active_phase_p(), free(), get_string_property(), pips_debug, same_string_p, and strdup().

Referenced by create_workspace().

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

◆ active_phase_for_resource()

string active_phase_for_resource ( string  res)

return the phase which would be used to build a given resource.

Parameters
reses

Definition at line 119 of file activate.c.

120 {
121  return rule_phase(find_rule_by_resource(res));
122 }

References find_rule_by_resource(), and rule_phase.

+ Here is the call graph for this function:

◆ active_phase_p()

bool active_phase_p ( const char *  phase)
Parameters
phasehase

Definition at line 80 of file activate.c.

81 {
82  makefile current_makefile = parse_makefile();
83  list apl = makefile_active_phases(current_makefile);
84 
85  FOREACH(STRING, s, apl)
86  if (same_string_p(s, phase))
87  return true; // new line for breakpoints
88 
89  return false;
90 }
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References FOREACH, makefile_active_phases, parse_makefile(), same_string_p, STRING, and STUB_ERROR.

Referenced by activate_language(), activate_phase(), activate_phases(), make_pre_post_transformation(), points_to_unary_operation_to_transformer(), and ProcessEntry().

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

◆ add_resource_to_make_cache()

void add_resource_to_make_cache ( void *  res_id)

FI: debugging messages cannot be factorized here because of sibling resources, unless an extra parameter is added...

Parameters
res_ides_id

Definition at line 225 of file pipsmake.c.

226 {
227  /* FI: debugging messages cannot be factorized here because of
228  sibling resources, unless an extra parameter is added... */
229  //string res_rn = real_resource_resource_name((real_resource) res);
230  //string res_on = real_resource_owner_name((real_resource) res);
231  //pips_debug(5, "resource %s(%s) added to up_to_date make cache\n",
232  // res_rn, res_on);
235  res_id);
236 }
set set_add_element(set, const set, const void *)
Definition: set.c:152
static set up_to_date_resources
FI: pipsmmake is very slow when interprocedural analyzes have been selected; some memoization has bee...
Definition: pipsmake.c:189

References set_add_element(), and up_to_date_resources.

Referenced by check_physical_resource_up_to_date(), and rmake().

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

◆ add_rule()

void add_rule ( rule  r)

Definition at line 1704 of file readmakefile.c.

1705 {
1706  string pn = rule_phase(r);
1707  bool active_phase = false;
1708 
1709  // Check resources produced by this rule
1711  string vrn = virtual_resource_name(vr);
1712  string phase;
1713 
1714  // We activated this rule to produce this resource only if
1715  // this resource is not already produced
1716  if ((phase = hash_get(activated, vrn)) == HASH_UNDEFINED_VALUE) {
1717  pips_debug(1, "Default function for %s is %s\n", vrn, pn);
1718 
1719  active_phase = true;
1720  hash_put(activated, vrn, pn);
1721 
1724  }
1725  else pips_debug(1, "Function %s not activated\n", pn);
1726  }
1727 
1728  // Check resources required for this rule if it is an active one
1729  if (active_phase) {
1731  string vrn = virtual_resource_name(vr);
1732  owner vro = virtual_resource_owner(vr);
1733  string phase;
1734 
1735  // We must use a resource already defined
1736  if ( owner_callers_p(vro) || owner_callees_p(vro) ) {}
1737  else {
1738  phase = hash_get(activated, vrn);
1739  if (phase == HASH_UNDEFINED_VALUE)
1740  {
1741  if (get_bool_property("PIPSMAKE_WARNINGS"))
1743  "%s: phase %s requires an undefined resource %s\n",
1744  PIPSMAKE_RC, pn, vrn);
1745  }
1746  // If we use a resource, another function should have produced it
1747  else if (strcmp(phase, pn) == 0) {
1749  "%s: phase %s cannot be active for the %s resource\n",
1750  PIPSMAKE_RC, phase, vrn);
1751  }
1752  else
1753  pips_debug(1, "Required resource %s is checked OK for Function %s\n",
1754  vrn, pn);
1755  }
1756  }
1757  }
1758 
1759  // FI: no check of rule name unicity; e.g. double declaration of sesamify
1761  if(rule_undefined_p(or))
1763  CONS(RULE, r, NIL));
1764  else
1765  pips_internal_error("Double declaration of phase \"%s\"\n"
1766  "Check pipsmake-rc.tex or pipsmake.rc\n",
1767  rule_phase(r));
1768 }
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
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.
Definition: hash.c:449
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.
Definition: hash.c:364
#define RULE(x)
RULE.
Definition: makefile.h:209
#define rule_undefined_p(x)
Definition: makefile.h:216
#define makefile_rules(x)
Definition: makefile.h:82
#define pips_internal_error
Definition: misc-local.h:149
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
static hash_table activated
Definition: readmakefile.c:101
rule find_rule_by_phase(const char *pname)
this function returns the rule that defines builder pname
static makefile pipsmakefile
First part of user prologue.
Definition: readmakefile.c:100

◆ array_dfg()

bool array_dfg ( char *  mod_name)

stubs.c

stubs.c

void array_dfg( (char*) module_name ) AL 93/06/29

It computes the array data flow graph using Feautrier's algorithm. This kind of graph detects the real dependances between arrays. It could be computed on a static control program. The original code is prepared by the static_controlize package. See its comments for more details.

summary or not ?

Initialize debugging functions

Initialization of the pass

set current_module_entity to ent ...

If the input program is not a static_control one, return

What will we compute ?

We need the dependance graph for a first source approximation. The graph is first reversed to have the possible source statement. Then we take only the WR dependances. At the end : duplicate nodes "a la Redon" for IF statement.

We reorder the statement number linked to each vertex in order to distinguich duplicated vertices

We compute the core of the pass

End of the program

Parameters
mod_nameodule

Definition at line 501 of file array_dfg.c.

503 {
504  extern int Gcount_re;
505  extern int Gcount_ie;
506  graph dg = NULL, rev_dg = NULL, wr_dg = NULL;
507  graph dup_dg = NULL, ret_dfg = NULL;
508  entity ent = NULL;
509  statement mod_stat = NULL;
510  static_control stco = NULL;
511  string ss = NULL; /* summary or not ? */
512  bool SUMMARY = false;
513 
514  /* Initialize debugging functions */
515  debug_on("ARRAY_DFG_DEBUG_LEVEL");
516  if (get_debug_level() > 0)
517  user_log("\n\n *** COMPUTE ARRAY DATA FLOW GRAPH for %s\n",mod_name);
518 
519 
520  my_pip_count = 0;
521  my_fai_count = 0;
522 
523  /* Initialization of the pass */
524  Gcount_re = 0;
525  Gcount_ie = 0;
526  ent = local_name_to_top_level_entity( mod_name );
527  set_current_module_entity(ent); /* set current_module_entity to ent ... */
528 
529  mod_stat = (statement) db_get_memory_resource(DBR_CODE, mod_name, true);
530  Gstco_map = (statement_mapping) db_get_memory_resource(DBR_STATIC_CONTROL,
531  mod_name, true);
532 
533  /* If the input program is not a static_control one, return */
535  if ( !static_control_yes( stco )) {
536  pips_user_error("\n"
537  " CAN'T APPLY FEAUTRIER'S ALGORITHM:\n"
538  " This is not a static control program !");
539  }
542  db_get_memory_resource(DBR_PROPER_EFFECTS, mod_name, true));
543 
544  /* What will we compute ? */
545  SUMMARY = ((ss = getenv("SUMMARY")) != NULL)? atoi(ss) : false;
546 
547 
548  /* We need the dependance graph for a first source approximation.
549  * The graph is first reversed to have the possible source statement.
550  * Then we take only the WR dependances.
551  * At the end : duplicate nodes "a la Redon" for IF statement.
552  */
553  dg = (graph) db_get_memory_resource( DBR_DG, mod_name, true );
554  rev_dg = adg_reverse_graph( dg );
555  wr_dg = adg_only_call_WR_dependence( rev_dg );
556  dup_dg = adg_dup_disjunctive_nodes( wr_dg, Gstco_map );
557 
558  /* We reorder the statement number linked to each vertex
559  * in order to distinguich duplicated vertices
560  */
562 
563  /* We compute the core of the pass */
564  if (!SUMMARY)
565  { ret_dfg = adg_dataflowgraph( mod_stat, Gstco_map, dup_dg );}
566  else ret_dfg = adg_dataflowgraph_with_extremities(mod_stat, Gstco_map, dup_dg);
567 
568 
569  /* End of the program */
570  if (get_debug_level() > 0) fprint_dfg(stderr, ret_dfg);
571  if (get_debug_level() > 8) fprint_dfg(stderr, adg_pure_dfg(ret_dfg));
572 
573  DB_PUT_MEMORY_RESOURCE( DBR_ADFG, strdup(mod_name), ret_dfg);
574 
575  if (get_debug_level() > 0) {
576  printf("\n PIP CALLS : %d\n", my_pip_count);
577  printf("\n FAI CALLS : %d\n", my_fai_count);
578  }
579 
580  if (get_debug_level() > 0) user_log("\n\n *** ARRAY_DFG done\n");
581  debug_off();
582 
586 
587  return(true);
588 }
void user_log(const char *format,...)
Definition: message.c:234
graph adg_dup_disjunctive_nodes(graph g, statement_mapping stco_map)
======================================================================
Definition: adg_graph.c:581
graph adg_pure_dfg(graph in_gr)
======================================================================
Definition: adg_graph.c:56
graph adg_only_call_WR_dependence(graph g)
======================================================================
Definition: adg_graph.c:784
void adg_reorder_statement_number(graph in_dfg)
======================================================================
Definition: adg_graph.c:318
graph adg_reverse_graph(graph g)
======================================================================
Definition: adg_graph.c:1047
void fprint_dfg(FILE *fp, graph obj)
===========================================================================
graph adg_dataflowgraph_with_extremities(statement mod_stat, statement_mapping stco_map, graph dup_dg)
======================================================================
Definition: adg_summary.c:230
int my_fai_count
Definition: array_dfg.c:51
graph adg_dataflowgraph(statement mod_stat, statement_mapping stco_map, graph dup_dg)
======================================================================
Definition: array_dfg.c:70
int Gcount_re
External variables.
Definition: array_dfg.c:45
list Gstructural_parameters
Definition: array_dfg.c:48
statement_mapping Gstco_map
Definition: array_dfg.c:47
int my_pip_count
Definition: array_dfg.c:50
int Gcount_ie
Definition: array_dfg.c:46
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
#define SUMMARY
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
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_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
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
#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
#define false
Definition: newgen_types.h:80
struct _newgen_struct_static_control_ * static_control
Definition: paf_ri.h:184
#define static_control_params(x)
Definition: paf_ri.h:755
#define static_control_yes(x)
Definition: paf_ri.h:753
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
int printf()

References adg_dataflowgraph(), adg_dataflowgraph_with_extremities(), adg_dup_disjunctive_nodes(), adg_only_call_WR_dependence(), adg_pure_dfg(), adg_reorder_statement_number(), adg_reverse_graph(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dg, fprint_dfg(), Gcount_ie, Gcount_re, get_debug_level(), GET_STATEMENT_MAPPING, Gstco_map, Gstructural_parameters, local_name_to_top_level_entity(), mod_stat, my_fai_count, my_pip_count, pips_user_error, printf(), reset_current_module_entity(), reset_current_module_statement(), reset_proper_rw_effects(), set_current_module_entity(), set_proper_rw_effects(), static_control_params, static_control_yes, strdup(), SUMMARY, and user_log().

+ Here is the call graph for this function:

◆ build_pgm_makefile()

string build_pgm_makefile ( const char *  )

◆ build_view_file()

string build_view_file ( const char *  print_type)

view.c

Parameters
print_typerint_type

Definition at line 97 of file view.c.

98 {
99  return get_view_file(print_type, true);
100 }
void print_type(type)
For debugging.
Definition: type.c:111
static string get_view_file(const char *print_type, bool displayable)
returns the allocated full path name.
Definition: view.c:54

References get_view_file(), and print_type().

Referenced by display(), display_a_resource(), gpips_display_graph_file_display(), gpips_display_plain_file(), wpips_display_graph_file_display(), wpips_display_plain_file(), and wpips_display_WP65_file().

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

◆ check_resource_up_to_date()

bool check_resource_up_to_date ( const char *  rname,
const char *  oname 
)

To be used in a rule.

use and update the up_to_dat list created by makeapply

Parameters
rnamename
onamename

Definition at line 1468 of file pipsmake.c.

1469 {
1470  return db_resource_p(rname, oname)?
1472 }
bool db_resource_p(const char *rname, const char *oname)
true if exists and in loaded or stored state.
Definition: database.c:524
static bool check_physical_resource_up_to_date(const char *rname, const char *oname)
returns whether resource is up to date.
Definition: pipsmake.c:1257

References check_physical_resource_up_to_date(), and db_resource_p().

Referenced by check_physical_resource_up_to_date(), and rmake().

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

◆ checkpoint_workspace()

void checkpoint_workspace ( void  )

checkpoint the current workspace, i.e.

save everything so that it is possible to reopen it in case of failure.

FC 25/06/2003 this seems to break pipsmake internal data... pips_debug(3, "\tdeleting obsolete resources...\n"); delete_obsolete_resources();

Definition at line 129 of file openclose.c.

130 {
132  {
133  user_log("Checkpoint of workspace.\n");
134  /* FC 25/06/2003
135  * this seems to break pipsmake internal data...
136  pips_debug(3, "\tdeleting obsolete resources...\n");
137  delete_obsolete_resources();
138  */
139  pips_debug(3, "\tsaving resources...\n");
141  pips_debug(3, "\tproperties and makefile...\n");
142  save_properties();
144  }
145 }
void db_checkpoint_workspace(void)
Definition: workspace.c:350
void save_makefile(const char *)
void save_properties(void)

References db_checkpoint_workspace(), db_get_current_workspace_name(), pips_debug, save_makefile(), save_properties(), and user_log().

Referenced by apply_a_rule(), and pips_signal_handler().

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

◆ close_makefile()

bool close_makefile ( const char *  name)
Parameters
nameame

Definition at line 1812 of file readmakefile.c.

1813 {
1814  save_makefile(name);
1816  return true;
1817 }
void free_makefile(makefile p)
Definition: makefile.c:19
#define makefile_undefined
Definition: makefile.h:58
void save_makefile(const char *name)

◆ delete_all_resources()

void delete_all_resources ( void  )

Definition at line 1513 of file pipsmake.c.

1514 {
1516  reset_make_cache();
1517  init_make_cache();
1518 }
void db_delete_all_resources(void)
FC: I added this function to clean all resources, hence avoiding to save them.
Definition: database.c:1030
void init_make_cache(void)
Definition: pipsmake.c:199
void reset_make_cache(void)
Definition: pipsmake.c:191

References db_delete_all_resources(), init_make_cache(), and reset_make_cache().

+ Here is the call graph for this function:

◆ delete_named_resources()

void delete_named_resources ( const char *  rn)

Delete from up_to_date_resources make cache all the resources with a given resource name.

There is no internal data structure in pipsdbm to access these resources efficiently... The two-level mapping of database.c must be inverted.

FI: FC claims in an e-mail that this could be done more efficiently but does not explain how.

Parameters
rnn

Definition at line 1482 of file pipsmake.c.

1483 {
1484  pips_assert("make cache is consistent before deletion",
1486 
1487  // firstly, clean up the up-to-date cache if it exists
1488  int count = 0;
1489  if (make_cache_p()) {
1490  list rl = db_retrieve_resources(rn);
1491  FOREACH(STRING, r_id, rl) {
1492  if (make_cache_hit_p(r_id)) {
1494  count++;
1495  }
1496  }
1497  gen_free_list(rl);
1498  }
1499 
1500  pips_debug(8, "Number of resources no longer considered up-to-date: %d\n",
1501  count);
1502 
1503  // Then remove the resource
1504  // GO 29/6/95: many lines ... db_unput_resources_verbose (rn);
1505  int count2 = db_unput_resources(rn);
1506  pips_assert("The number of resources removed from the cache is smaller "
1507  "than the number of resources removed from te database\n",
1508  count<=count2);
1509  pips_assert("make cache is consistent before deletion",
1511 }
list db_retrieve_resources(const char *rname)
Retrieve all the db resources of a given resource type, "rname".
Definition: database.c:943
static int count
Definition: SDG.c:519
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
bool make_cache_p()
Can the make cache be used?
Definition: pipsmake.c:207
bool make_cache_consistent_p()
Debug function: make sure that up-to-date resources do exist in the resource database.
Definition: pipsmake.c:275
void remove_resource_from_make_cache(void *res_id)
Definition: pipsmake.c:239
bool make_cache_hit_p(void *rr_id)
Definition: pipsmake.c:219

References count, db_retrieve_resources(), db_unput_resources(), FOREACH, gen_free_list(), make_cache_consistent_p(), make_cache_hit_p(), make_cache_p(), pips_assert, pips_debug, remove_resource_from_make_cache(), and STRING.

Referenced by delete_derived_resources().

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

◆ delete_obsolete_resources()

int delete_obsolete_resources ( void  )

Definition at line 1432 of file pipsmake.c.

1433 {
1434  bool cache_off = !make_cache_p();
1435  // FI: this test breaks the consistency of init() and reset() for
1436  // the make cache
1437  if (cache_off) init_make_cache();
1438  int ndeleted =
1440  if (cache_off) reset_make_cache();
1441  return ndeleted;
1442 }
int db_delete_obsolete_resources(bool(*keep_p)(const char *, const char *))
delete all obsolete resources before a close.
Definition: database.c:1076

References check_physical_resource_up_to_date(), db_delete_obsolete_resources(), init_make_cache(), make_cache_p(), and reset_make_cache().

Referenced by delete_some_resources().

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

◆ delete_some_resources()

void delete_some_resources ( void  )

this is quite ugly, but I wanted to put the enumeration down to pipsdbm.

Definition at line 1446 of file pipsmake.c.

1447 {
1448  const char* what = get_string_property("PIPSDBM_RESOURCES_TO_DELETE");
1450 
1451  user_log("Deletion of %s resources:\n", what);
1452 
1453  if (same_string_p(what, "obsolete"))
1454  {
1455  int ndeleted = delete_obsolete_resources();
1456  if (ndeleted>0) user_log("%d destroyed.\n", ndeleted);
1457  else user_log("none destroyed.\n");
1458  } else if (same_string_p(what, "all")) {
1460  user_log("done.\n");
1461  } else
1462  pips_internal_error("unexpected delete request %s", what);
1463 }
void dont_interrupt_pipsmake_asap()
Definition: misc.c:53
int delete_obsolete_resources(void)
Definition: pipsmake.c:1432

References db_delete_all_resources(), delete_obsolete_resources(), dont_interrupt_pipsmake_asap(), get_string_property(), pips_internal_error, same_string_p, and user_log().

Referenced by close_workspace().

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

◆ do_resource_usage_check()

void do_resource_usage_check ( const char *  oname,
rule  ru 
)

check the usage of resources

es_write

Parameters
onamename
ruu

Definition at line 1559 of file pipsmake.c.

1560 {
1561  list reals;
1564 
1565  // Get the dbm sets
1567 
1568  // build the real required resrouces
1569  reals = build_real_resources(oname, rule_required (ru));
1570 
1571  // Delete then from the set of read resources
1572  FOREACH(real_resource, rr, reals)
1573  {
1574  string rron = real_resource_owner_name(rr);
1575  string rrrn = real_resource_resource_name(rr);
1576  string elem_name = strdup(concatenate(rron,".", rrrn, NULL));
1577 
1578  if (set_belong_p (res_read, elem_name)){
1579  pips_debug (5, "resource %s.%s has been read: ok\n", rron, rrrn);
1580  set_del_element(res_read, res_read, elem_name);
1581  }
1582  else
1583  user_log("resource %s.%s has not been read\n", rron, rrrn);
1584  }
1585 
1586  // Try to find an illegally read resource ... */
1587  SET_MAP(re, user_log("resource %s has been read\n", re), res_read);
1588  gen_full_free_list(reals);
1589 
1590  // build the real produced resources
1591  reals = build_real_resources(oname, rule_produced(ru));
1592 
1593  // Delete then from the set of written/generated resources
1594  FOREACH(real_resource, rr, reals /*res_write*/)
1595  {
1596  string rron = real_resource_owner_name(rr);
1597  string rrrn = real_resource_resource_name(rr);
1598  string elem_name = strdup(concatenate(rron,".", rrrn, NULL));
1599 
1600  if (set_belong_p (res_write, (void *) elem_name)){
1601  pips_debug (5, "resource %s.%s has been written: ok\n", rron, rrrn);
1602  set_del_element(res_write, res_write, elem_name);
1603  }
1604  else
1605  user_log ("resource %s.%s has not been written\n", rron, rrrn);
1606  }
1607 
1608  // Try to find an illegally written resource ...
1609  SET_MAP(re, user_log ("resource %s has been written\n", re), res_write);
1610 
1611  gen_full_free_list(reals);
1612 
1613  // not free!
1616 }
void gen_full_free_list(list l)
Definition: genClib.c:1023
#define real_resource_owner_name(x)
Definition: makefile.h:205
#define real_resource_resource_name(x)
Definition: makefile.h:203
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
set set_del_element(set, const set, const void *)
Definition: set.c:265
#define set_undefined
Definition: newgen_set.h:48
#define SET_MAP(element, code, the_set)
Definition: newgen_set.h:54
set set_clear(set)
Assign the empty set to s s := {}.
Definition: set.c:326
bool set_belong_p(const set, const void *)
Definition: set.c:194
static set res_read
Sets of the readwrite resources by pipsdbm.
Definition: misc.c:236
static set res_write
Definition: misc.c:237
void get_logged_resources(set *sr, set *sw)
Get the made sets.
Definition: misc.c:268
static list build_real_resources(const char *oname, list lvr)
Translate and expand a list of virtual resources into a potentially much longer list of real resource...
Definition: pipsmake.c:355
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59

References build_real_resources(), concatenate(), FOREACH, gen_full_free_list(), get_logged_resources(), pips_debug, real_resource_owner_name, real_resource_resource_name, res_read, res_write, rule_produced, rule_required, set_belong_p(), set_clear(), set_del_element(), SET_MAP, set_undefined, strdup(), and user_log().

Referenced by apply_a_rule().

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

◆ find_rule_by_phase()

rule find_rule_by_phase ( const char *  pname)

this function returns the rule that defines builder pname

walking thru rules

Parameters
pnamename

Definition at line 1686 of file readmakefile.c.

1687 {
1688  rule fr = rule_undefined;
1689  makefile m = parse_makefile();
1690 
1691  pips_debug(9, "searching rule for phase %s\n", pname);
1692 
1693  /* walking thru rules */
1694  FOREACH(RULE, r, makefile_rules(m)) {
1695  if (same_string_p(rule_phase(r), pname)) {
1696  fr = r;
1697  break;
1698  }
1699  }
1700 
1701  return fr;
1702 }
makefile parse_makefile(void)

Referenced by add_rule().

+ Here is the caller graph for this function:

◆ find_rule_by_resource()

rule find_rule_by_resource ( const char *  rname)

This function returns the active rule to produce resource rname.

It selects the first active rule in the database which produces the resource but does not use/require it.

walking thru rules

walking thru resources required by this rule to eliminate rules using and producing this resource, e.g. code transformations for the CODE resource.

Parameters
rnamename

Definition at line 694 of file pipsmake.c.

695 {
696  makefile m = parse_makefile();
697 
698  pips_debug(5, "searching rule for resource %s\n", rname);
699 
700  /* walking thru rules */
701  FOREACH(RULE, r, makefile_rules(m))
702  {
703  bool resource_required_p = false;
704 
705  /* walking thru resources required by this rule to eliminate rules
706  using and producing this resource, e.g. code transformations
707  for the CODE resource. */
709  {
710  string vrn = virtual_resource_name(vr);
711  owner vro = virtual_resource_owner(vr);
712 
713  // We do not check callers and callees
714  if ( owner_callers_p(vro) || owner_callees_p(vro) ) {}
715  // Is this resource required ??
716  else if (same_string_p(vrn, rname))
717  resource_required_p = true;
718  }
719 
720  // If this particular resource is not required by the current rule.
721  if (!resource_required_p)
722  {
723  // walking thru resources made by this particular rule
725  {
726  string vrn = virtual_resource_name(vr);
727 
728  if (same_string_p(vrn, rname)) {
729 
730  pips_debug(5, "made by phase %s\n", rule_phase(r));
731 
732  // Is this phase an active one ?
734  {
735  if (same_string_p(pps, rule_phase(r))) {
736  pips_debug(5, "active phase\n");
737  return r;
738  }
739  }
740 
741  pips_debug(5, "inactive phase\n");
742  }
743  }
744  }
745  }
746 
747  return rule_undefined;
748 }

References FOREACH, makefile_active_phases, makefile_rules, owner_callees_p, owner_callers_p, parse_makefile(), pips_debug, RULE, rule_phase, rule_produced, rule_required, rule_undefined, same_string_p, STRING, VIRTUAL_RESOURCE, virtual_resource_name, and virtual_resource_owner.

Referenced by activate_phase(), active_phase_for_resource(), array_bound_check_top_down(), check_physical_resource_up_to_date(), rice_regions_dependence_graph(), rmake(), safe_find_rule_by_resource(), safe_make(), update_options(), and used_before_set().

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

◆ fprint_activated()

void fprint_activated ( FILE *  fd)
Parameters
fdd

Definition at line 110 of file activate.c.

111 {
112  makefile m = parse_makefile();
114  fprintf(fd, "%s\n", s);
115 }
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References FOREACH, fprintf(), makefile_active_phases, parse_makefile(), and STRING.

Referenced by retrieve_active_phases(), and select_rule().

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

◆ fprint_makefile()

void fprint_makefile ( FILE *  fd,
makefile  m 
)
Parameters
fdd

Definition at line 1649 of file readmakefile.c.

1650 {
1651  FOREACH(RULE, r, makefile_rules(m))
1652  {
1653  fprintf(fd, "%s\n", rule_phase(r));
1655  fprint_virtual_resources(fd, "\t<", rule_required(r));
1656  fprint_virtual_resources(fd, "\t>", rule_produced(r));
1658  fprint_virtual_resources(fd, "\t#", rule_modified(r));
1659  }
1660 }
#define rule_modified(x)
Definition: makefile.h:252
#define rule_pre_transformation(x)
Definition: makefile.h:254
#define rule_preserved(x)
Definition: makefile.h:250
void fprint_virtual_resources(FILE *fd, const char *dir, list lrv)

Referenced by parse_makefile().

+ Here is the caller graph for this function:

◆ fprint_virtual_resources()

void fprint_virtual_resources ( FILE *  fd,
const char *  dir,
list  lrv 
)
Parameters
fdd
dirir
lrvrv

Definition at line 1611 of file readmakefile.c.

1612 {
1613  FOREACH(VIRTUAL_RESOURCE, vr, lrv)
1614  {
1615  owner o = virtual_resource_owner(vr);
1616  string n = virtual_resource_name(vr);
1617 
1618  switch (owner_tag(o)) {
1619  case is_owner_program:
1620  fprintf(fd, " %s program.%s\n", dir, n);
1621  break;
1622  case is_owner_module:
1623  fprintf(fd, " %s module.%s\n", dir, n);
1624  break;
1625  case is_owner_main:
1626  fprintf(fd, " %s main.%s\n", dir, n);
1627  break;
1628  case is_owner_callees:
1629  fprintf(fd, " %s callees.%s\n", dir, n);
1630  break;
1631  case is_owner_callers:
1632  fprintf(fd, " %s callers.%s\n", dir, n);
1633  break;
1634  case is_owner_all:
1635  fprintf(fd, " %s all.%s\n", dir, n);
1636  break;
1637  case is_owner_select:
1638  fprintf(fd, " %s select.%s\n", dir, n);
1639  break;
1641  fprintf(fd, " %s compilation_unit.%s\n", dir, n);
1642  break;
1643  default:
1644  pips_internal_error("bad owner tag (%d)\n", owner_tag(o));
1645  }
1646  }
1647 }
#define owner_tag(x)
Definition: makefile.h:145
@ is_owner_main
Definition: makefile.h:111
@ is_owner_callees
Definition: makefile.h:112
@ is_owner_select
Definition: makefile.h:115
@ is_owner_compilation_unit
Definition: makefile.h:116
@ is_owner_module
Definition: makefile.h:110
@ is_owner_callers
Definition: makefile.h:113
@ is_owner_all
Definition: makefile.h:114
@ is_owner_program
Definition: makefile.h:109

Referenced by fprint_makefile().

+ Here is the caller graph for this function:

◆ get_callees()

gen_array_t get_callees ( string  module)

Get all the callers of the specified module.

The returned value is allocated dynamically and needs to be freed by the caller of this function

Parameters
moduleodule

Definition at line 1816 of file pipsmake.c.

1817 {
1818  callees callee_modules;
1819 
1820  if (!safe_make(DBR_CALLEES, module))
1821  pips_internal_error("Cannot make callees for %s", module);
1822 
1823  callee_modules = (callees)
1824  db_get_memory_resource(DBR_CALLEES, module,true);
1825 
1826  return gen_array_from_list(callees_callees(callee_modules));
1827 }
gen_array_t gen_array_from_list(list ls)
Definition: array.c:170
static char * module
Definition: pips.c:74
bool safe_make(const char *res_n, const char *module_n)
Definition: pipsmake.c:1717
struct _newgen_struct_callees_ * callees
Definition: ri.h:55
#define callees_callees(x)
Definition: ri.h:675

References callees_callees, db_get_memory_resource(), gen_array_from_list(), module, pips_internal_error, and safe_make().

Referenced by get_callees_of().

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

◆ get_callers()

gen_array_t get_callers ( string  module)

Get all the callers of the specified module.

The returned value is allocated dynamically and needs to be freed by the caller of this function

Parameters
moduleodule

Definition at line 1799 of file pipsmake.c.

1800 {
1801  callees caller_modules;
1802 
1803  if (!safe_make(DBR_CALLERS, module))
1804  pips_internal_error("Cannot make callers for %s", module);
1805 
1806  caller_modules = (callees)
1807  db_get_memory_resource(DBR_CALLERS, module,true);
1808 
1809  return gen_array_from_list(callees_callees(caller_modules));
1810 }

References callees_callees, db_get_memory_resource(), gen_array_from_list(), module, pips_internal_error, and safe_make().

Referenced by get_callers_of().

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

◆ get_dont_build_view_file()

string get_dont_build_view_file ( const char *  print_type)
Parameters
print_typerint_type

Definition at line 102 of file view.c.

103 {
104  return get_view_file(print_type, false);
105 }

References get_view_file(), and print_type().

Referenced by wpips_display_WP65_file().

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

◆ get_first_main_module()

string get_first_main_module ( void  )

Should be able to handle Fortran applications, C applications and mixed Fortran/C applications.

This is a duplicate for pipsdbm function, get_main_entity_name()

Definition at line 1525 of file pipsmake.c.

1526 {
1527  string dir_name = db_get_current_workspace_directory();
1528  string main_name;
1529  string name = string_undefined;
1530 
1531  debug_on("PIPSMAKE_DEBUG_LEVEL");
1532 
1533  // Let's look for a Fortran main
1534  main_name = strdup(concatenate(dir_name, "/", MAIN_FILE_NAMES, NULL));
1535 
1536  if (file_exists_p(main_name))
1537  {
1538  FILE * tmp_file = safe_fopen(main_name, "r");
1539  name = safe_readline(tmp_file);
1540  safe_fclose(tmp_file, main_name);
1541  }
1542  free(main_name);
1543 
1544  if(string_undefined_p(name)) {
1545  // Let's now look for a C main
1546  main_name = strdup(concatenate(dir_name, "/", MAIN_FILE_NAMES, NULL));
1547  if (file_exists_p(main_name))
1548  name = strdup("main");
1549  free(main_name);
1550  }
1551 
1552  free(dir_name);
1553  debug_off();
1554  return name;
1555 }
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
bool file_exists_p(const char *name)
Definition: file.c:321
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
char * safe_readline(FILE *file)
returns the allocated line read, whatever its length.
Definition: file.c:497
#define string_undefined
Definition: newgen_types.h:40
#define string_undefined_p(s)
Definition: newgen_types.h:41
#define MAIN_FILE_NAMES
Name of the file containing the names of the main procedures.
Definition: pipsdbm-local.h:41
string db_get_current_workspace_directory(void)
Definition: workspace.c:96

References concatenate(), db_get_current_workspace_directory(), debug_off, debug_on, file_exists_p(), free(), MAIN_FILE_NAMES, safe_fclose(), safe_fopen(), safe_readline(), strdup(), string_undefined, and string_undefined_p.

Referenced by get_main(), and select_a_module_by_default().

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

◆ init_lex()

int init_lex ( void  )

◆ init_make_cache()

void init_make_cache ( void  )

Definition at line 199 of file pipsmake.c.

200 {
201  pips_debug(8, "The up-to-date resource cache is initialized to empty\n");
204 }
@ set_pointer
Definition: newgen_set.h:44
#define set_undefined_p(s)
Definition: newgen_set.h:49
set set_make(set_type)
Create an empty set of any type but hash_private.
Definition: set.c:102

References pips_assert, pips_debug, set_make(), set_pointer, set_undefined_p, and up_to_date_resources.

Referenced by apply(), concurrent_apply(), delete_all_resources(), delete_obsolete_resources(), make(), make_post_transformation(), make_pre_post_transformation(), and reinit_make_cache_if_necessary().

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

◆ initialize_signal_catcher()

void initialize_signal_catcher ( void  )

Definition at line 126 of file signal.c.

127 {
128  // misc signals
129  (void) signal(SIGINT, pips_signal_handler);
130  (void) signal(SIGHUP, pips_signal_handler);
131  (void) signal(SIGTERM, pips_signal_handler);
132 
133  (void) signal(SIGUSR1, pips_signal_handler);
134  (void) signal(SIGUSR2, pips_signal_handler);
135 
136  // timeout handling
138 }
void set_pips_timeout_from_env(void)
set pips timeout using PIPS_TIMEOUT environment variable
Definition: signal.c:84
static void pips_signal_handler(int num)
Definition: signal.c:94

References pips_signal_handler(), and set_pips_timeout_from_env().

Referenced by pips_main(), and tpips_main().

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

◆ make_cache_consistent_p()

bool make_cache_consistent_p ( void  )

Debug function: make sure that up-to-date resources do exist in the resource database.

If the cache does not exist, it is considered consistent.

FI: the first test should be enough

Definition at line 275 of file pipsmake.c.

276 {
278  SET_FOREACH(void *, res_id, up_to_date_resources) {
279  string res_rn = db_resource_name(res_id);
280  /* FI: the first test should be enough */
281  if(string_undefined_p(res_rn))
282  return false;
283  string res_on = db_resource_owner_name(res_id);
284  if(string_undefined_p(res_on))
285  return false;
286  if(!db_resource_p(res_rn, res_on))
287  return false;
288  }
289  }
290  return true;
291 }
string db_resource_name(void *dbr)
To be used for debugging.
Definition: database.c:1000
string db_resource_owner_name(void *dbr)
To be used for debugging.
Definition: database.c:1006
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
Definition: newgen_set.h:78

References db_resource_name(), db_resource_owner_name(), db_resource_p(), SET_FOREACH, set_undefined_p, string_undefined_p, and up_to_date_resources.

Referenced by delete_named_resources().

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

◆ make_cache_hit_p()

bool make_cache_hit_p ( void *  rr_id)
Parameters
rr_idr_id

Definition at line 219 of file pipsmake.c.

220 {
221  return set_belong_p(up_to_date_resources, rr_id);
222 }

References set_belong_p(), and up_to_date_resources.

Referenced by check_physical_resource_up_to_date(), delete_named_resources(), make_required(), rmake(), and update_preserved_resources().

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

◆ make_cache_p()

bool make_cache_p ( void  )

Can the make cache be used?

Definition at line 207 of file pipsmake.c.

208 {
210 }

References set_undefined_p, and up_to_date_resources.

Referenced by delete_named_resources(), delete_obsolete_resources(), and make_required().

+ Here is the caller graph for this function:

◆ make_close_workspace()

bool make_close_workspace ( bool  is_quit)

FI->GO: could be in top-level, no?

lazy...

dup because freed in db_close_workspace

Parameters
is_quits_quit

Definition at line 102 of file openclose.c.

103 {
104  bool res = true;
105  string name;
106 
107  if (db_get_current_module_name()) /* lazy... */
109 
110  /* dup because freed in db_close_workspace */
112 
113  res &= close_makefile(name);
114  save_properties();
115  res &= db_close_workspace(is_quit);
116 
117  if(res)
118  user_log("Workspace %s closed.\n\n", name);
119  else
120  user_log("Failed to close workspace %s.\n\n", name);
121 
122  free(name);
123  return res;
124 }
void db_reset_current_module_name(void)
Definition: database.c:1064
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
bool db_close_workspace(bool)
Definition: workspace.c:367
bool close_makefile(const char *)

References close_makefile(), db_close_workspace(), db_get_current_module_name(), db_get_current_workspace_name(), db_reset_current_module_name(), free(), save_properties(), strdup(), and user_log().

Referenced by close_workspace().

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

◆ make_open_workspace()

string make_open_workspace ( const char *  name)

should be an error?

Parameters
nameame

Definition at line 72 of file openclose.c.

73 {
74  if (db_open_workspace(name))
75  {
76  if (open_properties())
77  {
78  if (open_makefile(name) != makefile_undefined)
79  {
80  pips_debug(7, "makefile opened\n");
81  }
82  else
83  {
84  /* should be an error? */
85  pips_user_warning("No special makefile for this workspace "
86  "%s/%s.database\n", get_cwd(), name);
87  }
88  }
89  else
90  {
91  pips_user_warning("Cannot read properties...\n");
92  db_close_workspace(true);
93  }
94  } else
95  pips_user_warning("No workspace %s to open\n", name);
96 
98 }
char * get_cwd(void)
returns the current working directory name.
Definition: file.c:486
bool db_open_workspace(const char *)
Definition: workspace.c:380
makefile open_makefile(const char *)
bool open_properties(void)

References db_close_workspace(), db_get_current_workspace_name(), db_open_workspace(), get_cwd(), makefile_undefined, open_makefile(), open_properties(), pips_debug, and pips_user_warning.

Referenced by open_workspace().

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

◆ open_makefile()

makefile open_makefile ( const char *  name)
Parameters
nameame

Definition at line 1770 of file readmakefile.c.

1771 {
1772  FILE * fd;
1773  char * mkf_name;
1774 
1775  mkf_name = build_pgm_makefile(name);
1776  fd = fopen(mkf_name, "r");
1777 
1779  {
1782  pips_debug(1, "current makefile erased\n");
1783  }
1784 
1785  if (fd)
1786  {
1788  safe_fclose(fd, mkf_name);
1789  }
1790  else
1791  {
1792  pips_user_warning("pipsmake file not found in database...\n");
1794  }
1795 
1796  free(mkf_name);
1797  return pipsmakefile;
1798 }
makefile read_makefile(FILE *f)
Definition: makefile.c:49
#define makefile_undefined_p(x)
Definition: makefile.h:59
string build_pgm_makefile(const char *__attribute__((unused)) n)
Definition: openclose.c:63
void free(void *)

◆ parse_makefile()

makefile parse_makefile ( void  )

Definition at line 1663 of file readmakefile.c.

1664 {
1665  // do it only once
1667  {
1668  debug_on("PIPSMAKE_DEBUG_LEVEL");
1669 
1670  pipsmake_in = fopen_config(PIPSMAKE_RC, NULL, "PIPS_PIPSMAKERC");
1671 
1672  init_lex();
1673  yyparse();
1674  safe_fclose(pipsmake_in, "PIPS_PIPSMAKERC");
1675 
1676  ifdebug(8) fprint_makefile(stderr, pipsmakefile);
1677 
1678  debug_off();
1679  }
1680 
1682 }
FILE * fopen_config(const char *canonical_name, const char *cproperty, const char *cenv)
Definition: file.c:952
FILE * pipsmake_in
Definition: pipsmake.h:142
int init_lex(void)
#define yyparse
------—.
Definition: readmakefile.c:68
void fprint_makefile(FILE *fd, makefile m)
return(s1)
#define ifdebug(n)
Definition: sg.c:47

Referenced by find_rule_by_phase(), and open_makefile().

+ Here is the caller graph for this function:

◆ pipsmake_alloc()

void* pipsmake_alloc ( yy_size_t  )

◆ pipsmake_error()

void pipsmake_error ( const char *  )

symbols exported by lex / yacc

◆ pipsmake_free()

void pipsmake_free ( void *  )

◆ pipsmake_get_debug()

int pipsmake_get_debug ( void  )

◆ pipsmake_get_in()

FILE* pipsmake_get_in ( void  )

◆ pipsmake_get_leng()

int pipsmake_get_leng ( void  )

◆ pipsmake_get_lineno()

int pipsmake_get_lineno ( void  )

◆ pipsmake_get_out()

FILE* pipsmake_get_out ( void  )

◆ pipsmake_get_text()

char* pipsmake_get_text ( void  )

◆ pipsmake_lex()

int pipsmake_lex ( void  )

◆ pipsmake_lex_destroy()

int pipsmake_lex_destroy ( void  )

◆ pipsmake_parse()

int pipsmake_parse ( void  )

◆ pipsmake_pop_buffer_state()

void pipsmake_pop_buffer_state ( void  )

◆ pipsmake_realloc()

void* pipsmake_realloc ( void *  ,
yy_size_t   
)

◆ pipsmake_restart()

void pipsmake_restart ( FILE *  )

◆ pipsmake_set_debug()

void pipsmake_set_debug ( int  )

◆ pipsmake_set_in()

void pipsmake_set_in ( FILE *  )

◆ pipsmake_set_lineno()

void pipsmake_set_lineno ( int  )

◆ pipsmake_set_out()

void pipsmake_set_out ( FILE *  )

◆ pipsmake_wrap()

int pipsmake_wrap ( void  )

◆ prgm_mapping()

bool prgm_mapping ( string  module_name)

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

The placement function

The timing function

The number of nodes in the DFG

The number of dataflows in the DFG

Mapping from a dataflow to its distance

Mapping from a statement to its prototype

Perf.mesurement

List of the unknowns coefficients

Initialize debugging functions

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

The DFG

the BDT

First we count the number of nodes and dataflows

We look for the broadcasts

We sort the nodes of "the_dfg" in decreasing dimension order. The dimension of a node is the dimension of the iteration space of its instruction.

INITIALIZATION

We create a prototype for each statement. Each prototype is mapped to its statement in the hash table "StmtToProto". An other hash table "StmtToProto" associates the unknown coefficients used in the prototype and the statement. The returned value "lambda" gives all the coefficients that have been created.

plc_make_dim() has to initialize the Mu list

We compute the dimension of the placement function of each instruction, and the greatest one (dmax). This is based on the timing function, if it exists.

The number of mapping dimensions can be computed as a minimum, see plc_make_min_dim()

Mapping dimension can be fixed with the environment variable MAPPING_DIMENSION

We initialize the prgm_mapping function.

Computation of the weight of each dataflow of the DFG.

We get all the dataflows of the graph

We sort the dataflows in decreasing weight order

EDGES TREATMENT

BROADCAST CONDITIONS

We take into account the broadcast conditions

OD : we could give "remnants_df_l" as an arg, in order to only compute the useful distances.

DISTANCE COMPUTATION

Computation of the distance of each dataflow.

CUTTING CONDITIONS

We compute the list of equations that are to be nullified in order to zero out all the distances.

We eliminate all the unknowns that are valuated by the substitution computed above "sigma"; and then we cut it in two parts, one containing the indices coefficients, one containing the parameters coefficients, both sorted by decreasing frenquency in the prototypes. Before cutting the list "lambda" into two parts, we take into account the partial broadcast prototypes (contain in "pfunc") to replace some of the "lambda" coeff by the "mu" coeff. The new sigma is returned by this function.

UNELIMINATED COEFF SORTING

COEFF PARTITION

VALUATION

We valuate all the remaining unknowns by building successively each dimension.

Parameters
module_nameodule

Definition at line 2213 of file prgm_mapping.c.

2215 {
2216  extern plc pfunc; /* The placement function */
2217  extern bdt the_bdt; /* The timing function */
2218  extern graph the_dfg;
2219  extern int nb_nodes, /* The number of nodes in the DFG */
2220  nb_dfs; /* The number of dataflows in the DFG */
2221 
2222  extern hash_table DtfToDist; /* Mapping from a dataflow to its distance */
2223  extern hash_table StmtToProto;/* Mapping from a statement to its prototype */
2224  extern hash_table DtfToSink;
2225  extern hash_table DtfToWgh;
2226 
2227  extern list prgm_parameter_l;
2228 
2229  struct tms chrono1, chrono2; /* Perf.mesurement */
2231 
2232  /* List of the unknowns coefficients */
2233  list lambda, xmu_lambda, mu_lambda, mu,
2234  sigma, sigma1, sigma2, sigma_p, *sigma3,
2235  su_l,
2236  sorted_df_l, l, remnants_df_l, df_l;
2237  Psysteme M_ps;
2238  int dmax, i;
2239  entity ent;
2240  static_control stco;
2242  char *md;
2243 
2244  /* Initialize debugging functions */
2245  debug_on("MAPPING_DEBUG_LEVEL");
2246  if(get_debug_level() > 0)
2247  fprintf(stderr, "\n\n *** COMPUTE MAPPING for %s\n", module_name);
2248 
2249  if(get_debug_level() > 1) {
2250  times(&chrono1);
2251  }
2252 
2253  /* We get the required data: module entity, code, static_control, dataflow
2254  * graph, timing function.
2255  */
2257 
2259 
2261  STS = (statement_mapping) db_get_memory_resource(DBR_STATIC_CONTROL,
2262  module_name, true);
2264  if ( stco == static_control_undefined) {
2265  pips_internal_error("This is an undefined static control !");
2266  }
2267  if ( !static_control_yes( stco )) {
2268  pips_internal_error("This is not a static control program !");
2269  }
2270 
2272 
2274 
2275  if(get_debug_level() > 2) {
2276  fprintf(stderr, "[prgm_mapping] Structure parameters of the program: ");
2278  fprintf(stderr, "\n");
2279  }
2280 
2281  /* The DFG */
2283 
2284  /* the BDT */
2286  the_bdt = (bdt) db_get_memory_resource(DBR_BDT, module_name, true);
2287 
2288  if(get_debug_level() > 2) {
2289  fprint_dfg(stderr, the_dfg);
2290  }
2291  if(get_debug_level() > 0) {
2292  fprint_bdt(stderr, the_bdt);
2293  }
2294  /* First we count the number of nodes and dataflows */
2295  nb_nodes = 0;
2296  nb_dfs = 0;
2297  for(l = graph_vertices(the_dfg); !ENDP(l); POP(l)) {
2298  nb_nodes++;
2299  for(su_l = vertex_successors(VERTEX(CAR(l))); !ENDP(su_l); POP(su_l)) {
2300  for(df_l = SUCC_DATAFLOWS(SUCCESSOR(CAR(su_l))); df_l != NIL; df_l = CDR(df_l)) {
2301  nb_dfs++;
2302  }
2303  }
2304  }
2305 
2306  /* We look for the broadcasts */
2307  broadcast(the_dfg);
2308 
2309  /* We sort the nodes of "the_dfg" in decreasing dimension order. The
2310  * dimension of a node is the dimension of the iteration space of its
2311  * instruction.
2312  */
2314 
2315  if(get_debug_level() > 2)
2316 {
2317  fprintf(stderr, "[prgm_mapping] Nodes order:");
2318  for(l = graph_vertices(the_dfg); ! ENDP(l); POP(l))
2319  fprintf(stderr, " %d,", vertex_int_stmt(VERTEX(CAR(l))));
2320  fprintf(stderr, "\n");
2321  }
2322 
2323 /* INITIALIZATION */
2324  /* We create a prototype for each statement. Each prototype is mapped to
2325  * its statement in the hash table "StmtToProto". An other hash table
2326  * "StmtToProto" associates the unknown coefficients used in the
2327  * prototype and the statement. The returned value "lambda" gives all
2328  * the coefficients that have been created.
2329  */
2330  lambda = plc_make_proto();
2331 
2332  if(get_debug_level() > 2)
2333 {
2334  fprintf(stderr, "[prgm_mapping] Nodes prototypes:\n");
2336  fprintf(stderr, "[prgm_mapping] LAMBDAS: ");
2337  fprint_entity_list(stderr, lambda);
2338  fprintf(stderr, "\n");
2339  }
2340 
2341  /* plc_make_dim() has to initialize the Mu list*/
2342 
2343  /* We compute the dimension of the placement function of each instruction,
2344  * and the greatest one (dmax). This is based on the timing function, if it
2345  * exists.
2346  */
2347  count_mu_coeff = 1;
2348  dmax = plc_make_dim();
2349 
2350  /* The number of mapping dimensions can be computed as a minimum, see
2351  * plc_make_min_dim() */
2352  i = ((md = getenv("MINIMUM_DIMENSION")) != NULL) ? 1 : 0;
2353  if(i == 1) {
2354  int dmin;
2355 
2356  dmin = plc_make_min_dim();
2357 
2358  user_warning("prgm_mapping",
2359  "Minimum number of dimensions: %d instead of %d\n",
2360  dmin, dmax);
2361 
2362  dmax = dmin;
2363  }
2364 
2365  /* Mapping dimension can be fixed with the environment variable
2366  * MAPPING_DIMENSION */
2367  i = ((md = getenv("MAPPING_DIMENSION")) != NULL) ? atoi(md) : dmax;
2368  if(i != dmax) {
2369  user_warning("prgm_mapping",
2370  "environment variable MAPPING_DIMENSION has set the mapping dimension to %d instead of %d\n",
2371  i, dmax);
2372 
2373  dmax = i;
2374  }
2375 
2376  /* We initialize the prgm_mapping function. */
2377  pfunc = make_plc(NIL);
2378  for(l = graph_vertices(the_dfg); l != NIL; l = CDR(l)) {
2379  placement new_func;
2380  vertex v = VERTEX(CAR(l));
2381  int stmt = vertex_int_stmt(v);
2382 
2383  new_func = make_placement(stmt, NIL);
2385  CONS(PLACEMENT, new_func, NIL));
2386  }
2387 
2388  debug(3, "prgm_mapping", "DIM des fonctions de placement : %d\n", dmax);
2389  if(dmax == 0) {
2390  for(l = plc_placements(pfunc); !ENDP(l); POP(l)) {
2391  placement crt_func = PLACEMENT(CAR(l));
2392  placement_dims(crt_func) = CONS(EXPRESSION,
2393  int_to_expression(0),
2394  NIL);
2395  }
2396 
2400  debug_off();
2401  return(true);
2402  }
2403 
2404  /* Computation of the weight of each dataflow of the DFG. */
2405  edge_weight();
2406 
2407  /* We get all the dataflows of the graph */
2408  df_l = get_graph_dataflows(the_dfg);
2409  if(get_debug_level() > 5) {
2410  fprintf(stderr, "[prgm_mapping] Edges UNorder:\n");
2411  plc_fprint_dfs(stderr, df_l, DtfToSink, DtfToWgh);
2412  }
2413 
2414  /* We sort the dataflows in decreasing weight order */
2415  sorted_df_l = general_merge_sort(df_l, compare_dfs_weight);
2416  if(get_debug_level() > 2)
2417  {
2418  fprintf(stderr, "[prgm_mapping] Edges order:\n");
2419  plc_fprint_dfs(stderr, sorted_df_l, DtfToSink, DtfToWgh);
2420  }
2421 
2422 
2423 /* EDGES TREATMENT */
2424 
2425 /* BROADCAST CONDITIONS */
2426  /* We take into account the broadcast conditions */
2427  sigma = NIL;
2428  remnants_df_l = broadcast_conditions(lambda, sorted_df_l, &sigma);
2429  if(get_debug_level() > 2)
2430  {
2431  fprintf(stderr, "[prgm_mapping] Dif Red restriction:\n");
2432  fprint_vvs(stderr, sigma);
2433  fprintf(stderr, "[prgm_mapping] Remnants :\n");
2434  plc_fprint_dfs(stderr, remnants_df_l, DtfToSink, DtfToWgh);
2435  }
2436 
2437  for(sigma_p = sigma; !ENDP(sigma_p); POP(sigma_p))
2438  gen_remove(&lambda, (chunk *) var_val_variable(VAR_VAL(CAR(sigma_p))));
2439 
2440  if(get_debug_level() > 2)
2441  {
2442  fprintf(stderr, "[prgm_mapping] Prototypes after broadcast conditions:\n");
2444  fprintf(stderr, "\n");
2445  }
2446 
2447  mu = NIL;
2448  sigma1 = partial_broadcast_coefficients(lambda, &mu);
2449 
2450  if(get_debug_level() > 3)
2451 {
2452 fprintf(stderr, "[prgm_mapping] ******* Partial broadcast sub:");
2453 fprint_vvs(stderr, sigma1);
2454 fprintf(stderr, "\n");
2455 }
2456 
2457  vvs_on_prototypes(sigma1);
2458 
2459  if(get_debug_level() > 2)
2460 {
2461  fprintf(stderr, "[prgm_mapping] Prototypes after partial broadcast sub:\n");
2463  fprintf(stderr, "\n");
2464 }
2465 
2466  for(sigma_p = sigma1; !ENDP(sigma_p); POP(sigma_p)) {
2467  entity e = var_val_variable(VAR_VAL(CAR(sigma_p)));
2468  gen_remove(&lambda, (chunk *) e);
2469  gen_remove(&mu, (chunk *) e);
2470  }
2471 
2472 if(get_debug_level() > 3) {
2473 fprintf(stderr, "[prgm_mapping] ******* Remaining lambdas and Mus:\n");
2474 fprintf(stderr, "\t LAMBDAs:");
2475 fprint_entity_list(stderr, lambda);
2476 fprintf(stderr, "\n");
2477 fprintf(stderr, "\t MUs:");
2478 fprint_entity_list(stderr, mu);
2479 fprintf(stderr, "\n");
2480 }
2481 
2482 /*MOD : we could give "remnants_df_l" as an arg, in order to only compute the
2483 useful distances. */
2484 
2485 /* DISTANCE COMPUTATION */
2486  /* Computation of the distance of each dataflow. */
2488  if(get_debug_level() > 2) {
2489  fprintf(stderr, "[prgm_mapping] Edges distances:\n");
2491  }
2492 
2493 /* CUTTING CONDITIONS */
2494  /* We compute the list of equations that are to be nullified in order to zero
2495  * out all the distances.
2496  */
2497  M_ps = cutting_conditions(remnants_df_l);
2498  if(get_debug_level() > 2)
2499 {
2500  fprintf(stderr, "[prgm_mapping] Matrix M:\n");
2501  fprint_psysteme(stderr, M_ps);
2502  }
2503 
2504  sigma2 = NIL;
2505  (void) solve_system_by_succ_elim(M_ps, &sigma2);
2506 
2507  if(get_debug_level() > 2)
2508 {
2509  fprintf(stderr, "Crt subs:\n");
2510  fprint_vvs(stderr, sigma2);
2511  }
2512 
2513 if(get_debug_level() > 0) {
2514  fprintf(stderr, "[prgm_mapping] Prototypes after distance conditions:\n");
2516  fprintf(stderr, "\n");
2517 }
2518 
2519  /* We eliminate all the unknowns that are valuated by the substitution
2520  * computed above "sigma"; and then we cut it in two parts, one
2521  * containing the indices coefficients, one containing the parameters
2522  * coefficients, both sorted by decreasing frenquency in the
2523  * prototypes. Before cutting the list "lambda" into two parts, we take
2524  * into account the partial broadcast prototypes (contain in "pfunc") to
2525  * replace some of the "lambda" coeff by the "mu" coeff. The new sigma
2526  * is returned by this function. */
2527 
2528  for(sigma_p = sigma2; !ENDP(sigma_p); POP(sigma_p)) {
2529  entity e = var_val_variable(VAR_VAL(CAR(sigma_p)));
2530  gen_remove(&lambda, (chunk *) e);
2531  gen_remove(&mu, (chunk *) e);
2532  }
2533 
2534 if(get_debug_level() > 3) {
2535 fprintf(stderr, "[prgm_mapping] ******* Remaining lambdas:");
2536 fprint_entity_list(stderr, lambda);
2537 fprintf(stderr, "\n");
2538 fprintf(stderr, "[prgm_mapping] ******* Remaining mus:");
2539 fprint_entity_list(stderr, mu);
2540 fprintf(stderr, "\n");
2541 }
2542 
2543  /* UNELIMINATED COEFF SORTING */
2544  sort_unknowns(&lambda, dmax);
2545  sort_unknowns(&mu, dmax);
2546 
2547 if(get_debug_level() > 3) {
2548 fprintf(stderr, "[prgm_mapping] ******* Sorted lambdas:");
2549 fprint_entity_list(stderr, lambda);
2550 fprintf(stderr, "\n");
2551 fprintf(stderr, "[prgm_mapping] ******* Sorted mus:");
2552 fprint_entity_list(stderr, mu);
2553 fprintf(stderr, "\n");
2554 }
2555 
2556  /* COEFF PARTITION */
2557  mu_lambda = gen_nconc(mu, lambda);
2558  xmu_lambda = partition_unknowns(&mu_lambda, dmax);
2559 
2560  if(get_debug_level() > 2)
2561  {
2562  fprintf(stderr, "[prgm_mapping] \nRemaining unknowns\n");
2563  fprintf(stderr, "\tX COEFF: ");
2564  for(l = xmu_lambda; !ENDP(l); POP(l)) {
2565  fprintf(stderr, "(");
2566  fprint_entity_list(stderr, CONSP(CAR(l)));
2567  fprintf(stderr, ") ");
2568  }
2569  fprintf(stderr, "\tPC COEFF: ");
2570  fprint_entity_list(stderr, mu_lambda);
2571  fprintf(stderr, "\n");
2572 
2573 fprint_plc_pp_dims(stderr, pfunc);
2574 }
2575 
2576 /* VALUATION */
2577  /* We valuate all the remaining unknowns by building successively each
2578  * dimension.
2579  */
2580  sigma3 = (list *) malloc(sizeof(list)*dmax);
2581  for(i = 0; i < dmax; i++) {
2582  list plcs;
2583 
2584  sigma3[i] = valuer(i, xmu_lambda, mu_lambda);
2585 
2586  if(get_debug_level() > 2)
2587  {
2588  fprintf(stderr, "[prgm_mapping] Plc dim %d, new subs is\n", i);
2589  fprint_vvs(stderr, sigma3[i]);
2590  fprintf(stderr, "\n");
2591  }
2592 
2593  for(l = graph_vertices(the_dfg), plcs = plc_placements(pfunc); l != NIL;
2594  l = CDR(l), POP(plcs)) {
2595  placement crt_func = PLACEMENT(CAR(plcs));
2596  list dims;
2597  vertex v = VERTEX(CAR(l));
2598  int stmt = vertex_int_stmt(v);
2599 
2601  (char *) stmt));
2602  Ppolynome sub_pp = vvs_on_polynome(sigma3[i], pp);
2603  Pvecteur sub_vect = polynome_to_vecteur(sub_pp);
2605 
2606  if(i == 0)
2607  dims = NIL;
2608  else
2609  dims = placement_dims(crt_func);
2610 
2611  if(exp == expression_undefined)
2612  exp = int_to_expression(0);
2613 
2614  placement_dims(crt_func) = gen_nconc(dims, CONS(EXPRESSION, exp, NIL));
2615  }
2616  }
2617 
2618  if(get_debug_level() > 0) {
2619  fprintf(stderr, "\n RESULT OF MAPPING:\n**************\n");
2620  df_l = get_graph_dataflows(the_dfg);
2621  for(i = 0; i < dmax; i++) {
2622  fprintf(stderr,
2623  "Distance for dim %d\n=================================\n", i);
2624 
2625  for(l = df_l; !ENDP(l); POP(l)) {
2626  dataflow df = DATAFLOW(CAR(l));
2627  int stmt = (int) hash_get(DtfToSink, (char *) df);
2629  (char *) df));
2630 
2631  pp_dist = vvs_on_polynome(sigma, pp_dist);
2632  pp_dist = vvs_on_polynome(sigma1, pp_dist);
2633  pp_dist = vvs_on_polynome(sigma2, pp_dist);
2634  pp_dist = vvs_on_polynome(sigma3[i], pp_dist);
2635 
2636  fprintf(stderr, "Dataflow ");
2637  fprint_dataflow(stderr, stmt, df);
2638  fprintf(stderr, "\tDist = ");
2640  fprintf(stderr, "\n");
2641  }
2642  }
2643  }
2644 
2645  if(get_debug_level() > 1) {
2646  times(&chrono2);
2647 
2648  fprintf(stderr,
2649  "\n*******\nTIMING:\n*******\n\tuser : %ld, system : %ld \n",
2650  (long) chrono2.tms_utime - chrono1.tms_utime,
2651  (long) chrono2.tms_stime - chrono1.tms_stime );
2652  }
2653 
2654  if(get_debug_level() > 0) {
2655  fprintf(stderr, "\n MAPPING:\n**************\n");
2656  fprint_plc(stderr, pfunc);
2657  fprintf(stderr, "\n\n *** MAPPING done\n");
2658  }
2659 
2661 
2664 
2665  debug_off();
2666 
2667  return(true);
2668 }
plc make_plc(list a)
Definition: paf_ri.c:432
placement make_placement(intptr_t a1, list a2)
Definition: paf_ri.c:390
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
void const char const char const int
void broadcast(graph g)
========================================================================
Definition: broadcast.c:87
list broadcast_conditions(list lambda, list df_l, list *sigma)
========================================================================
Definition: broadcast.c:728
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
#define CONSP(x)
Definition: genC.h:88
void * malloc(YYSIZE_T)
#define vertex_successors(x)
Definition: graph.h:154
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
void fprint_entity_list(FILE *fp, list l)
void fprint_entity_list(FILE *fp,list l): prints a list of entities on file fp.
Definition: entity.c:3188
#define user_warning(fn,...)
Definition: misc-local.h:262
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
const char * pu_variable_name(Variable)
package mapping : Alexis Platonoff, april 1993
Definition: print.c:421
list general_merge_sort(list, bool(*)(void))
int vertex_int_stmt(vertex)
===========================================================================
Definition: utils.c:866
Pvecteur polynome_to_vecteur(Ppolynome)
========================================================================
Definition: utils.c:1063
void reset_current_stco_map(void)
========================================================================
Definition: utils.c:2423
bool pu_is_inferior_var(Variable, Variable)
void fprint_psysteme(FILE *, Psysteme)
===========================================================================
Definition: print.c:302
void set_current_stco_map(statement_mapping)
========================================================================
Definition: utils.c:2408
void fprint_bdt(FILE *, bdt)
===========================================================================
Definition: print.c:352
void fprint_dataflow(FILE *, int, dataflow)
===========================================================================
Definition: print.c:229
#define plc_placements(x)
Definition: paf_ri.h:557
#define var_val_variable(x)
Definition: paf_ri.h:793
#define DATAFLOW(x)
DATAFLOW.
Definition: paf_ri.h:308
struct _newgen_struct_bdt_ * bdt
Definition: paf_ri.h:72
#define placement_dims(x)
Definition: paf_ri.h:525
#define PLACEMENT(x)
PLACEMENT.
Definition: paf_ri.h:493
#define static_control_undefined
Definition: paf_ri.h:727
#define VAR_VAL(x)
VAR_VAL.
Definition: paf_ri.h:763
#define bdt_undefined
Definition: paf_ri.h:204
Ppolynome polynome_dup(Ppolynome pp)
Ppolynome polynome_dup(Ppolynome pp) creates and returns a copy of pp.
Definition: pnome-alloc.c:211
void polynome_fprint(FILE *fd, Ppolynome pp, char *(*variable_name)(Variable), int *is_inferior_var)
void polynome_fprint(FILE* fd, Ppolynome pp, char* (*variable_name)(), bool (*is_inferior_var)()) Out...
Definition: pnome-io.c:173
#define SUCC_DATAFLOWS(s)
void fprint_plc(FILE *fp, plc obj)
========================================================================
Definition: print.c:85
void plc_fprint_dfs(FILE *fp, list df_l, hash_table DtfToStmt, hash_table DtfToWgh)
========================================================================
Definition: print.c:181
void plc_fprint_distance(FILE *fp, graph g, hash_table DtfToDist)
========================================================================
Definition: print.c:143
void plc_fprint_proto(FILE *fp, graph g, hash_table StmtToProto)
========================================================================
Definition: print.c:118
void fprint_plc_pp_dims(FILE *fp, plc one_plc)
========================================================================
Definition: print.c:228
bool compare_dfs_weight(chunk *d1, chunk *d2)
========================================================================
Definition: utils.c:181
list get_graph_dataflows(graph g)
========================================================================
Definition: utils.c:765
int plc_make_min_dim()
========================================================================
Definition: prgm_mapping.c:313
int nb_dfs
The number of nodes in the DFG.
Definition: prgm_mapping.c:102
int plc_make_dim()
========================================================================
Definition: prgm_mapping.c:365
graph the_dfg
The placement function.
Definition: prgm_mapping.c:99
list valuer(int dim, list xunks, list pcunks)
========================================================================
void sort_unknowns(list *lambda, int dmax)
========================================================================
hash_table DtfToDist
Mapping from a dataflow to its sink statement.
Definition: prgm_mapping.c:104
bool solve_system_by_succ_elim(Psysteme sys, list *sigma)
========================================================================
hash_table DtfToWgh
Mapping from a dataflow to its distance.
Definition: prgm_mapping.c:105
list prgm_parameter_l
global variables
Definition: prgm_mapping.c:115
int nb_nodes
The timing function.
Definition: prgm_mapping.c:101
list sort_dfg_node(list l_nodes)
========================================================================
Definition: prgm_mapping.c:748
list partial_broadcast_coefficients(list var_l, list *used_mu)
=========================================================================
void edge_weight()
========================================================================
Definition: prgm_mapping.c:795
hash_table DtfToSink
The number of dataflows in the DFG.
Definition: prgm_mapping.c:103
hash_table StmtToProto
Mapping from a dataflow to its weight.
Definition: prgm_mapping.c:106
Psysteme cutting_conditions(list df_l)
========================================================================
Definition: prgm_mapping.c:682
list partition_unknowns(list *unks, int dmax)
========================================================================
list plc_make_proto()
========================================================================
Definition: prgm_mapping.c:190
void plc_make_distance()
========================================================================
Definition: prgm_mapping.c:453
plc pfunc
Internal variables
Definition: prgm_mapping.c:98
void vvs_on_prototypes(list sigma)
=========================================================================
bdt the_bdt
The data flow graph.
Definition: prgm_mapping.c:100
int count_mu_coeff
Mapping from an entity to its frenq in the plc proto.
Definition: prgm_mapping.c:113
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
Definition: expression.c:1825
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define expression_undefined
Definition: ri.h:1223
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Definition: statement.c:54
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
void fprint_vvs(FILE *fp, list vvs)
========================================================================
Definition: vvs.c:146
Ppolynome vvs_on_polynome(list vvs, Ppolynome pp)
========================================================================
Definition: vvs.c:465

References adg_pure_dfg(), bdt_undefined, broadcast(), broadcast_conditions(), CAR, CDR, compare_dfs_weight(), CONS, CONSP, count_mu_coeff, cutting_conditions(), DATAFLOW, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug(), debug_off, debug_on, DtfToDist, DtfToSink, DtfToWgh, edge_weight(), ENDP, exp, EXPRESSION, expression_undefined, fprint_bdt(), fprint_dataflow(), fprint_dfg(), fprint_entity_list(), fprint_plc(), fprint_plc_pp_dims(), fprint_psysteme(), fprint_vvs(), fprintf(), gen_nconc(), gen_remove(), general_merge_sort(), get_debug_level(), get_graph_dataflows(), GET_STATEMENT_MAPPING, graph_vertices, hash_get(), int, int_to_expression(), local_name_to_top_level_entity(), make_placement(), make_plc(), malloc(), mod_stat, module_name(), nb_dfs, nb_nodes, NIL, partial_broadcast_coefficients(), partition_unknowns(), pfunc, pips_internal_error, PLACEMENT, placement_dims, plc_fprint_dfs(), plc_fprint_distance(), plc_fprint_proto(), plc_make_dim(), plc_make_distance(), plc_make_min_dim(), plc_make_proto(), plc_placements, polynome_dup(), polynome_fprint(), polynome_to_vecteur(), POP, prgm_parameter_l, pu_is_inferior_var(), pu_variable_name(), Pvecteur_to_expression(), reset_current_module_entity(), reset_current_stco_map(), set_current_module_entity(), set_current_stco_map(), solve_system_by_succ_elim(), sort_dfg_node(), sort_unknowns(), static_control_params, static_control_undefined, static_control_yes, StmtToProto, strdup(), STS, SUCC_DATAFLOWS, SUCCESSOR, the_bdt, the_dfg, user_warning, valuer(), VAR_VAL, var_val_variable, VERTEX, vertex_int_stmt(), vertex_successors, vvs_on_polynome(), and vvs_on_prototypes().

◆ print_array_dfg()

bool print_array_dfg ( string  )

◆ 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 }
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
#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:

◆ print_make_cache()

void print_make_cache ( void  )

Debug function, to be tested...

Definition at line 251 of file pipsmake.c.

252 {
254  int count = 0;
255  SET_FOREACH(void *, res_id, up_to_date_resources) {
256  string res_rn = db_resource_name(res_id);
257  string res_on = db_resource_owner_name(res_id);
258  if(string_undefined_p(res_rn) || string_undefined_p(res_on))
259  printf("Up-to-date resources/make cache inconsistent with "
260  "pipsdbm resources\n");
261  else
262  printf("Up-to-date resource: \"%s.%s\"\n", res_on, res_rn);
263  count++;
264  }
265  if(count==0)
266  printf("No up-to-date resource is cached in make cache\n");
267  }
268  else
269  printf("The up-to-date resource make cache is currently undefined\n");
270 }

References count, db_resource_name(), db_resource_owner_name(), printf(), SET_FOREACH, set_undefined_p, string_undefined_p, and up_to_date_resources.

+ Here is the call graph for this function:

◆ print_parallelizedCMF_code()

bool print_parallelizedCMF_code ( string  mod_name)

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

Static controlize code

The DFG, the BDT and the PLC

Parameters
mod_nameodule

Definition at line 401 of file prettyprint.c.

403 {
404  plc the_plc;
405 
406  text r = make_text(NIL);
407  entity module;
409  code c;
410  string s, pp;
411  static_control stco;
413  bool success;
414 
415  debug_on("PRETTYPRINT_DEBUG_LEVEL");
416 
421  }
422  c = entity_code(module);
423  s = code_decls_text(c);
424 
425  /* Static controlize code */
426  mod_stat = (statement) db_get_memory_resource(DBR_CODE, mod_name, true);
427  STS = (statement_mapping) db_get_memory_resource(DBR_STATIC_CONTROL,
428  mod_name, true);
431 
433  if (stco == static_control_undefined)
434  pips_internal_error("This is an undefined static control !");
435  if (!static_control_yes(stco))
436  pips_internal_error("This is not a static control program !");
437 
438  /* The DFG, the BDT and the PLC */
440  mod_name, true));
441  current_bdt = (bdt) db_get_memory_resource(DBR_BDT, mod_name, true);
442  the_plc = (plc) db_get_memory_resource(DBR_PLC, mod_name, true);
443  if (get_debug_level() > 0) {
444  fprint_dfg(stderr, current_dfg);
445  fprint_bdt(stderr, current_bdt);
446  fprint_plc(stderr, the_plc);
447  }
448 
451  set_bool_property("PRETTYPRINT_ALL_DECLARATIONS", true);
452 
454 
455  mod_stat = (statement)
456  db_get_memory_resource(DBR_REINDEXED_CODE, mod_name, true);
457 
458  insure_declaration_coherency_of_module(module, mod_stat);
459 
461 
463 
464  success = make_text_resource(mod_name,
465  DBR_PARALLELPRINTED_FILE,
467  r);
468 
472 
474 
475  debug_off();
476 
477  return(success);
478 }
text make_text(list a)
Definition: text.c:107
bool success
Definition: gpips-local.h:59
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
static_control get_stco_from_current_map(statement)
========================================================================
Definition: utils.c:2429
struct _newgen_struct_plc_ * plc
Definition: paf_ri.h:144
text empty_text(entity __attribute__((unused)) e, int __attribute__((unused)) m, statement __attribute__((unused)) s)
Definition: misc.c:219
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
Definition: misc.c:242
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
Definition: misc.c:231
text text_module(entity, statement)
bool make_text_resource(const char *, const char *, const char *, text)
print.c
Definition: print.c:55
#define PRETTYPRINT_PARALLEL
void set_string_property(const char *, const char *)
static graph current_dfg
Definition: prettyprint.c:84
static bdt current_bdt
Definition: prettyprint.c:85
#define CM_FORTRAN_EXT
Ansi includes
Definition: prettyprint.c:76
list lparams
Array bounds.
Definition: reindexing.c:111
void cmf_layout_align(statement mod_stat)
======================================================================
Definition: prettyprint.c:183
code entity_code(entity e)
Definition: entity.c:1098
#define code_decls_text(x)
Definition: ri.h:786
#define MERGE_TEXTS(r, t)

References adg_pure_dfg(), close_prettyprint(), CM_FORTRAN_EXT, cmf_layout_align(), code_decls_text, current_bdt, current_dfg, db_get_memory_resource(), debug_off, debug_on, empty_text(), entity_code(), fprint_bdt(), fprint_dfg(), fprint_plc(), free(), get_current_module_entity(), get_debug_level(), get_stco_from_current_map(), get_string_property(), init_prettyprint(), local_name_to_top_level_entity(), lparams, make_text(), make_text_resource(), MERGE_TEXTS, mod_stat, module, NIL, pips_internal_error, PRETTYPRINT_PARALLEL, reset_current_module_entity(), reset_current_stco_map(), set_bool_property(), set_current_module_entity(), set_current_stco_map(), set_string_property(), static_control_params, static_control_undefined, static_control_yes, strdup(), STS, and text_module().

+ Here is the call graph for this function:

◆ print_parallelizedCRAFT_code()

bool print_parallelizedCRAFT_code ( string  mod_name)

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

Static controlize code

The DFG, the BDT and the PLC

Parameters
mod_nameodule

Definition at line 482 of file prettyprint.c.

484 {
485  plc the_plc;
486 
487  text r = make_text(NIL);
488  entity module;
490  code c;
491  string s, pp;
492  static_control stco;
494  bool success;
495 
496  debug_on("PRETTYPRINT_DEBUG_LEVEL");
497 
502  }
503  c = entity_code(module);
504  s = code_decls_text(c);
505 
506  /* Static controlize code */
507  mod_stat = (statement) db_get_memory_resource(DBR_CODE, mod_name, true);
508  STS = (statement_mapping)db_get_memory_resource(DBR_STATIC_CONTROL,
509  mod_name, true);
512 
514  if (stco == static_control_undefined)
515  pips_internal_error("This is an undefined static control !");
516  if (!static_control_yes(stco))
517  pips_internal_error("This is not a static control program !");
518 
519  /* The DFG, the BDT and the PLC */
521  mod_name,
522  true));
523  current_bdt = (bdt) db_get_memory_resource(DBR_BDT, mod_name, true);
524  the_plc = (plc) db_get_memory_resource(DBR_PLC, mod_name, true);
525  if (get_debug_level() > 0) {
526  fprint_dfg(stderr, current_dfg);
527  fprint_bdt(stderr, current_bdt);
528  fprint_plc(stderr, the_plc);
529  }
530 
533  set_bool_property("PRETTYPRINT_ALL_DECLARATIONS", true);
534 
536 
537  mod_stat = (statement) db_get_memory_resource(DBR_REINDEXED_CODE,
538  mod_name, true);
539 
540  insure_declaration_coherency_of_module(module, mod_stat);
543 
544  success = make_text_resource(mod_name,
545  DBR_PARALLELPRINTED_FILE,
547  r);
548 
553  debug_off();
554 
555  return(success);
556 }
void craft_layout_align(statement mod_stat)
======================================================================
Definition: prettyprint.c:295
#define CRAFT_FORTRAN_EXT
Definition: prettyprint.c:77

References adg_pure_dfg(), close_prettyprint(), code_decls_text, CRAFT_FORTRAN_EXT, craft_layout_align(), current_bdt, current_dfg, db_get_memory_resource(), debug_off, debug_on, empty_text(), entity_code(), fprint_bdt(), fprint_dfg(), fprint_plc(), free(), get_current_module_entity(), get_debug_level(), get_stco_from_current_map(), get_string_property(), init_prettyprint(), local_name_to_top_level_entity(), lparams, make_text(), make_text_resource(), MERGE_TEXTS, mod_stat, module, NIL, pips_internal_error, PRETTYPRINT_PARALLEL, reset_current_module_entity(), reset_current_stco_map(), set_bool_property(), set_current_module_entity(), set_current_stco_map(), set_string_property(), static_control_params, static_control_undefined, static_control_yes, strdup(), STS, and text_module().

+ Here is the call graph for this function:

◆ print_plc()

bool print_plc ( string  )

◆ reindexing()

bool reindexing ( char *  mod_name)

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

void reindexing((char*) mod_name):

Initialize debugging functions

We get the required data: module entity, code, static_control,

dataflow graph.

mod_stat = copy_statement((statement) db_get_memory_resource(DBR_CODE, mod_name, true));

The DFG, the BDT and the PLC

First we count the number of nodes to initialize the hash tables

The temporary variables counter

Remove the old code:

And replace it by the new one:

print the values of the delay

Parameters
mod_nameodule

Definition at line 664 of file reindexing.c.

666 {
667  extern int tc;
668 
669  graph the_dfg;
670  bdt the_bdt;
671  plc the_plc;
672  entity ent;
673  static_control stco;
674  statement mod_stat, new_mod_stat;
675  int nb_nodes;
676  list l;
678 
679  /* Initialize debugging functions */
680  debug_on("REINDEXING_DEBUG_LEVEL");
681  if (get_debug_level() > 0)
682  user_log("\n\n *** COMPUTE REINDEXING for %s\n", mod_name);
683 
684  /* We get the required data: module entity, code, static_control, */
685  /* dataflow graph. */
686  ent = local_name_to_top_level_entity( mod_name );
687 
688  if (ent != get_current_module_entity())
689  {
692  }
693 
694  /* mod_stat = copy_statement((statement) db_get_memory_resource(DBR_CODE, mod_name,
695  true));*/
696  mod_stat = (statement) db_get_memory_resource(DBR_CODE, mod_name, false);
697  STS = (statement_mapping)db_get_memory_resource(DBR_STATIC_CONTROL,
698  mod_name, false);
701 
703 
704  if (stco == static_control_undefined)
705  pips_internal_error("This is an undefined static control !");
706 
707  if (!static_control_yes(stco))
708  pips_internal_error("This is not a static control program !");
709 
710 
711  /* The DFG, the BDT and the PLC */
712  the_dfg = (graph)db_get_memory_resource(DBR_ADFG, mod_name, true);
713  the_bdt = (bdt)db_get_memory_resource(DBR_BDT, mod_name, true);
714  the_plc = (plc)db_get_memory_resource(DBR_PLC, mod_name, true);
715 
716  if (get_debug_level() > 0)
717  {
718  fprint_dfg(stderr, the_dfg);
719  fprint_bdt(stderr, the_bdt);
720  fprint_plc(stderr, the_plc);
721  }
722 
723  /* First we count the number of nodes to initialize the hash tables */
724  nb_nodes = 0;
725  for(l = graph_vertices(the_dfg); !ENDP(l); POP(l))
726  nb_nodes++;
730 
731  /* The temporary variables counter */
732  tc = 0;
733 
734  new_mod_stat = re_do_it(the_dfg, the_bdt, the_plc);
735 
736  /* Remove the old code: */
738  /* And replace it by the new one: */
740  new_mod_stat,
741  NIL));
742  DB_PUT_MEMORY_RESOURCE(DBR_REINDEXED_CODE, strdup(mod_name),
743  (char*) mod_stat);
746  db_get_memory_resource(DBR_CODE,
747  mod_name, true) );
749 
750  DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(mod_name), (char*) mod_stat);
752 
753  /* print the values of the delay */
754  if (get_debug_level() > 0)
755  fprint_delay(stderr, the_dfg, delay_table);
756 
757  if(get_debug_level() > 0)
758  user_log("\n\n *** REINDEXING done\n");
759 
762 
765 
766  debug_off();
767 
768  return(true);
769 }
void free_instruction(instruction p)
Definition: ri.c:1118
statement re_do_it(graph the_dfg, bdt the_bdt, plc the_plc)
======================================================================
Definition: cell.c:3038
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
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
@ hash_int
Definition: newgen_hash.h:32
void fprint_delay(FILE *fp, graph g, hash_table t)
======================================================================
Definition: delay.c:221
static int tc
Internal variables
Definition: reindexing.c:107
hash_table h_node
Definition: reindexing.c:108
hash_table ht_ab
Definition: reindexing.c:110
list lparams
Array bounds.
Definition: reindexing.c:111
hash_table delay_table
Name : delay.c Package : reindexing Author : Alexis Platonoff Date : March 1995 Historic :
Definition: reindexing.c:109
#define statement_instruction(x)
Definition: ri.h:2458
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CONS, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, delay_table, ENDP, fprint_bdt(), fprint_delay(), fprint_dfg(), fprint_plc(), free_instruction(), get_current_module_entity(), get_current_module_statement(), get_debug_level(), get_stco_from_current_map(), graph_vertices, h_node, hash_int, hash_table_free(), hash_table_make(), ht_ab, local_name_to_top_level_entity(), lparams, make_instruction_block(), mod_stat, nb_nodes, NIL, pips_internal_error, POP, re_do_it(), reset_current_module_entity(), reset_current_module_statement(), reset_current_stco_map(), set_current_module_entity(), set_current_module_statement(), set_current_stco_map(), STATEMENT, statement_instruction, static_control_params, static_control_undefined, static_control_yes, strdup(), STS, tc, the_bdt, the_dfg, and user_log().

+ Here is the call graph for this function:

◆ reinit_make_cache_if_necessary()

void reinit_make_cache_if_necessary ( void  )

Definition at line 212 of file pipsmake.c.

213 {
216 }

References init_make_cache(), reset_make_cache(), set_undefined_p, and up_to_date_resources.

+ Here is the call graph for this function:

◆ remove_resource_from_make_cache()

void remove_resource_from_make_cache ( void *  res_id)
Parameters
res_ides_id

Definition at line 239 of file pipsmake.c.

240 {
241  string res_rn = db_resource_name(res_id);
242  string res_on = db_resource_owner_name(res_id);
243  pips_debug(5, "resource %s(%s) deleted from up_to_date make cache\n",
244  res_rn, res_on);
247  res_id);
248 }

References db_resource_name(), db_resource_owner_name(), pips_debug, set_del_element(), and up_to_date_resources.

Referenced by delete_named_resources(), make_required(), and update_preserved_resources().

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

◆ reset_current_phase_context()

void reset_current_phase_context ( void  )

Definition at line 96 of file pipsmake.c.

97 {
101 }
void reset_pips_current_computation(void)
Definition: message.c:87
void reset_std_static_entities()
Definition: entity.c:138
void entity_basic_concrete_types_reset(void)
Definition: type.c:3513

References entity_basic_concrete_types_reset(), reset_pips_current_computation(), and reset_std_static_entities().

Referenced by callgraph(), and catch_user_error().

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

◆ reset_make_cache()

void reset_make_cache ( void  )

Definition at line 191 of file pipsmake.c.

192 {
193  pips_debug(8, "The up-to-date resource cache is reset\n");
194  pips_assert("set is defined", !set_undefined_p(up_to_date_resources));
197 }
void set_free(set)
Definition: set.c:332

References pips_assert, pips_debug, set_free(), set_undefined, set_undefined_p, and up_to_date_resources.

Referenced by apply(), concurrent_apply(), delete_all_resources(), delete_obsolete_resources(), make(), make_post_transformation(), make_pre_post_transformation(), reinit_make_cache_if_necessary(), safe_concurrent_apply(), and safe_do_something().

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

◆ reset_pips_timeout()

void reset_pips_timeout ( void  )

signal.c

Definition at line 60 of file signal.c.

61 {
62  if (pips_timeout_set)
63  POP_TIMEOUT();
64  pips_timeout_set = false;
65 }
#define POP_TIMEOUT()
static bool pips_timeout_set
Definition: signal.c:58

References pips_timeout_set, and POP_TIMEOUT.

Referenced by set_pips_timeout(), and set_pips_timeout_from_env().

+ Here is the caller graph for this function:

◆ reset_pipsmake_callback()

void reset_pipsmake_callback ( void  )

Definition at line 51 of file callback.c.

52 {
53  message_assert("callback not set", callback_set_p == true);
54 
55  callback_set_p = false;
57 }
static pipsmake_callback_handler_type callback
Definition: callback.c:39
static bool callback_set_p
Definition: callback.c:41
#define message_assert(msg, ex)
Definition: newgen_assert.h:47
bool(* pipsmake_callback_handler_type)(void)

References callback, callback_set_p, and message_assert.

Referenced by gpips_main(), and wpips_main().

+ Here is the caller graph for this function:

◆ reset_static_phase_variables()

void reset_static_phase_variables ( void  )

Static variables used by phases must be reset on error although pipsmake does not know which ones are used.

FI: let us hope this is documented in PIPS developer guide... It is not mentionned in the PIPS tutorial. And rightly so I believe. It should be linked to the exception pips_user_error().

From ri-util/static.c

Macro-generated resets

Definition at line 298 of file pipsmake.c.

299 {
300 #define DECLARE_ERROR_HANDLER(name) extern void name(); name()
301 
302  /* From ri-util/static.c */
305 
306  /* Macro-generated resets */
307 #ifdef HAVE_PIPS_effects_generic_LIBRARY
312  /* Macro-generated resets in effects-generic/utils.c */
314 #endif // HAVE_PIPS_effects_generic_LIBRARY
315 
316 #ifdef HAVE_PIPS_transformer_LIBRARY
318 #endif // HAVE_PIPS_transformer_LIBRARY
319 
320 #ifdef HAVE_PIPS_semantics_LIBRARY
323 #endif // HAVE_PIPS_semantics_LIBRARY
324 
325 #undef DECLARE_ERROR_HANDLER
326 
327  // call registered reset functions
329 }
void error_reset_cumulated_rw_effects(void)
void proper_effects_error_handler(void)
void error_reset_invariant_rw_effects(void)
void error_reset_proper_rw_effects(void)
void error_reset_rw_effects(void)
void reset_hooks_call(void)
this function is expected to be called when catching an exception.
Definition: reset_hooks.c:53
#define DECLARE_ERROR_HANDLER(name)
void error_reset_current_module_statement(void)
To be called by an error management routine only.
Definition: static.c:234
void error_reset_current_module_entity(void)
To be called by an error management routine only.
Definition: static.c:109
void reset_total_precondition_map(void)
void reset_precondition_map(void)
void reset_transformer_map(void)

References DECLARE_ERROR_HANDLER, error_reset_cumulated_rw_effects(), error_reset_current_module_entity(), error_reset_current_module_statement(), error_reset_invariant_rw_effects(), error_reset_proper_rw_effects(), error_reset_rw_effects(), proper_effects_error_handler(), reset_hooks_call(), reset_precondition_map(), reset_total_precondition_map(), and reset_transformer_map().

Referenced by catch_user_error(), and safe_do_something().

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

◆ retrieve_active_phases()

void retrieve_active_phases ( void  )

Definition at line 58 of file activate.c.

59 {
60  makefile current_makefile = parse_makefile();
61 
62  ifdebug(9) {
63  puts("----- BEFORE RETRIEVING -----");
64  fprint_activated(stdout);
65  }
66 
67  if (saved_active_phases != NIL)
68  {
70  makefile_active_phases(current_makefile) = saved_active_phases;
72 
73  ifdebug(9) {
74  puts("----- AFTER RETREIVING -----");
75  fprint_activated(stdout);
76  }
77  }
78 }
static list saved_active_phases
Definition: activate.c:47
void fprint_activated(FILE *fd)
Definition: activate.c:110
void gen_free_string_list(list ls)
Definition: list.c:564

References fprint_activated(), gen_free_string_list(), ifdebug, makefile_active_phases, NIL, parse_makefile(), and saved_active_phases.

Referenced by apply(), concurrent_apply(), make(), safe_concurrent_apply(), and safe_do_something().

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

◆ rmake()

bool rmake ( const char *  rname,
const char *  oname 
)

recursive make resource.

Should be static, but FI uses it in callgraph.c

is it up to date ?

YES, IT IS!

this resource exists but may be up-to-date?

NO, IT IS NOT.

the resource is already being required... this is bad

Well, the resource does not exists, we have to build it.

Let's check if the proper options have been selected.

These conditions should not be hardwired here but managed by the tpips script language.

we look for the active rule to produce this resource

we recursively make the pre transformations.

we recursively make required resources.

we build the resource

set up-to-date all the produced resources for that rule

we recursively make the post transformations.

Parameters
rnamename
onamename

Definition at line 919 of file pipsmake.c.

920 {
921  rule ru;
922  char * res_id = NULL;
923 
924  pips_debug(2, "%s(%s) - requested\n", rname, oname);
925 
926  /* is it up to date ? */
927  if (db_resource_p(rname, oname))
928  {
929  res_id = db_get_resource_id(rname, oname);
930  if(make_cache_hit_p(res_id))
931  {
932  pips_debug(5, "resource %s(%s) found up_to_date, time stamp %d\n",
933  rname, oname, db_time_of_resource(rname, oname));
934  return true; /* YES, IT IS! */
935  }
936  else
937  {
938  /* this resource exists but may be up-to-date? */
939  res_id = NULL; /* NO, IT IS NOT. */
940  }
941  }
942  else if (db_resource_is_required_p(rname, oname))
943  {
944  /* the resource is already being required... this is bad */
946  pips_user_error("recursion on resource %s of %s\n", rname, oname);
947  }
948  else
949  {
950  /* Well, the resource does not exists, we have to build it. */
951  db_set_resource_as_required(rname, oname);
952 
953  // FC: YUK, this warning should not be here:-(
954  /* Let's check if the proper options have been selected. */
955  /* These conditions should not be hardwired here but managed by
956  the tpips script language. */
957  if(same_string_p(rname, "IN_REGIONS")
958  || same_string_p(rname, "OUT_REGIONS")) {
960  "MUST_REGIONS"))
961  pips_user_warning("\nMUST REGIONS not selected - "
962  "Do not expect interesting results.\n");
963  }
964  }
965 
966  /* we look for the active rule to produce this resource */
967  if ((ru = find_rule_by_resource(rname)) == rule_undefined)
968  pips_internal_error("could not find a rule for %s", rname);
969 
970  /* we recursively make the pre transformations. */
971  if (!make_pre_transformation(oname, ru))
972  return false;
973 
974  /* we recursively make required resources. */
975  if (!make_required(oname, ru))
976  return false;
977 
978  if (check_resource_up_to_date (rname, oname))
979  {
980  pips_debug(8,
981  "Resource %s(%s) becomes up-to-date after applying\n"
982  " pre-transformations and building required resources\n",
983  rname,oname);
984  }
985  else
986  {
987  bool success = false;
988  list lr;
989 
990  /* we build the resource */
991  db_set_resource_as_required(rname, oname);
992 
993  success = apply_a_rule(oname, ru);
994  if (!success) return false;
995 
996  lr = build_real_resources(oname, rule_produced(ru));
997 
998  /* set up-to-date all the produced resources for that rule */
999  FOREACH(REAL_RESOURCE, rr, lr) {
1000  string rron = real_resource_owner_name(rr);
1001  string rrrn = real_resource_resource_name(rr);
1002 
1003  if (db_resource_p(rrrn, rron))
1004  {
1005  res_id = db_get_resource_id(rrrn, rron);
1006  pips_debug(5, "resource %s(%s) added to up_to_date "
1007  "with time stamp %d\n",
1008  rrrn, rron, db_time_of_resource(rrrn, rron));
1010  }
1011  else {
1012  pips_internal_error("resource %s[%s] just built not found!",
1013  rrrn, rron);
1014  }
1015  }
1016 
1017  gen_full_free_list(lr);
1018  }
1019 
1020  /* we recursively make the post transformations. */
1021  if (!make_post_transformation(oname, ru))
1022  return false;
1023 
1024  return true;
1025 }
bool db_resource_is_required_p(const char *rname, const char *oname)
true if exists and in required state.
Definition: database.c:512
void db_print_all_required_resources(FILE *file)
Definition: database.c:421
int db_time_of_resource(const char *rname, const char *oname)
Definition: database.c:603
void db_set_resource_as_required(const char *rname, const char *oname)
Definition: database.c:797
string db_get_resource_id(const char *rname, const char *oname)
some way to identify a resource...
Definition: database.c:704
#define REAL_RESOURCE(x)
REAL_RESOURCE.
Definition: makefile.h:173
static bool apply_a_rule(const char *oname, rule ru)
Definition: pipsmake.c:578
void add_resource_to_make_cache(void *res_id)
Definition: pipsmake.c:225
bool check_resource_up_to_date(const char *rname, const char *oname)
To be used in a rule.
Definition: pipsmake.c:1468
static bool make_required(const char *, rule)
compute all real resources needed to apply a rule "ru" on an object related to owner "oname".
Definition: pipsmake.c:1116
static bool make_pre_transformation(const char *, rule)
FI: guard added to simplify debugging and to call make_pre_post_transformation() only when it is usef...
Definition: pipsmake.c:871
static bool make_post_transformation(const char *, rule)
FI: guard added to simplify debugging and to call make_pre_post_transformation() only when it is usef...
Definition: pipsmake.c:882

References add_resource_to_make_cache(), apply_a_rule(), build_real_resources(), check_resource_up_to_date(), db_get_resource_id(), db_print_all_required_resources(), db_resource_is_required_p(), db_resource_p(), db_set_resource_as_required(), db_time_of_resource(), find_rule_by_resource(), FOREACH, gen_full_free_list(), make_cache_hit_p(), make_post_transformation(), make_pre_transformation(), make_required(), pips_debug, pips_internal_error, pips_user_error, pips_user_warning, REAL_RESOURCE, real_resource_owner_name, real_resource_resource_name, rule_phase, rule_produced, rule_undefined, and same_string_p.

Referenced by build_real_resources(), callgraph(), make(), and make_required().

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

◆ rule_use_resource_produced()

bool rule_use_resource_produced ( rule  r)

Test if a rule uses a resource it produces.

find resource res that is produced by phase

owner vro = virtual_resource_owner(vr);

We DO check callers and callees (DB,08/96)

if ( owner_callers_p(vro) || owner_callees_p(vro) ) {} else

Definition at line 353 of file activate.c.

355 {
356  MAPL(pvrp, {
357  /* find resource res that is produced by phase */
359  string vrn = virtual_resource_name(res);
360 
361  MAPL(pvr, {
363  string vrn2 = virtual_resource_name(vr);
364  /* owner vro = virtual_resource_owner(vr); */
365 
366  /* We DO check callers and callees (DB,08/96) */
367  /* if ( owner_callers_p(vro) || owner_callees_p(vro) ) {}
368  else
369  */
370  if (same_string_p(vrn, vrn2))
371  return true;
372  }, (list) rule_required( r ) );
373 
374  }, (list) rule_produced( r ) );
375 
376  return false;
377 }
struct cons * list
Definition: newgen_types.h:106

References CAR, MAPL, rule_produced, rule_required, same_string_p, VIRTUAL_RESOURCE, and virtual_resource_name.

Referenced by get_more_derived_resources().

+ Here is the caller graph for this function:

◆ run_pipsmake_callback()

bool run_pipsmake_callback ( void  )

Definition at line 59 of file callback.c.

60 {
61  bool result = true;
62 
63  if (callback_set_p)
64  result = (*callback)();
65 
66  return result;
67 }

References callback_set_p.

Referenced by apply_a_rule().

+ Here is the caller graph for this function:

◆ safe_apply()

bool safe_apply ( const char *  phase_n,
const char *  module_n 
)
Parameters
phase_nhase_n
module_nodule_n

Definition at line 1723 of file pipsmake.c.

1724 {
1725  return safe_do_something(phase_n, module_n, "phase/rule",
1727 }
static bool safe_do_something(const char *name, const char *module_n, const char *what_it_is, rule(*find_rule)(const char *), bool(*doit)(const char *, const char *))
Definition: pipsmake.c:1656
static bool apply(const char *pname, const char *oname)
Definition: pipsmake.c:1028

References apply(), find_rule_by_phase(), and safe_do_something().

Referenced by apply(), execute_safe_apply_outside_the_notifier(), execute_safe_apply_outside_the_notifyer(), hpfc_notify(), and pips_main().

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

◆ safe_concurrent_apply()

bool safe_concurrent_apply ( const char *  phase_n,
gen_array_t  modules 
)
Parameters
phase_nhase_n
modulesodules

Definition at line 1729 of file pipsmake.c.

1732 {
1733  bool ok = true;
1734  debug_on("PIPSMAKE_DEBUG_LEVEL");
1735 
1736  // Get a human being representation of the modules:
1737  string module_list = strdup(string_array_join(modules, ","));
1738 
1739  if (find_rule_by_phase(phase_n)==rule_undefined)
1740  {
1741  pips_user_warning("Unknown phase \"%s\"\n", phase_n);
1742  ok = false;
1743  }
1744  else
1745  {
1747  {
1748  reset_make_cache();
1750  pips_user_warning("Request aborted in pipsmake\n");
1751  ok = false;
1752 
1754  RETHROW();
1755  }
1756  TRY
1757  {
1758  logs_on();
1759  user_log("Request: capply %s for module [%s].\n", phase_n, module_list);
1760 
1761  ok = concurrent_apply(phase_n, modules);
1762 
1763  if (ok) {
1764  user_log("capply %s made for [%s].\n", phase_n, module_list);
1765  logs_off();
1766  }
1767  else {
1768  pips_user_warning("Request aborted under pipsmake: "
1769  "capply %s for module [%s].\n",
1770  phase_n, module_list);
1771  }
1773  }
1774  }
1775 
1776  free(module_list);
1777  debug_off();
1778  return ok;
1779 }
void retrieve_active_phases(void)
Definition: activate.c:58
#define CATCH(what)
@ timeout_error
@ any_exception_error
catch all
#define UNCATCH(what)
#define RETHROW()
#define TRY
linear_exception_t the_last_just_thrown_exception
string string_array_join(gen_array_t array, string separator)
Join a string array with a string separator.
Definition: array.c:198
static void logs_on(void)
Definition: pipsmake.c:1623
static void logs_off(void)
Definition: pipsmake.c:1632
static bool concurrent_apply(const char *pname, gen_array_t modules)
Definition: pipsmake.c:1048
static bool ok

References any_exception_error, CATCH, concurrent_apply(), debug_off, debug_on, find_rule_by_phase(), free(), logs_off(), logs_on(), ok, pips_user_warning, reset_make_cache(), RETHROW, retrieve_active_phases(), rule_undefined, strdup(), string_array_join(), the_last_just_thrown_exception, timeout_error, TRY, UNCATCH, and user_log().

Referenced by capply().

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

◆ safe_make()

bool safe_make ( const char *  res_n,
const char *  module_n 
)
Parameters
res_nes_n
module_nodule_n

Definition at line 1717 of file pipsmake.c.

1718 {
1719  return safe_do_something(res_n, module_n, "resource",
1721 }
static bool make(const char *rname, const char *oname)
Definition: pipsmake.c:893

References find_rule_by_resource(), make(), and safe_do_something().

Referenced by get_callees(), get_callees_of(), get_callers(), get_callers_of(), get_view_file(), loop_pragma(), module_loops(), pips_main(), tp_set_current_module(), and try_to_parse_everything_just_in_case().

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

◆ safe_set_property()

bool safe_set_property ( const char *  propname,
const char *  value 
)
Parameters
propnameropname
valuealue

Definition at line 1781 of file pipsmake.c.

1782 {
1783  size_t len = strlen(propname) + strlen(value) + 2;
1784  char* line = calloc(len, sizeof(char));
1785  strcat(line, propname);
1786  strcat(line, " ");
1787  strcat(line, value);
1788  user_log("set %s\n", line);
1789  parse_properties_string(line, false);
1790  free(line);
1791  // parse_properties_string() doesn't return whether it succeeded
1792  return true;
1793 }
void parse_properties_string(char *s, bool processing_p)
properties.c
Definition: properties.c:823
static int line
FLEX_SCANNER.
Definition: scanner.c:852

References free(), line, parse_properties_string(), and user_log().

Referenced by set_property().

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

◆ save_active_phases()

void save_active_phases ( void  )

activate.c

Definition at line 49 of file activate.c.

50 {
51  makefile current_makefile = parse_makefile();
52 
53  if (saved_active_phases == NIL)
56 }
list gen_copy_string_list(list ls)
of string
Definition: list.c:556

References gen_copy_string_list(), makefile_active_phases, NIL, parse_makefile(), and saved_active_phases.

Referenced by apply(), concurrent_apply(), and make().

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

◆ save_makefile()

void save_makefile ( const char *  name)
Parameters
nameame

Definition at line 1801 of file readmakefile.c.

1802 {
1803  char * mkf_name = build_pgm_makefile(name);
1804  FILE * fd = safe_fopen(mkf_name, "w");
1806  safe_fclose(fd, mkf_name);
1807  pips_debug(1, "makefile written on %s\n", mkf_name);
1808  free(mkf_name);
1809 }
void write_makefile(FILE *f, makefile p)
Definition: makefile.c:46

Referenced by close_makefile().

+ Here is the caller graph for this function:

◆ saved_active_phase_p()

bool saved_active_phase_p ( const char *  phase)

Debugging function.

Parameters
phasehase

Definition at line 93 of file activate.c.

94 {
96 
97  if(ENDP(sapl)) {
98  fprintf(stderr, "Active phases have not been saved\n");
99  }
100  else {
101  FOREACH(STRING, s, sapl)
102  if (same_string_p(s, phase))
103  return true; // new line for breakpoints
104  }
105 
106  return false;
107 }

References ENDP, FOREACH, fprintf(), same_string_p, saved_active_phases, and STRING.

+ 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 dfg
Global variables
Definition: adg_read_paf.c:138
void fprint_bdt_with_stat(FILE *fp, bdt obj)
===========================================================================
Definition: bdt_utils.c:115
bdt search_graph_bdt(sccs rgraph)
=================================================================
Definition: makebdt.c:3001
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:

◆ set_current_phase_context()

void set_current_phase_context ( const char *  rname,
const char *  oname 
)

cproto-generated files

pipsmake.c

Parameters
rnamename
onamename

Definition at line 89 of file pipsmake.c.

90 {
91  set_pips_current_computation(rname, oname);
94 }
void set_pips_current_computation(const char *rname, const char *oname)
message.c
Definition: message.c:65
void entity_basic_concrete_types_init(void)
Definition: type.c:3507

References entity_basic_concrete_types_init(), reset_std_static_entities(), and set_pips_current_computation().

Referenced by callgraph(), and catch_user_error().

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

◆ set_pips_timeout()

void set_pips_timeout ( unsigned int  delay)

set pips timeout on delay setting to 0 removes the current timeout.

Parameters
delayelay

Definition at line 70 of file signal.c.

71 {
74 
75  if (delay > 0)
76  {
77  pips_timeout_set = true;
78  PUSH_TIMEOUT(delay);
79  }
80 }
#define PUSH_TIMEOUT(delay)
void set_timeout_callback(timeout_callback_f)
Definition: errors.c:485
static void pips_timeout_callback(const int delay, _UNUSED_ const char *function, const char *file, const int lineno)
Definition: signal.c:47
void reset_pips_timeout(void)
signal.c
Definition: signal.c:60

References pips_timeout_callback(), pips_timeout_set, PUSH_TIMEOUT, reset_pips_timeout(), and set_timeout_callback().

+ Here is the call graph for this function:

◆ set_pips_timeout_from_env()

void set_pips_timeout_from_env ( void  )

set pips timeout using PIPS_TIMEOUT environment variable

Definition at line 84 of file signal.c.

85 {
88 
89  pips_timeout_set = PUSH_TIMEOUT_ENV("PIPS_TIMEOUT");
90 }
#define PUSH_TIMEOUT_ENV(env)

References pips_timeout_callback(), pips_timeout_set, PUSH_TIMEOUT_ENV, reset_pips_timeout(), and set_timeout_callback().

Referenced by initialize_signal_catcher().

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

◆ set_pipsmake_callback()

void set_pipsmake_callback ( pipsmake_callback_handler_type  p)

callback.c

Definition at line 43 of file callback.c.

44 {
45  message_assert("callback is already set", callback_set_p == false);
46 
47  callback_set_p = true;
48  callback = p;
49 }

References callback, callback_set_p, and message_assert.

Referenced by gpips_main(), and wpips_main().

+ Here is the caller graph for this function:

◆ unsplit()

bool unsplit ( const string  name)

unsplit.c

unsplit.c

Parameters
nameame

Definition at line 185 of file unsplit.c.

186 {
187  return unsplit_internal(name, DBR_PRINTED_FILE);
188 }
static bool unsplit_internal(const string name, const string dbr)
Definition: unsplit.c:104

References unsplit_internal().

+ Here is the call graph for this function:

◆ unsplit_parsed()

bool unsplit_parsed ( const  string)
Parameters
stringame

Definition at line 190 of file unsplit.c.

191 {
192  return unsplit_internal(name, DBR_PARSED_PRINTED_FILE);
193 }

References unsplit_internal().

+ Here is the call graph for this function:

◆ yyerror()

void yyerror ( const char *  s)

work around cproto 4.7t issue

symbols from readmakefile.y

work around cproto 4.7t issue

symbols from readmakefile.y

work around cproto 4.7t issue

Definition at line 1927 of file genread_yacc.c.

1928 {
1929  int c, n=40;
1930  newgen_lexer_position(stderr);
1931  fprintf(stderr, "%s before ", s);
1932 
1933  while (n-->0 && ((c=genread_input()) != EOF))
1934  putc(c, stderr);
1935 
1936  fprintf(stderr, "\n\n");
1937 
1938  fatal("Incorrect object written by GEN_WRITE\n", (char *) NULL);
1939 }
int genread_input(void)
void newgen_lexer_position(FILE *)
First part of user prologue.
Definition: genread_lex.c:831
void fatal(char *,...)

◆ yyerror_lex_part()

void yyerror_lex_part ( const char *  )

◆ yywrap()

int yywrap ( void  )

symbols form lexer.l

Variable Documentation

◆ pipsmake__flex_debug

int pipsmake__flex_debug
extern

◆ pipsmake_char

int pipsmake_char
extern

◆ pipsmake_in

FILE* pipsmake_in
extern

Definition at line 142 of file pipsmake.h.

◆ pipsmake_leng

int pipsmake_leng
extern

lexer.c

◆ pipsmake_lineno

int pipsmake_lineno
extern

◆ pipsmake_nerrs

int pipsmake_nerrs
extern

◆ pipsmake_out

FILE* pipsmake_out
extern

◆ pipsmake_text

char* pipsmake_text
extern