25 #include "pips_config.h"
33 #include "resources.h"
68 static int counter = 0;
71 pips_assert(
"buffer does not overflow",counter < 1000);
177 pips_debug(3,
"can do nothing with star reductions ...\n");
180 pips_debug(3,
"found in the statement ! Rewriting ...\n");
191 pips_debug(3,
"not found in the statement ! Skipping ...\n");
469 return !
ENDP(*reductions_info);
579 debug_on(
"SIMDREDUCTION_DEBUG_LEVEL");
605 static bool statement_reduction_prelude_p(
statement s) {
616 static bool statement_reduction_postlude_p(
statement s) {
641 if(
ENDP(tail))
break;
647 the_strict_successor = next;
661 return the_strict_successor;
664 static void redundant_load_store_elimination_move_vectors(
statement s,
set moved_vectors)
678 static void do_sac_reduction_optimizations(
graph dg)
684 if(statement_reduction_prelude_p(stat0)) {
685 statement stat1 = strict_successor(stat0);
698 statement stat1 = strict_successor(stat0);
699 if(statement_reduction_postlude_p(stat1)) {
731 bool out_effect =
false;
738 out_effect=
true;
break;
785 }
while(did_something);
int get_int_property(const string)
void write_effects(FILE *f, effects p)
call make_call(entity a1, list a2)
void free_reference(reference p)
expression copy_expression(expression p)
EXPRESSION.
reference make_reference(entity a1, list a2)
bool statement_consistent_p(statement p)
language copy_language(language p)
LANGUAGE.
dimension make_dimension(expression a1, expression a2, list a3)
instruction make_instruction_sequence(sequence _field_)
void free_expression(expression p)
reference copy_reference(reference p)
REFERENCE.
sequence make_sequence(list a)
reductionInfo make_reductionInfo(reduction a1, intptr_t a2, entity a3)
static graph dependence_graph
bool simd_load_stat_p(statement)
bool simd_store_stat_p(statement)
bdt base
Current expression.
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
bool clean_up_sequences(statement s)
Recursively clean up the statement sequences by fusing them if possible and by removing useless one.
struct _newgen_struct_statement_ * statement
#define CONFLICT(x)
CONFLICT.
#define dg_arc_label_conflicts(x)
#define conflict_source(x)
list load_proper_rw_effects_list(statement)
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)
list effects_write_effects(list)
void reset_cumulated_rw_effects(void)
bool out_effects(const string)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
#define effect_read_p(eff)
#define effect_scalar_p(eff) entity_scalar_p(effect_entity(eff))
bool anywhere_effect_p(effect)
Is it an anywhere effect? ANYMMODULE:ANYWHERE
bool empty_string_p(const char *s)
const char * module_name(const char *s)
Return the module part of an entity name.
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)
#define successor_vertex(x)
#define successor_arc_label(x)
struct _newgen_struct_graph_ * graph
#define vertex_successors(x)
#define SUCCESSOR(x)
SUCCESSOR.
#define graph_vertices(x)
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.
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.
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)
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and 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...
instruction make_assign_instruction(expression l, expression r)
#define ENDP(l)
Test if a list is empty.
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.
#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.
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.
loop statement_loop(statement)
Get the loop of a statement.
call statement_call(statement)
Get the call of a statement.
bool statement_call_p(statement)
bool empty_statement_or_continue_p(statement)
Return true if the statement is an empty instruction block or a continue or a recursive combination o...
bool statement_loop_p(statement)
statement update_statement_instruction(statement, instruction)
Replace the instruction in statement s by instruction i.
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
void insert_statement(statement, statement, bool)
This is the normal entry point.
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
#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 TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
#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 *)
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
bool same_reduction_p(reduction r1, reduction r2)
void unnormalize_expression(void *st)
void unnormalize_expression(expression exp): puts all the normalized field of expressions in "st" to ...
static void rename_reduction_ref_walker(expression e, reductionInfo ri)
static void undo_rename_reference(reference r, reductionInfo ri)
static bool reduction_in_statement_p(reduction red, statement stat)
static entity make_reduction_vector_entity(reduction r)
static bool simd_gather_reduction(statement body, list reductions, list *reductions_info)
bool redundant_load_store_elimination(char *module_name)
static expression make_minval_expression(basic b)
static reductionInfo add_reduction(list *reds, reduction r)
The first part of the function check that the reduction is allowed.
static void rename_statement_reductions(statement s, list *reductions_info, list reductions)
This function gets the possible reduction thanks to load_cumulated_reductions() function.
static statement generate_compact(reductionInfo ri)
static bool no_write_read_conflicts_p(list succs)
static expression make_0val_expression(basic b)
static void do_redundant_load_store_elimination(graph dg)
static bool reduction_in_statement_walker(reference r, reduction_in_statement_param *p)
bool simd_remove_reductions(char *mod_name)
remove reductions by expanding reduced scalar to an array
static bool reduction_rewrite_filter(statement s, set skip)
bool sac_expression_reduction_p(expression e)
reductions.c
static expression make_1val_expression(basic b)
static statement generate_prelude(reductionInfo ri)
static bool potential_out_effects_p(statement s)
static void reductions_rewrite(statement s, set skip)
static expression make_maxval_expression(basic b)
void print_reference(reference r)
void print_statement(statement)
Print a statement on stderr.
void reset_cumulated_reductions(void)
bool reduction_star_p(reduction)
utils.c
void set_cumulated_reductions(pstatement_reductions)
reductions load_cumulated_reductions(statement)
#define reduction_operator_sum_p(x)
@ is_reduction_operator_none
@ is_reduction_operator_min
@ is_reduction_operator_max
@ is_reduction_operator_csum
@ is_reduction_operator_prod
@ is_reduction_operator_or
@ is_reduction_operator_and
@ is_reduction_operator_sum
#define REDUCTION(x)
REDUCTION.
#define reduction_operator_tag(x)
#define reduction_reference(x)
#define reductions_list(x)
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 MAX_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define statement_block_p(stat)
#define call_to_statement(c)
#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 MULTIPLY_OPERATOR_NAME
#define PLUS_C_OPERATOR_NAME
#define MIN_OPERATOR_NAME
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local 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...
bool same_entity_p(entity e1, entity e2)
predicates on entities
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 top_level_entity_p(entity e)
Check if the scope of entity e is global.
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
expression reference_to_expression(reference r)
bool expression_call_p(expression e)
expression float_to_expression(float c)
call expression_call(expression e)
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
bool reference_equal_p(reference r1, reference r2)
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.
expression complex_to_expression(float re, float im)
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
expression bool_to_expression(bool b)
expression call_to_expression(call c)
Build an expression that call a function or procedure.
void AddLocalEntityToDeclarations(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
entity make_new_array_variable_with_prefix(const char *, entity, basic, list)
J'ai ameliore la fonction make_new_scalar_variable_with_prefix
void RemoveLocalEntityFromDeclarations(entity, entity, statement)
int entity_memory_size(entity)
bool formal_parameter_p(entity)
basic basic_of_reference(reference)
Retrieves the basic of a reference in a newly allocated basic object.
#define syntax_reference_p(x)
#define expression_domain
newgen_execution_domain_defined
#define syntax_reference(x)
#define reference_variable(x)
#define instruction_loop(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define basic_undefined_p(x)
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define reference_domain
newgen_range_domain_defined
#define expression_undefined
@ is_instruction_whileloop
@ is_instruction_sequence
#define instruction_tag(x)
#define sequence_statements(x)
#define dimension_upper(x)
#define reference_indices(x)
#define instruction_sequence(x)
#define instruction_forloop(x)
#define instruction_whileloop(x)
#define variable_dimensions(x)
#define whileloop_body(x)
#define statement_declarations(x)
#define statement_instruction(x)
#define call_arguments(x)
#define statement_undefined_p(x)
#define expression_syntax(x)
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define reductionInfo_reduction(x)
#define reductionInfo_count(x)
#define reductionInfo_undefined_p(x)
#define reductionInfo_undefined
#define REDUCTIONINFO(x)
REDUCTIONINFO.
#define reductionInfo_vector(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.
finds out expression with reduction