PIPS
|
Go to the source code of this file.
module_name | odule_name |
Definition at line 137 of file control_counters.c.
References add_counters(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, module, module_name(), module_name_to_entity(), module_reorder(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), and set_current_module_statement().
bool alias_check | ( | char * | module_name | ) |
File instrument.out is used to store alias checks and flags
We do not add the line "INCLUDE alias_flags.h" into code_decls_text because of repeated bug for module with ENTRY. 09/11/2001 : do not add INCLUDE any more, because there are modules that do not need this INCLUDE => use script: if a module is modified => add INCLUDE line fprintf(out, "AC: %s (%d,%d)\n",module_local_name(current_mod),0,1); fprintf(out," INCLUDE 'alias_flags.h'\n"); fprintf(out, "ACEND \n");
if the list of alias associations of module is NIL, do nothing
Compute the list of direct and indirect callees of current module
Get the proper and cumulated effects of the module, we have to take both kinds of effects because of their difference for an elementary statement: V(I) = I => cumulated effect : <may be written> V(*) => proper effect : <must be written> V(I) If a cumulated effect for elementary statements = proper effect => we need only cumulated effect
Looking for another formal variable in the list of alias associations that has same section and included call path. If this variable is checked dynamically with e1 => no need to continue
Looking for common variables in module or callee of modules to check for alias violation ...
For this moment, only for common variable of module ========> add for chain of callees
Check for write on common variables in callee, keep call path also => to insert test
formal parameter has a same section with other common variable
If u1 is defined (different to -1) and u1<l2, there is no alias violation The same for: l1 is defined (different to -1) and u2<l1
The common variable always have a good offset off2
module_name | odule_name |
Definition at line 1994 of file alias_check.c.
References ALIAS_ASSOCIATION, alias_association_call_chain, alias_association_lower_offset, alias_association_offset, alias_association_section, alias_association_upper_offset, alias_association_variable, alias_associations_list, alias_check_two_variables(), ALIAS_FLAG, alias_flag, ALIAS_FUNCTION, alias_function, array_entity_p(), CAR, CDR, code_declarations, concatenate(), copy_language(), current_mod, db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, display_alias_check_statistics(), dynamic_checked_p(), ENDP, ENTITY, entity_code(), entity_domain, entity_name, entity_storage, entity_type, entity_undefined, entity_undefined_p, fprintf(), free(), gen_find_tabulated(), gen_length(), ifdebug, included_call_chain_p(), initialize_dynamic_check_list(), int_to_expression(), is_type_variable, l_dynamic_check, l_module_aliases, local_name_to_top_level_entity(), make_basic_logical(), make_empty_subroutine(), make_entity, make_type(), make_variable(), MAP, module_language, module_name(), MODULE_SEP_STRING, module_statement, NIL, number_of_processed_modules, out, pips_debug, print_list_of_alias_associations(), ram_offset, ram_section, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_ordering_to_statement(), reset_proper_rw_effects(), safe_fclose(), safe_fopen(), same_entity_p(), set_cumulated_rw_effects(), set_current_module_entity(), set_ordering_to_statement(), set_proper_rw_effects(), SizeOfArray(), SizeOfElements(), statement_undefined, storage_ram, storage_undefined, strdup(), TOP_LEVEL_MODULE_NAME, type_variable, user_log(), value_undefined, variable_basic, and variable_in_common_p().
bool alias_propagation | ( | char * | module_name | ) |
No alias for main program
If the current module is never called by the main program => don't need to compute aliases for this module
search for formal parameters in the declaration list
if there is no formal parameter, do nothing
Take the list of callers, if there is no caller, do nothing
The module has no caller => don't need to compute aliases for this module
save to resource
module_name | odule_name |
Definition at line 903 of file alias_propagation.c.
References alias_propagation_callers(), callees_callees, caller_name, code_declarations, CONS, current_mod, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, display_alias_propagation_statistics(), ENTITY, entity_code(), entity_main_module_p(), entity_undefined, formal_parameter_p(), fprintf(), gen_nconc(), get_bool_property(), ifdebug, local_name_to_top_level_entity(), make_alias_associations(), MAP, module_is_called_by_main_program_p(), module_name(), NIL, number_of_processed_modules, pips_debug, pips_user_warning, print_entities(), reset_current_module_entity(), set_current_module_entity(), and STRING.
bool array_bound_check_bottom_up | ( | const char * | module_name | ) |
Begin the dynamic array bound checking phase. Get the code from dbm (true resource)
Reorder the module, because the bound checks have been added
module_name | odule_name |
Definition at line 1093 of file array_bound_check_bottom_up.c.
References bottom_up_abc_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug(), debug_off, debug_on, display_bottom_up_abc_statistics(), ifdebug, initialize_bottom_up_abc_statistics(), local_name_to_top_level_entity(), module_name(), module_reorder(), module_statement, pips_assert, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), and statement_consistent_p().
statement array_bound_check_display | ( | void | ) |
array_bound_check_instrumentation.c
Attention : no strdup => newgen error
Definition at line 158 of file array_bound_check_instrumentation.c.
References CONTINUE_FUNCTION_NAME, entity_undefined, make_call_statement(), NIL, and strdup().
Referenced by initial_code_abc_statement_rwt(), and pips_code_abc_statement_rwt().
bool array_bound_check_instrumentation | ( | const char * | module_name | ) |
ser_log("*\n%d variable in %s *\n",gen_length(l),entity_name(sec)); number_of_variables = number_of_variables + gen_length(l);
Eliminate 4 special variables : MAIN000:DYNAMIC, MAIN000:STATIC,MAIN000:HEAP, MAIN000:STACK
module_name | odule_name |
Definition at line 557 of file array_bound_check_instrumentation.c.
References area_layout, code_declarations, CONS, ENTITY, entity_in_list_p(), entity_initial, entity_name, entity_scalar_p(), entity_storage, entity_type, formal_parameter_p(), gen_nconc(), l_commons, local_entity_of_module_p(), local_name_to_top_level_entity(), MAP, module_name(), NIL, number_of_array_variables, number_of_scalar_variables, ram_section, storage_ram, type_area, type_tag, type_variable_p, user_log(), value_code, and variable_in_common_p().
bool array_bound_check_interprocedural | ( | const char * | module_name | ) |
array_bound_check_interprocedural.c
s bound checks are added
module_name | odule_name |
Definition at line 749 of file array_bound_check_interprocedural.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug(), debug_off, debug_on, display_interprocedural_abc_statistics(), ifdebug, initialize_interprocedural_abc_statistics(), interprocedural_abc_statement(), local_name_to_top_level_entity(), module_name(), module_reorder(), module_statement, pips_assert, reset_current_module_entity(), reset_ordering_to_statement(), reset_precondition_map(), set_current_module_entity(), set_ordering_to_statement(), set_precondition_map(), statement_consistent_p(), total_number_of_added_tests, total_number_of_bound_violations, and user_log().
bool array_bound_check_top_down | ( | const char * | module_name | ) |
set and get the current properties concerning regions
Get the code of the module.
Get the READ and WRITE regions of the module
Reorder the module, because the bound checks have been added
module_name | odule_name |
Definition at line 1129 of file array_bound_check_top_down.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, display_top_down_abc_statistics(), find_rule_by_resource(), get_regions_properties(), initialize_top_down_abc_statistics(), local_name_to_top_level_entity(), module_name(), module_reorder(), module_statement, pips_assert, pips_debug, pips_user_warning, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_proper_rw_effects(), reset_rw_effects(), rule_phase, same_string_p, set_bool_property(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_proper_rw_effects(), set_rw_effects(), statement_consistent_p(), and top_down_abc_statement().
This function returns true, if the array needs bound checks false, otherwise.
If the arrays are not created by user, for example the arrays of Logical Units : LUNS, END_LUNS, ERR_LUNS, ... in the IO_EFFECTS_PACKAGE_NAME, we don't have to check array references for those arrays. Maybe we have to add other kinds of arrays, not only those in IO_EFFECTS
Definition at line 196 of file array_bound_check_bottom_up.c.
References entity_module_name(), and IO_EFFECTS_PACKAGE_NAME.
Referenced by bottom_up_abc_reference(), bottom_up_abc_reference_implied_do(), initial_code_abc_reference(), and top_down_abc_flt().
Definition at line 115 of file array_bound_check_top_down.c.
Referenced by make_bottom_up_abc_tests(), and top_down_abc_array().
Must be the C version
stop_message | top_message |
Definition at line 837 of file array_bound_check_bottom_up.c.
References fortran_module_p(), get_current_module_entity(), make_exit_statement(), make_stop_statement(), and statement_undefined.
Referenced by make_bottom_up_abc_tests(), and make_c_stop_statement().
This function returns true if c is an user-defined function/subroutine.
Definition at line 506 of file alias_check.c.
References call_function, and entity_module_p().
Referenced by variable_is_written_by_statement_flt().
l1 | 1 |
l2 | 2 |
Definition at line 246 of file alias_check.c.
References CALL_SITE, CAR, CDR, ENDP, and same_call_site_p().
Referenced by alias_check(), same_section_formal_variable_in_list_p(), and tail_call_path_p().
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/instrumentation/instrumentation-local.h instead, to add your own modifications. header file built by cproto instrumentation-local.h cproto-generated files array_bound_check_bottom_up.c
Definition at line 162 of file array_bound_check_bottom_up.c.
Referenced by make_bottom_up_abc_tests(), and top_down_abc_array().
bool old_array_bound_check_instrumentation | ( | const char * | module_name | ) |
add COMMON ARRAY_BOUND_CHECK_COUNT to the declaration if main program : DATA ARRAY_BOUND_CHECK_COUNT 0
Begin the array bound check instrumentation phase. Get the code from dbm (true resource)
Before running the array_bound_check phase, for the implied-DO expression (in statement READ, WRITE of Fortran), we will create new Pips' loops before the READ/WRITE statement, it means that instead of checking array references for implied-DO statement (which is not true if we do it like other statements), we will check array references in new loops added
Reorder the module, because new loops have been added
Reorder the module, because new statements have been added
module_name | odule_name |
Definition at line 466 of file array_bound_check_instrumentation.c.
References ABC_COUNT, abccount, code_decls_text, concatenate(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug(), debug_off, debug_on, entity_code(), entity_main_module_p(), free(), get_bool_property(), get_current_module_entity(), ifdebug, initial_code_abc_statement(), local_name_to_top_level_entity(), make_basic_int(), make_scalar_entity(), mod_ent, module_name(), module_reorder(), module_statement, pips_assert, pips_code_abc_statement(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), statement_consistent_p(), and strdup().
void print_alias_association | ( | alias_association | aa | ) |
aa | a |
Definition at line 301 of file alias_check.c.
References alias_association_call_chain, alias_association_lower_offset, alias_association_offset, alias_association_section, alias_association_upper_offset, alias_association_variable, entity_name, exp, fprintf(), print_call_path(), and print_expression().
Referenced by formal_variable_add_aliases(), print_list_of_alias_associations(), ram_variable_add_aliases(), and same_or_equivalence_argument_add_aliases().
void print_list_of_alias_associations | ( | list | l | ) |
Definition at line 324 of file alias_check.c.
References ALIAS_ASSOCIATION, MAP, and print_alias_association().
Referenced by alias_check().
string print_variables | ( | expression | e | ) |
Definition at line 804 of file array_bound_check_bottom_up.c.
References call_arguments, concatenate(), exp, EXPRESSION, expression_syntax, is_syntax_call, is_syntax_range, is_syntax_reference, MAP, pips_internal_error, ref, reference_to_string(), strdup(), syntax_call, syntax_reference, and syntax_tag.
Referenced by make_bottom_up_abc_tests(), and make_interprocedural_abc_tests().
expression simplify_relational_expression | ( | expression | e | ) |
If e is a relational expression
Definition at line 139 of file alias_check.c.
References binary_intrinsic_expression, call_arguments, call_function, CAR, CDR, entity_local_name(), EXPRESSION, expression_syntax, expression_undefined_p, int_to_expression(), NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, Pvecteur_to_expression(), relational_expression_p(), syntax_call, vect_normalize(), and vect_substract().
Referenced by alias_check_array_and_scalar_variable_in_caller_flt(), alias_check_array_and_scalar_variable_in_module_flt(), alias_check_array_variable_in_caller_flt(), alias_check_array_variable_in_module_flt(), alias_check_scalar_and_array_variables_in_caller(), alias_check_scalar_and_array_variables_in_module(), alias_check_two_scalar_variables_in_caller(), and alias_check_two_scalar_variables_in_module().
expression subscript_value | ( | entity | arr, |
list | l_inds | ||
) |
arr | rr |
l_inds | _inds |
Definition at line 276 of file array_bound_check_bottom_up.c.
References binary_intrinsic_expression, copy_expression(), dimension_lower, dimension_upper, ENDP, entity_type, expression_constant_p(), expression_to_int(), expression_undefined, expression_undefined_p, find_ith_argument(), find_ith_dimension(), gen_length(), ifdebug, int_to_expression(), MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, pips_debug, PLUS_OPERATOR_NAME, print_expression(), same_expression_p(), type_variable, and variable_dimensions.
Referenced by abc_with_allocation_size().
expression translate_to_module_frame | ( | entity | mod1, |
entity | mod2, | ||
expression | e1, | ||
call | c | ||
) |
Common variable in mod1 => return corresponding common variable e2 in mod2 1.2. Special case : e1 is a formal parameter in mod1, mod2 is caller of mod1 => take corresponding actual argument e2 in call c 1.3. From the association information, if we have e1 = e2 where e2 is constant or contains variables of the mod2 => return e2 2.If e1 is a call : 2.1. Storage rom : numerical constant or symbolic value (PARAMETER) => return e1 2.2. Recursive : e1 = ex1 * ey1 ex2 = translate_to_module_frame(mod1,mod2,ex1,c) ey2 = translate_to_module_frame(mod1,mod2,ey1,c)
=> return e2=ex2*ey2 3.If e1 is a range : error
Return expression_undefined if we can not translate
Check if the common variable is also declared in the mod2 or not We can use ram_shared which contains a list of aliased variables with en but it does not work ????
Another way : looking for a variable in the declaration of the mod2 that has the same offset in the same common block
ATTENTION : enti may be an array, such as A(2): COMMON C1,C2,C3,C4,C5 COMMON C1,A(2,2) we must return A(1,1), not A
Special case : e1 is a formal parameter in mod1, mod2 is caller of mod1 miss a check : mod2 = caller of mod1 => can be wrong !!!
Use the association of the call site: Take only the equalities. Project all variables belonging to mod1 , except the current variable e1 there are 2 cases :
Look for equality that contain e1 Delete e1 from the vector Check if the remaining of the vectors contains only constant (TCTS) or variables of mod2 => return
Attention : here the transformer binding_context is consistent but not the system ps_tmp. I do not understand why ? fprintf(stderr, "consistent psystem ps_tmp before"); pips_assert("consistent psystem ps_tmp", sc_consistent_p(ps_tmp));
Take only the equations of the system
he coefficient of e is 1 or -1. Check if the remaining vector contains only constant or variavbles of mod2
Numerical constant or symbolic value (PARAMETER)
e1 is a call, not a constant Recursive : with the arguments of the call As our generated expression e1 is a call with operators : +,-,* only, we treat only these cases
mod1 | od1 |
mod2 | od2 |
e1 | 1 |
Definition at line 202 of file alias_propagation.c.
References array_entity_p(), Ssysteme::base, base_contains_variable_p(), call_arguments, call_function, CAR, CDR, clean_all_normalized(), code_declarations, contraintes_free(), Ssysteme::egalites, ENTITY, entity_code(), entity_local_name(), entity_module_name(), entity_storage, entity_to_expression(), entity_type, EXPRESSION, expression_equal_integer_p(), expression_syntax, expression_undefined, expression_undefined_p, find_ith_argument(), formal_and_actual_parameters_association(), formal_offset, gen_length(), ifdebug, Ssysteme::inegalites, is_syntax_call, is_syntax_reference, make_list_of_constant(), make_reference(), MakeBinaryCall(), MakeUnaryCall(), MAP, module_local_name(), Ssysteme::nb_ineq, NIL, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, pips_debug, pips_internal_error, predicate_system, print_expression(), Pvecteur_to_expression(), ref, reference_to_expression(), reference_variable, same_entity_p(), same_scalar_location_p(), sc_dup(), sc_rm(), storage_formal, Scontrainte::succ, Svecteur::succ, syntax_call, syntax_reference, syntax_tag, TCST, transformer_identity(), transformer_relation, type_variable, value_mone_p, VALUE_ONE, value_one_p, Svecteur::var, var_of, variable_dimensions, variable_in_common_p(), variable_is_a_module_formal_parameter_p(), vect_add_elem(), vect_chg_sgn(), vect_coeff(), vect_contains_variable_p(), vect_del_var(), vect_rm(), Scontrainte::vecteur, VECTEUR_NUL, VECTEUR_NUL_P, VECTEUR_UNDEFINED, VECTEUR_UNDEFINED_P, and vecteur_var.
Referenced by alias_check_array_and_scalar_variable_in_caller_flt(), alias_check_array_variable_in_caller_flt(), alias_check_scalar_and_array_variables_in_caller(), alias_check_two_array_variables_in_caller(), formal_variable_add_aliases(), interprocedural_abc_arrays(), ram_variable_add_aliases(), and same_or_equivalence_argument_add_aliases().
bool used_before_set | ( | const char * | module_name | ) |
File instrument.out is used to store ubs checks
Set and get the current properties concerning regions
Get the code of the module
Get IN regions of the module
File xxx.database/Src/initialization.f contains all the initializations of global variables
Common variable in main program
Local variable in main program, but attention, IN regions contain also static variables of other modules !!!
Formal or common variable
Local variable
save to resource
module_name | odule_name |
Definition at line 1046 of file used_before_set.c.
References callees_callees, concatenate(), copy_ubs(), current_mod, db_get_current_workspace_directory(), db_get_directory_name_for_module(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, display_used_before_set_statistics(), entity_main_module_p(), entity_module_name(), entity_undefined, file_name, find_rule_by_resource(), formal_parameter_p(), fprintf(), free(), get_regions_properties(), ifdebug, initialization_file, initialize_and_verify_common_variable(), initialize_and_verify_local_variable(), IO_EFFECTS_PACKAGE_NAME, l_ubs_checks, load_statement_in_regions(), local_name_to_top_level_entity(), make_ubs(), MAP, module_name(), module_statement, NIL, number_of_processed_modules, out, out2, pips_basename(), pips_debug, pips_user_warning, PREFIX1, PREFIX2, print_inout_regions(), REGION, region_entity, regions_end(), regions_init(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_ordering_to_statement(), rule_phase, safe_fclose(), safe_fopen(), same_string_p, set_bool_property(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_ordering_to_statement(), strdup(), user_file, variable_in_common_p(), verify_formal_and_common_variables(), and WORKSPACE_SRC_SPACE.