25 #include "pips_config.h"
49 #include "constants.h"
59 #include "resources.h"
66 bool memory_effects_only;
67 bool memory_in_out_effects_only;
69 } out_effects_context;
72 static void init_out_effects_context(out_effects_context *ctxt,
76 ctxt->memory_in_out_effects_only =
get_bool_property(
"MEMORY_IN_OUT_EFFECTS_ONLY");
78 if (! ctxt->memory_effects_only
79 && ctxt->memory_in_out_effects_only)
86 ctxt->representation = representation;
89 static void reset_out_effects_context(out_effects_context *ctxt)
91 if (! ctxt->memory_effects_only
92 && ctxt->memory_in_out_effects_only)
102 if (!ctxt->memory_effects_only
103 && ctxt->memory_in_out_effects_only)
112 if (!ctxt->memory_effects_only
113 && ctxt->memory_in_out_effects_only)
135 l_sum_out_eff = l_out;
141 l_sum_out_eff = (*effects_test_union_op)(l_sum_out_eff, l_out,
149 return(l_sum_out_eff);
160 out_effects_from_call_site_to_callee(
call c)
204 l_tmp = (*effects_intersection_op)(l_tmp,
effects_dup(l_sum_rw_eff),
241 summary_out_effects_stmt_filter(
statement s)
291 return(l_sum_out_eff);
318 debug_on(
"OUT_EFFECTS_DEBUG_LEVEL");
321 pips_debug(1,
"begin for %s with %td callers\n",
333 (void)out_effects_from_caller_to_callee(caller,
callee);
340 (*db_put_summary_out_effects_func)(
module_name, l_eff);
348 (*effects_prettyprint_func)(l_eff);
379 out_effects_from_unstructured_to_nodes(
unstructured u, out_effects_context *ctxt)
405 transformer unst_trans = (*load_transformer_func)(unst_stat);
410 (*effects_transformer_inverse_composition_op)(l_out_unst, unst_trans);
418 l_out_unst = (*effects_union_op)(l_out_unst,
effects_dup(l_in),
425 transformer node_prec = (*load_context_func)(node_stat);
435 l_out_node = (*effects_precondition_composition_op)(
436 l_out_node, node_prec,
true);
441 l_out_node = (*effects_intersection_op)(
467 out_effects_from_loop_to_body(
loop l, out_effects_context *ctxt)
479 transformer loop_trans = (*load_transformer_func)(loop_stat);
490 debug(1,
"",
"OUT_L = \n");
491 (*effects_prettyprint_func)(l_out_loop);
499 range_descriptor = (*loop_descriptor_make_func)(l);
517 (*effects_precondition_composition_op)(l_body_w, loop_proper_context,
true);
519 debug(1,
"",
"W(i) = \n");
520 (*effects_prettyprint_func)(l_body_w);
529 (*effects_transformer_inverse_composition_op)(l_out_loop, loop_trans);
534 (*effects_precondition_composition_op)(l_out_loop, loop_proper_context,
true);
536 debug(1,
"",
"l_out = append(T_B(l_out), loop_proper_preconditions) = \n");
537 (*effects_prettyprint_func)(l_out_loop);
570 i_prime_gt_i_d_prime;
573 d_i_i_prime_i_d_prime;
576 c_i_i_prime_i_d_prime;
599 i_prime_gt_i_d_prime =
607 d_i_i_prime_i_d_prime =
609 d_i_i_prime_i_d_prime =
611 d_i_i_prime_i_d_prime =
624 (*effects_descriptors_variable_change_func)(l_next_w, i, i_prime);
628 l_next_w = (*effects_precondition_composition_op)(l_next_w, c_i_i_prime,
true);
631 debug(1,
"",
"W(i', i'>i) = \n");
632 (*effects_prettyprint_func)(l_next_w);
640 debug(1,
"",
"proj_i'(W(i', i'>i)) = \n");
641 (*effects_prettyprint_func)(l_next_w);
653 l_out_glob = (*effects_sup_difference_op)(
661 debug(1,
"",
"l_out_glob = \n");
662 (*effects_prettyprint_func)(l_out_glob);
672 (*effects_descriptors_variable_change_func)(l_prev_w, i, i_d_prime);
677 (*effects_precondition_composition_op)(l_prev_w, c_i_i_prime_i_d_prime,
true);
680 debug(1,
"",
"W(i'', i<i''<i') = \n");
681 (*effects_prettyprint_func)(l_prev_w);
688 l_prev_w = (*effects_union_over_range_op)(
692 debug(1,
"",
"proj_i''(W(i'', i<i''<i')) = \n");
693 (*effects_prettyprint_func)(l_prev_w);
703 (*effects_descriptors_variable_change_func)(l_next_in, i, i_prime);
707 l_next_in = (*effects_precondition_composition_op)(l_next_in, c_i_i_prime,
true);
710 debug(1,
"",
"IN(i', i<i') = \n");
711 (*effects_prettyprint_func)(l_next_in);
717 l_next_in = (*effects_sup_difference_op)(
721 debug(1,
"",
"IN(i', i<i') - proj_i''(W(i'')) = \n");
722 (*effects_prettyprint_func)(l_next_in);
728 l_next_in = (*effects_union_over_range_op)(
736 l_out_loc = (*effects_intersection_op)(
effects_dup(l_body_w),
741 debug(1,
"",
"l_out_loc = \n");
742 (*effects_prettyprint_func)(l_out_loc);
759 debug(1,
"",
"l_body_out = \n");
760 (*effects_prettyprint_func)(l_body_out);
774 out_effects_from_test_to_branches(
test t, out_effects_context *ctxt)
792 pips_debug(1,
"OUT effects of the current test :\n");
793 (*effects_prettyprint_func)(l_out_test);
803 prec_branche = (*load_context_func)(branche);
809 l_out_branche = (*effects_precondition_composition_op)(
810 l_out_branche, prec_branche,
false);
815 l_out_branche = (*effects_intersection_op)(
821 debug(1,
"",
"l_out_branche = \n");
822 (*effects_prettyprint_func)(l_out_branche);
832 static bool out_effects_from_for_to_body(
forloop f, out_effects_context *ctxt)
848 debug(1,
"",
"lout = \n");
849 (*effects_prettyprint_func)(lout);
857 static bool out_effects_from_while_to_body(
whileloop w, out_effects_context *ctxt)
873 debug(1,
"",
"lout = \n");
874 (*effects_prettyprint_func)(lout);
889 out_effects_from_block_to_statements(
sequence seq, out_effects_context *ctxt)
897 pips_debug(1,
"OUT effects of the current block :\n");
898 (*effects_prettyprint_func)(l_out_seq);
928 transformer seq_trans = (*load_transformer_func)(seq_stat);
937 (*effects_transformer_inverse_composition_op)(l_out_seq, seq_trans);
938 l_out_prime = l_out_seq;
942 pips_debug(1,
"OUT effects of block after translation into store"
944 (*effects_prettyprint_func)(l_out_prime);
950 transformer c_stat_trans = (*load_completed_transformer_func)(c_stat);
958 debug(1,
"",
"W(k) = \n");
959 (*effects_prettyprint_func)(l_c_stat_w_eff);
960 debug(1,
"",
"W(k+1) = \n");
961 (*effects_prettyprint_func)(l_next_stat_w_eff);
970 (*effects_sup_difference_op)(l_out_prime,
978 (*effects_transformer_composition_op)(l_out_prime, c_stat_trans);
981 debug(1,
"",
"OUT'_k = \n");
982 (*effects_prettyprint_func)(l_out_prime);
987 debug(1,
"",
"IN'_(k+1) = \n");
988 (*effects_prettyprint_func)(l_in_prime);
995 (*effects_transformer_composition_op)(l_in_prime, c_stat_trans);
998 debug(1,
"",
"IN'_(k+1) = "
999 "(after elimination of modified variables)\n");
1000 (*effects_prettyprint_func)(l_in_prime);
1008 l_tmp = (*effects_union_op)(
effects_dup(l_out_prime),
1012 debug(1,
"",
"OUT'_k Umust IN'_(k+1) = \n");
1013 (*effects_prettyprint_func)(l_tmp);
1020 l_out_stat = (*effects_intersection_op)(
effects_dup(l_c_stat_w_eff),
1025 debug(1,
"",
"OUT_k = \n");
1026 (*effects_prettyprint_func)(l_out_stat);
1034 l_next_stat_w_eff = l_c_stat_w_eff;
1068 out_effects_of_module_statement(
statement module_stat, out_effects_context *ctxt)
1076 statement_domain, out_effects_statement_filter, out_effects_statement_leave,
1107 debug_on(
"OUT_EFFECTS_DEBUG_LEVEL");
1108 debug(1,
"out_effects",
"begin\n");
1138 l_sum_out = (*db_get_summary_out_effects_func)(
module_name);
1144 out_effects_context ctxt;
1145 init_out_effects_context(&ctxt, representation);
1146 out_effects_of_module_statement(module_stat, &ctxt);
1147 reset_out_effects_context(&ctxt);
bool descriptor_defined_p(descriptor p)
descriptor copy_descriptor(descriptor p)
DESCRIPTOR.
effect copy_effect(effect p)
EFFECT.
void free_descriptor(descriptor p)
static const char * caller_name
static statement current_stmt
static entity current_callee
#define pips_debug_effects(level, message, l_eff)
effects_representation_val
void free_effects_private_current_context_stack(void)
void set_invariant_in_effects(statement_effects)
void update_out_summary_effects_list(list)
void set_cumulated_in_effects(statement_effects)
void effects_to_write_effects(list)
list effects_store_effects(list)
statement_effects(* db_get_invariant_in_effects_func)(const char *)
void set_rw_effects(statement_effects)
void reset_invariant_in_effects(void)
void effects_to_may_effects(list)
void init_out_effects(void)
void make_effects_private_current_context_stack(void)
list load_out_effects_list(statement)
void reset_out_summary_effects_list(void)
out_effects_engine.c
list generic_effects_forward_translation(entity, list, list, transformer)
void make_effects_private_current_stmt_stack(void)
utils.c
list get_out_summary_effects_list(void)
void descriptor_variable_rename(descriptor, entity, entity)
void reset_cumulated_in_effects(void)
statement_effects(* db_get_invariant_rw_effects_func)(const char *)
void array_effects_to_may_effects(list)
bool out_effects_engine(const char *, effects_representation_val)
list effects_write_effects_dup(list)
bool w_r_combinable_p(effect, effect)
transformer descriptor_to_context(descriptor)
statement_effects(* db_get_out_effects_func)(const char *)
statement effects_private_current_stmt_pop(void)
void reset_out_effects(void)
bool get_descriptor_range_p(void)
void free_effects_private_current_stmt_stack(void)
bool normalizable_and_linear_loop_p(entity, range)
list load_in_effects_list(statement)
descriptor descriptor_inequality_add(descriptor, Pvecteur)
statement_effects(* db_get_cumulated_in_effects_func)(const char *)
bool summary_out_effects_engine(const char *)
statement effects_private_current_stmt_head(void)
void set_out_effects(statement_effects)
void effects_private_current_stmt_push(statement)
descriptor descriptor_append(descriptor, descriptor)
void set_in_effects(statement_effects)
list load_cumulated_in_effects_list(statement)
void reset_in_effects(void)
bool w_w_combinable_p(effect, effect)
list load_rw_effects_list(statement)
list effects_write_effects(list)
void store_out_effects_list(statement, list)
void reset_invariant_rw_effects(void)
statement_effects get_out_effects(void)
statement_effects(* db_get_in_effects_func)(const char *)
bool r_w_combinable_p(effect, effect)
void set_invariant_rw_effects(statement_effects)
void reset_rw_effects(void)
bool effects_same_action_p(effect, effect)
statement_effects(* db_get_rw_effects_func)(const char *)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_approximation_tag(eff)
#define approximation_tag(x)
#define action_write_p(x)
#define descriptor_undefined
#define effect_approximation(x)
const char * module_name(const char *s)
Return the module part of an entity name.
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
statement set_current_module_statement(statement)
Set the current module statement.
statement get_current_module_statement(void)
Get the current module statement.
entity set_current_module_entity(entity)
static.c
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
bool gen_false(__attribute__((unused)) gen_chunk *unused)
Return false and ignore the argument.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
#define ENDP(l)
Test if a list is empty.
#define list_undefined_p(c)
Return if a list is undefined.
list gen_nreverse(list cp)
reverse a list in place
#define NIL
The empty list (nil in Lisp)
list gen_copy_seq(list l)
Copy a list structure.
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
#define CAR(pcons)
Get the value of the first element of a list.
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define list_undefined
Undefined list definition :-)
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
static void reset_converted_rw_effects(list *lrw, live_paths_analysis_context *ctxt)
static list convert_rw_effects(list lrw, live_paths_analysis_context *ctxt)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
const char * entity_minimal_name(entity e)
Do preserve scope informations.
bool set_belong_p(const set, const void *)
set set_make(set_type)
Create an empty set of any type but hash_private.
set set_add_element(set, const set, const void *)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
void print_statement(statement)
Print a statement on stderr.
void set_bool_property(const char *, bool)
#define NORMALIZE_EXPRESSION(e)
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
const char * module_local_name(entity e)
Returns the module local user name.
bool entity_pointer_p(entity e)
statement pop_statement_global_stack(void)
void push_statement_on_statement_global_stack(statement)
void free_statement_global_stack(void)
void make_statement_global_stack(void)
#define forloop_domain
newgen_extensions_domain_defined
#define test_domain
newgen_entity_domain_defined
struct _newgen_struct_callees_ * callees
#define transformer_undefined
#define unstructured_domain
newgen_type_domain_defined
#define callees_callees(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define control_predecessors(x)
#define statement_ordering(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define range_increment(x)
#define call_domain
newgen_callees_domain_defined
#define sequence_statements(x)
#define control_successors(x)
#define whileloop_body(x)
#define whileloop_domain
newgen_variable_domain_defined
#define call_arguments(x)
#define control_statement(x)
#define statement_number(x)
#define normalized_linear(x)
#define sequence_domain
newgen_reference_domain_defined
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Pvecteur vect_make(Pvecteur v, Variable var, Value val,...)
Pvecteur vect_make(v, [var, val,]* 0, val) Pvecteur v; // may be NULL, use assigne anyway Variable va...
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...