PIPS
|
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "workspace-util.h"
#include "prettyprint.h"
#include "effects.h"
#include "effects-util.h"
#include "text-util.h"
#include "effects-simple.h"
#include "effects-generic.h"
#include "pipsdbm.h"
#include "misc.h"
#include "pointer_values.h"
Go to the source code of this file.
Macros | |
#define | UNDEF abort |
#define | PV_NB_MAX_ITER_FIX_POINT 3 |
Typedefs | |
typedef void(* | void_function) () |
typedef gen_chunk *(* | chunks_function) () |
typedef list(* | list_function) () |
typedef bool(* | bool_function) () |
typedef descriptor(* | descriptor_function) () |
typedef statement_cell_relations(* | statement_cell_relations_function) () |
typedef statement_effects(* | statement_effects_function) () |
typedef cell_relation(* | cell_relation_function) () |
#define PV_NB_MAX_ITER_FIX_POINT 3 |
Definition at line 619 of file pointer_values_analyses.c.
#define UNDEF abort |
Definition at line 151 of file pointer_values_analyses.c.
typedef bool(* bool_function) () |
Definition at line 156 of file pointer_values_analyses.c.
typedef cell_relation(* cell_relation_function) () |
Definition at line 160 of file pointer_values_analyses.c.
typedef gen_chunk*(* chunks_function) () |
Definition at line 154 of file pointer_values_analyses.c.
typedef descriptor(* descriptor_function) () |
Definition at line 157 of file pointer_values_analyses.c.
typedef list(* list_function) () |
Definition at line 155 of file pointer_values_analyses.c.
typedef statement_cell_relations(* statement_cell_relations_function) () |
Definition at line 158 of file pointer_values_analyses.c.
typedef statement_effects(* statement_effects_function) () |
Definition at line 159 of file pointer_values_analyses.c.
typedef void(* void_function) () |
Definition at line 153 of file pointer_values_analyses.c.
void assignment_to_post_pv | ( | expression | lhs, |
bool | may_lhs_p, | ||
expression | rhs, | ||
bool | declaration_p, | ||
list | l_in, | ||
pv_results * | pv_res, | ||
pv_context * | ctxt | ||
) |
first convert the rhs and lhs into memory paths, rhs is evaluated first
this is done even if this is a non-pointer assignment, becasue there maybe side effects on alising hidden in sub-expressions, function calls...
we should test here that lhs_pv_res.result_paths has only one element. well is it correct? can a relational operator expression be a lhs ?
l_gen = NIL; l_kill = NIL;
simple case first: lhs is a pointer
hidden pointer assignments
lhs | hs |
may_lhs_p | ay_lhs_p |
rhs | hs |
declaration_p | eclaration_p |
l_in | _in |
pv_res | v_res |
ctxt | txt |
Definition at line 1582 of file pointer_values_analyses.c.
References basic_concrete_type_leads_to_pointer_p(), bool_to_string(), CAR, CELL_INTERPRETATION, CONS, copy_effect(), EFFECT, effect_to_may_effect(), effect_undefined, expression_to_post_pv(), expression_to_type(), free_pv_results_paths(), pv_results::l_out, make_cell_interpretation_value_of(), make_pv_results(), multiple_pointer_assignment_to_post_pv(), NIL, pips_debug, pips_debug_pv_results, pips_debug_pvs, pips_internal_error, pointer_type_p(), pv_results::result_paths, pv_results::result_paths_interpretations, single_pointer_assignment_to_post_pv(), type_functional_p, type_fundamental_basic_p(), and type_variable_p.
Referenced by assignment_intrinsic_to_post_pv(), declaration_to_post_pv(), and pointer_values_remove_var().
|
static |
We should be here only in case of a pointer value rhs, and the value should be 0
use approximation_exact to be consistent with effects, should be approximation_exact
constant strings
not generic here
Definition at line 1141 of file pointer_values_analyses.c.
References basic_string_p, call_arguments, call_function, CELL_INTERPRETATION, CONS, constant_int, constant_int_p, EFFECT, effect_add_dereferencing_dimension(), entity_initial, entity_local_name(), entity_type, external_call_to_post_pv(), functional_result, intrinsic_to_post_pv(), is_value_code, is_value_constant, is_value_intrinsic, is_value_symbolic, is_value_unknown, pv_results::l_out, make_action_read_memory(), make_approximation_exact(), make_cell_interpretation_address_of(), make_cell_interpretation_value_of(), make_cell_reference(), make_descriptor_none(), make_effect(), make_null_pointer_value_cell(), make_reference(), NIL, pips_debug, pips_debug_pvs, pips_internal_error, pv_results::result_paths, pv_results::result_paths_interpretations, type_functional, type_functional_p, type_statement_p, type_variable, type_variable_p, ultimate_type(), value_constant, value_tag, and variable_basic.
Referenced by expression_to_post_pv(), and instruction_to_post_pv().
list db_get_in_simple_pv | ( | const char * | module_name | ) |
module_name | odule_name |
Definition at line 73 of file pointer_values_analyses.c.
References cell_relations_list, db_get_memory_resource(), and module_name().
Referenced by make_simple_pv_context().
list db_get_initial_simple_pv | ( | const char * | module_name | ) |
module_name | odule_name |
Definition at line 93 of file pointer_values_analyses.c.
References cell_relations_list, db_get_memory_resource(), and module_name().
Referenced by make_simple_pv_context().
list db_get_out_simple_pv | ( | const char * | module_name | ) |
module_name | odule_name |
Definition at line 83 of file pointer_values_analyses.c.
References cell_relations_list, db_get_memory_resource(), and module_name().
Referenced by make_simple_pv_context().
list db_get_program_simple_pv | ( | void | ) |
Definition at line 103 of file pointer_values_analyses.c.
References cell_relations_list, and db_get_memory_resource().
Referenced by make_simple_pv_context().
statement_cell_relations db_get_simple_pv | ( | const char * | module_name | ) |
I don't know how to deal with these mappings if we have to analyse several modules at the same time when performing an interprocedural analysis.
We may need a stack of mappings, or a global mapping for the whole program, and a temporary mapping to store the resources one module at a time
module_name | odule_name |
Definition at line 63 of file pointer_values_analyses.c.
References db_get_memory_resource(), and module_name().
Referenced by make_simple_pv_context().
void db_put_in_simple_pv | ( | const char * | module_name, |
list | l_pv | ||
) |
module_name | odule_name |
l_pv | _pv |
Definition at line 78 of file pointer_values_analyses.c.
References DB_PUT_MEMORY_RESOURCE, make_cell_relations(), and module_name().
Referenced by make_simple_pv_context().
void db_put_initial_simple_pv | ( | const char * | module_name, |
list | l_pv | ||
) |
module_name | odule_name |
l_pv | _pv |
Definition at line 98 of file pointer_values_analyses.c.
References DB_PUT_MEMORY_RESOURCE, make_cell_relations(), and module_name().
Referenced by make_simple_pv_context().
void db_put_out_simple_pv | ( | const char * | module_name, |
list | l_pv | ||
) |
module_name | odule_name |
l_pv | _pv |
Definition at line 88 of file pointer_values_analyses.c.
References DB_PUT_MEMORY_RESOURCE, make_cell_relations(), and module_name().
Referenced by make_simple_pv_context().
void db_put_program_simple_pv | ( | list | l_pv | ) |
l_pv | _pv |
Definition at line 108 of file pointer_values_analyses.c.
References DB_PUT_MEMORY_RESOURCE, and make_cell_relations().
Referenced by make_simple_pv_context().
void db_put_simple_pv | ( | const char * | module_name, |
statement_cell_relations | scr | ||
) |
module_name | odule_name |
scr | cr |
Definition at line 68 of file pointer_values_analyses.c.
References DB_PUT_MEMORY_RESOURCE, and module_name().
Referenced by make_simple_pv_context().
|
static |
turned to true if rhs_exp is built and must be freed
in case of a local static variable, and when not dealing with the initial analysis, we should generate a stub sink
when no initialization is provided for pointer static variables, or aggregate variables which recursively have pointer fields, then all pointers are initialized to NULL previous to program execution.
Definition at line 408 of file pointer_values_analyses.c.
References assignment_to_post_pv(), basic_concrete_type_leads_to_pointer_p(), compilation_unit_entity_p(), entity_basic_concrete_type(), entity_initial, entity_name, entity_static_variable_p(), entity_to_expression(), entity_user_name(), expression_undefined, free_expression(), free_pv_results_paths(), get_current_module_entity(), pv_context::initial_pointer_values_p, is_value_code, is_value_constant, is_value_expression, is_value_intrinsic, is_value_symbolic, is_value_unknown, pv_results::l_out, make_address_of_expression(), make_pv_results(), NIL, null_pointer_value_entity(), pips_debug, pips_debug_pvs, pips_internal_error, same_string_p, std_file_entity_p(), std_file_entity_to_pointed_file_entity(), string_of_type(), type_fundamental_basic_p(), type_to_string(), type_variable_p, typedef_entity_p(), undefined_pointer_value_entity(), value_expression, value_tag, and value_undefined.
Referenced by declarations_to_post_pv(), generic_module_initial_pointer_values(), and sequence_to_post_pv().
|
static |
well, not exactly, we must take kills into account
Definition at line 391 of file pointer_values_analyses.c.
References declaration_to_post_pv(), ENTITY, FOREACH, gen_nconc(), pips_debug, and pips_debug_pvs.
Referenced by statement_to_post_pv().
void expression_to_post_pv | ( | expression | exp, |
list | l_in, | ||
pv_results * | pv_res, | ||
pv_context * | ctxt | ||
) |
we assume no effects on aliases due to subscripts evaluations for the moment
we assume no effects on aliases due to sizeof argument expression for the moment
aborts if there are calls in subscript expressions
free the spine
we assume no effects on aliases due to subscripts evaluations for the moment
exp | xp |
l_in | _in |
pv_res | v_res |
ctxt | txt |
Definition at line 930 of file pointer_values_analyses.c.
References call_to_post_pv(), cast_expression, CELL_INTERPRETATION, CONS, copy_reference(), EFFECT, entity_local_name(), exp, expression_syntax, expression_to_post_pv(), expression_to_string(), expression_undefined_p, FOREACH, gen_free_list(), gen_full_free_list(), generic_proper_effects_of_complex_address_expression(), is_syntax_application, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, is_syntax_va_arg, pv_results::l_out, make_action_read_memory(), make_action_write_memory(), make_approximation_exact(), make_cell_interpretation_value_of(), make_descriptor_none(), make_effect(), make_null_pointer_value_cell(), make_undefined_pointer_value_cell(), NIL, pips_debug, pips_debug_pv_results, pips_internal_error, reference_to_effect_func, reference_variable, pv_results::result_paths, pv_results::result_paths_interpretations, same_string_p, syntax_call, syntax_cast, syntax_reference, and syntax_tag.
Referenced by address_of_to_post_pv(), assignment_to_post_pv(), binary_arithmetic_operator_to_post_pv(), c_return_to_post_pv(), conditional_operator_to_post_pv(), default_intrinsic_to_post_pv(), dereferencing_to_post_pv(), expression_to_post_pv(), external_call_to_post_pv(), field_to_post_pv(), forloop_to_post_pv(), heap_intrinsic_to_post_pv(), instruction_to_post_pv(), logical_operator_to_post_pv(), point_to_to_post_pv(), range_to_post_pv(), safe_intrinsic_to_post_pv(), test_to_post_pv(), unary_arithmetic_operator_to_post_pv(), update_operator_to_post_pv(), and whileloop_to_post_pv().
|
static |
the expression that denotes the called function and the arguments are evaluated; then there is a sequence point, and the function is called
Arguments evaluation: we don't use expressions_to_post_pv because we want to accumulate the results paths
Function call: we generate abstract_location targets for all possible effects from arguments. We should also do the same for all global variables in the current compilation unit...
to avoid too long paths until GAPS are handled
only pointers
Return value: test the type of the result path : if it's a pointer type, generate an abstract location target of the pointed type, else it's an empty set/list.
Definition at line 1046 of file pointer_values_analyses.c.
References call_arguments, call_function, CAR, CELL_INTERPRETATION, cell_interpretation_address_of_p, cell_to_type(), compute_basic_concrete_type(), CONS, EFFECT, effect_cell, effects_to_may_effects(), ENDP, entity_local_name(), entity_type, EXPRESSION, expression_to_post_pv(), FOREACH, free_type(), functional_result, gen_full_free_list(), gen_nconc(), generic_effect_generate_all_accessible_paths_effects_with_level(), pv_results::l_out, make_action_write_memory(), make_anywhere_effect(), make_cell_interpretation_address_of(), make_pv_results(), NIL, pips_debug, pips_debug_effect, pips_debug_effects, pips_debug_pvs, pointer_type_p(), POP, pv_results::result_paths, pv_results::result_paths_interpretations, single_pointer_assignment_to_post_pv(), and type_functional.
Referenced by call_to_post_pv().
|
static |
First, the initialization is always evaluatated
saved in case fix point is not reached
condition is evaluated before each iteration
increment expression is evaluated at the end of each iteration
this iteration may never be executed :
now update input pointer values of inner loop statements
Definition at line 794 of file pointer_values_analyses.c.
References CELL_INTERPRETATION, CONS, EFFECT, expression_to_post_pv(), forloop_body, forloop_condition, forloop_increment, forloop_initialization, free_effect(), free_pv_results_paths(), gen_free_list(), gen_full_copy_list(), gen_full_free_list(), init, pv_results::l_out, make_action_write_memory(), make_anywhere_effect(), make_cell_interpretation_address_of(), make_pv_results(), NIL, pips_debug, pips_debug_pvs, PV_NB_MAX_ITER_FIX_POINT, pv_context::pvs_equal_p_func, pv_context::pvs_may_union_func, single_pointer_assignment_to_post_pv(), and statement_to_post_pv().
Referenced by instruction_to_post_pv().
void free_pv_results_paths | ( | pv_results * | pv_res | ) |
pv_res | v_res |
Definition at line 203 of file pointer_values_analyses.c.
References gen_full_free_list(), NIL, pv_results::result_paths, and pv_results::result_paths_interpretations.
Referenced by assignment_to_post_pv(), binary_arithmetic_operator_to_post_pv(), declaration_to_post_pv(), default_intrinsic_to_post_pv(), forloop_to_post_pv(), free_to_post_pv(), heap_intrinsic_to_post_pv(), instruction_to_post_pv(), logical_operator_to_post_pv(), loop_to_post_pv(), range_to_post_pv(), safe_intrinsic_to_post_pv(), sequence_to_post_pv(), single_pointer_assignment_to_post_pv(), test_to_post_pv(), and whileloop_to_post_pv().
|
static |
Definition at line 1835 of file pointer_values_analyses.c.
References db_get_memory_resource(), pv_context::db_put_initial_pv_func, debug_off, debug_on, declaration_to_post_pv(), ENTITY, FOREACH, get_current_module_entity(), init_pv(), module_name(), module_name_to_entity(), module_to_all_declarations(), NIL, pips_debug, pips_debug_pvs, reset_current_module_entity(), reset_current_module_statement(), reset_pv(), set_current_module_entity(), set_current_module_statement(), and variable_static_p().
Referenced by initial_simple_pointer_values().
|
static |
generic interface to compute the pointer values of a given module
module_name | is the name of the module |
ctxt | gives the functions specific to the kind of pointer values to be computed. |
temporary settings : in an interprocedural context we need to keep track of visited modules
Get the code of the module.
Definition at line 1798 of file pointer_values_analyses.c.
References db_get_memory_resource(), pv_context::db_get_program_pv_func, pv_context::db_put_in_pv_func, pv_context::db_put_out_pv_func, pv_context::db_put_pv_func, debug_off, debug_on, entity_main_module_p(), gen_full_copy_list(), get_current_module_entity(), get_current_module_statement(), get_pv(), init_pv(), module_initial_parameter_pv(), module_name(), module_name_to_entity(), pips_debug, pv_context::pvs_must_union_func, reset_current_module_entity(), reset_current_module_statement(), reset_pv(), set_current_module_entity(), set_current_module_statement(), and statement_to_post_pv().
Referenced by simple_pointer_values().
|
static |
Unavoidable pitfall: initializations in uncalled modules may be taken into account. It all depends on the "create" command.
Definition at line 1871 of file pointer_values_analyses.c.
References pv_context::db_get_initial_pv_func, db_get_module_list(), pv_context::db_put_program_pv_func, debug_off, debug_on, entity_undefined, gen_array_item(), gen_array_nitems(), gen_full_copy_list(), gen_nconc(), get_main_entity_name(), module_local_name(), module_name(), module_name_to_entity(), NIL, pips_assert, pips_debug, pips_debug_pvs, reset_current_module_entity(), and set_current_module_entity().
Referenced by program_simple_pointer_values().
module_name | odule_name |
Definition at line 1925 of file pointer_values_analyses.c.
References generic_effects_reset_all_methods(), generic_module_initial_pointer_values(), pv_context::initial_pointer_values_p, make_simple_pv_context(), module_name(), reset_pv_context(), and set_methods_for_simple_effects().
|
static |
Definition at line 537 of file pointer_values_analyses.c.
References call_to_post_pv(), expression_to_post_pv(), forloop_to_post_pv(), free_pv_results_paths(), instruction_call, instruction_expression, instruction_forloop, instruction_loop, instruction_sequence, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_multitest, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, pv_results::l_out, loop_to_post_pv(), make_pv_results(), NIL, pips_debug, pips_debug_pvs, pips_internal_error, sequence_to_post_pv(), test_to_post_pv(), unstructured_to_post_pv(), and whileloop_to_post_pv().
Referenced by statement_to_post_pv().
|
static |
first loop range is evaluated
then, the loop body is executed if and only if the upper bound is greater than the lower bound, else the loop body is only possibly executed.
as a first approximation, we perform no test on the loop bounds, and thus assume that the loop body is only possibly executed
this iteration may never be executed :
now update input pointer values of inner loop statements
Definition at line 622 of file pointer_values_analyses.c.
References CELL_INTERPRETATION, CONS, EFFECT, free_effect(), free_pv_results_paths(), gen_free_list(), gen_full_copy_list(), gen_full_free_list(), pv_results::l_out, loop_body, loop_range, make_action_write_memory(), make_anywhere_effect(), make_cell_interpretation_address_of(), make_pv_results(), NIL, pips_debug, pips_debug_pvs, PV_NB_MAX_ITER_FIX_POINT, pv_context::pvs_equal_p_func, pv_context::pvs_may_union_func, range_to_post_pv(), single_pointer_assignment_to_post_pv(), and statement_to_post_pv().
Referenced by instruction_to_post_pv().
list make_anywhere_anywhere_pvs | ( | void | ) |
Definition at line 237 of file pointer_values_analyses.c.
References CELL_RELATION, CONS, copy_cell(), entity_all_locations(), is_approximation_may, make_address_of_pointer_value(), make_cell_reference(), make_descriptor_none(), make_reference(), and NIL.
Referenced by unstructured_to_post_pv().
pv_results make_pv_results | ( | void | ) |
Definition at line 194 of file pointer_values_analyses.c.
References pv_results::l_out, NIL, pv_results::result_paths, and pv_results::result_paths_interpretations.
Referenced by assignment_to_post_pv(), binary_arithmetic_operator_to_post_pv(), conditional_operator_to_post_pv(), declaration_to_post_pv(), external_call_to_post_pv(), forloop_to_post_pv(), heap_intrinsic_to_post_pv(), instruction_to_post_pv(), logical_operator_to_post_pv(), loop_to_post_pv(), safe_intrinsic_to_post_pv(), sequence_to_post_pv(), test_to_post_pv(), and whileloop_to_post_pv().
pv_context make_simple_pv_context | ( | void | ) |
Definition at line 119 of file pointer_values_analyses.c.
References pv_context::cell_preceding_p_func, pv_context::cell_reference_with_address_of_cell_reference_translation_func, pv_context::cell_reference_with_value_of_cell_reference_translation_func, pv_context::db_get_in_pv_func, db_get_in_simple_pv(), pv_context::db_get_initial_pv_func, db_get_initial_simple_pv(), pv_context::db_get_out_pv_func, db_get_out_simple_pv(), pv_context::db_get_program_pv_func, db_get_program_simple_pv(), pv_context::db_get_pv_func, db_get_simple_pv(), pv_context::db_put_in_pv_func, db_put_in_simple_pv(), pv_context::db_put_initial_pv_func, db_put_initial_simple_pv(), pv_context::db_put_out_pv_func, db_put_out_simple_pv(), pv_context::db_put_program_pv_func, db_put_program_simple_pv(), pv_context::db_put_pv_func, db_put_simple_pv(), pv_context::initial_pointer_values_p, pv_context::make_pv_from_effects_func, make_simple_pv_from_simple_effects(), pv_context::pv_composition_with_transformer_func, pv_context::pvs_equal_p_func, pv_context::pvs_may_union_func, pv_context::pvs_must_union_func, simple_cell_preceding_p(), simple_cell_reference_with_address_of_cell_reference_translation(), simple_cell_reference_with_value_of_cell_reference_translation(), simple_pv_composition_with_transformer(), simple_pvs_may_union(), simple_pvs_must_union(), simple_pvs_syntactically_equal_p(), stack_make(), statement_domain, and pv_context::stmt_stack.
Referenced by convex_effect_find_aliased_paths_with_pointer_values(), initial_simple_pointer_values(), print_code_simple_gen_kill_pointer_values(), print_code_simple_pointer_values(), program_simple_pointer_values(), simple_effect_to_constant_path_effects_with_pointer_values(), and simple_pointer_values().
|
static |
to avoid too long paths until GAPS are handled
Definition at line 1657 of file pointer_values_analyses.c.
References basic_pointer, basic_pointer_p, CELL_RELATION, cell_to_type(), concatenate(), CONS, copy_basic(), copy_cell(), copy_storage(), DIMENSION, EFFECT, effect_any_reference, effect_approximation_tag, effect_cell, ENDP, ENTITY, entity_all_locations(), entity_basic_concrete_type(), entity_undefined, entity_user_name(), EXPRESSION, FindOrCreateEntity(), FOREACH, free_storage(), free_type(), gen_full_copy_list(), gen_full_free_list(), gen_length(), gen_nconc(), generic_effect_generate_all_accessible_paths_effects_with_level(), get_current_module_entity(), get_current_module_name(), int2a(), int_to_expression(), make_action_write_memory(), make_address_of_pointer_value(), make_approximation_exact(), make_cell_reference(), make_descriptor_none(), make_dimension(), make_entity, make_ram(), make_reference(), make_reference_simple_effect, make_storage_ram(), make_type_variable(), make_unbounded_expression(), make_value_unknown(), make_variable(), module, module_formal_parameters(), MODULE_SEP_STRING, NIL, pips_debug, pips_debug_effect, pips_debug_pv, pointed_type(), POINTER_DUMMY_TARGETS_AREA_LOCAL_NAME, reference_indices, strdup(), string_of_type(), type_to_string(), type_undefined, type_variable, type_variable_p, unbounded_expression_p(), UNKNOWN_RAM_OFFSET, variable_basic, and variable_dimensions.
Referenced by generic_module_pointer_values().
void multiple_pointer_assignment_to_post_pv | ( | effect | lhs_base_eff, |
type | lhs_type, | ||
list | l_rhs_base_eff, | ||
list | l_rhs_base_kind, | ||
bool | declaration_p, | ||
list | l_in, | ||
pv_results * | pv_res, | ||
pv_context * | ctxt | ||
) |
we could be more precise here on abstract locations
if (!anywhere_lhs_p)
lhs is not a pointer, but it is an array of pointers or an aggregate type with pointers....
In this case, it cannot be an address_of case
First, search for all accessible pointers
to work around the fact that exact effects are must effects
Then for each found pointer, do as if there were an assignment by translating the rhs path accordingly
build the list of corresponding rhs
should be refined
general case at least :-)
This is not generic, I should use a translation algorithm here I guess
first skip dimensions of kill_ref similar to lhs_base_ref
add the remaining dimensions to the copy of rhs_base_eff
while
if (!ENDP(l_lhs))
if (!anywhere_lhs_p)
lhs_base_eff | hs_base_eff |
lhs_type | hs_type |
l_rhs_base_eff | _rhs_base_eff |
l_rhs_base_kind | _rhs_base_kind |
declaration_p | eclaration_p |
l_in | _in |
pv_res | v_res |
ctxt | txt |
Definition at line 1444 of file pointer_values_analyses.c.
References anywhere_effect_p(), CAR, CELL_INTERPRETATION, cell_reference_to_type(), cell_undefined, cell_undefined_p, CONS, copy_effect(), EFFECT, effect_any_reference, effect_cell, effect_exact_p, effects_to_must_effects(), ENDP, EXPRESSION, FOREACH, free_type(), gen_free_list(), gen_full_free_list(), gen_length(), generic_effect_generate_all_accessible_paths_effects_with_level(), is_action_write, pv_results::l_out, make_action_write_memory(), make_anywhere_effect(), make_cell_interpretation_address_of(), NIL, null_pointer_value_cell_p(), pips_assert, pips_debug, pips_debug_effects, POP, reference_indices, pv_results::result_paths, single_pointer_assignment_to_post_pv(), type_equal_p(), and undefined_pointer_value_cell_p().
Referenced by assignment_to_post_pv().
void print_pv_results | ( | pv_results | pv_res | ) |
pv_res | v_res |
Definition at line 211 of file pointer_values_analyses.c.
References CAR, CELL_INTERPRETATION, cell_interpretation_value_of_p, EFFECT, ENDP, fprintf(), pv_results::l_out, POP, print_pointer_values(), pv_results::result_paths, and pv_results::result_paths_interpretations.
prog_name | rog_name |
Definition at line 1936 of file pointer_values_analyses.c.
References generic_effects_reset_all_methods(), generic_program_pointer_values(), make_simple_pv_context(), reset_pv_context(), and set_methods_for_simple_effects().
statement pv_context_statement_head | ( | pv_context * | ctxt | ) |
ctxt | txt |
Definition at line 187 of file pointer_values_analyses.c.
References stack_head(), and pv_context::stmt_stack.
Referenced by heap_intrinsic_to_post_pv().
void pv_context_statement_pop | ( | pv_context * | ctxt | ) |
ctxt | txt |
Definition at line 182 of file pointer_values_analyses.c.
References stack_pop(), and pv_context::stmt_stack.
Referenced by sequence_to_post_pv(), and statement_to_post_pv().
void pv_context_statement_push | ( | statement | s, |
pv_context * | ctxt | ||
) |
ctxt | txt |
Definition at line 177 of file pointer_values_analyses.c.
References stack_push(), and pv_context::stmt_stack.
Referenced by sequence_to_post_pv(), and statement_to_post_pv().
void range_to_post_pv | ( | range | r, |
list | l_in, | ||
pv_results * | pv_res, | ||
pv_context * | ctxt | ||
) |
l_in | _in |
pv_res | v_res |
ctxt | txt |
Definition at line 913 of file pointer_values_analyses.c.
References expression_to_post_pv(), free_pv_results_paths(), pv_results::l_out, pips_debug, pips_debug_pvs, range_increment, range_lower, and range_upper.
Referenced by loop_to_post_pv().
void reset_pv_context | ( | pv_context * | p_ctxt | ) |
p_ctxt->db_get_gen_pv_func =(statement_cell_relations_function) UNDEF ;
p_ctxt->db_put_gen_pv_func = (void_function) UNDEF;
p_ctxt->db_get_kill_pv_func = (statement_effects_function) UNDEF;
p_ctxt->db_put_kill_pv_func = (void_function) UNDEF;
p_ctxt | _ctxt |
Definition at line 162 of file pointer_values_analyses.c.
References pv_context::db_get_pv_func, pv_context::db_put_pv_func, pv_context::make_pv_from_effects_func, pv_context::pv_composition_with_transformer_func, pv_context::pvs_equal_p_func, pv_context::pvs_may_union_func, pv_context::pvs_must_union_func, and UNDEF.
Referenced by convex_effect_find_aliased_paths_with_pointer_values(), initial_simple_pointer_values(), print_code_simple_gen_kill_pointer_values(), print_code_simple_pointer_values(), program_simple_pointer_values(), simple_effect_to_constant_path_effects_with_pointer_values(), and simple_pointer_values().
|
static |
keep local variables in declaration reverse order
beware don't push static variables and non pointer variables.
don't forget to eliminate local declarations on exit
...
Definition at line 289 of file pointer_values_analyses.c.
References basic_concrete_type_leads_to_pointer_p(), bound_pv_p(), CONS, declaration_statement_p(), declaration_to_post_pv(), ENDP, ENTITY, entity_basic_concrete_type(), entity_name, entity_storage, entity_to_expression(), FOREACH, free_expression(), free_pv_results_paths(), gen_full_copy_list(), ifdebug, pv_results::l_out, make_cell_relations(), make_pv_results(), NIL, pips_debug, pips_debug_pvs, pointer_values_remove_var(), print_statement(), pv_context_statement_pop(), pv_context_statement_push(), ram_section, sequence_statements, STATEMENT, statement_declarations, statement_to_post_pv(), static_area_p(), storage_ram, storage_ram_p, store_pv(), type_fundamental_basic_p(), undefined_pointer_value_entity(), and update_pv().
Referenced by instruction_to_post_pv().
interface to compute the simple pointer values of a given module
module_name | odule_name |
Definition at line 1915 of file pointer_values_analyses.c.
References generic_effects_reset_all_methods(), generic_module_pointer_values(), make_simple_pv_context(), module_name(), reset_pv_context(), and set_methods_for_simple_effects().
void single_pointer_assignment_to_post_pv | ( | effect | lhs_eff, |
list | l_rhs_eff, | ||
list | l_rhs_kind, | ||
bool | declaration_p, | ||
list | l_in, | ||
pv_results * | pv_res, | ||
pv_context * | ctxt | ||
) |
First search for all killed paths
we could be more precise/generic on abstract locations
no aliases for a newly declared entity
if lhs_eff is a may-be-killed, then all aliased effects are also may-be-killed effects
we must find in l_in all pointers p and generate p == rhs for all rhs if p is of a type compatible with rhs, and p == &*anywhere* otherwise. in fact, for the moment we generate p == &*anywhere* in all cases
dealing with first cell
not generic
not generic
generate for all alias p in l_kill p == rhs_eff
except for p==undefined or p==null (should other abstract values/locations be ignored here?)
now take kills into account
and add gen
lhs_eff | hs_eff |
l_rhs_eff | _rhs_eff |
l_rhs_kind | _rhs_kind |
declaration_p | eclaration_p |
l_in | _in |
pv_res | v_res |
ctxt | txt |
Definition at line 1253 of file pointer_values_analyses.c.
References anywhere_effect_p(), CAR, CELL_INTERPRETATION, cell_interpretation_value_of_p, CELL_RELATION, cell_relation_first_cell, cell_relation_second_cell, cell_relation_second_value_of_p, CONS, copy_cell(), copy_effect(), EFFECT, effect_find_aliased_paths_with_pointer_values(), effect_may_p, effect_to_string(), effects_to_may_effects(), ENDP, FOREACH, free_cell_interpretation(), free_effect(), free_pv_results_paths(), gen_full_free_list(), gen_length(), gen_nconc(), ifdebug, kill_pointer_values(), pv_results::l_out, make_action_write_memory(), make_anywhere_effect(), make_approximation_may(), make_cell_interpretation_address_of(), make_descriptor_none(), make_effect(), pv_context::make_pv_from_effects_func, NIL, null_pointer_value_cell_p(), null_pointer_value_effect_p(), pips_assert, pips_debug, pips_debug_effect, pips_debug_effects, pips_debug_pvs, pips_user_warning, POP, pv_context::pvs_must_union_func, pv_results::result_paths, pv_results::result_paths_interpretations, undefined_pointer_value_cell_p(), and undefined_pointer_value_effect_p().
Referenced by assignment_to_post_pv(), external_call_to_post_pv(), forloop_to_post_pv(), free_to_post_pv(), loop_to_post_pv(), multiple_pointer_assignment_to_post_pv(), safe_intrinsic_to_post_pv(), update_operator_to_post_pv(), and whileloop_to_post_pv().
|
static |
Definition at line 356 of file pointer_values_analyses.c.
References bound_pv_p(), declaration_statement_p(), declarations_to_post_pv(), gen_full_copy_list(), instruction_to_post_pv(), make_cell_relations(), NIL, pips_debug, pips_debug_pvs, pv_context_statement_pop(), pv_context_statement_push(), pvs_composition_with_transformer(), statement_declarations, statement_instruction, store_pv(), transformer_undefined, and update_pv().
Referenced by forloop_to_post_pv(), generic_module_pointer_values(), loop_to_post_pv(), sequence_to_post_pv(), test_to_post_pv(), unstructured_to_post_pv(), and whileloop_to_post_pv().
|
static |
Definition at line 593 of file pointer_values_analyses.c.
References expression_to_post_pv(), free_pv_results_paths(), gen_full_copy_list(), pv_results::l_out, make_pv_results(), NIL, pips_debug, pips_debug_pvs, pv_context::pvs_may_union_func, statement_to_post_pv(), test_condition, test_false, and test_true.
Referenced by instruction_to_post_pv().
|
static |
there is only one statement in u;
Definition at line 882 of file pointer_values_analyses.c.
References CONTROL_MAP, control_predecessors, control_statement, control_successors, gen_free_list(), gen_full_copy_list(), gen_full_free_list(), make_anywhere_anywhere_pvs(), NIL, pips_debug, pips_debug_pvs, pips_user_warning, statement_to_post_pv(), unstructured_entry, and unstructured_exit.
Referenced by instruction_to_post_pv().
|
static |
in case fix point is not reached
this iteration may never be executed :
now update input pointer values of inner loop statements
Definition at line 693 of file pointer_values_analyses.c.
References CELL_INTERPRETATION, CONS, EFFECT, evaluation_before_p, expression_to_post_pv(), free_effect(), free_pv_results_paths(), gen_free_list(), gen_full_copy_list(), gen_full_free_list(), pv_results::l_out, make_action_write_memory(), make_anywhere_effect(), make_cell_interpretation_address_of(), make_pv_results(), NIL, pips_debug, pips_debug_pvs, PV_NB_MAX_ITER_FIX_POINT, pv_context::pvs_equal_p_func, pv_context::pvs_may_union_func, single_pointer_assignment_to_post_pv(), statement_to_post_pv(), whileloop_body, whileloop_condition, and whileloop_evaluation.
Referenced by instruction_to_post_pv().