PIPS
|
#include <stdint.h>
#include <stdlib.h>
#include "genC.h"
#include "misc.h"
#include "freia.h"
#include "linear.h"
#include "pipsdbm.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "properties.h"
#include "c_syntax.h"
#include "freia_spoc_private.h"
#include "hwac.h"
#include "effects-generic.h"
Go to the source code of this file.
Data Structures | |
struct | fcs_ctx |
struct | fis_ctx |
struct | freia_info |
Functions | |
static bool | fcs_call_flt (call c, fcs_ctx *ctx) |
static void | freia_cleanup_status (statement s, set helpers) |
static bool | fis_call_flt (call c, fis_ctx *ctx) |
static bool | freia_image_shuffle (statement s, set shuffled) |
static void | sctc_call_rwt (call c, int *count) |
static void | switch_cast_to_copy (statement s) |
switch all image casts to image copies in "s" More... | |
static bool | freia_stmt_free_p (const statement s) |
static bool | freia_alloc_call_p (const call c) |
static bool | freia_alloc_stat_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... More... | |
static int | freia_cmp_statement (const statement *s1, const statement *s2) |
order two statements for qsort. More... | |
static string | stmt_nb (void *s) |
debug helper More... | |
static list | clean_list_head (list ls) |
remove non aipo statements at the head of ls More... | |
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 compilation. More... | |
static void | sort_subsequence (list ls, sequence sq) |
reorder a little bit statements, so that allocs & deallocs are up front or in the back, and may be removed by the previous function. More... | |
bool | freia_some_effects_on_images (statement s) |
tell whether a statement has no effects on images. More... | |
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 a poor's man dependency graph in order to move some statements around... More... | |
static bool | statement_depends_p (set written, statement s) |
static bool | fsi_loop_flt (__attribute__((unused)) gen_chunk *o, freia_info *fsip) |
static void | fsi_loop_rwt (__attribute__((unused)) gen_chunk *o, freia_info *fsip) |
expression | freia_transpose_kernel (const expression se) |
Transpose a structuring element expression. More... | |
bool | freia_is_transpose_call (statement s) |
Detect a call to a se transposition function and transpose the arguments. More... | |
static bool | fsi_stmt_flt (statement s, freia_info *fsip) |
detect one lone aipo statement out of a sequence... More... | |
static bool | fsi_seq_flt (sequence sq, freia_info *fsip) |
consider a sequence More... | |
static _int | min_statement (list ls) |
static int | fsi_cmp (const list *l1, const list *l2) |
static void | fsi_sort (list lls) |
static void | collect_images (reference r, set referenced) |
static bool | freia_cleanup_sequence_rec (statement modstat, set referenced) |
static bool | freia_cleanup_main_sequence (statement modstat) |
string | freia_compile (string module, statement mod_stat, string target) |
freia_compile: compile freia module & statement for target More... | |
Variables | |
static hash_table | fsi_number = NULL |
remove non aipo statements at the head of ls
Definition at line 330 of file freia.c.
References CAR, CDR, freia_statement_aipo_call_p(), gen_free_list(), NIL, and STATEMENT.
Referenced by clean_statement_list_for_aipo().
remove unrelated stuff at head & tail, so that it does not come in later on and possibly trouble the compilation.
Definition at line 343 of file freia.c.
References clean_list_head(), and gen_nreverse().
Referenced by fsi_seq_flt().
Definition at line 705 of file freia.c.
References freia_image_variable_p(), reference_variable, referenced, set_add_element(), and set_belong_p().
Referenced by freia_cleanup_sequence_rec().
Definition at line 60 of file freia.c.
References call_arguments, call_function, CAR, CDR, CONTINUE_FUNCTION_NAME, ENTITY_BITWISE_OR_UPDATE_P, entity_freia_api_p(), entity_intrinsic(), EXPRESSION, expression_integer_value(), expression_syntax, free_call(), freia_assignment_p(), gen_free_list(), gen_length(), fcs_ctx::helper_functions, NIL, pips_assert, reference_indices, reference_variable, set_add_element(), set_belong_p(), syntax_call, syntax_call_p, syntax_reference, syntax_reference_p, and fcs_ctx::used_for_status.
Referenced by freia_cleanup_status().
Definition at line 148 of file freia.c.
References call_arguments, call_function, CAR, CDR, ENTITY_ASSIGN_P, entity_undefined, EXPRESSION, expression_to_entity(), freia_image_variable_p(), gen_length(), pips_assert, set_add_element(), and fis_ctx::shuffled.
Referenced by freia_image_shuffle().
Definition at line 209 of file freia.c.
References call_function, entity_user_name(), f(), FREIA_ALLOC, FREIA_FREE, and same_string_p.
Referenced by freia_alloc_stat_p().
Definition at line 217 of file freia.c.
References call_function, ENTITY_CONTINUE_P, entity_initial, eval(), expression_call(), expression_call_p(), f(), FOREACH, freia_alloc_call_p(), freia_statement_to_call(), statement_declarations, value_expression, value_expression_p, and value_unknown_p.
Referenced by fsi_seq_flt().
Definition at line 768 of file freia.c.
References freia_cleanup_sequence_rec(), referenced, set_free(), set_make(), and set_pointer.
Referenced by freia_compile().
Definition at line 712 of file freia.c.
References freia_api_t::arg_img_out, call_arguments, call_function, CAR, collect_images(), entity_initial, entity_local_name(), EXPRESSION, expression_to_entity(), FOREACH, formal_parameter_p(), free_instruction(), freia_statement_aipo_call_p(), freia_statement_to_call(), gen_context_recurse, gen_copy_seq(), gen_free_list(), gen_nreverse(), gen_true2(), hwac_freia_api(), instruction_sequence, instruction_sequence_p, is_freia_dealloc(), make_continue_instruction(), reference_domain, referenced, sequence_statements, set_belong_p(), statement_declarations, statement_instruction, and statement_sequence_p().
Referenced by freia_cleanup_main_sequence().
Definition at line 120 of file freia.c.
References call_domain, call_to_expression(), entity_initial, fcs_call_flt(), free_value(), freia_ok(), gen_context_recurse, gen_null2(), make_value_expression(), SET_FOREACH, set_free(), set_make(), set_pointer, fcs_ctx::used_for_status, and value_unknown_p.
Referenced by freia_compile().
order two statements for qsort.
s1 before s2 => -1
Definition at line 279 of file freia.c.
References _intFMT, call_function, ENTITY_C_RETURN_P, entity_name, instruction_call, is_freia_alloc(), is_freia_dealloc(), pips_assert, pips_debug, s1, statement_call_p(), statement_instruction, and statement_number.
Referenced by sort_subsequence().
freia_compile: compile freia module & statement for target
module | odule |
mod_stat | od_stat |
target | arget |
Definition at line 785 of file freia.c.
References add_declaration_statement(), CAR, CDR, CONS, DAG, dagvtx_statement(), freia_info::enclosing_loops, file_readable_p(), FOREACH, forloop_domain, fprintf(), free_dag(), freia_aipo_compile_calls(), freia_aipo_p, freia_build_dag(), freia_build_image_occurrences(), freia_clean_image_occurrences(), freia_cleanup_main_sequence(), freia_cleanup_status(), freia_close_dep_cache(), freia_compute_current_output_images(), freia_image_shuffle(), freia_init_dep_cache(), freia_mppa_compile_calls(), FREIA_MPPA_INCLUDES, freia_mppa_p, freia_opencl_compile_calls(), FREIA_OPENCL_INCLUDES, freia_opencl_p, freia_shuffle_move_forward(), freia_sigmac_compile_calls(), FREIA_SIGMAC_INCLUDES, freia_sigmac_p, freia_spoc_compile_calls(), FREIA_SPOC_INCLUDES, freia_spoc_p, freia_terapix_p, freia_trpx_compile_calls(), FREIA_TRPX_INCLUDES, freia_valid_target_p, fsi_loop_flt(), fsi_loop_rwt(), fsi_seq_flt(), fsi_sort(), fsi_stmt_flt(), gen_context_multi_recurse(), gen_copy_seq(), gen_exchange_in_list(), gen_free_list(), gen_length(), gen_nreverse(), gen_null(), get_bool_property(), hash_defined_p(), HASH_FOREACH, hash_get(), hash_pointer, hash_table_free(), hash_table_make(), helper_file_name(), freia_info::in_loops, loop_domain, mod_stat, module, n_dags, NIL, pips_assert, pips_debug, pips_internal_error, pips_user_error, pips_user_warning, safe_fclose(), safe_fopen(), freia_info::seqs, freia_info::sequence, sequence_domain, sequence_statements, set_belong_p(), set_free(), set_make(), set_pointer, set_union(), statement_domain, switch_cast_to_copy(), unstructured_domain, and whileloop_domain.
Referenced by freia_compiler().
Definition at line 169 of file freia.c.
References call_domain, fis_call_flt(), gen_context_recurse, gen_null2(), and set_size().
Referenced by freia_compile().
Detect a call to a se transposition function and transpose the arguments.
The expected function should have the following signature transpose_func(int kernelOut[9], const int kernelIn[9], ...)
Definition at line 499 of file freia.c.
References call_arguments, call_function, CAR, CDR, entity_initial, entity_local_name(), EXPRESSION, expression_to_entity(), expression_to_string(), freia_transpose_kernel(), gen_length(), get_string_property(), pips_assert, pips_debug, same_string_p, set_entity_initial(), statement_call(), statement_call_p(), value_expression, and value_expression_p.
Referenced by fsi_stmt_flt().
tell whether a statement has no effects on images.
if so, it may be included somehow in the pipeline and just skipped, provided stat scalar dependencies are taken care of.
Definition at line 402 of file freia.c.
References effect_variable, effects_effects, FOREACH, freia_image_variable_p(), and load_cumulated_rw_effects().
Referenced by fsi_seq_flt().
Definition at line 202 of file freia.c.
References call_function, entity_user_name(), FREIA_FREE, freia_statement_to_call(), and same_string_p.
Referenced by fsi_seq_flt().
expression freia_transpose_kernel | ( | const expression | se | ) |
Transpose a structuring element expression.
se | e |
Definition at line 479 of file freia.c.
References call_arguments, call_function, expression_normalized, expression_syntax, gen_full_copy_list(), gen_nreverse(), make_call(), make_expression(), make_syntax_call(), and syntax_call.
Referenced by freia_is_transpose_call().
Definition at line 681 of file freia.c.
References fsi_number, and hash_get().
Referenced by fsi_sort().
|
static |
Definition at line 463 of file freia.c.
References freia_info::enclosing_loops.
Referenced by freia_compile().
|
static |
Definition at line 470 of file freia.c.
References freia_info::enclosing_loops.
Referenced by freia_compile().
|
static |
consider a sequence
of statements
Definition at line 559 of file freia.c.
References _intFMT, call_function, CAR, clean_statement_list_for_aipo(), CONS, freia_info::enclosing_loops, ENTITY_C_RETURN_P, entity_local_name(), FOREACH, freia_alloc_stat_p(), freia_some_effects_on_images(), freia_statement_aipo_call_p(), freia_stmt_free_p(), gen_copy_seq(), gen_free_list(), gen_last(), gen_nconc(), hash_put(), freia_info::in_loops, move_ahead(), NIL, pips_debug, same_string_p, freia_info::seqs, freia_info::sequence, sequence_statements, set_add_element(), set_clear(), set_free(), set_make(), set_pointer, sort_subsequence(), STATEMENT, statement_call(), statement_call_p(), statement_depends_p(), statement_number, update_written_variables(), and written.
Referenced by freia_compile().
|
static |
Definition at line 687 of file freia.c.
References FOREACH, fsi_cmp(), fsi_number, gen_sort_list(), hash_pointer, hash_put(), hash_table_free(), hash_table_make(), min_statement(), and pips_assert.
Referenced by freia_compile().
|
static |
detect one lone aipo statement out of a sequence...
Definition at line 542 of file freia.c.
References CONS, freia_info::enclosing_loops, freia_is_transpose_call(), freia_statement_aipo_call_p(), gen_get_ancestor(), freia_info::in_loops, instruction_domain, instruction_sequence_p, NIL, freia_info::seqs, and set_add_element().
Referenced by freia_compile().
Definition at line 670 of file freia.c.
References FOREACH, min, and statement_number.
Referenced by fsi_sort().
move statements in l ahead of s in sq note that ls is in reverse order...
Definition at line 247 of file freia.c.
References CONS, FOREACH, gen_copy_seq(), gen_free_list(), gen_nconc(), gen_nreverse(), NIL, sequence_statements, set_append_list(), set_belong_p(), set_free(), set_make(), and set_pointer.
Referenced by fsi_seq_flt().
Definition at line 178 of file freia.c.
References AIPO, call_function, entity_local_name(), local_name_to_top_level_entity(), and same_string_p.
Referenced by switch_cast_to_copy().
reorder a little bit statements, so that allocs & deallocs are up front or in the back, and may be removed by the previous function.
Definition at line 351 of file freia.c.
References CONS, FOREACH, freia_cmp_statement(), gen_fprint(), gen_free_list(), gen_nconc(), gen_nreverse(), gen_sort_list(), ifdebug, NIL, pips_debug, sequence_statements, set_assign_list(), set_belong_p(), set_free(), set_make(), set_pointer, and stmt_nb().
Referenced by fsi_seq_flt().
Definition at line 434 of file freia.c.
References effect_read_p, effect_variable, effects_effects, FOREACH, load_cumulated_rw_effects(), set_belong_p(), and written.
Referenced by fsi_seq_flt().
|
static |
debug helper
Definition at line 322 of file freia.c.
References i2a(), and statement_number.
Referenced by sort_subsequence().
|
static |
switch all image casts to image copies in "s"
Definition at line 190 of file freia.c.
References call_domain, count, gen_context_recurse, gen_true2(), pips_user_warning, and sctc_call_rwt().
Referenced by freia_compile().
update the set of written variables, as seen from effects, with a statement this is really to rebuild a poor's man dependency graph in order to move some statements around...
Definition at line 421 of file freia.c.
References effect_variable, effect_write_p, effects_effects, entity_local_name(), FOREACH, ifdebug, load_cumulated_rw_effects(), set_add_element(), set_fprint(), and written.
Referenced by fsi_seq_flt().
|
static |
Definition at line 679 of file freia.c.
Referenced by fsi_cmp(), and fsi_sort().