PIPS
Functions used to define phases

It defines macros for simple transformation phases that use (at least) the CODE of a module and write back a (possibly) new version of the CODE. More...

Macros

#define PIPS_PHASE_PRELUDE(module_name, debug_env_var)
 Start a phase that use a module CODE. More...
 
#define PIPS_PHASE_POSTLUDE(new_module_statement)
 End a transformation phase by putting back into PIPS the (possibly) modified statement. More...
 
#define PIPS_PHASE_PRELUDE(module_name, debug_env_var)
 Start a phase that use a module CODE. More...
 
#define PIPS_PHASE_POSTLUDE(new_module_statement)
 End a transformation phase by putting back into PIPS the (possibly) modified statement. More...
 

Detailed Description

It defines macros for simple transformation phases that use (at least) the CODE of a module and write back a (possibly) new version of the CODE.

Macro Definition Documentation

◆ PIPS_PHASE_POSTLUDE [1/2]

#define PIPS_PHASE_POSTLUDE (   new_module_statement)
Value:
pips_assert("Statement should be OK at exit...", \
statement_consistent_p(new_module_statement)); \
pips_debug(1, "done\n"); \
/**Exit current debug context */ \
debug_off(); \
\
/**Reorder the module, because some statements have been replaced. */ \
module_reorder(new_module_statement); \
\
/**Put the new CODE ressource into PIPS: */ \
DB_PUT_MEMORY_RESOURCE(DBR_CODE, \
new_module_statement); \
\
/**There is no longer a current module: */ \
reset_current_module_statement(); \
reset_current_module_entity(); \
\
/**Assume it should have worked by returning true... */ \
return true
bool statement_consistent_p(statement p)
Definition: ri.c:2195
const char * get_current_module_name(void)
Get the name of the current module.
Definition: static.c:121
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172

End a transformation phase by putting back into PIPS the (possibly) modified statement.

Parameters
new_module_statementpoint to the (potentially) new module statement of the module

Definition at line 2265 of file ri-util-local.h.

◆ PIPS_PHASE_POSTLUDE [2/2]

#define PIPS_PHASE_POSTLUDE (   new_module_statement)
Value:
pips_assert("Statement should be OK at exit...", \
statement_consistent_p(new_module_statement)); \
pips_debug(1, "done\n"); \
/**Exit current debug context */ \
debug_off(); \
\
/**Reorder the module, because some statements have been replaced. */ \
module_reorder(new_module_statement); \
\
/**Put the new CODE ressource into PIPS: */ \
DB_PUT_MEMORY_RESOURCE(DBR_CODE, \
new_module_statement); \
\
/**There is no longer a current module: */ \
reset_current_module_statement(); \
reset_current_module_entity(); \
\
/**Assume it should have worked by returning true... */ \
return true

End a transformation phase by putting back into PIPS the (possibly) modified statement.

Parameters
new_module_statementpoint to the (potentially) new module statement of the module

Definition at line 2273 of file ri-util.h.

◆ PIPS_PHASE_PRELUDE [1/2]

#define PIPS_PHASE_PRELUDE (   module_name,
  debug_env_var 
)
Value:
/**Get and return the CODE resource of the module and define this \
module as the current one at the same time to avoid introducing \
a new variable: */ \
set_current_module_statement((statement) \
true)); \
\
/**Set the current module entity required to have many things \
working in PIPS: */ \
set_current_module_entity(module_name_to_entity(module_name)); \
\
/**The debug is now controled by this environment variable name: */ \
debug_on(debug_env_var); \
pips_debug(1, "Entering...\n"); \
pips_assert("Statement should be OK at entry...", \
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
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
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479

Start a phase that use a module CODE.

Parameters
module_nameis a string with the name of the module the phase is applied to
debug_env_varis a string with the name of the environment variable used to get the debug level to use inside the phase
Returns
the statement of the module

Definition at line 2242 of file ri-util-local.h.

◆ PIPS_PHASE_PRELUDE [2/2]

#define PIPS_PHASE_PRELUDE (   module_name,
  debug_env_var 
)
Value:
/**Get and return the CODE resource of the module and define this \
module as the current one at the same time to avoid introducing \
a new variable: */ \
set_current_module_statement((statement) \
true)); \
\
/**Set the current module entity required to have many things \
working in PIPS: */ \
set_current_module_entity(module_name_to_entity(module_name)); \
\
/**The debug is now controled by this environment variable name: */ \
debug_on(debug_env_var); \
pips_debug(1, "Entering...\n"); \
pips_assert("Statement should be OK at entry...", \
entity module_name_to_entity(const char *)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479

Start a phase that use a module CODE.

Parameters
module_nameis a string with the name of the module the phase is applied to
debug_env_varis a string with the name of the environment variable used to get the debug level to use inside the phase
Returns
the statement of the module

Definition at line 2250 of file ri-util.h.