25 #include "pips_config.h"
137 make_ref_exprs_stack();
151 free_ref_exprs_stack();
160 bool updated =
false;
162 pips_debug(7,
"reduction %s[%s] under effect %s on %s\n",
388 #define OKAY(op,com) do { *op_tag=op; *commutative=com; return true;} while(false)
389 #define OKAY_WO_COMM(op) do { *op_tag=op; return true;} while(false)
587 return (red_up_op || (
fsr_found != NULL));
602 if (
ENDP(lr))
return true;
643 bool assign_op =
false;
645 bool unary_op =
false;
661 if ((unary_op ==
false) && (
update_op ==
false) && (assign_op ==
false)) {
662 pips_debug(5,
"No unary, nor update, no assign !\n");
673 "this is not handled and no reduction will be detected\n");
682 pips_debug(5,
"Lhs or Rhs not functional !\n");
685 pips_debug(8,
"lhs and rhs are functional\n");
691 if ((unary_op ==
false) && (
update_op ==
false) &&
693 pips_debug(5,
"extract_reduction_operator returned false !!\n");
700 if (unary_op ==
false) {
702 pips_debug(5,
"!equal_reference_in_expression_p !!\n");
705 pips_debug(8,
"matching reference found (%p)\n", other);
709 if ((
update_op ==
true) || (unary_op ==
true))
713 pips_debug(7,
"list lr is: %p and %p\n", other, lhs);
716 pips_debug(5,
"Other effects on references !!\n");
772 " than reduction detection. This merits a bug report !\n");
776 " reduction detection. This merits a bug report !\n");
788 " unary nor a binary ? It's a bug, sorry no choice but abort !\n");
reduction copy_reduction(reduction p)
REDUCTION.
void free_reduction(reduction p)
reduction_operator make_reduction_operator(enum reduction_operator_utype tag, void *val)
reduction make_reduction(reference a1, reduction_operator a2, list a3, list a4)
void free_reference(reference p)
reference make_reference(entity a1, list a2)
reference copy_reference(reference p)
REFERENCE.
void free_syntax(syntax p)
syntax make_syntax(enum syntax_utype tag, void *val)
preference make_preference(reference a1)
range make_range(expression a1, expression a2, expression a3)
static reference ref
Current stmt (an integer)
list load_summary_effects(entity e)
FI->FI, FI->BC: these two functions should be moved into effects-util or effects-simple.
effects load_proper_references(statement)
#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))
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
bool store_effect_p(effect)
bool io_effect_entity_p(entity)
#define effects_effects(x)
#define gen_recurse(start, domain_number, flt, rwt)
void update_op(int op, char *error_msg)
UPDATE_OP checks whether the just read OPerator is compatible with the current one.
bool entities_may_conflict_p(entity e1, entity e2)
Check if two entities may conflict.
void gen_recurse_stop(void *obj)
Tells the recursion not to go in this object.
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#define ENDP(l)
Test if a list is empty.
#define NIL
The empty list (nil in Lisp)
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
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
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#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.
call statement_call(statement)
Get the call of a statement.
bool statement_call_p(statement)
#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 DEFINE_LOCAL_STACK(name, type)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
bool same_ref_name_p(reference, reference)
#define reduction_variable(r)
shorthands for REDUCTION:
#define DEBUG_REDUCTION(level, msg, red)
quick debug macros
#define reduction_none_p(r)
string reduction_operator_tag_name(tag t)
returns a (static) string describing the tag t reduction
static void ref_rwt(reference r)
static list referenced
returns the list of referenced variables
static reference fsr_ref
looks for an equal reference in e, for reduction rop.
bool no_other_effects_on_references(statement s, list lr)
checks that the references are the only touched within this statement.
static bool functional_object_p(gen_chunk *obj)
expression get_complement_expression(statement s, reference reduced)
Return the "other part" of the reduction.
static bool is_functional
tells whether r is a functional reference...
static bool call_flt(call c)
static void expr_rwt(expression e)
static list dead_expressions
list of expressions to be deleted (at rwt)
static bool find_reduction_of_var(entity var, reductions reds, reduction *pr)
looks for a reduction about var in reds, and returns it.
static expression first_encountered_call
the first expression encountered which is a function call, so as to avoid "*+J" results
static bool fsr_reference_flt(reference r)
bool update_reduction_under_effect(reduction red, effect eff)
bool update_compatible_reduction_with(reduction *pr, entity var, reduction r)
update *pr according to r for variable var r is not touched.
bool reduction_star_p(reduction r)
utils.c
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....
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,...
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 correspond...
static list referenced_variables(reference r)
of entity
bool pure_function_p(entity f)
extract the proper reduction of a call (instruction) if any.
static entity variable_to_remove
must be able to remove a modified variable from a reduction:
static bool reduction_function_compatible_p(entity f, tag op, bool *pcomm)
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.
void remove_variable_from_reduction(reduction red, entity var)
static bool equal_reference_in_expression_p(reference r, expression e, tag rop, bool red_up_op, reference *pfound)
returned
static bool ref_flt(reference r)
static bool expr_flt(expression e)
stack of reference expressions (if there is no call)
static reference fsr_found
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.
static syntax make_star_syntax()
??? some arrangements with words_range to print a star in this case:-)
static bool merge_two_reductions(reduction first, reduction second)
merge two reductions into first so as to be compatible with both.
static bool fsr_call_flt(call c)
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 corr...
@ is_reduction_operator_bitwise_xor
@ is_reduction_operator_none
@ is_reduction_operator_min
@ is_reduction_operator_bitwise_and
@ is_reduction_operator_neqv
@ is_reduction_operator_max
@ is_reduction_operator_bitwise_or
@ is_reduction_operator_eqv
@ 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_dependences(x)
#define reduction_reference(x)
#define reductions_list(x)
#define ENTITY_PLUS_UPDATE_P(e)
#define ENTITY_DIVIDE_P(e)
#define ENTITY_BITWISE_AND_UPDATE_P(e)
#define ENTITY_ASSIGN_P(e)
#define ENTITY_MINUS_P(e)
#define ENTITY_MULTIPLY_P(e)
#define ENTITY_PRE_DECREMENT_P(e)
#define ENTITY_POST_DECREMENT_P(e)
#define ENTITY_POST_INCREMENT_P(e)
#define ENTITY_PRE_INCREMENT_P(e)
#define ENTITY_BITWISE_OR_UPDATE_P(e)
#define ENTITY_NON_EQUIV_P(e)
#define ENTITY_MULTIPLY_UPDATE_P(e)
#define ENTITY_BITWISE_OR_P(e)
#define ENTITY_BITWISE_XOR_P(e)
#define ENTITY_DIVIDE_UPDATE_P(e)
#define ENTITY_BITWISE_XOR_UPDATE_P(e)
#define ENTITY_MINUS_UPDATE_P(e)
#define ENTITY_BITWISE_AND_P(e)
#define ENTITY_EQUIV_P(e)
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
bool entity_module_p(entity e)
bool expression_call_p(expression e)
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)
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.
#define PREFERENCE(x)
PREFERENCE.
#define syntax_reference_p(x)
#define expression_domain
newgen_execution_domain_defined
#define REFERENCE(x)
REFERENCE.
#define syntax_reference(x)
#define reference_undefined
#define reference_variable(x)
#define value_intrinsic_p(x)
#define value_constant_p(x)
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define reference_domain
newgen_range_domain_defined
#define expression_undefined
#define value_symbolic_p(x)
#define reference_indices(x)
#define expression_undefined_p(x)
#define call_arguments(x)
#define syntax_range_p(x)
#define expression_syntax(x)
#define entity_initial(x)
The structure used to build lists in NewGen.
A gen_chunk is used to store every object.
#define exp
Avoid some warnings from "gcc -Wshadow".