PIPS
safescale.h File Reference
#include <string.h>
#include <stdio.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "properties.h"
#include "ri-util.h"
#include "effects-util.h"
#include "pipsdbm.h"
#include "resources.h"
#include "semantics.h"
#include "effects-generic.h"
#include "effects-convex.h"
#include "effects-simple.h"
#include "transformer.h"
#include "transformations.h"
#include "control.h"
#include "callgraph.h"
#include "misc.h"
#include "prettyprint.h"
+ Include dependency graph for safescale.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  statement_checking_context
 
struct  sequence_searching_context
 

Macros

#define EXTERNALIZED_CODE_PRAGMA_BEGIN   "BEGIN_KAAPI_%s"
 Warning! Do not modify this file that is automatically generated! More...
 
#define EXTERNALIZED_CODE_PRAGMA_END   "END_KAAPI_%s"
 
#define EXTERNALIZED_CODE_PRAGMA_ANALYZED_TOP   "ANALYZED_KAAPI_%s (%d statements)"
 
#define EXTERNALIZED_CODE_PRAGMA_ANALYZED_BOTTOM   "ANALYZED_KAAPI_%s (%d statements)"
 
#define EXTERNALIZED_CODE_PRAGMA_ANALYZED_PREFIX_TOP   "--> "
 
#define EXTERNALIZED_CODE_PRAGMA_ANALYZED_PREFIX_BOTTOM   "<-- "
 
#define EXTERNALIZED_FUNCTION_PARAM_NAME   "%s_PARAM_%d"
 
#define EXTERNALIZED_FUNCTION_PRIVATE_PARAM_NAME   "%s_PRIV"
 
#define EXTERNALIZED_CODE_PRAGMA_CALL   "CALL_KAAPI_%s"
 

Functions

bool safescale_module_analysis (const char *)
 cproto-generated files More...
 
bool safescale_distributor_init (const char *)
 identification.c More...
 
bool safescale_distributor (const char *)
 externalization.c More...
 

Macro Definition Documentation

◆ EXTERNALIZED_CODE_PRAGMA_ANALYZED_BOTTOM

#define EXTERNALIZED_CODE_PRAGMA_ANALYZED_BOTTOM   "ANALYZED_KAAPI_%s (%d statements)"

Definition at line 35 of file safescale.h.

◆ EXTERNALIZED_CODE_PRAGMA_ANALYZED_PREFIX_BOTTOM

#define EXTERNALIZED_CODE_PRAGMA_ANALYZED_PREFIX_BOTTOM   "<-- "

Definition at line 37 of file safescale.h.

◆ EXTERNALIZED_CODE_PRAGMA_ANALYZED_PREFIX_TOP

#define EXTERNALIZED_CODE_PRAGMA_ANALYZED_PREFIX_TOP   "--> "

Definition at line 36 of file safescale.h.

◆ EXTERNALIZED_CODE_PRAGMA_ANALYZED_TOP

#define EXTERNALIZED_CODE_PRAGMA_ANALYZED_TOP   "ANALYZED_KAAPI_%s (%d statements)"

Definition at line 34 of file safescale.h.

◆ EXTERNALIZED_CODE_PRAGMA_BEGIN

#define EXTERNALIZED_CODE_PRAGMA_BEGIN   "BEGIN_KAAPI_%s"

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

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

Definition at line 32 of file safescale.h.

◆ EXTERNALIZED_CODE_PRAGMA_CALL

#define EXTERNALIZED_CODE_PRAGMA_CALL   "CALL_KAAPI_%s"

Definition at line 42 of file safescale.h.

◆ EXTERNALIZED_CODE_PRAGMA_END

#define EXTERNALIZED_CODE_PRAGMA_END   "END_KAAPI_%s"

Definition at line 33 of file safescale.h.

◆ EXTERNALIZED_FUNCTION_PARAM_NAME

#define EXTERNALIZED_FUNCTION_PARAM_NAME   "%s_PARAM_%d"

Definition at line 39 of file safescale.h.

◆ EXTERNALIZED_FUNCTION_PRIVATE_PARAM_NAME

#define EXTERNALIZED_FUNCTION_PRIVATE_PARAM_NAME   "%s_PRIV"

Definition at line 40 of file safescale.h.

Function Documentation

◆ safescale_distributor()

bool safescale_distributor ( const char *  module_name)

externalization.c

Set and get the current properties concerning regions

Get the resources

Set dynamic_area

Get the READ, WRITE, IN and OUT regions of the module

Do the job

Restructuring code to avoid imbricated sequences if some portions are found to allow more than one INIT

Reorder the module because new statements have been added

Update/release resources

Parameters
module_nameodule_name

Definition at line 774 of file externalization.c.

