25 #include "pips_config.h"
36 #include "resources.h"
101 the_dynamics_object =
gen_once(c, the_dynamics_object);
111 error_reset_current_stmt_stack();
178 for(; ndim>0; ndim--)
215 if (size==0 || (*pshift!=0 && size==1))
217 *padim = 0, *prate = 0;
223 for(array_dim = 1; !
ENDP(align_src);
POP(align_src), array_dim++)
245 *padim = 0, *prate = 0;
263 int array_dim, template_dim, tndim, andim;
272 if (lopt) align_src = lopt;
282 int dim, ndim, tlower, alower, unused;
285 ndim=
MIN(andim, tndim);
287 for (dim=1; dim<=ndim; dim++)
306 for(template_dim=1; !
ENDP(align_sub);
POP(align_sub), template_dim++)
309 &array_dim, &rate, &shift))
441 for(; args!=last;
POP(args))
443 template, lopt, dynamic);
512 for (dim=1; dim<=npdim; dim++)
520 for(; !
ENDP(lformat);
POP(lformat))
637 for(; args!=last;
POP(args))
650 #define HANDLER(name) handle_##name##_directive
1005 while (
x->name && strcmp(name,
x->name))
x++;
1073 make_current_stmt_stack();
1126 pips_debug(1,
"starting optimization phase\n");
1137 DEBUG_STAT(7,
"after optimization phase", s);
1143 pips_assert(
"empty stack", current_stmt_empty_p());
1145 free_current_stmt_stack();
distribution make_distribution(style a1, expression a2)
distribute make_distribute(list a1, entity a2)
alignment make_alignment(intptr_t a1, intptr_t a2, expression a3, expression a4)
align make_align(list a1, entity a2)
style make_style(enum style_utype tag, void *val)
entities make_entities(list a)
renaming make_renaming(entity a1, entity a2)
call make_call(entity a1, list a2)
expression copy_expression(expression p)
EXPRESSION.
void free_instruction(instruction p)
struct _newgen_struct_entity_ * entity
#define MIN(x, y)
minimum and maximum if they are defined somewhere else, they are very likely to be defined the same w...
bool expression_is_constant_p(expression e)
BEGIN_EOLE.
void build_full_ctrl_graph(statement)
bool next_ctrl_graph_travel(statement *)
void init_ctrl_graph_travel(statement, bool(*)(statement))
void clean_ctrl_graph(void)
global mapping from statements to their control in the full control graph
void close_ctrl_graph_travel(void)
void print_align(align a)
this is a set of functions to help hpfc debugging
void close_dynamic_locals()
list alive_arrays(statement s, entity t)
what: returns the list of alive arrays for statement s and template t.
void init_dynamic_locals()
DYNAMIC LOCAL DATA.
void hpfc_translate_call_with_distributed_args(statement s, call c)
??? only simple calls are handled.
bool(* dynamic_entity_p)(entity)
as expected, true if entity e is dynamic.
void dump_current_remapping_graph(string when)
void simplify_remapping_graph(void)
void simplify_remapping_graph()
void propagate_synonym(statement s, entity old, entity new, bool is_array)
bool hpfc_call_with_distributed_args_p(call c)
whether call c inplies a distributed argument
void set_entity_as_dynamic(entity e)
a new dynamic entity is stored.
void hpfc_check_for_similarities(list le)
check all dynamic arrays for some similars...
void add_as_a_used_dynamic_to_statement(statement s, entity e)
align new_align_with_template(align a, entity t)
entity template_synonym_distributed_as(entity temp, distribute d)
what: finds or creates a new entity distributed as needed.
statement generate_copy_loop_nest(entity src, entity trg)
statement generate_copy_loop_nest(src, trg) entity src, trg;
entity array_synonym_aligned_as(entity array, align a)
entity array_synonym_aligned_as(array, a) entity array; align a;
static statement current_stmt
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
entity get_current_module_entity(void)
Get the entity of the current module.
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 gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
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)
void gen_map(gen_iter_func_t fp, const list l)
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)
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
list gen_last(list l)
Return the last element of a 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 MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
void fix_sequence_statement_attributes(statement)
Since blocks are not represented in Fortran, they cannot carry a label.
#define DISTRIBUTION(x)
DISTRIBUTION.
#define ALIGNMENT(x)
ALIGNMENT.
#define RENAMING(x)
RENAMING.
void get_entity_dimensions(entity e, int dim, int *plow, int *pup)
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
void normalize_align(_UNUSED_ entity e, align a)
void normalize_distribute(entity t, distribute d)
#define hpfc_warning
WARNING.
#define DEBUG_STAT(D, W, S)
#define DEBUG_CODE(D, W, M, S)
static bool directive_managed_now_p(const char *name)
static void handle_unexpected_directive(_UNUSED_ entity f, _UNUSED_ list args)
static void handle_time_directive(_UNUSED_ entity f, _UNUSED_ list args)
for both timeon and timeoff
static void handle_host_section_directive(_UNUSED_ entity f, _UNUSED_ list args)
static struct DirectiveHandler handlers[]
#define HANDLER(name)
each directive is handled by a function here.
static void one_align_directive(reference alignee, reference temp, list lopt, bool dynamic)
handle a simple (re)align directive.
static distribute extract_the_distribute(reference distributee, reference proc)
builds the distribute from the distributee and processor references.
static void handle_distribute_directive(entity f, list args)
static void handle_new_directive(_UNUSED_ entity f, _UNUSED_ list args)
??? not implemented and not used.
void add_a_dynamic(entity c)
local primary dynamics
static bool align_indices_p(entity f)
hack, the common indices of a free form align is stored in a BLOCK()
static void array_as_template(entity array)
array is to be seen as a template.
static void handle_dynamic_directive(_UNUSED_ entity f, list args)
static void new_processor(expression e)
static void initial_alignment(statement s)
handle s as the initial alignment...
static void new_fake_function(expression e)
static void handle_kill_directive(_UNUSED_ entity f, _UNUSED_ list args)
tells the compiler that the array values are dead from now on.
static void new_pure_function(expression e)
static void handle_realign_directive(entity f, list args)
static void handle_redistribute_directive(entity f, list args)
static void handle_processors_directive(_UNUSED_ entity f, list args)
static void handle_reduction_directive(_UNUSED_ entity f, list args)
I chose not to modify the ri to add reductions as private variables.
static void handle_prescriptive_directive(_UNUSED_ entity f, list args)
prescriptive mappings before a call.
static void(*)(entity, list) directive_handler(const char *name)
returns the handler for directive name.
static void handle_template_directive(_UNUSED_ entity f, list args)
static bool prescription_filter(call c)
static void add_statement_to_clean(statement s)
static void handle_independent_directive(_UNUSED_ entity f, list args)
??? I wait for the next statements in a particular order, what should not be necessary.
static bool directive_filter(call c)
newgen recursion thru the IR.
static void handle_align_directive(entity f, list args)
static void new_template(expression e)
static void handle_pure_directive(_UNUSED_ entity f, list args)
may be used to declare functions as pure.
void hpfc_directives_error_handler()
the local stack is used to retrieve the current statement while scanning the AST with gen_recurse.
static tag distribution_format(expression e, list *pl)
one DISTRIBUTE directive management
static void one_distribute_directive(reference distributee, reference proc, bool dynamic)
handles a simple (one template) distribute or redistribute directive.
static void handle_align_and_realign_directive(_UNUSED_ entity f, list args, bool dynamic)
handle a full (re)align directive.
static align extract_the_align(reference alignee, reference temp, list lopt)
builds an align from the alignee and template references.
static void handle_synchro_directive(_UNUSED_ entity f, _UNUSED_ list args)
static void handle_nothing_directive(entity f, _UNUSED_ list args)
static void handle_distribute_and_redistribute_directive(_UNUSED_ entity f, list args, bool dynamic)
handles a full distribute or redistribute directive.
static bool alignment_p(list align_src, expression subscript, int *padim, Value *prate, Value *pshift)
one simple ALIGN directive is handled.
static int analysis_phase
HPFC module by Fabien COELHO.
static void new_io_function(expression e)
static void handle_set_directive(entity f, list args)
for both setbool and setint ??? looks like a hack:-)
static void switch_basic_type_to_overloaded(entity e)
management of PROCESSORS and TEMPLATE directives.
static void handle_io_directive(_UNUSED_ entity f, list args)
static void handle_fake_directive(_UNUSED_ entity f, list args)
static void new_dynamic(expression e)
static list to_be_cleaned
list of statements to be cleaned.
static void clean_statement(statement s)
the directive is freed and replaced by a continue call or a copy loop nest, depending on the renaming...
void handle_hpf_directives(statement s, bool dyn)
void handle_hpf_directives(s) statement s;
void add_an_io_function(entity f)
void add_a_pure(entity f)
void add_a_fake_function(entity f)
bool bound_hpf_reductions_p(statement)
bool bound_renamings_p(statement)
void store_hpf_distribution(entity, distribute)
list load_renamings(statement)
bool entity_template_p(entity)
void set_template(entity)
list get_the_dynamics(void)
void store_hpf_alignment(entity, align)
void update_renamings(statement, list)
void close_the_dynamics(void)
entities load_hpf_reductions(statement)
align load_hpf_alignment(entity)
void init_the_dynamics(void)
bool bound_hpf_alignment_p(entity)
void set_array_as_distributed(entity)
void store_renamings(statement, list)
void store_hpf_reductions(statement, entities)
bool array_distributed_p(entity)
void set_processor(entity)
#define current_stmt_head()
We want to keep track of the current statement inside the recurse.
int vect_size(Pvecteur v)
package vecteur - reductions
static void unexpected(void)
#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
#define pips_user_assert(what, predicate)
#define GENERIC_STATIC_STATUS(PREFIX, name, type, init, cloze)
#define DEFINE_LOCAL_STACK(name, type)
#define same_string_p(s1, s2)
void(* gen_iter_func_t)(void *)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
void normalize_all_expressions_of(void *obj)
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
void set_bool_property(const char *, bool)
void set_int_property(const char *, int)
struct _newgen_struct_property_ * property
#define HPF_PREFIX
moved here because needed by syntax:-(
#define FCD_IGNORE_PREFIX
property prefix for ignoring FCD directives TIME, SYNCHRO and SET exists.
#define REDISTRIBUTE_SUFFIX
#define INDEPENDENT_SUFFIX
#define HOSTSECTION_SUFFIX
#define BLOCK_SUFFIX
suffixies for encoded hpf keywords
#define DISTRIBUTE_SUFFIX
#define CONTINUE_FUNCTION_NAME
#define TELL_SUFFIX
suffixes for my own (FCD:-) directives.
#define PROCESSORS_SUFFIX
#define ALIGN_SUFFIX
suffixes for HPF directives managed by HPFC
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...
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
reference expression_to_reference(expression e)
list expressions_to_entities(list expressions)
map expression_to_entity on expressions
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression Value_to_expression(Value v)
added interface for linear stuff.
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
bool hpf_directive_entity_p(entity e)
bool keep_directive_in_code_p(const char *s)
whether an entity must be kept in the code.
int NumberOfDimension(entity)
#define expression_domain
newgen_execution_domain_defined
#define loop_execution(x)
#define storage_formal_p(x)
#define normalized_complex_p(x)
#define normalized_linear_p(x)
#define instruction_loop_p(x)
#define reference_variable(x)
#define instruction_loop(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define expression_undefined
#define expression_normalized(x)
#define reference_indices(x)
#define instruction_call_p(x)
#define statement_instruction(x)
#define instruction_call(x)
#define call_arguments(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define STATEMENT(x)
STATEMENT.
finds the handler for a given entity.
int phase
all names must start with the HPF_PREFIX
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...