PIPS
|
Go to the source code of this file.
Macros | |
#define | OKAY(op, com) do { *op_tag=op; *commutative=com; return true;} while(false) |
#define | OKAY_WO_COMM(op) do { *op_tag=op; return true;} while(false) |
Functions | |
static syntax | make_star_syntax () |
??? some arrangements with words_range to print a star in this case:-) More... | |
bool | reduction_star_p (reduction r) |
utils.c More... | |
static void | ref_rwt (reference r) |
static list | referenced_variables (reference r) |
of entity More... | |
static bool | expr_flt (expression e) |
stack of reference expressions (if there is no call) More... | |
static void | expr_rwt (expression e) |
static bool | ref_flt (reference r) |
void | remove_variable_from_reduction (reduction red, entity var) |
bool | update_reduction_under_effect (reduction red, effect eff) |
static bool | find_reduction_of_var (entity var, reductions reds, reduction *pr) |
looks for a reduction about var in reds, and returns it. More... | |
static bool | merge_two_reductions (reduction first, reduction second) |
merge two reductions into first so as to be compatible with both. More... | |
bool | update_compatible_reduction_with (reduction *pr, entity var, reduction r) |
update *pr according to r for variable var r is not touched. More... | |
bool | update_compatible_reduction (reduction *pr, entity var, list le, reductions reds) |
what to do with reduction *pr for variable var under effects le and reductions reds. More... | |
bool | pure_function_p (entity f) |
extract the proper reduction of a call (instruction) if any. More... | |
static bool | call_flt (call c) |
static bool | functional_object_p (gen_chunk *obj) |
static bool | function_reduction_operator_p (entity f, tag *op_tag, bool *commutative) |
tells whether entity f is a reduction operator function also returns the corresponding tag, and if commutative More... | |
static bool | extract_reduction_operator (expression e, tag *op_tag, bool *commutative) |
returns the possible operator of expression e if it is a reduction, and the operation commutative. More... | |
static bool | extract_reduction_update_operator (entity operator, tag *op_tag, bool *commutative) |
Test if the operator is an update operator compatible with reduction This also returns the corresponding tag, and if commutative. More... | |
static bool | extract_reduction_unary_update_operator (entity operator, tag *op_tag) |
Test if the operator is an unary update operator compatible with reduction This also returns the corresponding tag. More... | |
static bool | reduction_function_compatible_p (entity f, tag op, bool *pcomm) |
static bool | fsr_reference_flt (reference r) |
static bool | fsr_call_flt (call c) |
static bool | equal_reference_in_expression_p (reference r, expression e, tag rop, bool red_up_op, reference *pfound) |
returned More... | |
bool | no_other_effects_on_references (statement s, list lr) |
checks that the references are the only touched within this statement. More... | |
bool | call_proper_reduction_p (statement s, call c, reduction *red) |
This function look for a reduction and return it if found mallocs are avoided if nothing is found... More... | |
expression | get_complement_expression (statement s, reference reduced) |
Return the "other part" of the reduction. More... | |
Variables | |
static list | referenced |
returns the list of referenced variables More... | |
static entity | variable_to_remove |
must be able to remove a modified variable from a reduction: More... | |
static list | dead_expressions |
list of expressions to be deleted (at rwt) More... | |
static expression | first_encountered_call |
the first expression encountered which is a function call, so as to avoid "*+J" results More... | |
static bool | is_functional |
tells whether r is a functional reference... More... | |
static reference | fsr_ref |
looks for an equal reference in e, for reduction rop. More... | |
static reference | fsr_found |
static tag | fsr_op |
else
Definition at line 369 of file utils.c.
References call_function, gen_recurse_stop(), is_functional, and pure_function_p().
Referenced by functional_object_p().
This function look for a reduction and return it if found mallocs are avoided if nothing is found...
looks for v = v OP y or v OP= y, where y is independent of v.
s |
c | needed to query about proper effects |
red | the call of interest |
Definition at line 633 of file utils.c.
References call_arguments, call_function, CAR, CDR, CONS, copy_reference(), DEBUG_REDUCTION, ENTITY_ASSIGN_P, entity_name, equal_reference_in_expression_p(), EXPRESSION, expression_syntax, expression_undefined, extract_reduction_operator(), extract_reduction_unary_update_operator(), extract_reduction_update_operator(), FOREACH, functional_object_p(), gen_free_list(), make_preference(), make_reduction(), make_reduction_operator(), NIL, no_other_effects_on_references(), pips_debug, pips_user_warning, PREFERENCE, reduction_operator_tag_name(), REFERENCE, reference_undefined, referenced_variables(), syntax_reference, syntax_reference_p, update_op(), and UU.
Referenced by pr_call_flt().
|
static |
returned
e | looked for |
rop | visited object |
red_up_op | assumed reduction |
Definition at line 570 of file utils.c.
References call_domain, fsr_call_flt(), fsr_found, fsr_op, fsr_ref, fsr_reference_flt(), gen_multi_recurse(), gen_null(), and reference_domain.
Referenced by call_proper_reduction_p().
|
static |
stack of reference expressions (if there is no call)
REFERENCE
CALL
Definition at line 94 of file utils.c.
References expression_call_p(), expression_reference_p(), and first_encountered_call.
Referenced by remove_variable_from_reduction().
|
static |
Definition at line 103 of file utils.c.
References dead_expressions, expression_reference_p(), expression_syntax, first_encountered_call, free_syntax(), gen_in_list_p(), and make_star_syntax().
Referenced by remove_variable_from_reduction().
|
static |
returns the possible operator of expression e if it is a reduction, and the operation commutative.
(- and / are not)
Definition at line 437 of file utils.c.
References call_function, expression_syntax, f(), function_reduction_operator_p(), syntax_call, and syntax_call_p.
Referenced by call_proper_reduction_p().
Test if the operator is an unary update operator compatible with reduction This also returns the corresponding tag.
operator,the | operator (as an entity) to look at |
op_tag,used | to return the reduction operator (+, ...) |
Definition at line 487 of file utils.c.
References ENTITY_POST_DECREMENT_P, ENTITY_POST_INCREMENT_P, ENTITY_PRE_DECREMENT_P, ENTITY_PRE_INCREMENT_P, is_reduction_operator_sum, and OKAY_WO_COMM.
Referenced by call_proper_reduction_p(), and get_complement_expression().
|
static |
Test if the operator is an update operator compatible with reduction This also returns the corresponding tag, and if commutative.
operator,the | operator (as an entity) to look at |
op_tag,used | to return the reduction operator (+, * ...) |
commutative,used | to return the operator commutativity |
Definition at line 459 of file utils.c.
References ENTITY_BITWISE_AND_UPDATE_P, ENTITY_BITWISE_OR_UPDATE_P, ENTITY_BITWISE_XOR_UPDATE_P, ENTITY_DIVIDE_UPDATE_P, ENTITY_MINUS_UPDATE_P, ENTITY_MULTIPLY_UPDATE_P, ENTITY_PLUS_UPDATE_P, is_reduction_operator_bitwise_and, is_reduction_operator_bitwise_or, is_reduction_operator_bitwise_xor, is_reduction_operator_prod, is_reduction_operator_sum, and OKAY.
Referenced by call_proper_reduction_p(), and get_complement_expression().
|
static |
looks for a reduction about var in reds, and returns it.
tells whether it worths keeping on. It does not if there may be some conflicts with other reduced variables...
I will not combine them...
Definition at line 209 of file utils.c.
References copy_reduction(), entities_may_conflict_p(), FOREACH, REDUCTION, reduction_variable, and reductions_list.
Referenced by update_compatible_reduction().
c,the | call to search for operators |
else
of expression
Definition at line 553 of file utils.c.
References call_arguments, call_function, CAR, CDR, EXPRESSION, fsr_op, gen_length(), gen_recurse_stop(), pips_assert, and reduction_function_compatible_p().
Referenced by equal_reference_in_expression_p().
stop the recursion if does not need to check int div
no candidate refs within a ref!
Definition at line 532 of file utils.c.
References basic_int_p, entity_basic(), entity_name, fsr_found, fsr_op, fsr_ref, gen_recurse_stop(), is_reduction_operator_prod, pips_debug, reference_equal_p(), and reference_variable.
Referenced by equal_reference_in_expression_p().
tells whether entity f is a reduction operator function also returns the corresponding tag, and if commutative
f,the | entity to look at |
op_tag,use | to return the reduction operator (+, * ...) |
commutative,use | to return the operator commutativity |
Definition at line 398 of file utils.c.
References ENTITY_AND_P, ENTITY_BITWISE_AND_P, ENTITY_BITWISE_OR_P, ENTITY_BITWISE_XOR_P, ENTITY_DIVIDE_P, ENTITY_EQUIV_P, ENTITY_MAX0_P, ENTITY_MAX_P, ENTITY_MIN0_P, ENTITY_MIN_P, ENTITY_MINUS_P, ENTITY_MULTIPLY_P, ENTITY_NON_EQUIV_P, ENTITY_OR_P, ENTITY_PLUS_P, f(), is_reduction_operator_and, is_reduction_operator_bitwise_and, is_reduction_operator_bitwise_or, is_reduction_operator_bitwise_xor, is_reduction_operator_eqv, is_reduction_operator_max, is_reduction_operator_min, is_reduction_operator_neqv, is_reduction_operator_or, is_reduction_operator_prod, is_reduction_operator_sum, and OKAY.
Referenced by extract_reduction_operator(), and reduction_function_compatible_p().
Definition at line 379 of file utils.c.
References call_domain, call_flt(), gen_null(), gen_recurse, and is_functional.
Referenced by call_proper_reduction_p().
expression get_complement_expression | ( | statement | s, |
reference | reduced | ||
) |
Return the "other part" of the reduction.
If the statement is : sum = sum + a[i]; then we'll return a[i]
try to find out which of the two expression corresponds to the reduced reference. We'll return the other...
reduced | educed |
Definition at line 743 of file utils.c.
References call_arguments, call_function, CAR, CDR, ENTITY_ASSIGN_P, EXPRESSION, expression_call(), expression_call_p(), expression_reference(), expression_reference_p(), expression_undefined, extract_reduction_unary_update_operator(), extract_reduction_update_operator(), gen_length(), int_to_expression(), pips_assert, pips_debug, pips_internal_error, pips_user_warning, same_ref_name_p(), statement_call(), and statement_call_p().
Referenced by replace_reductions_in_statement().
|
static |
??? some arrangements with words_range to print a star in this case:-)
Definition at line 39 of file utils.c.
References expression_undefined, is_syntax_range, make_range(), and make_syntax().
Referenced by expr_rwt().
merge two reductions into first so as to be compatible with both.
deletes the second. tells whether they where compatibles quite basic at the time
actually merges, very simple at the time
Definition at line 231 of file utils.c.
References free_reduction(), free_reference(), make_reference(), NIL, pips_assert, reduction_op, reduction_operator_tag, reduction_reference, reduction_variable, and reference_equal_p().
Referenced by update_compatible_reduction(), and update_compatible_reduction_with().
checks that the references are the only touched within this statement.
I trust the proper effects to store all references...
of effect
lr | of reference on the same variable |
Definition at line 596 of file utils.c.
References CAR, EFFECT, effect_any_reference, effects_effects, ENDP, entities_may_conflict_p(), entity_name, FOREACH, gen_in_list_p(), load_proper_references(), pips_debug, print_effect, REFERENCE, reference_variable, and store_effect_p().
Referenced by call_proper_reduction_p().
extract the proper reduction of a call (instruction) if any.
I trust intrinsics (operations?) and summary effects...
else
a side effect!?
LUNS
Definition at line 343 of file utils.c.
References EFFECT, effect_variable, effect_write_p, entity_initial, entity_module_p(), f(), FOREACH, io_effect_entity_p(), load_summary_effects(), store_effect_p(), value_constant_p, value_intrinsic_p, and value_symbolic_p.
Referenced by call_flt().
f | the entity to check. |
op | the tag to check against. |
pcomm | the commutative return value. |
Definition at line 505 of file utils.c.
References f(), and function_reduction_operator_p().
Referenced by fsr_call_flt().
utils.c
Definition at line 46 of file utils.c.
References exp, EXPRESSION, expression_syntax, expression_undefined_p, FOREACH, range_upper, reduction_reference, ref, reference_indices, syntax_range, and syntax_range_p.
Referenced by rename_statement_reductions().
Definition at line 117 of file utils.c.
References dead_expressions, first_encountered_call, gen_once(), reference_variable, and variable_to_remove.
Referenced by remove_variable_from_reduction().
|
static |
Definition at line 61 of file utils.c.
References gen_once(), reference_variable, and referenced.
Referenced by referenced_variables().
of entity
Definition at line 65 of file utils.c.
References gen_recurse, gen_true(), NIL, ref_rwt(), reference_domain, and referenced.
Referenced by call_proper_reduction_p(), and update_reduction_under_effect().
red | ed |
var | ar |
Definition at line 130 of file utils.c.
References dead_expressions, entity_name, expr_flt(), expr_rwt(), expression_domain, first_encountered_call, gen_free_list(), gen_multi_recurse(), gen_null(), NIL, pips_debug, reduction_op, reduction_operator_tag, reduction_operator_tag_name(), reduction_reference, reduction_variable, ref_flt(), reference_domain, and variable_to_remove.
Referenced by compute_one_summary_reduction(), update_compatible_reduction(), and update_reduction_under_effect().
bool update_compatible_reduction | ( | reduction * | pr, |
entity | var, | ||
list | le, | ||
reductions | reds | ||
) |
what to do with reduction *pr for variable var under effects le and reductions reds.
returns whether worth to go on. conditions:
some reduction already available
must update the reduction with the encountered effects
else now no new reduction waas found, must check *pr against effects
some reduction
stores for latter cleaning
pr | r |
var | ar |
le | of effect |
reds | eds |
Definition at line 285 of file utils.c.
References DEBUG_REDUCTION, EFFECT, effect_variable, effect_write_p, entities_may_conflict_p(), ENTITY, entity_name, find_reduction_of_var(), FOREACH, free_reduction(), gen_once(), merge_two_reductions(), pips_debug, reduction_dependences, reduction_none_p, remove_variable_from_reduction(), store_effect_p(), and update_reduction_under_effect().
Referenced by build_reduction_of_variable().
update *pr according to r for variable var r is not touched.
else same var and no conflict
else are they compatible?
ok, let us merge them
pr | r |
var | ar |
Definition at line 260 of file utils.c.
References copy_reduction(), entities_may_conflict_p(), free_reduction(), merge_two_reductions(), reduction_none_p, reduction_tag, and reduction_variable.
Referenced by compatible_reduction_of_var().
REDUCTION is dead if the reduction variable is affected
else
now var is written
red | ed |
eff | ff |
Definition at line 155 of file utils.c.
References effect_read_p, effect_variable, effect_write_p, entities_may_conflict_p(), ENTITY, entity_name, FOREACH, gen_free_list(), is_reduction_operator_none, pips_debug, reduction_dependences, reduction_op, reduction_operator_tag, reduction_operator_tag_name(), reduction_reference, reduction_variable, referenced_variables(), remove_variable_from_reduction(), and store_effect_p().
Referenced by update_compatible_reduction().
|
static |
list of expressions to be deleted (at rwt)
of expression
Definition at line 85 of file utils.c.
Referenced by expr_rwt(), ref_flt(), and remove_variable_from_reduction().
|
static |
the first expression encountered which is a function call, so as to avoid "*+J" results
Definition at line 89 of file utils.c.
Referenced by expr_flt(), expr_rwt(), ref_flt(), and remove_variable_from_reduction().
|
static |
Definition at line 529 of file utils.c.
Referenced by equal_reference_in_expression_p(), and fsr_reference_flt().
|
static |
Definition at line 530 of file utils.c.
Referenced by equal_reference_in_expression_p(), fsr_call_flt(), and fsr_reference_flt().
|
static |
looks for an equal reference in e, for reduction rop.
the reference found is also returned. caution:
Definition at line 528 of file utils.c.
Referenced by equal_reference_in_expression_p(), and fsr_reference_flt().
|
static |
tells whether r is a functional reference...
actually I would need to recompute somehow the proper effects of obj?
Definition at line 368 of file utils.c.
Referenced by call_flt(), and functional_object_p().
|
static |
returns the list of referenced variables
of entity
Definition at line 60 of file utils.c.
Referenced by collect_images(), freia_cleanup_main_sequence(), freia_cleanup_sequence_rec(), ref_rwt(), and referenced_variables().
|
static |
must be able to remove a modified variable from a reduction:
A(I) / I -> A(*) . A(B(C(I))) / C -> A(B(*)) . A(I+J) / I -> A(*) . A(B(I)+C(I)) / I -> A(*) or A(B(*)+C(*)) ? former looks better the variable that must be removed is stored here
Definition at line 82 of file utils.c.
Referenced by ref_flt(), and remove_variable_from_reduction().