775 {
776  statement module_stat;
777  entity module;
778 
779  /* Set and get the current properties concerning regions */
780  set_bool_property("MUST_REGIONS", true);
781  set_bool_property("EXACT_REGIONS", true);
783 
784  /* Get the resources */
785  module_stat = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
787 
788  set_current_module_statement(module_stat);
790 
794 
795  /* Set dynamic_area */
797  {
799  }
800 
801  debug_on("SAFESCALE_DISTRIBUTOR_DEBUG_LEVEL");
802 
803  /* Get the READ, WRITE, IN and OUT regions of the module */
807 
808  /* Do the job */
809  pips_debug(2, "BEGIN of SAFESCALE_DISTRIBUTOR\n");
810  /* Restructuring code to avoid imbricated sequences if some portions are found to allow more than one INIT */
811  simple_restructure_statement(module_stat);
812  distribute(module_stat, module);
813  pips_debug(2, "END of SAFESCALE_DISTRIBUTOR\n");
814 
815  print_statement(module_stat);
816 
817  pips_assert("Statement structure is consistent after SAFESCALE_DISTRIBUTOR", gen_consistent_p((gen_chunk*) module_stat));
818  pips_assert("Statement is consistent after SAFESCALE_DISTRIBUTOR", statement_consistent_p(module_stat));
819 
820  /* Reorder the module because new statements have been added */
821  module_reorder(module_stat);
822 
823  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, module_stat);
824  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name, compute_callees(module_stat));
825 
826  /* Update/release resources */
836 
837  debug_off();
838 
839  return true;
840 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
Definition: callgraph.c:355
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void simple_restructure_statement(statement)
A simple cleaning of the control graph without major topological restructuring.
void get_regions_properties(void)
void set_rw_effects(statement_effects)
void reset_out_effects(void)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void set_out_effects(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
void reset_cumulated_rw_effects(void)
void reset_rw_effects(void)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
static entity dynamic_area
Main phase for block code externalization.
static void distribute(statement module_stat, entity module)
Distribute for main module module with root statement stat.
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
Definition: genClib.c:2398
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
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
#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 DYNAMIC_AREA_LOCAL_NAME
Definition: naming-local.h:69
static char * module
Definition: pips.c:74
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
void set_bool_property(const char *, bool)
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
Definition: entity.c:1586
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
#define entity_undefined_p(x)
Definition: ri.h:2762
#define entity_undefined
Definition: ri.h:2761
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
Definition: mappings.c:624
void free_value_mappings(void)
Normal call to free the mappings.
Definition: value.c:1212
A gen_chunk is used to store every object.
Definition: genC.h:58

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, distribute(), dynamic_area, DYNAMIC_AREA_LOCAL_NAME, entity_undefined, entity_undefined_p, FindOrCreateEntity(), free_value_mappings(), gen_consistent_p(), get_regions_properties(), module, module_local_name(), module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), pips_assert, pips_debug, print_statement(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_out_effects(), reset_proper_rw_effects(), reset_rw_effects(), set_bool_property(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_out_effects(), set_proper_rw_effects(), set_rw_effects(), simple_restructure_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ safescale_distributor_init()

bool safescale_distributor_init ( const char *  module_name)

identification.c

identification.c

Get the resources

Doi the job

Reorder the module because new statements have been added

Update/release resources

Parameters
module_nameodule_name

Definition at line 483 of file identification.c.

484 {
485  /* Get the resources */
486  statement stat = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
487 
488 
491 
492  debug_on("SAFESCALE_DISTRIBUTOR_DEBUG_LEVEL");
493 
494  /* Doi the job */
495  pips_debug(2, "BEGIN of SAFESCALE_DISTRIBUTOR_INIT\n");
497  pips_debug(2, "END of SAFESCALE_DISTRIBUTOR_INIT\n");
498 
499  pips_assert("Statement structure is consistent after SAFESCALE_DISTRIBUTOR_INIT", gen_consistent_p((gen_chunk*) stat));
500  pips_assert("Statement is consistent after SAFESCALE_DISTRIBUTOR_INIT", statement_consistent_p(stat));
501 
502  /* Reorder the module because new statements have been added */
503  module_reorder(stat);
504  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
506 
507  /* Update/release resources */
510 
511  debug_off();
512 
513  return true;
514 }
static list identify_statements_to_distribute(statement module_stat)
Return a list of statements that are marked for externalization.

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, gen_consistent_p(), identify_statements_to_distribute(), module_name(), module_name_to_entity(), module_reorder(), pips_assert, pips_debug, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ safescale_module_analysis()

bool safescale_module_analysis ( const char *  module_name)

cproto-generated files

analysis.c

cproto-generated files

Initialize the resources

Get effects of the module

Build hash tables between variables and values and between values and names for the module

Get regions of the module

Do the job

Update/release resources

Parameters
module_nameodule_name

Definition at line 33 of file analysis.c.

34 {
36  entity module;
37 
38  /* Initialize the resources */
40  // module = local_name_to_top_level_entity(module_name);
42 
45 
46  /* Get effects of the module */
49 
50  /* Build hash tables between variables and values and between values and names for the module */
52 
53  //debug_on("PHRASE_DISTRIBUTOR_DEBUG_LEVEL");
54 
55  /* Get regions of the module */
59 
60  /* Do the job */
61  //pips_debug(2, "BEGIN of PHRASE_DISTRIBUTOR\n");
62 
63  // convertion_to_kaapi(....); ou identification des blocs délimités par des pragmas selon méthode retenue.
64 
65  //pips_debug(2, "END of PHRASE_DISTRIBUTOR\n");
66 
68 
69  //pips_assert("Statement structure is consistent after PHRASE_DISTRIBUTOR", gen_consistent_p((gen_chunk*) statement));
70  //pips_assert("Statement is consistent after PHRASE_DISTRIBUTOR", statement_consistent_p(statement));
71 
72  /* Update/release resources */
75  //dynamic_area = entity_undefined;
82 
83  //debug_off();
84 
85  return true;
86 }
static statement module_statement
Definition: alias_check.c:125

References db_get_memory_resource(), free_value_mappings(), module, module_name(), module_name_to_entity(), module_statement, module_to_value_mappings(), print_statement(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_out_effects(), reset_proper_rw_effects(), reset_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_out_effects(), set_proper_rw_effects(), and set_rw_effects().

+ Here is the call graph for this function: