25 #include "pips_config.h"
95 #include "resources.h"
102 #define PREFIX1 "$ALIAS_CHECK"
103 #define PREFIX2 "$ALIAS_CHECK_END"
104 #define ALIAS_FLAG "ALIAS_FLAG"
105 #define ALIAS_FUNCTION "DYNAMIC_ALIAS_CHECK"
309 fprintf(stderr,
"\n Alias association :");
312 fprintf(stderr,
"\n offset :");
314 fprintf(stderr,
"lower offset :%d, upper offset: %d \n",l,u);
348 for (j=1; j<= num_dim; j++)
372 fprintf(stderr,
"\n Stride of array size : \n");
494 fprintf(stderr,
"\n New flag expression: \n");
632 context->second_entity,size,s);
903 fprintf(stderr,
"\n Check in module, 2 scalar variables \n");
963 fprintf(stderr,
"\n Check in module, scalar and array variables \n");
1078 fprintf(stderr,
"\n Check in module, 2 array variables \n");
1083 fprintf(stderr,
"\n off1> off2+size_stride2 is true => Okay, no alias between these 2 variables \n");
1105 fprintf(stderr,
"\n off2 > off1+size_stride1 is true => Okay, no alias between these 2 variables \n");
1284 fprintf(stderr,
"\n New flag expression: \n");
1414 fprintf(stderr,
"\n New flag expression: \n");
1458 context->second_entity,size2,s);
1490 fprintf(stderr,
"\n Check in caller, 2 scalar variables \n");
1554 fprintf(stderr,
"\n Check in caller, scalar and array variables \n");
1698 fprintf(stderr,
"\n Check in caller, 2 array variables \n");
1819 if (initial_off == 0)
1998 string instrument_file =
strdup(
concatenate(dir_name,
"/instrument.out", NULL));
1999 free(dir_name), dir_name = NULL;
2010 debug_on(
"ALIAS_CHECK_DEBUG_LEVEL");
2036 fprintf(stderr,
" \n The list of alias associations for module %s is:\n",
module_name);
2084 if (((u1==-1)||(u1>=l2))&&((u2==-1)||(u2>=l1)))
2088 fprintf(stderr,
"\nFound two may be aliased formal parameters: %s, %s. Let's check !\n",
2125 user_log(
"Varying size of common variable");
2129 if (((u1==-1)||(u1>=l2))&&(u2>=l1))
2134 fprintf(stderr,
"\n Found may be aliased formal and common variable :%s, %s. Let's check ! \n",
2154 user_log(
"\n No alias for this module \n");
2157 free(instrument_file), instrument_file= NULL;
void user_log(const char *format,...)
dynamic_check make_dynamic_check(entity a1, entity a2, bool a3)
call make_call(entity a1, list a2)
expression copy_expression(expression p)
EXPRESSION.
reference make_reference(entity a1, list a2)
language copy_language(language p)
LANGUAGE.
test make_test(expression a1, statement a2, statement a3)
variable make_variable(basic a1, list a2, list a3)
basic make_basic_logical(intptr_t _field_)
type make_type(enum type_utype tag, void *val)
static void insert_test_before_statement(expression flags, expression condition, statement s, entity e1, entity e2, list path)
static void alias_check_in_caller(entity e1, entity e2, expression off1, expression off2, list path)
expression simplify_relational_expression(expression e)
alias_check.c
static void alias_check_scalar_and_array_variables_in_caller(entity e1, entity e2, expression off1, expression off2, list path)
static int current_ordering
bool alias_check(char *module_name)
static void initialize_dynamic_check_list()
static void alias_check_two_array_variables_in_caller(entity e1, entity e2, expression off1, expression off2, list path)
static expression offset_in_caller(entity e, call_site cs, list path)
static bool same_call_site_p(call_site cs1, call_site cs2)
static void display_alias_check_statistics()
static string print_call_path(list path)
This function prints the call path , including names of caller functions and orderings of call sites ...
static int number_of_tests
static bool dynamic_checked_p(entity e1, entity e2)
static bool alias_check_array_variable_in_module_flt(statement s, alias_context_p context)
static void insert_flag_before_call_site(list flags, list path)
static void alias_check_two_array_variables_in_module(entity e1, entity e2, expression off1, expression off2, list path)
static bool dynamic_alias_check_flt(statement s, alias_context_p context)
bool included_call_chain_p(list l1, list l2)
static void alias_check_in_module(entity e1, entity e2, expression off1, expression off2, list path)
static entity alias_function
#define PREFIX1
TO AMELIORATE : for the moment, we only use trivial_expression_p to compare offsets + array sizes CAN...
static bool search_statement_by_ordering_flt(statement s)
static expression array_size_stride(entity ent)
static void alias_check_two_scalar_variables_in_module(entity e1, entity e2, expression off1, expression off2, list path)
static entity current_entity
static void set_dynamic_checked(entity e1, entity e2)
static bool alias_check_array_variable_in_caller_flt(statement s, alias_context_p context)
static entity current_caller
static bool variable_is_written_p(entity ent)
static bool tail_call_path_p(call_site cs, list l1, list l2)
bool functional_call_p(call c)
This function returns true if c is an user-defined function/subroutine.
struct alias_context_t * alias_context_p
static expression storage_formal_offset(call_site cs, entity actual_var, expression subval, list path)
static void insert_check_alias_before_statement(entity e1, expression subval, entity e2, expression size, statement s)
static int unique_flag_number
static int number_of_processed_modules
static expression storage_ram_offset(storage s, expression subval)
static statement module_statement
static int number_of_calls
static void alias_check_two_variables(entity e1, entity e2, expression off1, expression off2, list path)
static void insert_test_before_caller(expression condition, expression e_flag)
static list l_module_aliases
static statement current_statement
static bool alias_check_array_and_scalar_variable_in_caller_flt(statement s, alias_context_p context)
void print_list_of_alias_associations(list l)
static bool alias_check_scalar_variable_in_caller_flt(statement s, alias_context_p context)
static void alias_check_scalar_and_array_variables_in_module(entity e1, entity e2, expression off1, expression off2, list path)
static void alias_check_two_scalar_variables_in_caller(entity e1, entity e2, expression off1, expression off2, list path)
static list make_list_of_flags(list path)
void print_alias_association(alias_association aa)
static bool alias_check_array_and_scalar_variable_in_module_flt(statement s, alias_context_p context)
static list l_dynamic_check
This list tells us if two variables have been checked dynamically or not.
static entity current_mod
static const char * caller_name
static bool variable_is_written_by_statement_flt(statement s)
This function returns true if the variable is written directly in the current module,...
static bool alias_check_scalar_variable_in_module_flt(statement s, alias_context_p context)
#define dynamic_check_second(x)
#define alias_associations_list(x)
#define alias_association_lower_offset(x)
#define CALL_SITE(x)
CALL_SITE.
#define call_site_function(x)
#define alias_association_upper_offset(x)
#define alias_association_section(x)
#define alias_association_variable(x)
#define ALIAS_ASSOCIATION(x)
ALIAS_ASSOCIATION.
#define dynamic_check_checked(x)
#define alias_association_call_chain(x)
#define dynamic_check_first(x)
#define alias_association_offset(x)
#define DYNAMIC_CHECK(x)
DYNAMIC_CHECK.
#define call_site_ordering(x)
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....
void const char const char const int
struct _newgen_struct_statement_ * statement
expression MakeCharacterConstantExpression(string s)
END_EOLE.
list load_proper_rw_effects_list(statement)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
list load_cumulated_rw_effects_list(statement)
void reset_cumulated_rw_effects(void)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define approximation_exact_p(x)
#define action_write_p(x)
#define effect_approximation(x)
const char * module_name(const char *s)
Return the module part of an entity name.
FILE * safe_fopen(const char *filename, const char *what)
int safe_fclose(FILE *stream, const char *filename)
char * pips_basename(char *fullpath, char *suffix)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
#define gen_recurse(start, domain_number, flt, rwt)
static FILE * user_file
These functions implements the writing of objects.
statement make_block_statement(list)
Make a block statement from a list of statement.
void reset_current_module_entity(void)
Reset the current module entity.
entity set_current_module_entity(entity)
static.c
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
void gen_null(__attribute__((unused)) void *unused)
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 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.
call statement_call(statement)
Get the call of a statement.
bool statement_call_p(statement)
statement make_assign_statement(expression, expression)
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 expression_constant_p(expression)
HPFC module by Fabien COELHO.
string db_get_directory_name_for_module(const char *name)
returns the allocated and mkdir'ed directory for module name
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
#define MODULE_SEP_STRING
string concatenate(const char *,...)
Return the concatenation of the given strings.
void * gen_find_tabulated(const char *, int)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
int f2(int off1, int off2, int w, 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.
#define WORKSPACE_SRC_SPACE
string db_get_current_workspace_directory(void)
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
void fprint_statement(FILE *, statement)
Print statement "s" on file descriptor "fd".
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define NORMALIZE_EXPRESSION(e)
#define gt_expression(e1, e2)
#define make_entity(n, t, s, i)
#define test_to_statement(t)
#define and_expression(e1, e2)
#define binary_intrinsic_expression(name, e1, e2)
#define call_to_statement(c)
#define ge_expression(e1, e2)
#define le_expression(e1, e2)
#define eq_expression(e1, e2)
#define module_language(e)
implemented as a macro to allow lhs
#define MULTIPLY_OPERATOR_NAME
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)
bool array_entity_p(entity e)
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.
bool pointer_type_array_p(entity e)
code entity_code(entity e)
entity make_empty_subroutine(const char *name, language l)
const char * module_local_name(entity e)
Returns the module local user name.
bool entity_module_p(entity e)
expression reference_to_expression(reference r)
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
void clean_all_normalized(expression e)
int expression_to_int(expression exp)
================================================================
int trivial_expression_p(expression e)
This function returns:
bool true_expression_p(expression e)
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression expression_list_to_conjonction(list l)
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)
expression subscript_value_stride(entity arr, list l_inds)
bool expression_equal_integer_p(expression exp, int i)
================================================================
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
bool relational_expression_p(expression e)
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 SizeOfArray(entity, int *)
This function computes the total size of a variable in bytes, ie.
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
bool variable_in_common_p(entity)
true if v is in a common.
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 storage_formal_p(x)
#define normalized_linear_p(x)
#define reference_variable(x)
#define statement_ordering(x)
#define dimension_lower(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define code_declarations(x)
#define storage_formal(x)
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define expression_undefined
#define dimension_upper(x)
#define reference_indices(x)
#define expression_undefined_p(x)
#define variable_dimensions(x)
#define call_arguments(x)
#define statement_undefined_p(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define entity_domain
newgen_syntax_domain_defined
#define variable_basic(x)
#define statement_undefined
#define storage_undefined
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.
#define CHAIN_SWORD(l, s)
string words_to_string(cons *lw)
#define exp
Avoid some warnings from "gcc -Wshadow".
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_normalize(Pvecteur v)
void vect_normalize(Pvecteur v): division de tous les coefficients de v par leur pgcd; "normalisation...