30 #include "pips_config.h"
46 #include "resources.h"
93 char *seeds[] = {
"KERNEL_LOAD_STORE_LOAD_FUNCTION",
94 "KERNEL_LOAD_STORE_STORE_FUNCTION",
95 "KERNEL_LOAD_STORE_ALLOCATE_FUNCTION",
96 "KERNEL_LOAD_STORE_DEALLOCATE_FUNCTION" };
97 const char * propname = seeds[(
int)m];
100 char * apropname=NULL;
101 if(d > 0 && (
int)m < 2)
102 asprintf(&apropname,
"%s_%dD", seeds[(
int)m], (
int)d);
119 "KERNEL_LOAD_STORE_..._FUNCTION "
120 "to a defined entity and added the correct .c file?\n",function_name);
141 #define INIT_STATEMENT_SIZE 20
142 #define INIT_ENTITY_SIZE 10
145 #define MAKE_SET() (set_make( set_pointer ))
151 #define COPY_FROM_IN(st) ((set)hash_get(copies_from_in, (char *)st))
166 #define COPY_FROM_OUT(st) ((set)hash_get(copies_from_out, (char *)st))
181 #define COPY_TO_IN(st) ((set)hash_get(copies_to_in, (char *)st))
196 #define COPY_TO_OUT(st) ((set)hash_get(copies_to_out, (char *)st))
322 int arg_num, n_formals =
gen_length(l_formals);
329 for (arg_num = 1; !
ENDP(real_args) && arg_num <= n_formals; real_args
330 =
CDR(real_args), arg_num++) {
348 "Interprocedural mapping on %s map on a non ref expression ",
428 pips_debug(6,
"Handling copy from for test expression : ");
470 pips_debug(1,
"Loop not executed once :-( !\n");
564 copy_from_out =
set_union(copy_from_out, at_call_site, copy_from_out);
566 pips_debug(6,
"Adding interprocedural summary : ");
630 "** stmt (%d) associated copy from : **\n",
632 fprintf(stderr,
"*\n* OUT : ");
634 string str =
concatenate(
"Copy from out : ", NULL);
644 fprintf(stderr,
"*\n**********************************\n");
658 fprintf(stderr,
"*\n**********************************\n");
711 pips_debug(6,
"Handling copy to for test expression : ");
759 pips_debug(1,
"Loop not executed once :-( !\n");
815 pips_debug(6,
"Do not add %s into copy_in because fully overwritten\n",
841 copy_to_in =
set_union(copy_to_in, at_call_site, copy_to_in);
918 pips_debug(4,
"Removing from copy_to_out what is not written here : ");
933 "** stmt (%d) associated copy to : **\n",
935 fprintf(stderr,
"*\n* OUT : ");
959 fprintf(stderr,
"*\n**********************************\n");
970 set already_transfered_to,
971 set already_transfered_from,
972 set array_to_transfer_to_after,
973 set array_to_transfer_from_before);
977 set already_transfered,
978 set already_transfered_from) {
994 already_transfered_from,
1021 set already_transfered,
1022 set already_transfered_from,
1024 set transfert_from) {
1030 set_assign(already_transfered_from_tmp,already_transfered_from);
1031 set_assign(already_transfered_tmp,already_transfered);
1033 set_assign(transfert_from_tmp,transfert_from);
1037 already_transfered_tmp,
1038 already_transfered_from_tmp,
1040 transfert_from_tmp);
1043 set_assign(already_transfered_from_tmp,already_transfered_from);
1044 set_assign(already_transfered_tmp,already_transfered);
1046 set_assign(transfert_from_tmp,transfert_from);
1049 already_transfered_tmp,
1050 already_transfered_from_tmp,
1052 transfert_from_tmp);
1061 set already_transfered,
1062 set already_transfered_from,
1064 set transfert_from) {
1070 already_transfered_from,
1088 last_copy_from = copy_from;
1110 set already_transfered,
1111 set already_transfered_from,
1113 set transfert_from) {
1119 already_transfered_from,
1125 set already_transfered,
1126 set already_transfered_from,
1128 set transfert_from) {
1134 already_transfered_from,
1149 pips_user_error(
"Unstructured are not processed. Please structure your input code.\n");
1153 set already_transfered_to,
1154 set already_transfered_from,
1155 set array_to_transfer_to_after,
1156 set array_to_transfer_from_before) {
1163 set_difference(transferts_to, transferts_to, already_transfered_to);
1170 pips_debug(4,
"Removing from transfer_to what is not written here : ");
1185 set_add_element(array_to_transfer_to_after, array_to_transfer_to_after, e);
1201 set_difference(transferts_from, transferts_from, already_transfered_from);
1208 array_to_transfer_from_before,
1227 already_transfered_to,
1228 already_transfered_from);
1233 already_transfered_to,
1234 already_transfered_from,
1235 array_to_transfer_to_after,
1236 array_to_transfer_from_before);
1241 already_transfered_to,
1242 already_transfered_from,
1243 array_to_transfer_to_after,
1244 array_to_transfer_from_before);
1249 already_transfered_to,
1250 already_transfered_from,
1251 array_to_transfer_to_after,
1252 array_to_transfer_from_before);
1257 already_transfered_to,
1258 already_transfered_from,
1259 array_to_transfer_to_after,
1260 array_to_transfer_from_before);
1265 already_transfered_to,
1266 already_transfered_from);
1272 already_transfered_to,
1273 already_transfered_from);
1281 already_transfered_to,
1282 already_transfered_from);
1292 set_difference(already_transfered_to, already_transfered_to, killed_transfer);
1295 already_transfered_from,
1311 debug_on(
"KERNEL_DATA_MAPPING_DEBUG_LEVEL");
1354 debug_on(
"KERNEL_DATA_MAPPING_DEBUG_LEVEL");
1420 #define TABLE_FREE(t) \
1421 {HASH_MAP( k, v, {set_free( (set)v ) ;}, t ) ; hash_table_free(t);}
1490 debug_on(
"WRAP_KERNEL_ARGUMENT_DEBUG_LEVEL");
1504 "WRAP_KERNEL_ARGUMENT_FUNCTION_NAME"
1505 "to a defined entity and added the correct .c file?\n",function_name);
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
approximation make_approximation_exact(void)
memory_mapping make_memory_mapping(set a)
void free_normalized(normalized p)
call make_call(entity a1, list a2)
expression make_expression(syntax a1, normalized a2)
type make_type_variable(variable _field_)
syntax make_syntax_sizeofexpression(sizeofexpression _field_)
basic copy_basic(basic p)
BASIC.
language copy_language(language p)
LANGUAGE.
sizeofexpression make_sizeofexpression_type(type _field_)
variable make_variable(basic a1, list a2, list a3)
instruction make_instruction_call(call _field_)
syntax copy_syntax(syntax p)
SYNTAX.
static const char * caller_name
void const char const char const int
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
#define region_empty_p(reg)
#define region
simulation of the type region
#define region_exact_p(reg)
list region_sup_difference(region reg1, region reg2)
list region_sup_difference(effect reg1, reg2) input : two regions output : a list of regions containi...
effect entity_whole_region(entity, action)
Psysteme entity_declaration_sc(entity)
void region_exact_projection_along_variables(effect, list)
void region_exact_projection_along_variables(effect reg, list l_var) input : a region and a list of v...
list load_proper_rw_effects_list(statement)
void reset_out_effects(void)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void set_out_effects(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
list load_statement_out_regions(statement)
list load_statement_in_regions(statement)
void reset_cumulated_rw_effects(void)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
action make_action_write_memory(void)
To ease the extension of action with action_kind.
bool store_effect_p(effect)
#define descriptor_convex_p(x)
#define effect_descriptor(x)
#define descriptor_convex(x)
#define effect_approximation(x)
const char * module_name(const char *s)
Return the module part of an entity name.
char * get_string_property(const char *)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
#define gen_recurse(start, domain_number, flt, rwt)
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.
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.
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
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
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
#define POP(l)
Modify a list pointer to point on the next element of the 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)
#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.
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.
sequence statement_sequence(statement)
Get the sequence of a statement sequence.
bool empty_statement_or_continue_without_comment_p(statement)
Return true if the statement is an empty instruction block or a continue without comments or without ...
bool statement_sequence_p(statement)
Statement classes induced from instruction type.
void insert_comments_to_statement(statement, const char *)
Insert a comment string (if non empty) at the beginning of the comments of a statement.
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_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.
list base_to_list(Pbase base)
Most includes are centralized here.
static void get_written_entities(statement s, set written_entities)
static void transfert_call(_UNUSED_ statement st, _UNUSED_ call c, _UNUSED_ set already_transfered, _UNUSED_ set already_transfered_from)
static void copy_from_forloop(statement st, forloop l)
static void wrap_call_argument(call c, const char *module_name)
static bool force_renormalize(expression e)
Should be useful, but for some bullshit reason the array dimensions even for simple case like a[512][...
static void transfert_block(_UNUSED_ statement st, list sts, set already_transfered, set already_transfered_from)
static void force_renormalize_rwt(expression e)
static set interprocedural_mapping(string res, call c)
Translate the interprocedural summary for a function into a set of local corresponding parameters (en...
bool is_a_kernel(const char *func_name)
#define INIT_STATEMENT_SIZE
static const char * get_dma_name(enum region_to_dma_switch m, int d)
converts a region_to_dma_switch to corresponding dma name according to properties
static void transfert_forloop(_UNUSED_ statement st, forloop l, set already_transfered, set already_transfered_from, set transfert_to, set transfert_from)
static void transfert_test(_UNUSED_ statement st, test t, set already_transfered, set already_transfered_from, set transfert_to, set transfert_from)
static void copy_to_whileloop(statement st, whileloop l)
static expression makeTransfertSizeExpression(entity e)
Make a sizeof expression.
#define MAKE_SET()
Macro to create set.
static void wrap_argument(syntax s)
void dump_entity_set(set s)
ikernels.c
static void copy_from_statement(statement st)
static void copy_to_block(statement st, list sts)
static hash_table copies_to_in
copy_to_in maps each statement to the "copy to" data that are in-coming the statement
static void transfert_whileloop(_UNUSED_ statement st, whileloop l, set already_transfered, set already_transfered_from, set transfert_to, set transfert_from)
static void copy_from_whileloop(statement st, whileloop l)
static bool array_must_fully_written_by_regions_p(entity e_used, list lreg)
Check that an array is fully written by an exact W region in a list.
static void copy_to_all_kind_of_loop(statement st, statement body)
static hash_table copies_to_out
copy_to_out maps each statement to the "copy to" data that are out-going from the statement
static void copy_to_call(statement st, call c)
static void transfert_unstructured(_UNUSED_ statement st, _UNUSED_ unstructured u, _UNUSED_ set already_transfered, _UNUSED_ set already_transfered_from)
static void copy_from_test(statement st, test t)
static statement make_dma_transfert(entity e, enum region_to_dma_switch dma)
#define COPY_FROM_OUT(st)
static entity wrapper_function
static void init_one_statement(statement st)
static void copy_to_forloop(statement st, forloop l)
static void copy_from_call(statement st, call c)
static void copy_from_unstructured(_UNUSED_ statement st, _UNUSED_ unstructured u)
static void copy_to_test(statement st, test t)
static hash_table copies_from_out
copy_from_out maps each statement to the "copy from" data that are out-going from the statement
bool kernel_data_mapping(char *module_name)
bool wrap_kernel_argument(char *module_name)
This pass will wrap kernel arguments in a call to a wrapper function.
bool ikernel_load_store(__attribute__((unused)) char *module_name)
static void copy_from_all_kind_of_loop(statement st, statement body)
static void transfert_loop(_UNUSED_ statement st, loop l, set already_transfered, set already_transfered_from, set transfert_to, set transfert_from)
static void transfert_statement(statement st, set already_transfered_to, set already_transfered_from, set array_to_transfer_to_after, set array_to_transfer_from_before)
static void copy_from_block(statement st, cons *sts)
static void copy_to_statement(statement st)
static void copy_from_loop(statement st, loop l)
static void copy_to_unstructured(_UNUSED_ statement st, _UNUSED_ unstructured u)
static void copy_to_loop(statement st, loop l)
static hash_table copies_from_in
copy_from_in maps each statement to the "copy from" data that are in-coming the statement
struct _newgen_struct_memory_mapping_ * memory_mapping
#define memory_mapping_map(x)
#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_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
#define same_string_p(s1, s2)
set set_del_element(set, const set, const void *)
set set_intersection(set, const set, const set)
list set_to_list(const set)
create a list from a set the set is not freed
list set_to_sorted_list(const set, gen_cmp_func_t)
set set_assign(set, const set)
Assign a set with the content of another set.
bool set_equal_p(const set, const set)
returns whether s1 == s2
set set_difference(set, const set, const set)
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
bool set_belong_p(const set, const void *)
set set_union(set, const set, const set)
#define set_undefined_p(s)
set set_make(set_type)
Create an empty set of any type but hash_private.
set set_add_element(set, const set, const void *)
int(* gen_cmp_func_t)(const void *, const void *)
normalized NormalizeExpression(expression e)
normalize.c
void print_syntax(syntax s)
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define make_expression_list(stats...)
#define statement_block_p(stat)
#define call_intrinsic_p(C)
#define is_instruction_block
soft block->sequence transition
#define module_language(e)
implemented as a macro to allow lhs
#define instruction_block(i)
#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...
int compare_entities(const entity *pe1, const entity *pe2)
Comparison function for qsort.
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
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
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)
const char * module_local_name(entity e)
Returns the module local user name.
void print_entities(list l)
bool top_level_entity_p(entity e)
Check if the scope of entity e is global.
entity find_ith_formal_parameter(entity the_fnct, int rank)
This function gives back the ith formal parameter, which is found in the declarations of a call or a ...
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
bool expression_call_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.
call expression_call(expression e)
bool user_call_p(call c)
Test if a call is a user call.
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.
list module_formal_parameters(entity func)
list module_formal_parameters(entity func) input : an entity representing a function.
expression SizeOfDimensions(list)
computes the product of all dimensions in dims
#define normalized_undefined
struct _newgen_struct_callees_ * callees
#define syntax_reference_p(x)
#define expression_domain
newgen_execution_domain_defined
#define syntax_reference(x)
#define callees_callees(x)
#define reference_variable(x)
#define instruction_loop(x)
#define statement_ordering(x)
#define dimension_lower(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
@ is_instruction_unstructured
@ is_instruction_whileloop
@ is_instruction_expression
#define instruction_tag(x)
#define expression_normalized(x)
#define sequence_statements(x)
#define dimension_upper(x)
#define reference_indices(x)
#define instruction_forloop(x)
#define instruction_expression(x)
#define test_condition(x)
#define instruction_whileloop(x)
#define variable_dimensions(x)
#define whileloop_body(x)
#define statement_instruction(x)
#define instruction_call(x)
#define call_arguments(x)
#define instruction_test(x)
#define normalized_undefined_p(x)
#define statement_number(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define instruction_unstructured(x)
#define variable_basic(x)
#define STATEMENT(x)
STATEMENT.
#define syntax_domain
newgen_synchronization_domain_defined
Psysteme sc_safe_append(Psysteme s1, Psysteme s2)
Psysteme sc_safe_append(Psysteme s1, Psysteme s2) input : output : calcul de l'intersection des polye...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Psysteme sc_safe_normalize(Psysteme ps)
Psysteme sc_safe_normalize(Psysteme ps) output : ps, normalized.
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
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.
@ empty
b1 < bj -> h1/hj = empty
void AddEntityToModuleCompilationUnit(entity e, entity module)