27 #include "pips_config.h"
87 if(
gen_length(current_l_ind) <= current_nb_dim) {
98 result = (
int) current_nb_dim;
112 for(i=0; i< (
int) current_nb_dim; i++,
POP(current_l_ind));
116 pips_debug(8,
"_IO_FILE_ array: no pointer dimension\n");
129 while (!
ENDP(l_fields))
142 result = result < 0 ? tmp_result : (tmp_result <= result ? tmp_result : result);
145 *exact_p = (result < 0);
146 if (result >= 0) result += i+1;
153 if (result >=0) result += i+1;
223 return (pointer_rank >= 0);
325 int current_nb_dim =
gen_length(l_current_dim);
327 int common_nb_dim =
MIN(current_nb_dim, ref_l_ind_nb_dim);
331 pips_debug(8,
"common number of dimensions: %d\n", common_nb_dim);
338 *to_be_freed =
false;
343 for(
int i=0; i< common_nb_dim; i++,
POP(ref_l_ind),
POP(l_current_dim));
356 if(
ENDP(l_current_dim)) {
364 list n_dims =
CDR(l_current_dim);
406 pips_internal_error(
"the current basic tag is derived, but corresponding index is not a field entity");
409 pips_internal_error(
"the current basic tag is derived, but corresponding index is not a reference");
415 *to_be_freed =
false;
432 pips_debug(8,
"with basic : %s, and number of dimensions %d\n",
435 pips_debug(8,
"*to_be_freed = %s\n", *to_be_freed?
"true":
"false");
453 pips_internal_error(
"non void and non variable case: not handled yet here, please report\n");
468 debug_on(
"EFFECTS-UTIL_DEBUG_LEVEL");
499 *to_be_freed =
false;
536 *to_be_freed =
false;
547 *to_be_freed =
false;
558 *to_be_freed =
false;
701 static list real_structured_types =
NIL;
702 static list formal_structured_types =
NIL;
704 pips_debug(8,
"real_ct : %s \t formal_ct: %s\n",
710 if (real_ct == formal_ct)
737 bool finished =
false;
758 pips_debug(8,
"derived case, real: %s, formal: %s\n",
771 void * found_formal_t = (
type)
gen_find_eq(formal_dt,formal_structured_types);
772 void * found_real_t = (
type)
gen_find_eq(real_dt,real_structured_types);
776 pips_debug(8,
"types already encountered (1) \n");
777 result =
gen_position(found_formal_t, formal_structured_types)
782 pips_debug(8,
"types not encountered (1) \n");
783 formal_structured_types =
gen_type_cons(formal_dt, formal_structured_types);
784 real_structured_types =
gen_type_cons(real_dt, real_structured_types);
786 list old_formal_structured_types = formal_structured_types;
787 list old_real_structured_types = real_structured_types;
788 POP(formal_structured_types);
789 POP(real_structured_types);
790 CDR(old_formal_structured_types) =
NIL;
791 CDR(old_real_structured_types) =
NIL;
819 formal_dims =
CDR(formal_dims);
837 real_dims =
CDR(real_dims);
851 pips_debug(8,
"struct, union or enum case\n");
857 while(result && !
ENDP(real_fields))
861 pips_debug(8,
"fields, real: %s, formal: %s\n",
875 void * found_formal_ft = (
type)
gen_find_eq(formal_ft,formal_structured_types);
876 void * found_real_ft = (
type)
gen_find_eq(real_ft,real_structured_types);
880 pips_debug(8,
"types already encountered (2)\n");
881 result =
gen_position(found_formal_ft, formal_structured_types)
890 formal_structured_types =
gen_type_cons(formal_ft, formal_structured_types);
891 real_structured_types =
gen_type_cons(real_ft, real_structured_types);
899 (real_fbct, formal_fbct);
901 list old_formal_structured_types = formal_structured_types;
902 list old_real_structured_types = real_structured_types;
903 POP(formal_structured_types);
904 POP(real_structured_types);
905 CDR(old_formal_structured_types) =
NIL;
906 CDR(old_real_structured_types) =
NIL;
924 pips_debug(8,
"returning %s\n", result?
"true":
"false");
936 if (real_arg_t == formal_arg_t)
945 (real_arg_ct, formal_arg_ct);
997 bool l_to_be_freed, r_to_be_freed;
1062 fprintf(stderr,
"Type pointed by source \"pt\": \"");
1064 fprintf(stderr,
"\"\nSink type \"urt\": \"");
1070 fprintf(stderr,
"Pointed type \"pt\": ");
1086 fprintf(stderr,
"Type pointed by source \"pt\": \"");
1088 fprintf(stderr,
"\"\nSink type \"urt\": \"");
1136 pips_internal_error(
"Type mistake for heap allocation. Probably a user error. It should have been trapped at a higher level.\n");
1151 r_to_be_freed =
true;
1175 fprintf(stderr,
"Type pointed by source cell, \"pt\": \"");
1178 fprintf(stderr,
"\" with type: \"");
1180 fprintf(stderr,
"\"\nType of sink cell, \"urt\": \"");
1182 fprintf(stderr,
"\" with type: \"");
1243 bool compatible_p =
true;
1246 compatible_p =
false;
1248 compatible_p =
false;
1250 return compatible_p;
1260 bool compatible_p =
true;
1262 return compatible_p;
1328 int (*line_number_func)(
void))
1330 bool succeed_p =
true;
1355 pips_user_warning(
"There may be a typing error at line %d (e.g. improper malloc call).\n Reference \"%s\" with type \"%s\" cannot be adapted to type \"%s\".\n",
1357 (*line_number_func)(),
1376 bool unbounded_p =
true;
1380 unbounded_p =
false;
1409 bool constant_path =
false;
1419 constant_path =
true;
1424 constant_path =
true;
1429 constant_path =
true;
1434 constant_path =
true;
1439 constant_path =
true;
1442 constant_path =
true;
1446 constant_path =
true;
1450 constant_path =
true;
1454 constant_path =
true;
1459 constant_path =
true;
1462 else if (!
ENDP(l_ind)) {
1467 return constant_path;
1494 bool constant_path =
true;
1497 constant_path =
true;
1499 bool exact_p =
true;
1501 constant_path =
true;
1504 constant_path =
false;
1508 return constant_path;
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
type make_type_variable(variable _field_)
basic make_basic(enum basic_utype tag, void *val)
type copy_type(type p)
TYPE.
void free_reference(reference p)
basic copy_basic(basic p)
BASIC.
basic make_basic_pointer(type _field_)
expression copy_expression(expression p)
EXPRESSION.
reference make_reference(entity a1, list a2)
dimension make_dimension(expression a1, expression a2, list a3)
variable make_variable(basic a1, list a2, list a3)
void free_expression(expression p)
type make_type(enum type_utype tag, void *val)
list gen_type_cons(type p, list l)
static reference ref
Current stmt (an integer)
bool entity_all_module_static_locations_p(entity e)
test if an entity is the a static area
bool entity_null_locations_p(entity e)
test if an entity is the NULL POINTER
bool entity_abstract_location_p(entity al)
bool entity_all_dynamic_locations_p(entity e)
test if an entity is the set of all dynamic locations
bool entity_stub_sink_p(entity e)
test if an entity is a stub sink for a formal parameter e.g.
bool entity_all_locations_p(entity e)
test if an entity is the top of the lattice
bool entity_all_static_locations_p(entity e)
test if an entity is the set of all static locations
bool entity_typed_anywhere_locations_p(entity e)
Test if an entity is the bottom of the lattice.
bool entity_nowhere_locations_p(entity e)
test if an entity is the bottom of the lattice
bool entity_all_module_locations_p(entity e)
test if an entity is the set of locations defined in a module
bool entity_anywhere_locations_p(entity e)
test if an entity is the bottom of the lattice
bool entity_all_module_heap_locations_p(entity e)
test if an entity is the a heap area
bool entity_all_module_dynamic_locations_p(entity e)
test if an entity is the a dynamic area
bool entity_all_module_stack_locations_p(entity e)
test if an entity is the a stack area
bool entity_all_stack_locations_p(entity e)
test if an entity is the set of all stack locations
bool entity_all_heap_locations_p(entity e)
test if an entity is the set of all heap locations
bool entity_typed_nowhere_locations_p(entity e)
test if an entity is the bottom of the lattice
void const char const char const int
#define MIN(x, y)
minimum and maximum if they are defined somewhere else, they are very likely to be defined the same w...
struct _newgen_struct_type_ * type
entity int_to_entity(_int c)
#define variable_phi_p(e)
true if e is a phi variable PHI entities have a name like: REGIONS:PHI#, where # is a number.
type points_to_cell_to_concrete_type(cell c)
static void substitute_unbounded_call(call c)
type points_to_expression_to_concrete_type(expression e)
The type returned is stored in a hash-table.
type points_to_reference_to_type(reference ref, bool *to_be_freed)
FI: I need more generality than is offered by cell_to_type()
bool points_to_sink_cell_compatible_p(cell c __attribute__((unused)))
type cell_reference_to_type(reference ref, bool *to_be_freed)
computes the type of a cell reference representing a memory access path.
bool basic_concrete_types_compatible_for_effects_interprocedural_translation_p(type real_ct, type formal_ct)
tests if the actual argument type and the formal argument type are compatible with the current state ...
static int effect_reference_first_pointer_dimension_rank(reference ref, bool *exact_p)
walks thru ref indices and ref entity type arborescence in parallel until a pointer dimension is foun...
type points_to_reference_to_concrete_type(reference r)
bool strict_constant_path_p(reference r)
bool can_be_constant_path_p(reference r)
TODO most of the time return same result that !effect_reference_dereferencing_p for the moment want t...
static int effect_indices_first_pointer_dimension_rank(list current_l_ind, type current_type, bool *exact_p)
recursively walks thru current_l_ind and current_type in parallel until a pointer dimension is found.
bool effect_reference_dereferencing_p(reference ref, bool *exact_p)
void points_to_cell_types_compatibility(cell l, cell r)
Make sure that cell l can points towards cell r.
bool effect_reference_contains_pointer_dimension_p(reference ref, bool *exact_p)
bool adapt_reference_to_type(reference r, type et, int(*line_number_func)(void))
FI: a really stupid function...
static expression eliminate_calls_to_unbounded(expression e)
Allocate a copy of expression "e" where calls to the unbounded function are replaced by calls to the ...
bool reference_unbounded_indices_p(reference r)
This function should be at expression.c.
bool points_to_source_cell_compatible_p(cell c)
entity effect_field_dimension_entity(expression exp, list l_fields)
type.c
type points_to_expression_to_type(expression e, bool *to_be_freed)
FI: I need more generality than is offered by expression_to_type() because fields are assimilated to ...
bool types_compatible_for_effects_interprocedural_translation_p(type real_arg_t, type formal_arg_t)
tests if the actual argument type and the formal argument type are compatible with the current state ...
type cell_to_type(cell c, bool *to_be_freed)
static type r_cell_reference_to_type(list ref_l_ind, type current_type, bool *to_be_freed)
Lines 291 to 682.
type points_to_expression_to_pointed_type(expression e)
Return a new allocated type "t" of the address pointed by expression "e", if expression "e" denotes a...
type points_to_cell_to_type(cell c, bool *to_be_freed)
FI: I need more generality than is offered by cell_to_type()
list find_points_to_subscript_for_type(cell c, type t)
Find the subscript in the reference of cell "c" that would make the reference type be "t" if the subs...
list effect_words_reference(reference)
prettyprint.c
reference cell_any_reference(cell)
API for reference.
bool anywhere_cell_p(cell)
Is it an anywhere cell?
bool all_heap_locations_cell_p(cell)
bool nowhere_cell_p(cell)
Target of an undefined pointer.
void points_to_cell_add_zero_subscripts(cell)
bool heap_cell_p(cell)
Any heap cell, more or less abstract or typed.
#define cell_reference(x)
#define cell_preference(x)
#define cell_reference_p(x)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_chunk_undefined_p(c)
#define gen_recurse(start, domain_number, flt, rwt)
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
int gen_position(const void *item, const list l)
Element ranks are strictly positive as for first, second, and so on.
#define POP(l)
Modify a list pointer to point on the next element of the list.
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)
list gen_copy_seq(list l)
Copy a list structure.
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
list gen_last(list l)
Return the last element of a list.
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define CDR(pcons)
Get the list less its first element.
void * gen_find_eq(const void *item, const list seq)
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
#define list_undefined
Undefined list definition :-)
list gen_full_copy_list(list l)
Copy a list structure with element copy.
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
#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
#define pips_internal_error
#define same_string_p(s1, s2)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
string reference_to_string(reference r)
#define print_points_to_cell(x)
string string_of_type(const type t)
string type_to_full_string_definition(type t)
Provide a full ASCII description of type "t".
void print_type(type t)
For debugging.
string basic_to_string(basic b)
RI-UTIL Library: Functions dealing with and constants related to PIPS intermediate representation ri....
#define UNBOUNDED_DIMENSION_NAME
bool heap_area_p(entity aire)
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
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 same_entity_p(entity e1, entity e2)
predicates on entities
bool entity_field_p(entity e)
e is the field of a structure
bool expression_integer_constant_p(expression e)
bool expression_field_p(expression e)
The expression is of kind "s.a", where "s" is a struct and a "a" field.
void reference_add_zero_subscripts(reference r, type t)
int expression_to_int(expression exp)
================================================================
expression make_unbounded_expression()
expression make_zero_expression(void)
Make a zero expression.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
bool unbounded_expression_p(expression e)
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
bool array_pointer_string_type_equal_p(type t1, type t2)
Assume that a pointer to type x is equal to a 1-D array of x.
bool array_type_p(type t)
list derived_type_fields(type t)
type expression_to_type(expression exp)
For an array declared as int a[10][20], the type returned for a[i] is int [20].
bool basic_equal_p(basic b1, basic b2)
bool type_equal_up_to_typedefs_and_qualifiers_p(type t1, type t2)
bool string_type_p(type t)
type type_to_pointed_type(type t)
returns t if t is not a pointer type, and the pointed type if t is a pointer type.
type entity_basic_concrete_type(entity e)
retrieves or computes and then returns the basic concrete type of an entity
string type_to_string(const type t)
type.c
type array_type_to_element_type(type t)
returns the type of the elements of an array type, as a newly allocated type.
bool pointer_type_p(type t)
Check for scalar pointers.
bool scalar_type_p(type t)
bool overloaded_type_p(type t)
Returns true if t is a variable type with a basic overloaded.
bool C_pointer_type_p(type t)
Returns OK for "char[]" as well as for "char *".
bool struct_type_p(type t)
Returns true if t is of type derived and if the derived type is a struct.
bool array_pointer_type_equal_p(type t1, type t2)
assume that a pointer to type x is equal to a 1-D array of x
type type_to_pointer_type(type t)
allocate a new type "pt" which includes directly "t".
type compute_basic_concrete_type(type t)
computes a new type which is the basic concrete type of the input type (this new type is not stored i...
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
#define type_functional_p(x)
#define syntax_reference_p(x)
#define functional_result(x)
#define syntax_reference(x)
#define type_unknown_p(x)
#define reference_variable(x)
#define type_functional(x)
#define basic_pointer_p(x)
#define basic_derived_p(x)
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define type_undefined_p(x)
#define reference_indices(x)
#define preference_reference(x)
#define variable_dimensions(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define variable_basic(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
The structure used to build lists in NewGen.
string words_to_string(cons *lw)
#define exp
Avoid some warnings from "gcc -Wshadow".