25 #include "pips_config.h"
68 #include "resources.h"
111 return ", READING, ";
112 return ", WRITING, ";
118 return ", lower bound, ";
119 return ", upper bound, ";
136 user_log(
"* There %s %d array bound check%s added *\n",
142 user_log(
"* There %s %d bound violation%s *\n",
167 for(i=1; i <= length; i++ )
254 ps = sc_system_projection_along_variables(ps, pv_var);
355 fprintf(stderr,
"\n The ith expression");
366 fprintf(stderr,
"\n The lower bound test");
379 fprintf(stderr,
"\n The upper bound test");
456 retour.
bound =
false;
560 if (ps == SC_UNDEFINED)
585 retour.
bound =
false;
619 fprintf(stderr,
"a variable = current entity !!");
620 fprintf(stderr,
"This statement writes on %s with max ordering %d",
639 fprintf(stderr,
" return current_max = %d of current entity %s ",
665 fprintf(stderr,
"a variable = current entity !!");
666 fprintf(stderr,
" This statement writes on %s with min ordering %d",
684 fprintf(stderr,
" return current_min = %d of current entity %s",
702 if (
max >=
min)
return false;
750 while (!
ENDP(dc_list)) {
788 user_log(
"\n Bound violation !!! \n");
806 fprintf(stderr,
"\n The upper test");
847 user_log(
"\n Bound violation !!! \n");
867 fprintf(stderr,
"\n The lower test");
891 dc_list =
CDR(dc_list);
952 fprintf(stderr,
"\n list of regions ");
954 fprintf(stderr,
"\n for the statement");
981 if (
ENDP(l_written_arrays))
985 while (!
ENDP(l_copy))
992 l_copy =
CDR(l_copy);
1012 fprintf(stderr,
"\n First array: ");
1018 while (!
ENDP(l_copy))
1026 l_copy =
CDR(l_copy);
1035 fprintf(stderr,
"\n The sequence of test");
1072 fprintf(stderr,
"\n Rewrite : The sequence of test");
1074 fprintf(stderr,
"\n of statement");
1136 "\n Do not expect wonderful results\n");
1153 debug_on(
"ARRAY_BOUND_CHECK_TOP_DOWN_DEBUG_LEVEL");
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
void user_log(const char *format,...)
abc_checked copy_abc_checked(abc_checked p)
ABC_CHECKED.
void free_abc_checked(abc_checked p)
dimension_checked make_dimension_checked(intptr_t a1, bool a2, bool a3)
array_dimension_checked make_array_dimension_checked(entity a1, list a2)
abc_checked make_abc_checked(list a)
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)
dimension copy_dimension(dimension p)
DIMENSION.
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)
#define array_dimension_checked_dims(x)
#define dimension_checked_undefined
#define abc_checked_list(x)
#define dimension_checked_dim(x)
#define DIMENSION_CHECKED(x)
DIMENSION_CHECKED.
#define ARRAY_DIMENSION_CHECKED(x)
ARRAY_DIMENSION_CHECKED.
#define dimension_checked_upper(x)
#define array_dimension_checked_array(x)
struct _newgen_struct_abc_checked_ * abc_checked
struct _newgen_struct_entity_ * entity
#define dimension_checked_lower(x)
static reference ref
Current stmt (an integer)
static statement module_statement
bool array_need_bound_check_p(entity e)
This function returns true, if the array needs bound checks false, otherwise.
string int_to_dimension(int i)
Warning! Do not modify this file that is automatically generated!
static bool push_uns(unstructured u, top_down_abc_context_p context)
static void display_top_down_abc_statistics()
static Bound_test top_down_abc_dimension(statement s, top_down_abc_context_p context, region re, bool action, entity array, int i, bool bound)
static bool min_statement_write_flt(statement s)
static bool is_first_written_array_p(entity a, list l, statement s)
static int number_of_added_tests
Statistic variables:
static bool top_down_abc_flt(statement s, top_down_abc_context_p context)
The old algorithm is false in the case of incorrect code, because regions are computed with the assum...
static Psysteme my_system_remove_variables(Psysteme ps)
static statement test_sequence
struct top_down_abc_context_t * top_down_abc_context_p
static int maximum_ordering(entity a, statement s)
search for the maximum ordering of statement (after s) that writes on a
static bool store_mapping(control c, top_down_abc_context_p context)
string bool_to_bound(bool b)
array_bound_check_top_down.c
static int minimum_ordering(entity a, statement s)
search for the minimum ordering of statement (after s) that writes on a
static entity current_entity
static void top_down_abc_statement(statement module_statement)
static void top_down_abc_rwt(statement s, top_down_abc_context_p context)
static void top_down_abc_insert_before_statement(statement s, statement s1, top_down_abc_context_p context)
bool array_bound_check_top_down(const char *module_name)
static int number_of_bound_violations
static void pop_uns(unstructured __attribute__((unused)) u, top_down_abc_context_p context)
static bool max_statement_write_flt(statement s)
static void set_array_dimension_checked(top_down_abc_context_p context, bool action, entity array, int dim, bool bound)
static string read_or_write(bool a)
static void initialize_top_down_abc_statistics()
static entity find_first_written_array(list l, statement s)
static list top_down_abc_call(call c, entity array, dimension dim_i, int i, bool bound)
static void top_down_abc_array(entity array, region re, statement s, top_down_abc_context_p context)
static Bound_test top_down_abc_not_exact_case(statement s, top_down_abc_context_p context, bool action, entity array, dimension dim_i, int i, bool bound)
static abc_checked initiliaze_marked_list()
struct Bound_test Bound_test
bool base_contains_variable_p(Pbase b, Variable v)
bool base_contains_variable_p(Pbase b, Variable v): returns true if variable v is one of b's elements...
struct _newgen_struct_statement_ * statement
#define CONTRAINTE_UNDEFINED
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Pcontrainte contrainte_free(Pcontrainte c)
Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c a...
expression Psysteme_to_expression(Psysteme)
system_to_code.c
#define region_system(reg)
#define region_read_p(reg)
useful region macros
#define region
simulation of the type region
#define region_exact_p(reg)
entity make_phi_entity(int)
list phi_entities_list(int, int)
void get_regions_properties(void)
bool sc_add_phi_equation(Psysteme *, expression, int, bool, bool)
void append_declaration_sc_if_exact_without_constraints(effect)
void set_rw_effects(statement_effects)
list load_proper_rw_effects_list(statement)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
list load_statement_local_regions(statement)
void reset_rw_effects(void)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define action_write_p(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 gen_recurse(start, domain_number, flt, rwt)
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.
void reset_current_module_statement(void)
Reset the current module statement.
statement set_current_module_statement(statement)
Set the current module statement.
entity set_current_module_entity(entity)
static.c
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_recurse_stop(void *obj)
Tells the recursion not to go in this object.
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.
#define ENDP(l)
Test if a list is empty.
void gen_remove_once(list *pl, const void *o)
Remove the first occurence of o in list pl:
#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.
void gen_free_list(list l)
free the spine of the 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)
list gen_full_copy_list(list l)
Copy a list structure with element copy.
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)
bool statement_call_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.
void insert_statement(statement, statement, bool)
This is the normal entry point.
hash_table hash_table_make(hash_key_type key_type, size_t size)
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
entity first_array
une copie de l'un des nids de la sequence
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define same_string_p(s1, s2)
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.
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.
rule find_rule_by_resource(const char *rname)
This function returns the active rule to produce resource rname.
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
void print_statement(statement)
Print a statement on stderr.
void set_bool_property(const char *, bool)
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 lt_expression(e1, e2)
bool same_entity_p(entity e1, entity e2)
predicates on entities
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
void clean_all_normalized(expression e)
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.
int trivial_expression_p(expression e)
This function returns:
bool true_expression_p(expression e)
expression expression_list_to_binary_operator_call(list l, entity op)
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression find_ith_argument(list args, int n)
bool unbounded_dimension_p(dimension dim)
bool unbounded_dimension_p(dim) input : a dimension of an array entity.
bool array_reference_p(reference r)
predicates on references
expression make_true_expression()
dimension find_ith_dimension(list, int)
This function returns the ith dimension of a list of dimensions.
#define normalized_undefined
#define unstructured_domain
newgen_type_domain_defined
#define syntax_reference(x)
#define normalized_linear_p(x)
#define reference_variable(x)
#define control_predecessors(x)
struct _newgen_struct_unstructured_ * unstructured
#define statement_ordering(x)
#define dimension_lower(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define control_domain
newgen_controlmap_domain_defined
#define code_declarations(x)
#define CONTROL(x)
CONTROL.
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define expression_undefined
@ is_instruction_sequence
#define dimension_upper(x)
#define reference_indices(x)
#define control_successors(x)
#define expression_undefined_p(x)
#define variable_dimensions(x)
#define statement_instruction(x)
#define instruction_call(x)
#define call_arguments(x)
#define control_statement(x)
#define statement_undefined_p(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define type_variable_p(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
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
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,...
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
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
The structure used to build lists in NewGen.
The following data structure is the context of top_down_abc: The read_marked_list marks if one bound ...
hash_table statement_check_list
persistant_statement_to_control map
abc_checked write_marked_list
hash_table read_saved_list
abc_checked read_marked_list
hash_table write_saved_list
#define exp
Avoid some warnings from "gcc -Wshadow".
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
#define OFL_CTRL
I do thing that overflows are managed in a very poor manner.
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_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...