29 #include "pips_config.h"
103 const char *seeds[] = {
104 "KERNEL_LOAD_STORE_LOAD_FUNCTION",
105 "KERNEL_LOAD_STORE_STORE_FUNCTION",
106 "KERNEL_LOAD_STORE_ALLOCATE_FUNCTION",
107 "KERNEL_LOAD_STORE_DEALLOCATE_FUNCTION"
109 const char * propname = seeds[(
int)m];
112 char * apropname= NULL;
113 if(d > 0 && (
int)m < 2)
114 asprintf(&apropname,
"%s_%dD", seeds[(
int)m], (
int)d);
116 if(apropname)
free(apropname);
124 static bool declaration_region_to_dimensions(
effect reg,
158 pips_user_warning(
"failed to compute DMA from the array declaration based region\n");
193 ", are you using Fortran?");
207 pips_user_warning(
"failed to convert regions to minimal array dimensions, using whole array instead\n");
209 bool success_p =
false;
227 int indice_first = (is_fortran ==
true) ? 1 : 0;
341 &sc_inegalites(sc_reg), &lower, &upper);
394 "KERNEL_LOAD_STORE_..._FUNCTION "
395 "to a defined entity and added the correct .c file?\n",function_name);
583 bool fine_grain_analysis,
const char*
prefix,
602 for(
list iter = rw_effects;!
ENDP(iter);
POP(iter)) {
694 if(!fine_grain_analysis) {
730 may_write_effects=
CONS(
EFFECT,fake,may_write_effects);
771 pips_user_error(
"We can't handle abstract locations here. Please try to "
772 "avoid using pointer or activate some pointer analyzes.\n");
795 pips_assert(
"the type of the considered effect is expected to be variable",
829 if (statements ==
NIL)
873 &sc_inegalites(sc_reg), &lower, &upper);
914 pips_user_error(
"Cannot handle with some effects on non local variables in isolate_statement\n");
956 &sc_inegalites(sc_reg), &lower, &upper);
984 else pips_internal_error(
"This case should have been filtered out by `do_check_isolate_statement_preconditions_on_call'");
986 else pips_internal_error(
"This case should have been filtered out by `do_check_isolate_statement_preconditions_on_call'");
1019 bool fine_grain_analysis =
true;
1020 statement allocates, loads, stores, deallocates;
1024 pips_user_warning(
"isolated statement has callees, transfers will be approximated\n");
1025 fine_grain_analysis =
false;
1030 fine_grain_analysis,
prefix,suffix);
1057 pips_assert(
"there should be at least one declaration inserted by isolate_statement\n",!
ENDP(prev));
1092 if(!
ENDP(offsets)) {
1252 bool compute_upperbound_p =
1255 if(compute_upperbound_p)
1264 lowerbound_value<=0) {
1376 pips_debug (5,
"isolate_statement suffix : %s\n", suffix);
action copy_action(action p)
ACTION.
effects make_effects(list a)
approximation make_approximation_exact(void)
approximation make_approximation_may(void)
void free_effects(effects p)
effect copy_effect(effect p)
EFFECT.
void free_normalized(normalized p)
cast make_cast(type a1, expression a2)
call make_call(entity a1, list a2)
syntax make_syntax_call(call _field_)
expression make_expression(syntax a1, normalized a2)
subscript make_subscript(expression a1, list a2)
type make_type_variable(variable _field_)
basic copy_basic(basic p)
BASIC.
void free_callees(callees p)
type make_type_void(list _field_)
basic make_basic_pointer(type _field_)
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)
dimension make_dimension(expression a1, expression a2, list a3)
dimension copy_dimension(dimension p)
DIMENSION.
variable make_variable(basic a1, list a2, list a3)
instruction make_instruction_test(test _field_)
instruction make_instruction_call(call _field_)
void free_expression(expression p)
reference copy_reference(reference p)
REFERENCE.
syntax make_syntax_cast(cast _field_)
void free_syntax(syntax p)
syntax make_syntax_subscript(subscript _field_)
range make_range(expression a1, expression a2, expression a3)
#define dma_allocate_p(e)
#define dma_deallocate_p(e)
#define dma_load_p(e)
Add NewGen-like methods:
static reference ref
Current stmt (an integer)
struct _newgen_struct_expression_ * expression
bool entity_abstract_location_p(entity al)
void const char const char const int
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
struct _newgen_struct_statement_ * statement
#define CONTRAINTE_UNDEFINED_P(c)
#define contrainte_rm(c)
the standard xxx_rm does not return a value
void constraints_for_bounds(Variable, Pcontrainte *, Pcontrainte *, Pcontrainte *)
void constraints_for_bounds(var, pinit, plower, pupper) Variable var; Pcontrainte *pinit,...
expression constraints_to_loop_bound(Pcontrainte, Variable, bool, entity)
expression constraints_to_loop_bound(c, var, is_lower)
bool bounds_equal_p(Variable, Pcontrainte, Pcontrainte)
this function checks whether the lower and upper constraints are going to generate the same bound on ...
#define region_any_reference(reg)
To be avoided.
#define region_write_p(reg)
#define region_action(reg)
#define region_system(reg)
#define effect_region_p(e)
#define region_read_p(reg)
useful region macros
#define region_approximation_tag(reg)
#define make_region(reference, action, approximation, system)
#define region
simulation of the type region
effect regions_must_convex_hull(region f1, region f2)
1- Union :
bool sc_add_phi_equation(Psysteme *, expression, int, bool, bool)
bool summary_regions(const string)
effect region_dup(effect)
expression region_reference_to_expression(reference)
Psysteme entity_declaration_sc(entity)
effect region_rectangular_hull(effect, bool)
list effects_store_effects(list)
void update_cumulated_rw_effects_list(statement, list)
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 effect_approximation_tag(eff)
#define effect_any_entity(e)
some useful SHORTHANDS for EFFECT:
#define variable_phi_p(e)
true if e is a phi variable PHI entities have a name like: REGIONS:PHI#, where # is a number.
list effects_to_list(effects)
bool std_file_effect_p(effect)
#define approximation_may_p(x)
#define action_write_p(x)
#define descriptor_convex_p(x)
#define effect_descriptor(x)
#define descriptor_convex(x)
#define effect_approximation(x)
bool empty_string_p(const char *s)
const char * module_name(const char *s)
Return the module part of an entity name.
void set_live_loop_indices(void)
cproto-generated files
void partial_eval_declaration(entity, Psysteme, effects)
assumes conditions checked by partial_eval_declarations()
void reset_live_loop_indices(void)
char * get_string_property(const char *)
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)
void gen_full_free_list(list l)
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.
const char * get_current_module_name(void)
Get the name of the current module.
statement set_current_module_statement(statement)
Set the current module statement.
statement get_current_module_statement(void)
Get 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.
gen_chunk * gen_get_ancestor(int, const void *)
return the first ancestor object found of the given type.
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
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
#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 REFCAR(pc)
Get the adress of the first element of a list.
#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
#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.
list gen_append(list l1, const list l2)
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.
list statement_block(statement)
Get the list of block statements of a statement sequence.
void insert_statement(statement, statement, bool)
This is the normal entry point.
statement find_statement_from_label_name(statement, const char *, const char *)
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
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.
static bool declarations_to_dimensions(entity e, list *dimensions, list *offsets)
range dimension_to_range(dimension d)
static statement effects_to_dma(statement stat, enum region_to_dma_switch s, hash_table e2e, expression *condition, bool fine_grain_analysis, const char *prefix, const char *suffix)
Compute a call to a DMA function from the effects of a statement.
void region_to_dimensions(effect reg, transformer tr, list *dimensions, list *offsets, expression *condition)
isolate_statement.c
static void upperbound_of_expression(expression e, transformer tr)
replaces expression e by its upperbound under preconditions tr
static const char * get_dma_name(enum region_to_dma_switch m, size_t d)
converts a region_to_dma_switch to corresponding dma name according to properties
bool isolate_statement(const char *module_name)
static void isolate_patch_reference(reference r, isolate_param *p)
replace reference r on entity p->old by a reference on entity p->new with offsets p->offsets
static size_t get_dma_dimension(region reg_from)
void do_isolate_statement(statement s, const char *prefix, const char *suffix)
perform statement isolation on statement s that is make sure that all access to variables in s are ma...
static expression get_sizeofexpression_for_region(region reg)
generate an expression of the form sizeof(typeof(variable[indices]))
static bool do_check_isolate_statement_preconditions_on_call(call c, param_t *p)
region find_region_on_entity(entity e, list regions)
static bool do_isolate_statement_preconditions_satisified_p(statement s)
static void bounds_of_expression(expression e, transformer tr, bool is_upper)
replaces expression e by its upper or lower bound under preconditions tr is_upper is used to choose a...
static const int dma1D
Some constant intended to have a more readable code.
bool region_to_minimal_dimensions(region r, transformer tr, list *dims, list *offsets, bool exact, expression *condition)
generate a list of dimensions dims and of offsets from a region r for example if r = a[phi0,...
list variable_to_dimensions(region reg_from)
static expression region_to_address(region reg)
call dimensions_to_dma(effect reg_from, entity to, list ld, list lo, enum region_to_dma_switch m)
converts dimensions to a dma call from a memory from to another memory to
static region extended_regions_must_convex_hull(region r0, region r1)
perform the convex hull between r0 and r1, and merge them if they have a common prefix e....
static void lowerbound_of_expression(expression e, transformer tr)
replaces expression e by its lowerbound under preconditions tr
void isolate_patch_entities(void *where, entity old, entity new, list offsets)
replace all references on entity old by references on entity new and adds offset offsets to its indic...
static void isolate_patch_statement(statement s, isolate_param *p)
run isolate_patch_entities on all declared entities from s
#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
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define HASH_MAP(k, v, code, ht)
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
#define HASH_DEFAULT_SIZE
#define same_string_p(s1, s2)
bool set_belong_p(const set, const void *)
set set_make(set_type)
Create an empty set of any type but hash_private.
set set_add_element(set, const set, const void *)
void print_entity_variable(entity e)
print_entity_variable(e)
static const char * prefix
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define make_expression_list(stats...)
#define GREATER_THAN_OPERATOR_NAME
#define MINUS_OPERATOR_NAME
#define NORMALIZE_EXPRESSION(e)
#define statement_block_p(stat)
#define DEREFERENCING_OPERATOR_NAME
#define FIELD_OPERATOR_NAME
#define C_LOC_FUNCTION_NAME
F2003.
#define AND_OPERATOR_NAME
FI: intrinsics are defined at a third place after bootstrap and effects! I guess the name should be d...
#define ADDRESS_OF_OPERATOR_NAME
#define module_language(e)
implemented as a macro to allow lhs
#define DIVIDE_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
#define make_empty_statement
An alias for make_empty_block_statement.
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 entity_array_p(entity e)
Is e a variable with an array type?
bool same_entity_p(entity e1, entity e2)
predicates on entities
bool entity_local_variable_p(entity var, entity module)
Check if a variable "var" is local to a module "module".
bool c_module_p(entity m)
Test if a module "m" is written in C.
entity AddEntityToModule(entity e, entity module)
!!! caution, it may not be a module, but a common...
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
entity make_empty_subroutine(const char *name, language l)
bool entity_field_p(entity e)
e is the field of a structure
static int init
Maximal value set for Fortran 77.
bool fortran_module_p(entity m)
Test if a module is in Fortran.
bool entity_pointer_p(entity e)
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
bool expression_integer_value(expression e, intptr_t *pval)
expression add_integer_to_expression(expression exp, int val)
expression MakeSizeofType(type t)
bool expression_minmax_p(expression e)
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
void update_expression_syntax(expression e, syntax s)
frees expression syntax of e and replace it by the new syntax s
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression MakeSizeofExpression(expression e)
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
bool expression_reference_p(expression e)
Test if an expression is a reference.
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
expression syntax_to_expression(syntax s)
generates an expression from a syntax
expression SizeOfDimensions(list)
computes the product of all dimensions in dims
void AddLocalEntityToDeclarations(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
type ultimate_array_type(type)
type pointed_type(type)
returns the type pointed by the input type if it is a pointer or an array of pointers
bool pointer_type_p(type)
Check for scalar pointers.
bool formal_parameter_p(entity)
entity make_new_array_variable(entity, basic, list)
expression SizeOfDimension(dimension)
bool type_struct_variable_p(type)
bool type_pointer_on_struct_variable_p(type)
basic basic_of_reference(reference)
Retrieves the basic of a reference in a newly allocated basic object.
entity make_temporary_pointer_to_array_entity_with_prefix(char *, entity, entity, expression)
#define value_undefined_p(x)
#define normalized_undefined
#define expression_domain
newgen_execution_domain_defined
#define normalized_linear_p(x)
#define callees_callees(x)
#define reference_variable(x)
#define dimension_lower(x)
#define basic_pointer_p(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define reference_domain
newgen_range_domain_defined
#define expression_undefined
#define transformer_relation(x)
#define expression_normalized(x)
#define dimension_upper(x)
#define reference_indices(x)
#define expression_undefined_p(x)
#define variable_dimensions(x)
#define statement_declarations(x)
#define statement_undefined_p(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define predicate_system(x)
#define variable_basic(x)
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Psysteme sc_intersection(Psysteme s1, Psysteme s2, Psysteme s3)
Psysteme sc_intersection(Psysteme s1, Psysteme s2, Psysteme s3): calcul d'un systeme de contraintes s...
Psysteme sc_free(Psysteme in_ps)
Psysteme sc_free( in_ps ) AL 30/05/94 Free of in_ps.
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Psysteme sc_normalize2(volatile Psysteme ps)
Psysteme sc_normalize2(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires...
bool precondition_minmax_of_expression(expression exp, transformer tr, intptr_t *pmin, intptr_t *pmax)
compute integer bounds pmax, pmin of expression exp under preconditions tr require value mappings set...
void simplify_minmax_expression(expression e, transformer tr)
tries hard to simplify expression e if it is a min or a max operator, by evaluating it under precondi...
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
transformer load_statement_precondition(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
enum region_to_dma_switch s
char * callee_module_name
#define sc_equal_p(ps1, ps2)
#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....
void AddEntityToModuleCompilationUnit(entity e, entity module)