25 #include "pips_config.h"
39 #define MAX_REDUCTION 1
40 #define MIN_REDUCTION 2
41 #define SUM_REDUCTION 3
120 static char *reduction_names[] = {
"MAX",
"MIN",
"SUM"};
122 return(reduction_names[kind-1]);
137 (void) sprintf(
buffer,
"%sRED %d %s %s",
157 int dim = 0, arraynum = -1;
250 make_current_call_stack();
254 call_domain, current_call_filter, current_call_rewrite,
257 free_current_call_stack();
320 (host?
"H":
"N", prolog?
"PRE":
"POST",
" ",
379 #define expression_complex_p(e) \
380 (normalized_complex_p(expression_normalized(e)))
397 for(; v!=NULL; v=v->
succ)
412 bool shift_was_seen =
false;
443 lhs_ind=
CDR(lhs_ind), rhs_ind=
CDR(rhs_ind))
481 if (shift_was_seen ||
485 pips_debug(7,
"false on array %s, dimension %d\n",
492 shift_was_seen =
true;
577 (void) sprintf(
buffer,
"%s SHIFT %d",
609 c = sc_inegalites(s);
707 error_reset_current_stmt_stack();
708 error_reset_current_call_stack();
739 make_current_stmt_stack();
750 free_current_stmt_stack();
787 for(ndim=1; li;
POP(li),
POP(ld), ndim++)
834 pips_debug(9,
"incomplete scan of %s[dim=%d]\n",
857 #define XDEBUG(msg) \
858 pips_debug(6, "statement %p: " msg "\n", (void*) s)
884 for (l=lb; l;
POP(l))
887 XDEBUG(
"non perfectly nested");
939 XDEBUG(
"references not aligned");
return false;
983 for(i=1, l=lindexes; i<=ndim; i++,
POP(lindexes),
POP(ld))
hpfc_reductions make_hpfc_reductions(entity a1, entity a2, reduction_operator a3)
reduction_operator make_reduction_operator(enum reduction_operator_utype tag, void *val)
execution make_execution(enum execution_utype tag, void *val)
call make_call(entity a1, list a2)
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
expression copy_expression(expression p)
EXPRESSION.
reference copy_reference(reference p)
REFERENCE.
range make_range(expression a1, expression a2, expression a3)
static reference ref
Current stmt (an integer)
void const char const char const int
bdt base
Current expression.
struct _newgen_struct_statement_ * statement
statement parallel_loop_nest_to_body(statement loop_nest, list *pblocks, list *ploops)
bool vecteur_nul_p(Pvecteur v)
#define CONTRAINTE_UNDEFINED
struct Scontrainte * Pcontrainte
Pcontrainte contraintes_free(Pcontrainte pc)
Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc.
void constraints_for_bounds(Variable, Pcontrainte *, Pcontrainte *, Pcontrainte *)
void constraints_for_bounds(var, pinit, plower, pupper) Variable var; Pcontrainte *pinit,...
expression constraints_to_loop_bound(Pcontrainte, Variable, bool, entity)
expression constraints_to_loop_bound(c, var, is_lower)
static statement current_stmt
bool rectangular_must_region_p(entity, statement)
list load_statement_local_regions(statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
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.
bool gen_false(__attribute__((unused)) gen_chunk *unused)
Return false and ignore the argument.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool instruction_assign_p(instruction i)
Test if an instruction is an assignment.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
void gen_map(gen_iter_func_t fp, const list l)
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
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#define CDR(pcons)
Get the list less its first element.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
statement make_assign_statement(expression, expression)
bool empty_code_p(statement)
statement.c
#define hpfc_reductions_initial(x)
#define hpfc_reductions_operator(x)
#define HPFC_REDUCTIONS(x)
HPFC_REDUCTIONS.
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
bool ith_dim_distributed_p(entity array, int i, int *pprocdim)
whether a dimension is distributed or not.
bool ref_to_dist_array_p(void *obj)
this file describe a few functions usefull to the compiler to manage the hpfc data structures.
bool references_aligned_p(reference r1, reference r2)
bool written_effect_p(entity var, list le)
written_effects_to_dist_arrays_p
#define DEBUG_STAT(D, W, S)
entity hpfc_name_to_entity(const char *)
entity load_new_node(entity)
entity MakeRunTimeSupportFunction(string, int, tag)
list array_lower_upper_bounds_list(entity)
of expressions
bool block_distributed_p(entity)
o-analysis.c
entity get_ith_region_dummy(int)
statement hpfc_make_call_statement(entity, list)
statement hpfc_make_call_statement(e, l) generate a call statement to function e, with expression lis...
entities load_hpf_reductions(statement)
entity MakeRunTimeSupportSubroutine(string, int)
run-time.c
string pvm_what_options(basic)
string pvm_what_options(b)
intptr_t load_hpf_number(entity)
bool array_distributed_p(entity)
#define current_stmt_head()
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_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define DEFINE_LOCAL_STACK(name, type)
#define same_string_p(s1, s2)
void(* gen_iter_func_t)(void *)
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
#define reduction_operator_sum_p(x)
@ is_reduction_operator_min
@ is_reduction_operator_max
@ is_reduction_operator_prod
@ is_reduction_operator_or
@ is_reduction_operator_and
@ is_reduction_operator_sum
#define reduction_operator_min_p(x)
#define reduction_operator_tag(x)
struct _newgen_struct_reduction_ * reduction
#define reduction_operator_prod_p(x)
#define reduction_operator_or_p(x)
#define reduction_operator_and_p(x)
#define reduction_operator_max_p(x)
static const char * prefix
#define loop_to_statement(l)
#define ENTITY_ASSIGN_P(e)
#define ENTITY_MINUS_P(e)
#define ENTITY_MULTIPLY_P(e)
#define ENTITY_CONTINUE_P(e)
#define call_to_statement(c)
#define CONTINUE_FUNCTION_NAME
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
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 entity_empty_label(void)
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
const char * module_local_name(entity e)
Returns the module local user name.
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
expression reference_to_expression(reference r)
list expressions_to_entities(list expressions)
map expression_to_entity on expressions
expression make_call_expression(entity e, list l)
Build an expression that call an function entity with an argument list.
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
bool integer_constant_expression_p(expression e)
positive integer constant expression: call to a positive constant or to a sum of positive integer con...
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.
bool same_expression_p(expression e1, expression e2)
this is slightly different from expression_equal_p, as it will return true for a+b vs b+a
int integer_constant_expression_value(expression e)
int element_number(basic, list)
END_EOLE.
int NumberOfDimension(entity)
#define test_domain
newgen_entity_domain_defined
#define syntax_reference_p(x)
#define expression_domain
newgen_execution_domain_defined
#define syntax_reference(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define dimension_lower(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define range_increment(x)
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define reference_domain
newgen_range_domain_defined
#define expression_undefined
#define expression_normalized(x)
#define dimension_upper(x)
#define reference_indices(x)
#define instruction_call_p(x)
#define variable_dimensions(x)
#define statement_instruction(x)
#define instruction_call(x)
@ is_execution_sequential
#define call_arguments(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define variable_basic(x)
#define STATEMENT(x)
STATEMENT.
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
static bool check_simple(call c)
statement generate_full_copy(reference left, reference right)
statement generate_full_copy(reference left, reference right)
static statement compile_one_reduction(hpfc_reductions red, bool prolog, bool host)
list handle_hpf_reduction(statement s)
of hpfc_reductions
struct t_reduction t_reduction
void free_vector_list(list l)
static bool loop_filter(loop l)
bool call_reduction_p(call c)
static bool locally_constant_vector_p(Pvecteur v)
static bool subarray_shift_ok
some static variables used for the detection...
static tag found_operator
static void reduction_parameters(call c, t_reduction **pred, basic *pb, int *pdim, entity *pe, list *pl)
#define XDEBUG(msg)
bool full_copy_p(statement s, reference * pleft, reference * pright)
static entity make_shift_subroutine(entity var)
generates the needed subroutine
bool subarray_shift_p(statement s, entity *pe, list *plvect)
static statement simple_found
tests whether a loop nest is a full copy loop nest, i.e.
static t_reduction * find_reduction(const char *s)
static t_reduction *find_reduction(c)
bool full_copy_p(statement s, reference *pleft, reference *pright)
static t_reduction all_reductions[]
static char * reduction_name(int kind)
list make_rectangular_area(statement st, entity var)
static entity make_reduction_function(string prefix, int ndim, int kind, basic base, int nargs)
find or create an entity for the reduction function...
#define expression_complex_p(e)
bool subarray_shift_p(s, pe, plvect) statement s; entity *pe; list *plvect;
static loop find_loop(entity index, list ll)
bool full_define_p (reference r, list ll)
static string new_reduction_name(reduction_operator op)
for reduction directive:
statement simple_statement(statement s)
static bool not_simple(_UNUSED_ void *x)
void hpfc_special_cases_error_handler()
static bool subarray_shift_assignment_p(call c)
statement generate_subarray_shift(statement s, entity var, list lshift)
statement generate_subarray_shift(s, var, lshift) statement s; entity var; list lshift;
static hpfc_reductions reduction_of_in(entity e, statement s)
finally, I can do without replacement: the host keeps and contributes the initial value!
static list current_regions
static bool cannot_be_a_shift(_UNUSED_ void *x)
static entity searched_variable
hpfc_reductions = initial:entity x replacement:entity x operator:reduction ; reduction = { min ,...
static bool call_filter(call c)
#define MAX_REDUCTION
HPFC module, Fabien Coelho, May 1993.
list compile_hpf_reduction(list lr, bool prolog, bool host)
of statement
bool compile_reduction(statement initial, statement *phost, statement *pnode)
bool compile_reduction(initial, phost, pnode)
Psysteme get_read_effect_area(list le, entity var)
bool full_define_p(reference r, list ll)
bool hpfc_entity_reduction_p(entity e)
bool call_reduction_p(c)
static reduction_operator get_operator(entity e, statement s)
static bool ref_filter(reference r)
static entity make_new_reduction_function(reduction_operator op, bool prolog, bool host, basic base)
name is {H,N}{PRE,POST}_{SUM,PROD,MIN,...}_{REAL4,INTERGER4,...}
static int number_of_non_empty_statements(list ls)
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
The structure used to build lists in NewGen.
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
struct Svecteur * Pvecteur
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...