PIPS
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "database.h"
#include "pipsdbm.h"
#include "resources.h"
#include "misc.h"
#include "control.h"
#include "properties.h"
#include "alias_private.h"
#include "instrumentation.h"
Go to the source code of this file.
Data Structures | |
struct | abc_instrumentation_context_t |
context data structure for array_bound_check_instrumentation newgen recursion More... | |
struct | abc_number_of_operators_context_t |
Macros | |
#define | ABC_COUNT "ARRAY_BOUND_CHECK_COUNT" |
Typedefs | |
typedef struct abc_instrumentation_context_t * | abc_instrumentation_context_p |
typedef struct abc_number_of_operators_context_t * | abc_number_of_operators_context_p |
Variables | |
static entity | abccount |
static entity | mod_ent |
static list | l_commons = NIL |
static int | number_of_scalar_variables = 0 |
static int | number_of_array_variables = 0 |
#define ABC_COUNT "ARRAY_BOUND_CHECK_COUNT" |
Definition at line 68 of file array_bound_check_instrumentation.c.
typedef struct abc_instrumentation_context_t * abc_instrumentation_context_p |
typedef struct abc_number_of_operators_context_t * abc_number_of_operators_context_p |
Definition at line 308 of file array_bound_check_instrumentation.c.
References call_arguments, call_function, CAR, entity_name, EXPRESSION, expression_syntax, NIL, statement_call(), stop_statement_p(), and syntax_call.
Referenced by pips_code_abc_statement_rwt().
|
static |
If s is in an unstructured instruction, we must pay attention when inserting s1 before s.
take the control that has s as its statement
take the unstructured correspond to the control c
for a consistent unstructured, a test must have 2 successors, so if s1 is a test, we transform it into sequence in order to avoid this constraint. Then we create a new control for it, with the predecessors are those of c and the only one successor is c. The new predecessors of c are only the new control
if c is the entry node of the correspond unstructured u, the newc will become the new entry node of u
Definition at line 168 of file array_bound_check_instrumentation.c.
References apply_persistant_statement_to_control(), bound_persistant_statement_to_control_p(), CAR, CONS, CONTROL, CONTROL_, control_predecessors, control_successors, fprintf(), ifdebug, insert_statement(), instruction_to_statement(), is_instruction_sequence, make_control(), make_instruction(), make_sequence(), MAP, MAPL, NIL, print_statement(), s1, stack_head(), stack_size(), STATEMENT, statement_test_p(), and unstructured_control.
Referenced by initial_code_abc_statement_rwt(), and pips_code_abc_statement_rwt().
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().
Definition at line 135 of file array_bound_check_instrumentation.c.
References call_arguments, CAR, CDR, ENDP, EXPRESSION, and initial_code_abc_expression().
Referenced by initial_code_abc_expression(), and initial_code_abc_statement_rwt().
|
static |
the syntax of an expression can be a reference, a range or a call
There is nothing to check here
Definition at line 115 of file array_bound_check_instrumentation.c.
References expression_implied_do_p(), expression_syntax, initial_code_abc_call(), initial_code_abc_reference(), is_syntax_call, is_syntax_range, is_syntax_reference, syntax_call, syntax_reference, and syntax_tag.
Referenced by initial_code_abc_call(), initial_code_abc_reference(), and initial_code_abc_statement_rwt().
Definition at line 92 of file array_bound_check_instrumentation.c.
References array_need_bound_check_p(), array_reference_p(), find_ith_argument(), gen_length(), initial_code_abc_expression(), int, reference_indices, and reference_variable.
Referenced by initial_code_abc_expression().
|
static |
Definition at line 432 of file array_bound_check_instrumentation.c.
References control_domain, free_persistant_statement_to_control(), gen_context_multi_recurse(), gen_null(), gen_true(), initial_code_abc_statement_rwt(), make_persistant_statement_to_control(), module_statement, pop_uns(), push_uns(), stack_free(), stack_make(), statement_domain, store_mapping(), and unstructured_domain.
Referenced by old_array_bound_check_instrumentation().
|
static |
There are 2 kinds of statement which cause the execution of the program to terminate
This code is not correct ! The counting statement must be inserted in the body of the loop !
bug Example abc_ins.f : there is STOP statement in the branch of if statement
IF (A(1).GE.L) ... STOP ENDIF free_instruction(s) in insert_statement will be not consistent => core dumped Solution : like pips_code_abc_statement_rwt
Definition at line 225 of file array_bound_check_instrumentation.c.
References abc_instrumentation_insert_before_statement(), array_bound_check_display(), entity_main_module_p(), fprintf(), ifdebug, initial_code_abc_call(), initial_code_abc_expression(), instruction_call, instruction_tag, instruction_test, instruction_whileloop, is_instruction_call, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, make_abc_count_statement(), message_assert, mod_ent, pips_internal_error, print_statement(), return_statement_p(), statement_consistent_p(), statement_instruction, stop_statement_p(), test_condition, and whileloop_condition.
Referenced by initial_code_abc_statement().
Definition at line 149 of file array_bound_check_instrumentation.c.
References abccount, binary_intrinsic_expression, int_to_expression(), make_assign_statement(), make_reference(), NIL, PLUS_OPERATOR_NAME, and reference_to_expression().
Referenced by initial_code_abc_statement_rwt(), and pips_code_abc_statement_rwt().
|
static |
Definition at line 340 of file array_bound_check_instrumentation.c.
References expression_domain, gen_context_recurse, gen_null2(), and number_of_operators_flt().
Referenced by pips_code_abc_statement_rwt().
|
static |
Definition at line 326 of file array_bound_check_instrumentation.c.
References expression_call_p(), and logical_operator_expression_p().
Referenced by number_of_logical_operators().
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().
|
static |
Definition at line 449 of file array_bound_check_instrumentation.c.
References control_domain, free_persistant_statement_to_control(), gen_context_multi_recurse(), gen_null(), gen_true(), make_persistant_statement_to_control(), module_statement, pips_code_abc_statement_rwt(), pop_uns(), push_uns(), stack_free(), stack_make(), statement_domain, store_mapping(), and unstructured_domain.
Referenced by old_array_bound_check_instrumentation().
|
static |
s is a bound check generated by PIPS which has this form: IF (e) THEN STOP "Bound violation ...." ENDIF we replace it by: ARRAY_BOUND_CHECK_COUNT = ARRAY_BOUND_CHECK_COUNT + n IF (e) THEN PRINT *,'Number of bound checks : ', ARRAY_BOUND_CHECK_COUNT STOP "Bound violation ...." ENDIF
There are 2 kinds of statement which cause the execution of the program to terminate
Definition at line 351 of file array_bound_check_instrumentation.c.
References abc_bound_violation_stop_statement_p(), abc_instrumentation_insert_before_statement(), array_bound_check_display(), CONS, copy_statement(), entity_main_module_p(), instruction_tag, instruction_test, instruction_to_statement(), is_instruction_call, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, make_abc_count_statement(), make_instruction(), make_sequence(), mod_ent, NIL, number_of_logical_operators(), pips_internal_error, return_statement_p(), s1, STATEMENT, statement_instruction, stop_statement_p(), test_condition, and test_true.
Referenced by pips_code_abc_statement().
|
static |
Definition at line 426 of file array_bound_check_instrumentation.c.
References pips_assert, and stack_pop().
Referenced by initial_code_abc_statement(), and pips_code_abc_statement().
|
static |
Definition at line 420 of file array_bound_check_instrumentation.c.
References stack_push().
Referenced by initial_code_abc_statement(), and pips_code_abc_statement().
|
static |
Definition at line 413 of file array_bound_check_instrumentation.c.
References control_statement, and extend_persistant_statement_to_control().
Referenced by initial_code_abc_statement(), and pips_code_abc_statement().
|
static |
Definition at line 73 of file array_bound_check_instrumentation.c.
Referenced by make_abc_count_statement(), and old_array_bound_check_instrumentation().
Definition at line 554 of file array_bound_check_instrumentation.c.
Referenced by array_bound_check_instrumentation(), controlize_distribution(), init_dynamic_check_list(), initialize_dynamic_check_list(), make_receive_scalar_params_modules(), make_scalar_communication_module(), make_scalar_communication_modules(), make_send_scalar_params_modules(), make_start_ru_module(), and make_wait_ru_module().
|
static |
Definition at line 74 of file array_bound_check_instrumentation.c.
Referenced by adg_get_integer_entity(), adg_rename_entities(), formal_array_resizing_bottom_up(), initial_code_abc_statement_rwt(), make_new_entity(), make_new_simd_vector_with_prefix(), make_nlc_entity(), make_nsp_entity(), make_nub_entity(), make_reduction_vector_entity(), old_array_bound_check_instrumentation(), and pips_code_abc_statement_rwt().
|
static |
Definition at line 556 of file array_bound_check_instrumentation.c.
Referenced by array_bound_check_instrumentation().
|
static |
Definition at line 555 of file array_bound_check_instrumentation.c.
Referenced by array_bound_check_instrumentation().