PIPS
|
Go to the source code of this file.
Data Structures | |
struct | DirectiveHandler |
finds the handler for a given entity. More... | |
Macros | |
#define | HANDLER(name) handle_##name##_directive |
each directive is handled by a function here. More... | |
Functions | |
static void | clean_statement (statement s) |
the directive is freed and replaced by a continue call or a copy loop nest, depending on the renamings. More... | |
static void | add_statement_to_clean (statement s) |
void | add_a_dynamic (entity c) |
local primary dynamics More... | |
void | hpfc_directives_error_handler () |
the local stack is used to retrieve the current statement while scanning the AST with gen_recurse. More... | |
static void | switch_basic_type_to_overloaded (entity e) |
management of PROCESSORS and TEMPLATE directives. More... | |
static void | new_processor (expression e) |
static void | new_template (expression e) |
static void | new_dynamic (expression e) |
static void | new_io_function (expression e) |
static void | new_fake_function (expression e) |
static void | new_pure_function (expression e) |
static void | array_as_template (entity array) |
array is to be seen as a template. More... | |
static bool | alignment_p (list align_src, expression subscript, int *padim, Value *prate, Value *pshift) |
one simple ALIGN directive is handled. More... | |
static align | extract_the_align (reference alignee, reference temp, list lopt) |
builds an align from the alignee and template references. More... | |
static void | initial_alignment (statement s) |
handle s as the initial alignment... More... | |
static void | one_align_directive (reference alignee, reference temp, list lopt, bool dynamic) |
handle a simple (re)align directive. More... | |
static bool | align_indices_p (entity f) |
hack, the common indices of a free form align is stored in a BLOCK() More... | |
static void | handle_align_and_realign_directive (_UNUSED_ entity f, list args, bool dynamic) |
handle a full (re)align directive. More... | |
static tag | distribution_format (expression e, list *pl) |
one DISTRIBUTE directive management More... | |
static distribute | extract_the_distribute (reference distributee, reference proc) |
builds the distribute from the distributee and processor references. More... | |
static void | one_distribute_directive (reference distributee, reference proc, bool dynamic) |
handles a simple (one template) distribute or redistribute directive. More... | |
static void | handle_distribute_and_redistribute_directive (_UNUSED_ entity f, list args, bool dynamic) |
handles a full distribute or redistribute directive. More... | |
static void | handle_unexpected_directive (_UNUSED_ entity f, _UNUSED_ list args) |
static void | handle_processors_directive (_UNUSED_ entity f, list args) |
static void | handle_template_directive (_UNUSED_ entity f, list args) |
static void | handle_align_directive (entity f, list args) |
static void | handle_distribute_directive (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. More... | |
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. More... | |
static void | handle_new_directive (_UNUSED_ entity f, _UNUSED_ list args) |
??? not implemented and not used. More... | |
static void | handle_dynamic_directive (_UNUSED_ entity f, list args) |
static void | handle_pure_directive (_UNUSED_ entity f, list args) |
may be used to declare functions as pure. More... | |
static void | handle_io_directive (_UNUSED_ entity f, list args) |
static void | handle_fake_directive (_UNUSED_ entity f, list args) |
static void | handle_realign_directive (entity f, list args) |
static void | handle_redistribute_directive (entity f, list args) |
static void | handle_synchro_directive (_UNUSED_ entity f, _UNUSED_ list args) |
static void | handle_time_directive (_UNUSED_ entity f, _UNUSED_ list args) |
for both timeon and timeoff More... | |
static void | handle_host_section_directive (_UNUSED_ entity f, _UNUSED_ list args) |
static void | handle_set_directive (entity f, list args) |
for both setbool and setint ??? looks like a hack:-) More... | |
static void | handle_prescriptive_directive (_UNUSED_ entity f, list args) |
prescriptive mappings before a call. More... | |
static void | handle_kill_directive (_UNUSED_ entity f, _UNUSED_ list args) |
tells the compiler that the array values are dead from now on. More... | |
static void | handle_nothing_directive (entity f, _UNUSED_ list args) |
static bool | directive_managed_now_p (const char *name) |
static bool | directive_filter (call c) |
newgen recursion thru the IR. More... | |
static bool | prescription_filter (call c) |
void | handle_hpf_directives (statement s, bool dyn) |
void handle_hpf_directives(s) statement s; More... | |
Variables | |
static int | analysis_phase = 0 |
HPFC module by Fabien COELHO. More... | |
static list | to_be_cleaned = NIL |
list of statements to be cleaned. More... | |
static struct DirectiveHandler | handlers [] |
static void(*)(entity, list) | directive_handler (const char *name) |
returns the handler for directive name. More... | |
#define HANDLER | ( | name | ) | handle_##name##_directive |
each directive is handled by a function here.
these handlers may use the statement stack to proceed. I may add some handlers for private directives?
Definition at line 650 of file directives.c.
void add_a_dynamic | ( | entity | c | ) |
local primary dynamics
Definition at line 99 of file directives.c.
References gen_once().
Referenced by hpfc_translate_call_with_distributed_args(), and new_dynamic().
|
static |
Definition at line 90 of file directives.c.
References CONS, STATEMENT, and to_be_cleaned.
Referenced by directive_filter(), handle_set_directive(), handle_synchro_directive(), and handle_time_directive().
hack, the common indices of a free form align is stored in a BLOCK()
Definition at line 406 of file directives.c.
References BLOCK_SUFFIX, entity_local_name(), f(), HPF_PREFIX, and same_string_p.
Referenced by handle_align_and_realign_directive().
|
static |
one simple ALIGN directive is handled.
retrieve the alignment from references array and template true if the template dimension subscript is an alignment. false if the dimension is replicated.
else the subscript is affine
the alignment should be a simple affine expression
constant alignment case
affine alignment case
alignment ok
matching array dimension not found, replicated!
align_src | of expressions |
Definition at line 193 of file directives.c.
References CAR, ENDP, EXPRESSION, expression_normalized, normalized_complex_p, normalized_linear, normalized_linear_p, pips_user_assert, POP, TCST, var_of, vect_coeff(), and vect_size().
Referenced by extract_the_align().
|
static |
array is to be seen as a template.
aligned to itself...
of alignment
Definition at line 170 of file directives.c.
References ALIGNMENT, array, CONS, int_to_expression(), make_align(), make_alignment(), NIL, NumberOfDimension(), set_array_as_distributed(), set_template(), and store_hpf_alignment().
Referenced by extract_the_align(), extract_the_distribute(), and one_distribute_directive().
|
static |
the directive is freed and replaced by a continue call or a copy loop nest, depending on the renamings.
of renamings
of statements
Do not forget to move forbidden information associated with block:
Definition at line 56 of file directives.c.
References bound_renamings_p(), call_undefined, CONS, CONTINUE_FUNCTION_NAME, entity_intrinsic(), fix_sequence_statement_attributes(), free_call(), free_instruction(), generate_copy_loop_nest(), instruction_call, instruction_call_p, load_renamings(), make_call(), make_instruction_block(), MAP, NIL, pips_assert, RENAMING, renaming_new, renaming_old, STATEMENT, and statement_instruction.
Referenced by handle_hpf_directives().
newgen recursion thru the IR.
Definition at line 1017 of file directives.c.
References add_statement_to_clean(), call_arguments, call_function, current_stmt_head, directive_handler, directive_managed_now_p(), entity_local_name(), entity_name, f(), hpf_directive_entity_p(), keep_directive_in_code_p(), and pips_debug.
Referenced by handle_hpf_directives().
|
static |
Definition at line 1010 of file directives.c.
References directive_handler, and HANDLER.
Referenced by directive_filter().
|
static |
one DISTRIBUTE directive management
returns the expected style tag for the given distribution format, plus a pointer to the list of arguments.
BLOCK()
CYCLIC()
just to avoid a gcc warning
pl | of expressions |
Definition at line 451 of file directives.c.
References BLOCK_SUFFIX, call_arguments, call_function, CYCLIC_SUFFIX, entity_local_name(), expression_syntax, hpf_directive_entity_p(), HPF_PREFIX, is_style_block, is_style_cyclic, is_style_none, pips_assert, pips_user_error, pl, same_string_p, STAR_SUFFIX, syntax_call, and syntax_call_p.
Referenced by extract_the_distribute().
builds an align from the alignee and template references.
used by both align and realign management.
of alignments
of expressions
each array dimension is looked for a possible alignment
align A with T - implicit alignment
explicit alignment
for an alignment tree I should check here whether template is aligned to sg, and update accordingly. Also backtracking already built alignments when a "template" happens to be aligned would be useful. Some day...
built align is returned. should be normalized?
lopt | of expression |
Definition at line 253 of file directives.c.
References ALIGNMENT, alignment_p(), array, array_as_template(), CAR, CONS, ENDP, entity_template_p(), EXPRESSION, gen_length(), get_entity_dimensions(), int_to_expression(), make_align(), make_alignment(), MIN, NIL, NumberOfDimension(), pips_user_assert, POP, reference_indices, reference_variable, and Value_to_expression().
Referenced by one_align_directive().
|
static |
builds the distribute from the distributee and processor references.
of expressions
keep the non empty one
of distributions
the template arguments are scanned to build the distribution
distribute T onto P - implicit
explicit distribution
implicit size
explicit size
Definition at line 486 of file directives.c.
References array_as_template(), CAR, CONS, copy_expression(), DISTRIBUTION, distribution_format(), ENDP, entity_template_p(), EXPRESSION, expression_undefined, gen_length(), gen_nreverse(), is_style_block, is_style_cyclic, is_style_none, make_distribute(), make_distribution(), make_style(), NIL, NumberOfDimension(), pips_assert, pips_internal_error, pips_user_assert, POP, reference_indices, reference_variable, and UU.
Referenced by one_distribute_directive().
|
static |
handle a full (re)align directive.
just decompose into simple alignments...
of expression
last points to the last item of args, which should be the template
args | of expressions |
Definition at line 415 of file directives.c.
References align_indices_p(), call_arguments, CAR, current_stmt_head, EXPRESSION, expression_syntax, expression_to_entity(), expression_to_reference(), gen_last(), gen_length(), gen_map(), NIL, normalize_all_expressions_of(), one_align_directive(), pips_debug, pips_user_assert, POP, store_renamings(), and syntax_call.
Referenced by handle_align_directive(), and handle_realign_directive().
Definition at line 672 of file directives.c.
References f(), and handle_align_and_realign_directive().
|
static |
handles a full distribute or redistribute directive.
of expression
last points to the last item of args, which should be the processors
calls the simple case handler.
Definition at line 619 of file directives.c.
References CAR, current_stmt_head, EXPRESSION, expression_to_reference(), gen_last(), gen_length(), gen_map(), NIL, normalize_all_expressions_of(), one_distribute_directive(), pips_user_assert, POP, and store_renamings().
Referenced by handle_distribute_directive(), and handle_redistribute_directive().
Definition at line 678 of file directives.c.
References f(), and handle_distribute_and_redistribute_directive().
see new_dynamic
Definition at line 783 of file directives.c.
References gen_map(), and new_dynamic().
Definition at line 814 of file directives.c.
References add_a_fake_function(), ENDP, gen_map(), get_current_module_entity(), module, and new_fake_function().
Definition at line 854 of file directives.c.
References pips_debug.
void handle_hpf_directives(s) statement s;
what: handles the HPF directives in statement s. how: recurses thru the AST, looking for special "directive calls". when found, a special handler is called for the given directive. input: the code statement s output: none side effects: (many)
INITIALIZE needed static stuff
PHASE 1
PHASE 2
PHASE 3
OPTIMIZATION
CLEAN
dyn | yn |
Definition at line 1069 of file directives.c.
References analysis_phase, build_full_ctrl_graph(), call_domain, clean_ctrl_graph(), clean_statement(), close_dynamic_locals(), close_the_dynamics(), DEBUG_CODE, DEBUG_STAT, directive_filter(), dump_current_remapping_graph(), expression_domain, gen_false(), gen_free_list(), gen_map(), gen_multi_recurse(), gen_null(), get_bool_property(), get_current_module_entity(), get_the_dynamics(), hpfc_check_for_similarities(), ifdebug, init_dynamic_locals(), init_the_dynamics(), initial_alignment(), NIL, pips_assert, pips_debug, prescription_filter(), simplify_remapping_graph(), statement_domain, store_renamings(), and to_be_cleaned.
Referenced by hpfc_directives_handler().
??? I wait for the next statements in a particular order, what should not be necessary.
Means I should deal with independent directives on the PARSED_CODE rather than after the CONTROLIZED.
of entities
travels thru the full control graph to find the loops and tag them as parallel.
what we're looking for
simple independent case, first loop is tagged //
else general independent case (with a list of indexes)
the end
Definition at line 721 of file directives.c.
References close_ctrl_graph_travel(), current_stmt_head, ENDP, entity_name, execution_tag, expressions_to_entities(), gen_in_list_p(), gen_length(), gen_remove(), gen_true(), init_ctrl_graph_travel(), instruction_loop, instruction_loop_p, is_execution_parallel, loop_execution, loop_index, next_ctrl_graph_travel(), pips_debug, pips_user_error, and statement_instruction.
Definition at line 804 of file directives.c.
References add_an_io_function(), ENDP, gen_map(), get_current_module_entity(), module, and new_io_function().
tells the compiler that the array values are dead from now on.
can be used by the propagation to stop the process... and mark at this point all copies as live! pretty simple handling! I let the call as a marker for itself, and it will be removed later on at the compilation stage only...
Definition at line 929 of file directives.c.
References pips_debug.
??? not implemented and not used.
The independent directive is trusted by the compiler to apply its optimizations...
(that's indeed a first implementation:-)
Definition at line 776 of file directives.c.
References hpfc_warning.
Definition at line 935 of file directives.c.
References entity_name, f(), and pips_debug.
prescriptive mappings before a call.
another kind of remapping, as realign and redistribute.
only one renaming per rename directive!
Definition at line 905 of file directives.c.
References array, CAR, CDR, CONS, current, current_stmt_head, EXPRESSION, expression_to_entity(), make_renaming(), NIL, propagate_synonym(), RENAMING, and store_renamings().
see new_processor
Definition at line 660 of file directives.c.
References gen_map(), and new_processor().
may be used to declare functions as pure.
??? it is not a directive in HPF, but I put it this way in F77. ??? pure declarations are not yet used by HPFC.
Definition at line 793 of file directives.c.
References add_a_pure(), ENDP, gen_map(), get_current_module_entity(), module, and new_pure_function().
Definition at line 824 of file directives.c.
References f(), and handle_align_and_realign_directive().
Definition at line 830 of file directives.c.
References f(), and handle_distribute_and_redistribute_directive().
I chose not to modify the ri to add reductions as private variables.
the reason is the following: locals are not well placed (they should be attached to statements?), I won't add one more misplaced sg. Also I would have to update all make_loop() within PIPS...
of entity
Definition at line 689 of file directives.c.
References bound_hpf_reductions_p(), close_ctrl_graph_travel(), current_stmt_head, entities_list, expressions_to_entities(), gen_nconc(), gen_true(), init_ctrl_graph_travel(), instruction_loop_p, load_hpf_reductions(), make_entities(), next_ctrl_graph_travel(), pips_user_error, statement_instruction, and store_hpf_reductions().
for both setbool and setint ??? looks like a hack:-)
property name. ??? moved to uppers because hpfc_directives put lowers. ??? plus having to deal with quotes that are put in the name!
Definition at line 864 of file directives.c.
References add_statement_to_clean(), call_function, CAR, CDR, current_stmt_head, entity_local_name(), EXPRESSION, expression_is_constant_p(), expression_syntax, f(), FCD_IGNORE_PREFIX, free(), gen_length(), get_bool_property(), HPF_PREFIX, HpfcExpressionToInt(), pips_user_assert, same_string_p, set_bool_property(), set_int_property(), SETBOOL_SUFFIX, strdup(), and syntax_call.
Definition at line 838 of file directives.c.
References add_statement_to_clean(), current_stmt_head, FCD_IGNORE_PREFIX, and get_bool_property().
see new_template
Definition at line 666 of file directives.c.
References gen_map(), and new_template().
for both timeon and timeoff
Definition at line 847 of file directives.c.
References add_statement_to_clean(), current_stmt_head, FCD_IGNORE_PREFIX, and get_bool_property().
Definition at line 654 of file directives.c.
References pips_user_error.
void hpfc_directives_error_handler | ( | void | ) |
the local stack is used to retrieve the current statement while scanning the AST with gen_recurse.
Definition at line 109 of file directives.c.
Referenced by hpfc_error_handler().
|
static |
handle s as the initial alignment...
to be called after the dynamics arrays...
a formal is considered as used to force the remapping
Definition at line 332 of file directives.c.
References add_as_a_used_dynamic_to_statement(), array, array_distributed_p(), CONS, ENTITY, entity_storage, get_the_dynamics(), load_renamings(), make_renaming(), MAP, propagate_synonym(), RENAMING, storage_formal_p, and update_renamings().
Referenced by handle_hpf_directives().
|
static |
Definition at line 144 of file directives.c.
References add_a_dynamic(), entity_name, expression_to_entity(), pips_debug, and set_entity_as_dynamic().
Referenced by handle_dynamic_directive().
|
static |
Definition at line 158 of file directives.c.
References add_a_fake_function(), and expression_to_entity().
Referenced by handle_fake_directive().
|
static |
Definition at line 153 of file directives.c.
References add_an_io_function(), and expression_to_entity().
Referenced by handle_io_directive().
|
static |
Definition at line 126 of file directives.c.
References entity_name, expression_to_entity(), pips_debug, set_processor(), and switch_basic_type_to_overloaded().
Referenced by handle_processors_directive().
|
static |
Definition at line 163 of file directives.c.
References add_a_pure(), and expression_to_entity().
Referenced by handle_pure_directive().
|
static |
Definition at line 135 of file directives.c.
References entity_name, expression_to_entity(), pips_debug, set_template(), and switch_basic_type_to_overloaded().
Referenced by handle_template_directive().
|
static |
handle a simple (re)align directive.
store the mappings in internal data structures. realign or align
a variable in a common can be declared several alignments that MUST be the same...
temp | the array |
lopt | the template of expressions |
Definition at line 355 of file directives.c.
References array, array_distributed_p(), array_synonym_aligned_as(), bound_hpf_alignment_p(), CONS, current, current_stmt_head, dynamic_entity_p, entity_name, extract_the_align(), ifdebug, load_renamings(), make_renaming(), normalize_align(), pips_assert, pips_debug, pips_user_assert, print_align(), propagate_synonym(), reference_variable, RENAMING, set_array_as_distributed(), store_hpf_alignment(), and update_renamings().
Referenced by handle_align_and_realign_directive().
handles a simple (one template) distribute or redistribute directive.
redistribute or distribute
the new template may be an array, thus auto-aligned
all arrays aligned to template are propagated in turn.
proc | the template |
dynamic | the processor arrangement |
Definition at line 554 of file directives.c.
References alive_arrays(), array, array_as_template(), array_distributed_p(), array_synonym_aligned_as(), bound_hpf_alignment_p(), CONS, current, current_stmt_head, dynamic_entity_p, ENDP, ENTITY, entity_name, entity_template_p(), extract_the_distribute(), load_hpf_alignment(), load_renamings(), make_renaming(), MAP, new_align_with_template(), normalize_distribute(), pips_debug, pips_user_assert, propagate_synonym(), reference_indices, reference_variable, RENAMING, store_hpf_distribution(), template_synonym_distributed_as(), and update_renamings().
Referenced by handle_distribute_and_redistribute_directive().
Definition at line 1038 of file directives.c.
References call_function, current_stmt_head, entity_name, f(), hpfc_call_with_distributed_args_p(), hpfc_translate_call_with_distributed_args(), and pips_debug.
Referenced by handle_hpf_directives().
|
static |
management of PROCESSORS and TEMPLATE directives.
just changes the basic type to overloaded and stores the entity as a processor or a template.
Definition at line 119 of file directives.c.
References basic_tag, basic_undefined, entity_basic(), is_basic_overloaded, and pips_assert.
Referenced by new_processor(), and new_template().
|
static |
HPFC module by Fabien COELHO.
These functions deal with HPF directives. (just a big hack, but few lines of code and neither lex nor yacc:-) I'm definitely happy with this. FC. several phases are used to analyze the directives. 1: static directives 2: special management of prescriptive mappings 3: dynamic mappings
Definition at line 44 of file directives.c.
Referenced by handle_hpf_directives().
returns the handler for directive name.
assumes that name should point to a directive.
Definition at line 1002 of file directives.c.
Referenced by directive_filter(), and directive_managed_now_p().
|
static |
Definition at line 935 of file directives.c.
list of statements to be cleaned.
the operation is delayed because the directives are needed in place to stop the dynamic updates. of statements
Definition at line 51 of file directives.c.
Referenced by add_statement_to_clean(), and handle_hpf_directives().