PIPS
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "constants.h"
#include "misc.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "workspace-util.h"
#include "resources.h"
#include "phases.h"
#include "properties.h"
#include "pips-libs.h"
#include "pipsmake.h"
#include "builder_map.h"
Go to the source code of this file.
Macros | |
#define | DECLARE_ERROR_HANDLER(name) extern void name(); name() |
#define | add_res(vrn, on) |
Apply an instantiated rule with a given ressource owner. More... | |
Functions | |
void | set_current_phase_context (const char *rname, const char *oname) |
cproto-generated files More... | |
void | reset_current_phase_context (void) |
static bool | catch_user_error (builder_func_t builder, const char *rname, const char *oname) |
call builder to build a resource for something. More... | |
static builder_func_t | get_builder (const char *name) |
void | reset_make_cache (void) |
void | init_make_cache (void) |
bool | make_cache_p () |
Can the make cache be used? More... | |
void | reinit_make_cache_if_necessary (void) |
bool | make_cache_hit_p (void *rr_id) |
void | add_resource_to_make_cache (void *res_id) |
void | remove_resource_from_make_cache (void *res_id) |
void | print_make_cache () |
Debug function, to be tested... More... | |
bool | make_cache_consistent_p () |
Debug function: make sure that up-to-date resources do exist in the resource database. More... | |
void | reset_static_phase_variables () |
Static variables used by phases must be reset on error although pipsmake does not know which ones are used. More... | |
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 resources. More... | |
static void | preserve_virtual_resource (const char *oname, virtual_resource vr) |
touch the resource if it exits this is currently an experimental and partial implementation More... | |
static void | update_preserved_resources (const char *oname, rule ru) |
static bool | apply_a_rule (const char *oname, rule ru) |
rule | find_rule_by_resource (const char *rname) |
This function returns the active rule to produce resource rname. More... | |
static rule | safe_find_rule_by_resource (const char *rname) |
Always returns a defined rule. More... | |
static bool | make_pre_transformation (const char *oname, rule ru) |
FI: guard added to simplify debugging and to call make_pre_post_transformation() only when it is useful. More... | |
static bool | make_post_transformation (const char *oname, rule ru) |
FI: guard added to simplify debugging and to call make_pre_post_transformation() only when it is useful. More... | |
static bool | make_required (const char *oname, rule ru) |
compute all real resources needed to apply a rule "ru" on an object related to owner "oname". More... | |
static bool | apply_without_reseting_up_to_date_resources (const char *pname, const char *oname) |
Apply do NOT activate the rule applied. More... | |
static bool | make_pre_post_transformation (const char *oname, rule ru, list transformations) |
compute all pre or post-transformations to apply a rule on an object or activate a phase if owner is SELECT. More... | |
static bool | make (const char *rname, const char *oname) |
bool | rmake (const char *rname, const char *oname) |
recursive make resource. More... | |
static bool | apply (const char *pname, const char *oname) |
static bool | concurrent_apply (const char *pname, gen_array_t modules) |
static bool | check_physical_resource_up_to_date (const char *rname, const char *oname) |
returns whether resource is up to date. 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 *rname, const char *oname) |
To be used in a rule. More... | |
void | delete_named_resources (const char *rn) |
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 *oname, rule ru) |
check the usage of resources More... | |
static void | logs_on (void) |
static void | logs_off (void) |
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 *)) |
bool | safe_make (const char *res_n, const char *module_n) |
bool | safe_apply (const char *phase_n, const char *module_n) |
bool | safe_concurrent_apply (const char *phase_n, gen_array_t modules) |
bool | safe_set_property (const char *propname, const char *value) |
gen_array_t | get_callers (string module) |
Get all the callers of the specified module. More... | |
gen_array_t | get_callees (string module) |
Get all the callers of the specified module. More... | |
Variables | |
static set | up_to_date_resources = set_undefined |
FI: pipsmmake is very slow when interprocedural analyzes have been selected; some memoization has been added; we need to distinguish betweeen an external make which initializes a set of up-to-date resources and an internal recursive make which updates and exploits that set. More... | |
static double | initial_memory_size |
#define add_res | ( | vrn, | |
on | |||
) |
Apply an instantiated rule with a given ressource owner.
FI: uncomment if rmake no longer needed in callgraph.c static bool rmake(string, string);
Definition at line 337 of file pipsmake.c.
#define DECLARE_ERROR_HANDLER | ( | name | ) | extern void name(); name() |
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...
res_id | es_id |
Definition at line 225 of file pipsmake.c.
References set_add_element(), and up_to_date_resources.
Referenced by check_physical_resource_up_to_date(), and rmake().
|
static |
Definition at line 1028 of file pipsmake.c.
References apply_without_reseting_up_to_date_resources(), dont_interrupt_pipsmake_asap(), init_make_cache(), pips_debug, reset_make_cache(), retrieve_active_phases(), and save_active_phases().
Referenced by safe_apply().
periodically checkpoints the workspace if required.
??? FC 05/04/2002 quick fix because of a recursion loop: apply_a_rule -> checkpoint_workspace -> delete_obsolete_resources -> check_physical_resource_up_to_date -> build_real_resources -> rmake -> apply_a_rule ! maybe it would be better treated in checkpoint_workspace?
output the message somewhere...
DO IT HERE!
Definition at line 578 of file pipsmake.c.
References build_real_resources(), catch_user_error(), checkpoint_workspace(), do_resource_usage_check(), FOREACH, gen_full_free_list(), get_bool_property(), get_builder(), get_int_property(), get_process_gross_heap_size(), get_string_timers(), init_log_timers(), init_resource_usage_check(), initial_memory_size, interrupt_pipsmake_asap_p(), pips_malloc_debug(), REAL_RESOURCE, real_resource_owner_name, real_resource_resource_name, rule_phase, rule_produced, rule_required, run_pipsmake_callback(), same_string_p, update_preserved_resources(), and user_log().
Referenced by apply_without_reseting_up_to_date_resources(), concurrent_apply(), and rmake().
|
static |
Apply do NOT activate the rule applied.
In the case of an interprocedural rule, the rules applied to the callees of the main will be the default rules. For instance, "apply PRINT_CALL_GRAPH_WITH_TRANSFORMERS" applies the rule PRINT_CALL_GRAPH to all callees of the main, leading to a core dump.
Safe apply checks if the rule applied is activated and produces ressources that it requires (no transitive closure) –DB 8/96
Definition at line 778 of file pipsmake.c.
References apply_a_rule(), find_rule_by_phase(), make_post_transformation(), make_pre_transformation(), make_required(), pips_debug, pips_user_warning, and rule_undefined.
Referenced by apply(), and make_pre_post_transformation().
Translate and expand a list of virtual resources into a potentially much longer list of real resources.
this is intrinsically a bad idea: if a new module is created as a side effect of some processing, then the dependency on this new module will never appear and cannot be checked for a redo here (see comments of is_owner_all case).
In spite of the name, no resource is actually built.
FI: the result "result" seems to be always an empty list, NIL, but macro add_res does update "result". Once again, macros improve readability and maintenance.
Definition at line 355 of file pipsmake.c.
References add_res, called_modules, callees_callees, CAR, CDR, compilation_unit_name, compilation_unit_of_module(), compilation_unit_p(), db_get_memory_resource(), db_get_module_list(), ENDP, entity_main_module_p(), FOREACH, free(), GEN_ARRAY_FOREACH, gen_array_full_free(), gen_copy_string_list(), gen_free_string_list(), gen_nreverse(), is_owner_all, is_owner_callees, is_owner_callers, is_owner_compilation_unit, is_owner_main, is_owner_module, is_owner_program, is_owner_select, local_name_to_top_level_entity(), NIL, owner_tag, pips_debug, pips_internal_error, pips_user_error, pips_user_warning, rmake(), STRING, string_undefined_p, VIRTUAL_RESOURCE, virtual_resource_name, and virtual_resource_owner.
Referenced by apply_a_rule(), check_physical_resource_up_to_date(), do_resource_usage_check(), make_pre_post_transformation(), make_required(), rmake(), and update_preserved_resources().
|
static |
call builder to build a resource for something.
handle possible exceptions while doing so.
Definition at line 106 of file pipsmake.c.
References any_exception_error, CATCH, get_debug_stack_pointer(), linear_error_count(), linear_get_error_counts(), linear_require_gmp(), linear_reset_error_counters(), linear_with_gmp(), pips_user_warning, reset_current_phase_context(), reset_hooks_is_empty(), reset_static_phase_variables(), RETHROW, set_current_phase_context(), set_debug_stack_pointer(), the_last_just_thrown_exception, timeout_error, TRY, and UNCATCH.
Referenced by apply_a_rule().
|
static |
returns whether resource is up to date.
Maybe is has already been proved true
Initial resources by definition are not associated to a rule. FI: and they always are up-to-date?!? Even if somebody touched the file? You mean you do not propagate modifications performed outside of the workspace?
We get the active rule to build this resource
we build the list of required real_resources
Here we are sure (thanks to find_rule_by_resource) that the rule does not use a resource it produces. FI: OK, this does not rule out modified resources which should not be taken into account to avoid infinite recursion.
we are going to check if the required resources are
If the resource is in the modified list, then don't check anything
Check if this resource is up to date
Check if the timestamp is OK
If the resource is up to date then add it in the set, as well as its siblings, if they are produced by the same rule. Think of callgraph with may produce literaly thousands of resources, three times the number of modules!
well, if it is not okay, let us delete it!??? okay, this might be done later, but in some case it is not. I'm not really sure this is the right fix, but at least it avoids a coredump after touching some internal file (.f_initial) and requesting the PRINTED_FILE for it. FC, 22/07/1998
FI: this may be costly and should be avoided on a quit!
FC 2016-11-16: ??? this is a bad idea, because this function we are in is called by db_delete_obsolete_resources by a hook, and changing the datastructures while scanning them leads to inconsistencies and random aborts... see tspear-17.
Definition at line 1257 of file pipsmake.c.
References add_resource_to_make_cache(), build_real_resources(), check_resource_up_to_date(), db_get_resource_id(), db_resource_p(), db_time_of_resource(), find_rule_by_resource(), FOREACH, gen_full_free_list(), make_cache_hit_p(), NIL, pips_assert, pips_debug, REAL_RESOURCE, real_resource_owner_name, real_resource_resource_name, rule_modified, rule_produced, rule_required, rule_undefined, safe_find_rule_by_resource(), and same_string_p.
Referenced by check_resource_up_to_date(), and delete_obsolete_resources().
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
rname | name |
oname | name |
Definition at line 1468 of file pipsmake.c.
References check_physical_resource_up_to_date(), and db_resource_p().
Referenced by check_physical_resource_up_to_date(), and rmake().
|
static |
modules | phase to be applied modules that must be computed |
Definition at line 1048 of file pipsmake.c.
References apply_a_rule(), dont_interrupt_pipsmake_asap(), find_rule_by_phase(), GEN_ARRAY_FOREACH, init_make_cache(), make_post_transformation(), make_pre_transformation(), make_required(), reset_make_cache(), retrieve_active_phases(), and save_active_phases().
Referenced by safe_concurrent_apply().
void delete_all_resources | ( | void | ) |
Definition at line 1513 of file pipsmake.c.
References db_delete_all_resources(), init_make_cache(), and reset_make_cache().
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.
rn | n |
Definition at line 1482 of file pipsmake.c.
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().
int delete_obsolete_resources | ( | void | ) |
Definition at line 1432 of file pipsmake.c.
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().
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.
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().
void do_resource_usage_check | ( | const char * | oname, |
rule | ru | ||
) |
check the usage of resources
es_write
oname | name |
ru | u |
Definition at line 1559 of file pipsmake.c.
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().
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.
rname | name |
Definition at line 694 of file pipsmake.c.
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().
|
static |
Definition at line 163 of file pipsmake.c.
References pips_internal_error, and same_string_p.
Referenced by apply_a_rule().
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
module | odule |
Definition at line 1816 of file pipsmake.c.
References callees_callees, db_get_memory_resource(), gen_array_from_list(), module, pips_internal_error, and safe_make().
Referenced by get_callees_of().
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
module | odule |
Definition at line 1799 of file pipsmake.c.
References callees_callees, db_get_memory_resource(), gen_array_from_list(), module, pips_internal_error, and safe_make().
Referenced by get_callers_of().
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.
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().
void init_make_cache | ( | void | ) |
Definition at line 199 of file pipsmake.c.
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().
|
static |
Definition at line 1632 of file pipsmake.c.
References dbm_time, get_bool_property(), get_process_gross_heap_size(), get_request_string_timers(), initial_memory_size, phase_time, request_time, and user_log().
Referenced by safe_concurrent_apply(), and safe_do_something().
|
static |
Definition at line 1623 of file pipsmake.c.
References get_bool_property(), get_process_gross_heap_size(), init_request_timers(), and initial_memory_size.
Referenced by safe_concurrent_apply(), and safe_do_something().
|
static |
Definition at line 893 of file pipsmake.c.
References db_clean_all_required_resources(), db_print_all_required_resources(), debug(), dont_interrupt_pipsmake_asap(), ifdebug, init_make_cache(), pips_debug, reset_make_cache(), retrieve_active_phases(), rmake(), and save_active_phases().
Referenced by main(), and safe_make().
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.
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().
bool make_cache_hit_p | ( | void * | rr_id | ) |
rr_id | r_id |
Definition at line 219 of file pipsmake.c.
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().
bool make_cache_p | ( | void | ) |
Can the make cache be used?
Definition at line 207 of file pipsmake.c.
References set_undefined_p, and up_to_date_resources.
Referenced by delete_named_resources(), delete_obsolete_resources(), and make_required().
FI: guard added to simplify debugging and to call make_pre_post_transformation() only when it is useful.
Definition at line 882 of file pipsmake.c.
References ENDP, init_make_cache(), make_pre_post_transformation(), reset_make_cache(), and rule_post_transformation.
Referenced by apply_without_reseting_up_to_date_resources(), concurrent_apply(), and rmake().
|
static |
compute all pre or post-transformations to apply a rule on an object or activate a phase if owner is SELECT.
The phase is not necessarily a transformation anymore: analyses can be requested as well although pipsmake may core dump as a consequence. The select clauses are performed first.
we activate the requested rules if any
FI: apparently, we do not stack up the current active phase and we do not restore it once the requesting phase is completed.
FI: activate() is part of the pipsmake API, debug_on() is activated, pipsmake.rc is potentially parsed,...
we build the list of pre or post transformation real_resources
we recursively make the resources
actually the resource name is a phase name !!
now we must drop the up_to_date cache. maybe not that often? Or one should perform the transforms top-down to avoid recomputations, with ALL...
Definition at line 811 of file pipsmake.c.
References activate(), active_phase_p(), apply_without_reseting_up_to_date_resources(), build_real_resources(), FOREACH, init_make_cache(), owner_select_p, pips_debug, REAL_RESOURCE, real_resource_owner_name, real_resource_resource_name, reset_make_cache(), rule_phase, transformations, VIRTUAL_RESOURCE, virtual_resource_name, and virtual_resource_owner.
Referenced by make_post_transformation(), and make_pre_transformation().
FI: guard added to simplify debugging and to call make_pre_post_transformation() only when it is useful.
Definition at line 871 of file pipsmake.c.
References ENDP, make_pre_post_transformation(), and rule_pre_transformation.
Referenced by apply_without_reseting_up_to_date_resources(), concurrent_apply(), and rmake().
compute all real resources needed to apply a rule "ru" on an object related to owner "oname".
Make sure that the first computation of the resources does not require a recomputation either because the number of resources has increased because new modules have been added for call sites to missing library source codes or by the user, or because some resource computation include pre- or post-actions which destroy resources already considered up-to-date.
If the processus does not converge with one retry, core dump. The pre- and post-actions (a.k.a. transformations) must be checked for consistency.
we build the list of required real_resources
we recursively make required resources
Want to free the list ...
In french: ici nous devons tester si un des regles modified fait partie des required. Dans ce cas on la fabrique de suite.
Two problems may occur: ALL has changed, for instance because some code has been synthesized (issue for PROGAM.PRECONDITION), or one pre-transformation may have destroyed a resource that was available earlier (see Semantics-New/pointer02 with pre-transformations !CALLEES.proper_effects_with_points_to and !CALLEES.cumulated_effects_with_points_to)
In the first case, list "reals" should be recomputed and compared. In the second case, list "reals" should be compared to the content of the make cache. The second test can be performed first. The first test can be made conditional to code synthesis.
Check that all required resources exist and are up-to-date.
file resources such as USER_FILEs, which are mostly generated by create_worspace, are not inserted as ready in the make cache... It it were requested again here, it would then be in the cache... FI: no idea why...
We re-build the list of required real_resources in case ALL is used and modified because some code has been synthesized.
FI: In case ALL is updated and some bang rule is used, it would be better to fix ALL first.
The first resources must be removed from the make cache
The new resources must be recomputed if necessary
Want to free the list ...
ALL should not be a problem anymore, but FI has no idea if pre-transformations have to converge in one step...
Check again that all required resources are up-to-date.
FI: should be as bugged as the initial previous test. The resource existence should be tested before its id is requested.
file resources such as USER_FILE are not cached the first time...
Definition at line 1116 of file pipsmake.c.
References build_real_resources(), db_get_resource_id(), db_resource_p(), FOREACH, gen_full_free_list(), gen_length(), get_string_property(), int, make_cache_hit_p(), make_cache_p(), pips_debug, pips_internal_error, pips_user_warning, REAL_RESOURCE, real_resource_owner_name, real_resource_resource_name, remove_resource_from_make_cache(), rmake(), rule_phase, and rule_required.
Referenced by apply_without_reseting_up_to_date_resources(), concurrent_apply(), and rmake().
|
static |
touch the resource if it exits this is currently an experimental and partial implementation
Definition at line 510 of file pipsmake.c.
References db_resource_p(), db_touch_resource(), is_owner_all, is_owner_callees, is_owner_callers, is_owner_compilation_unit, is_owner_main, is_owner_module, is_owner_program, is_owner_select, owner_tag, pips_internal_error, virtual_resource_name, and virtual_resource_owner.
Referenced by update_preserved_resources().
void print_make_cache | ( | void | ) |
Debug function, to be tested...
Definition at line 251 of file pipsmake.c.
References count, db_resource_name(), db_resource_owner_name(), printf(), SET_FOREACH, set_undefined_p, string_undefined_p, and up_to_date_resources.
void reinit_make_cache_if_necessary | ( | void | ) |
Definition at line 212 of file pipsmake.c.
References init_make_cache(), reset_make_cache(), set_undefined_p, and up_to_date_resources.
void remove_resource_from_make_cache | ( | void * | res_id | ) |
res_id | es_id |
Definition at line 239 of file pipsmake.c.
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().
void reset_current_phase_context | ( | void | ) |
Definition at line 96 of file pipsmake.c.
References entity_basic_concrete_types_reset(), reset_pips_current_computation(), and reset_std_static_entities().
Referenced by callgraph(), and catch_user_error().
void reset_make_cache | ( | void | ) |
Definition at line 191 of file pipsmake.c.
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().
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.
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().
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.
rname | name |
oname | name |
Definition at line 919 of file pipsmake.c.
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().
bool safe_apply | ( | const char * | phase_n, |
const char * | module_n | ||
) |
phase_n | hase_n |
module_n | odule_n |
Definition at line 1723 of file pipsmake.c.
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().
bool safe_concurrent_apply | ( | const char * | phase_n, |
gen_array_t | modules | ||
) |
phase_n | hase_n |
modules | odules |
Definition at line 1729 of file pipsmake.c.
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().
|
static |
Definition at line 1656 of file pipsmake.c.
References any_exception_error, CATCH, db_clean_all_required_resources(), debug_off, debug_on, get_debug_stack_pointer(), logs_off(), logs_on(), pips_malloc_debug(), pips_user_warning, reset_make_cache(), reset_static_phase_variables(), retrieve_active_phases(), rule_undefined, set_debug_stack_pointer(), TRY, UNCATCH, and user_log().
Referenced by safe_apply(), and safe_make().
|
static |
Always returns a defined rule.
else
Definition at line 751 of file pipsmake.c.
References find_rule_by_resource(), pips_internal_error, and rule_undefined.
Referenced by check_physical_resource_up_to_date().
bool safe_make | ( | const char * | res_n, |
const char * | module_n | ||
) |
res_n | es_n |
module_n | odule_n |
Definition at line 1717 of file pipsmake.c.
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().
bool safe_set_property | ( | const char * | propname, |
const char * | value | ||
) |
propname | ropname |
value | alue |
Definition at line 1781 of file pipsmake.c.
References free(), line, parse_properties_string(), and user_log().
Referenced by set_property().
void set_current_phase_context | ( | const char * | rname, |
const char * | oname | ||
) |
cproto-generated files
rname | name |
oname | name |
Definition at line 89 of file pipsmake.c.
References entity_basic_concrete_types_init(), reset_std_static_entities(), and set_pips_current_computation().
Referenced by callgraph(), and catch_user_error().
|
static |
We increment the logical time (kept by pipsdbm)
we build the list of modified real_resources
we delete them from the up-to-date set
is it up to date ?
GO 11/7/95: we need to del the resource from the data base for a next call of pipsmake to find it unavailable
handle resources that are marked as "preserved", with "="
We increment the logical time again... (kept by pipsdbm) this seems necessary??? BC & FC
Definition at line 537 of file pipsmake.c.
References build_real_resources(), db_get_resource_id(), db_inc_logical_time(), db_unput_a_resource, FOREACH, gen_full_free_list(), make_cache_hit_p(), preserve_virtual_resource(), real_resource_owner_name, real_resource_resource_name, remove_resource_from_make_cache(), rule_modified, and rule_preserved.
Referenced by apply_a_rule().
|
static |
Definition at line 1621 of file pipsmake.c.
Referenced by apply_a_rule(), logs_off(), and logs_on().
|
static |
FI: pipsmmake is very slow when interprocedural analyzes have been selected; some memoization has been added; we need to distinguish betweeen an external make which initializes a set of up-to-date resources and an internal recursive make which updates and exploits that set.
This new functionality is extremely useful when old databases are re-opened.
apply(), which calls make() many times, does not fully benefit from this memoization scheme.
What is cached? a resource id, i.e. a db_resource, i.e. an object hidden in pipsdbm_private...
Definition at line 189 of file pipsmake.c.
Referenced by add_resource_to_make_cache(), init_make_cache(), make_cache_consistent_p(), make_cache_hit_p(), make_cache_p(), print_make_cache(), reinit_make_cache_if_necessary(), remove_resource_from_make_cache(), and reset_make_cache().