25 #include "pips_config.h"
77 #include "resources.h"
96 #define PREFIX "$IABC"
127 user_log(
"* There %s %d array bound check%s added *\n",
133 user_log(
"* There %s %d bound violation%s *\n",
143 #define array_test_undefined ((array_test) {NIL,NIL})
147 if ((
x.arr ==
NIL) && (
x.exp ==
NIL))
197 for (j=i+1; j<= num_dim; j++)
218 fprintf(stderr,
"\n Size of dummy array: \n");
234 fprintf(stderr,
"\n First expression e1: ");
236 fprintf(stderr,
"\n Second expression e2: ");
238 fprintf(stderr,
" \n e1 less e2 wrt to the precondition : ");
280 fprintf(stderr,
" \n System before add inequality: ");
286 fprintf(stderr,
" \n System after add inequality: ");
293 fprintf(stderr,
" \n System after strong normalize 2: ");
313 fprintf(stderr,
" \n System before #init variables projection: ");
316 sc = sc_system_projection_along_variables(sc, pv_var);
319 fprintf(stderr,
" \n System after #init variables projection: ");
323 if (!SC_UNDEFINED_P(sc))
365 fprintf(stderr,
"\n Number of same dimensions : %d \n",same_dim);
373 fprintf(stderr,
"\n Dummy array size before translation:\n");
382 fprintf(stderr,
"\n Dummy array size after translation: \n");
399 if (i_dummy != i_actual)
424 if (i_dummy != i_actual)
436 pips_user_warning(
"Cannot translate the size of dummy array %s into module %s's frame\n",
471 fprintf(stderr,
"\n Call to a function/subroutine:");
498 dummy_array,l_actual_ref,s);
579 fprintf(stderr,
" Returned statement:");
601 fprintf(stderr,
"Unstructured case: \n");
617 fprintf(stderr,
"Unstructured case, insert a test:\n");
757 debug_on(
"ARRAY_BOUND_CHECK_INTERPROCEDURAL_DEBUG_LEVEL");
760 debug(1,
"Interprocedural array bound check",
"Begin for %s\n",
module_name);
766 user_log(
"* The total number of added tests is %d *\n",
768 user_log(
"* The total number of bound violation is %d *\n",
void user_log(const char *format,...)
persistant_statement_to_control make_persistant_statement_to_control(void)
expression copy_expression(expression p)
EXPRESSION.
statement copy_statement(statement p)
STATEMENT.
bool statement_consistent_p(statement p)
test make_test(expression a1, statement a2, statement a3)
control apply_persistant_statement_to_control(persistant_statement_to_control f, statement k)
instruction make_instruction(enum instruction_utype tag, void *val)
bool bound_persistant_statement_to_control_p(persistant_statement_to_control f, statement k)
sequence make_sequence(list a)
control make_control(statement a1, list a2, list a3)
void extend_persistant_statement_to_control(persistant_statement_to_control f, statement k, control v)
void free_persistant_statement_to_control(persistant_statement_to_control p)
struct _newgen_struct_entity_ * entity
static statement module_statement
expression translate_to_module_frame(entity mod1, entity mod2, expression e1, call c)
This function translates an expression e1 from the frame of module 1 to the frame of module 2 1....
#define value_posz_p(val)
string print_variables(expression e)
static statement make_interprocedural_abc_tests(array_test at)
static bool push_uns(unstructured u, interprocedural_abc_context_p context)
static expression interprocedural_abc_arrays(call c, entity actual_array, entity dummy_array, list l_actual_ref, statement s)
static void display_interprocedural_abc_statistics()
static array_test interprocedural_abc_call(call c, statement s)
static expression expression_less_than_in_context(expression e1, expression e2, transformer context)
static array_test add_array_test(array_test retour, array_test temp)
static int number_of_added_tests
struct array_test array_test
static int total_number_of_bound_violations
static void initialize_interprocedural_abc_statistics()
static void interprocedural_abc_insert_before_statement(statement s, statement s1, interprocedural_abc_context_p context)
static void interprocedural_abc_statement_rwt(statement s, interprocedural_abc_context_p context)
bool array_bound_check_interprocedural(const char *module_name)
array_bound_check_interprocedural.c
#define array_test_undefined
static bool array_test_undefined_p(array_test x)
static int number_of_bound_violations
static array_test interprocedural_abc_expression(expression e, statement s)
static void interprocedural_abc_statement(statement module_statement)
static array_test make_array_test(entity e, expression exp)
static expression size_of_dummy_array(entity dummy_array, int i)
struct interprocedural_abc_context_t * interprocedural_abc_context_p
static void pop_uns(unstructured u, interprocedural_abc_context_p context)
static bool store_mapping(control c, interprocedural_abc_context_p context)
#define PREFIX
This phase checks for out of bound error when passing arrays or array elements as arguments in proced...
static int total_number_of_added_tests
transformer transformer_dup(transformer t_in)
transformer package - basic routines
transformer transformer_identity()
Allocate an identity transformer.
struct _newgen_struct_statement_ * statement
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
bool vect_constant_p(Pvecteur)
bool vect_constant_p(Pvecteur v): v contains only a constant term, may be zero
expression Psysteme_to_expression(Psysteme)
system_to_code.c
static entity current_callee
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....
statement make_block_statement(list)
Make a block statement from a list of statement.
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
void reset_current_module_entity(void)
Reset the current module entity.
entity set_current_module_entity(entity)
static.c
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#define ENDP(l)
Test if a list is empty.
#define NIL
The empty list (nil in Lisp)
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)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define CAR(pcons)
Get the value of the first element of a list.
#define CDR(pcons)
Get the list less its first element.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
#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.
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
bool statement_test_p(statement)
statement make_print_statement(string)
Make a Fortran print statement.
statement make_stop_statement(string)
This function returns a Fortran stop statement with an error message.
bool stop_statement_p(statement)
Test if a statement is a Fortran STOP.
void insert_statement(statement, statement, bool)
This is the normal entry point.
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
string concatenate(const char *,...)
Return the concatenation of the given strings.
void * stack_head(const stack)
returns the item on top of stack s
int stack_size(const stack)
observers
void stack_push(void *, stack)
stack use
void stack_free(stack *)
type, bucket_size, policy
stack stack_make(int, int, int)
allocation
void * stack_pop(stack)
POPs one item from stack s.
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
string expression_to_string(expression e)
void print_statement(statement)
Print a statement on stderr.
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define NORMALIZE_EXPRESSION(e)
#define test_to_statement(t)
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define binary_intrinsic_expression(name, e1, e2)
#define MULTIPLY_OPERATOR_NAME
#define lt_expression(e1, e2)
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
bool assumed_size_array_p(entity e)
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
code entity_code(entity e)
const char * entity_module_name(entity e)
See comments about module_name().
bool same_expression_in_list_p(expression e, list le)
This function returns true, if there exists a same expression in the list false, otherwise.
bool expression_call_p(expression e)
int expression_to_int(expression exp)
================================================================
bool true_expression_p(expression e)
expression size_of_actual_array(entity actual_array, list l_actual_ref, int i)
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
bool array_argument_p(expression e)
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
bool same_expression_p(expression e1, expression e2)
this is slightly different from expression_equal_p, as it will return true for a+b vs b+a
expression make_true_expression()
dimension find_ith_dimension(list, int)
This function returns the ith dimension of a list of dimensions.
bool formal_parameter_p(entity)
_int SizeOfElements(basic)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
#define unstructured_domain
newgen_type_domain_defined
#define normalized_linear_p(x)
#define reference_variable(x)
#define control_predecessors(x)
struct _newgen_struct_unstructured_ * unstructured
#define dimension_lower(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define control_domain
newgen_controlmap_domain_defined
#define code_declarations(x)
#define CONTROL(x)
CONTROL.
#define storage_formal(x)
#define EXPRESSION(x)
EXPRESSION.
#define expression_undefined
@ is_instruction_unstructured
@ is_instruction_whileloop
@ is_instruction_sequence
#define instruction_tag(x)
#define transformer_relation(x)
#define dimension_upper(x)
#define reference_indices(x)
#define control_successors(x)
#define expression_undefined_p(x)
#define test_condition(x)
#define instruction_whileloop(x)
#define variable_dimensions(x)
#define statement_instruction(x)
#define instruction_call(x)
#define call_arguments(x)
#define control_statement(x)
#define instruction_test(x)
#define statement_undefined_p(x)
#define whileloop_condition(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define predicate_system(x)
#define variable_basic(x)
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
bool sc_rn_p(Psysteme sc)
bool sc_rn_p(Psysteme sc): check if the set associated to sc is the whole space, rn
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
int sc_check_inequality_redundancy(Pcontrainte ineq, Psysteme ps)
int sc_check_inequality_redundancy(Pcontrainte ineq, Psysteme ps) Check if an inequality ineq,...
Psysteme sc_constraint_add(Psysteme sc, Pcontrainte c, bool equality)
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Psysteme sc_strong_normalize2(volatile Psysteme ps)
Psysteme sc_strong_normalize2(Psysteme ps)
bool statement_weakly_feasible_p(statement)
utils.c
transformer load_statement_precondition(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
The structure used to build lists in NewGen.
context data structure for interprocedural_abc newgen recursion
persistant_statement_to_control map
#define exp
Avoid some warnings from "gcc -Wshadow".
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
char *(* get_variable_name_t)(Variable)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...