26 #include "pips_config.h"
291 if (s1r || s2r)
pips_assert(
"one return in sequence", s1r ^ s2r);
302 if (s1r) order = 1, why =
"return1";
303 else if (s2r) order = -1, why =
"return2";
305 else if (s1a && !s2a) order = -1, why =
"alloc1";
306 else if (s2a && !s1a) order = 1, why =
"alloc2";
308 else if (s1d && !s2d) order = 1, why =
"free1";
309 else if (s2d && !s1d) order = -1, why =
"free2";
334 prev = ls, ls =
CDR(ls);
404 int img_effect =
false;
436 bool depends =
false;
511 pips_assert(
"an expected transposition function should have at least "
715 bool changed =
false;
787 pips_assert(
"we need some dependable effects for our purpose",
802 "freia compilation may result in wrong code!\n",
806 "see FREIA_ALLOW_IMAGE_SHUFFLE property to continue.\n",
839 FILE * helper = NULL;
846 "cannot reapply transformation\n", file);
848 pips_debug(1,
"generating file '%s'\n", file);
870 set_union(output_images, output_images, shuffled);
885 list lcurrent = ldags;
895 lcurrent =
CDR(lcurrent);
916 output_images, helper, helpers,
n_dags);
919 output_images, helper, helpers,
n_dags);
922 output_images, helper, helpers,
n_dags, signatures);
929 output_images, helper, helpers,
n_dags);
967 set_free(output_images), output_images = NULL;
968 set_free(shuffled), shuffled = NULL;
969 if (helpers)
set_free(helpers), helpers = NULL;
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
call make_call(entity a1, list a2)
value make_value_expression(expression _field_)
syntax make_syntax_call(call _field_)
expression make_expression(syntax a1, normalized a2)
void free_instruction(instruction p)
void set_entity_initial(entity, expression)
Be careful if the initial value has already been set.
dag freia_build_dag(string module, list ls, int number, const hash_table occurrences, const set output_images, const list ld, bool inloop)
build a full dag from list of statements ls.
statement dagvtx_statement(const dagvtx v)
return statement if any, or NULL (for input nodes).
effects load_cumulated_rw_effects(statement)
#define effect_write_p(eff)
#define effect_read_p(eff)
#define effect_scalar_p(eff) entity_scalar_p(effect_entity(eff))
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
#define effects_effects(x)
FILE * safe_fopen(const char *filename, const char *what)
char * get_string_property(const char *)
int safe_fclose(FILE *stream, const char *filename)
bool file_readable_p(char *name)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
bool entity_freia_api_p(const entity f)
returns whether the entity is a freia API (AIPO) function.
const freia_api_t * hwac_freia_api(const char *function)
freia-utils.c
bool is_freia_dealloc(const statement s)
bool is_freia_alloc(const statement s)
string helper_file_name(string func_name, string suffix)
return malloc'ed "foo.database/Src/%{module}_helper_functions.c" should it depend on the target?...
bool freia_image_variable_p(const entity var)
rather approximative?
hash_table freia_build_image_occurrences(statement s, set image_occs_stats, hash_table image_stats, const hash_table signatures)
void freia_close_dep_cache(void)
call freia_ok(void)
build all is well freia constant
call freia_statement_to_call(const statement s)
return the actual function call from a statement, dealing with assign and returns....
void freia_init_dep_cache(void)
set freia_compute_current_output_images(void)
bool freia_assignment_p(const entity e)
tell whether it is an assignment to ignore?
bool freia_statement_aipo_call_p(const statement s)
returns whether the statement is a FREIA call.
void freia_clean_image_occurrences(hash_table occs)
cleanup occurrence data structure
bool freia_is_transpose_call(statement s)
Detect a call to a se transposition function and transpose the arguments.
static bool freia_cleanup_sequence_rec(statement modstat, set referenced)
static int freia_cmp_statement(const statement *s1, const statement *s2)
order two statements for qsort.
static _int min_statement(list ls)
static bool statement_depends_p(set written, statement s)
static bool freia_alloc_call_p(const call c)
static string stmt_nb(void *s)
debug helper
expression freia_transpose_kernel(const expression se)
Transpose a structuring element expression.
static void update_written_variables(set written, statement s)
update the set of written variables, as seen from effects, with a statement this is really to rebuild...
static void sctc_call_rwt(call c, int *count)
static bool freia_image_shuffle(statement s, set shuffled)
static bool fsi_stmt_flt(statement s, freia_info *fsip)
detect one lone aipo statement out of a sequence...
bool freia_some_effects_on_images(statement s)
tell whether a statement has no effects on images.
static bool fsi_seq_flt(sequence sq, freia_info *fsip)
consider a sequence
string freia_compile(string module, statement mod_stat, string target)
freia_compile: compile freia module & statement for target
static bool fsi_loop_flt(__attribute__((unused)) gen_chunk *o, freia_info *fsip)
static list clean_statement_list_for_aipo(list ls)
remove unrelated stuff at head & tail, so that it does not come in later on and possibly trouble the ...
static void fsi_sort(list lls)
static int fsi_cmp(const list *l1, const list *l2)
static bool freia_alloc_stat_p(const statement s)
static bool fis_call_flt(call c, fis_ctx *ctx)
static hash_table fsi_number
static void switch_cast_to_copy(statement s)
switch all image casts to image copies in "s"
static bool freia_cleanup_main_sequence(statement modstat)
static void sort_subsequence(list ls, sequence sq)
reorder a little bit statements, so that allocs & deallocs are up front or in the back,...
static bool fcs_call_flt(call c, fcs_ctx *ctx)
static void freia_cleanup_status(statement s, set helpers)
static bool freia_stmt_free_p(const statement s)
static void move_ahead(list ls, statement target, sequence sq)
move statements in l ahead of s in sq note that ls is in reverse order...
static list clean_list_head(list ls)
remove non aipo statements at the head of ls
static void collect_images(reference r, set referenced)
static void fsi_loop_rwt(__attribute__((unused)) gen_chunk *o, freia_info *fsip)
#define freia_opencl_p(s)
#define freia_sigmac_p(s)
#define freia_terapix_p(s)
#define freia_valid_target_p(s)
list freia_aipo_compile_calls(string module, dag fulld, list ls, const hash_table occs, hash_table exchanges, int number)
freia_aipo.c
list freia_mppa_compile_calls(string module, dag fulld, sequence sq, list ls, const hash_table occs, hash_table exchanges, const set output_images, FILE *helper_file, __attribute__((__unused__)) set helpers, int number)
Compile one dag with AIPO optimizations.
#define FREIA_MPPA_INCLUDES
list freia_opencl_compile_calls(string module, dag fulld, sequence sq, list ls, const hash_table occs, hash_table exchanges, const set output_images, FILE *helper_file, set helpers, int number, hash_table signatures)
freia_opencl.c
#define FREIA_OPENCL_INCLUDES
#define FREIA_SIGMAC_INCLUDES
list freia_spoc_compile_calls(string module, dag fulld, sequence sq, list ls, const hash_table occs, hash_table exchanges, const set output_images, FILE *helper_file, set helpers, int number)
generate helpers for statements in ls of module output resulting functions in helper,...
#define FREIA_SPOC_INCLUDES
#define DAG(x)
newgen_vtxcontent_domain_defined
list freia_trpx_compile_calls(string module, dag fulld, sequence sq, list ls, const hash_table occs, hash_table exchanges, const set output_images, FILE *helper_file, set helpers, int number)
do compile a list of statements for terapix
#define FREIA_TRPX_INCLUDES
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
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_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
instruction make_continue_instruction()
Creates a CONTINUE instruction, that is the FORTRAN nop, the ";" in C or the "pass" in Python for exa...
void gen_fprint(FILE *out, string name, const list l, gen_string_func_t item_name)
list gen_nreverse(list cp)
reverse a list in place
void gen_exchange_in_list(list l, const void *i1, const void *i2)
exchange items i1 & i2 in 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)
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.
list gen_full_copy_list(list l)
Copy a list structure with element copy.
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
call statement_call(statement)
Get the call of a statement.
bool statement_call_p(statement)
bool statement_sequence_p(statement)
Statement classes induced from instruction type.
statement add_declaration_statement(statement, entity)
static Value eval(Pvecteur pv, Value val, Variable var)
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.
bool hash_defined_p(const hash_table htp, const void *key)
true if key has e value in htp.
list freia_sigmac_compile_calls(string, dag, sequence, list, const hash_table, hash_table, const set, FILE *, set, int, int)
freia_sigmac.c
static statement mod_stat
We want to keep track of the current statement inside the recurse.
#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
char * i2a(int)
I2A (Integer TO Ascii) yields a string for a given Integer.
#define HASH_FOREACH(key_type, k, value_type, v, ht)
#define same_string_p(s1, s2)
set set_assign_list(set, const list)
assigns a list contents to a set all duplicated elements are lost
int set_size(const set)
returns the number of items in s.
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
set set_clear(set)
Assign the empty set to s s := {}.
bool set_belong_p(const set, const void *)
set set_union(set, const set, const set)
void set_fprint(FILE *, string, const set, gen_string_func_t)
print set s to file stream out.
set set_append_list(set, const list)
add list l items to set s, which is returned.
set set_make(set_type)
Create an empty set of any type but hash_private.
set set_add_element(set, const set, const void *)
string(* gen_string_func_t)(const void *)
int(* gen_cmp_func_t)(const void *, const void *)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
string expression_to_string(expression e)
static list referenced
returns the list of referenced variables
#define ENTITY_ASSIGN_P(e)
#define ENTITY_CONTINUE_P(e)
#define ENTITY_BITWISE_OR_UPDATE_P(e)
#define CONTINUE_FUNCTION_NAME
#define ENTITY_C_RETURN_P(e)
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...
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!).
bool expression_integer_value(expression e, intptr_t *pval)
bool expression_call_p(expression e)
call expression_call(expression e)
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
expression call_to_expression(call c)
Build an expression that call a function or procedure.
bool formal_parameter_p(entity)
#define forloop_domain
newgen_extensions_domain_defined
#define syntax_reference_p(x)
#define instruction_sequence_p(x)
#define unstructured_domain
newgen_type_domain_defined
#define syntax_reference(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define value_unknown_p(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define instruction_domain
newgen_functional_domain_defined
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define reference_domain
newgen_range_domain_defined
#define expression_normalized(x)
#define sequence_statements(x)
#define reference_indices(x)
struct _newgen_struct_instruction_ * instruction
#define instruction_sequence(x)
#define whileloop_domain
newgen_variable_domain_defined
#define statement_declarations(x)
#define statement_instruction(x)
#define instruction_call(x)
#define call_arguments(x)
#define statement_number(x)
#define value_expression_p(x)
#define expression_syntax(x)
#define sequence_domain
newgen_reference_domain_defined
#define value_expression(x)
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
FREIA API function name -> SPoC hardware description (and others?)
A gen_chunk is used to store every object.