PIPS
|
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "resources.h"
#include "misc.h"
#include "ri-util.h"
#include "workspace-util.h"
#include "effects-util.h"
#include "pipsdbm.h"
#include "preprocessor.h"
#include "effects-generic.h"
#include "effects-convex.h"
#include "properties.h"
#include "callgraph.h"
#include "transformations.h"
#include "dg.h"
#include "graph.h"
#include "control.h"
#include "ricedg.h"
#include "effects-simple.h"
#include "accel-util.h"
Go to the source code of this file.
Data Structures | |
struct | conflict_t |
helper for do_recurse_statements_conflict_p More... | |
struct | context |
Typedefs | |
typedef dg_arc_label | arc_label |
typedef dg_vertex_label | vertex_label |
Variables | |
static bool | delay_communications_interprocedurally_p |
static graph | dependence_graph =graph_undefined |
static bool | __delay_communications_patch_properties |
Implementation of inter procedural load / store delaying
Definition in file delay.c.
typedef dg_arc_label arc_label |
typedef dg_vertex_label vertex_label |
Definition at line 262 of file delay.c.
References context::backward, context::caller, cp, gen_copy_seq(), context::need_flatten, context::result, statement_undefined, and context::stats.
Referenced by delay_communications_anyloop(), and delay_communications_test().
Definition at line 279 of file delay.c.
References CONS, declaration_statement_p(), instruction_to_statement(), instruction_undefined, make_instruction_block(), NIL, pips_assert, sequence_statements, STATEMENT, statement_block_p, statement_instruction, statement_sequence(), and update_statement_instruction().
Referenced by insert_statement_in_block().
|
static |
Get the code of the module.
clean badly generated sequences
Definition at line 924 of file delay.c.
References clean_up_sequences(), compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dependence_graph, get_proper_rw_effects(), graph_undefined, module, module_name(), module_name_to_entity(), module_reorder(), pips_assert, remove_preferences(), remove_redundant_communications(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_proper_rw_effects(), statement_consistent_p(), and statement_flatten_declarations().
Referenced by delay_communications_inter(), and delay_communications_intra().
first step is to check conflict with the head
then we check if there is a conflict inside the loop. In that case better insert before the loop than inside
then we propagate the dma inside the body
then we check for conflicts with indices or over iterations
if statements have been moved outside the loop then we (may) need to flatten
Definition at line 407 of file delay.c.
References context::backward, context_dup(), delay_communications_statement(), FOREACH, forloop_body, gen_chunk_undefined_p, gen_copy_seq(), gen_find_eq(), gen_free_list(), gen_remove_once(), insert_statement_in_block(), loop_body, manage_conflicts(), context::need_flatten, pips_assert, recurse_statements_conflict_p(), STATEMENT, statement_forloop(), statement_forloop_p(), statement_loop(), statement_loop_p(), statement_undefined, statement_undefined_p, statement_whileloop(), statement_whileloop_p(), statements_conflict_p(), context::stats, and whileloop_body.
Referenced by delay_communications_statement().
memorize additional dma
Definition at line 316 of file delay.c.
References context::backward, CONS, copy_statement(), empty_comments, empty_comments_p(), free(), gen_free_list(), intptr_t, make_continue_instruction(), manage_conflicts(), NIL, simd_load_stat_p(), simd_store_stat_p(), STATEMENT, statement_comments, statement_declarations, statement_ordering, context::stats, and update_statement_instruction().
Referenced by delay_communications_statement().
|
static |
Definition at line 589 of file delay.c.
References __delay_communications_patch_properties, callees_callees, db_get_memory_resource(), delay_communications_interprocedurally_p, dependence_graph, ENDP, get_current_module_entity(), graph_undefined_p, module_local_name(), and pips_assert.
Referenced by delay_load_communications(), and delay_store_communications().
bool delay_communications_inter | ( | const char * | module_name | ) |
module_name | odule_name |
Definition at line 970 of file delay.c.
References delay_communications(), delay_communications_interprocedurally_p, and module_name().
|
static |
Definition at line 561 of file delay.c.
References call_domain, callees_callees, context::caller, caller_name, context::caller_statement, callers_to_statements(), CAR, clean_up_sequences(), compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, delay_communications_intraprocedurally(), do_delay_communications_interprocedurally(), ENDP, gen_context_recurse, gen_true2(), get_current_module_entity(), get_current_module_name(), get_current_module_statement(), module_local_name(), module_name_to_entity(), module_reorder(), pips_user_warning, POP, STATEMENT, and STRING.
Referenced by delay_load_communications(), and delay_store_communications().
bool delay_communications_intra | ( | const char * | module_name | ) |
module_name | odule_name |
Definition at line 974 of file delay.c.
References delay_communications(), delay_communications_interprocedurally_p, and module_name().
transform each caller into a load / call /store sequence
Definition at line 556 of file delay.c.
References context::backward, FOREACH, gen_free_list(), insert_statement(), NIL, STATEMENT, and context::stats.
Referenced by delay_communications_interprocedurally(), delay_load_communications(), and delay_store_communications().
|
static |
Definition at line 596 of file delay.c.
References __delay_communications_patch_properties, delay_communications_interprocedurally_p, dependence_graph, graph_undefined, graph_undefined_p, and pips_assert.
Referenced by delay_load_communications(), and delay_store_communications().
Definition at line 270 of file delay.c.
References context::backward, delay_communications_statement(), FOREACH, gen_copy_seq(), gen_free_list(), gen_nreverse(), pips_assert, sequence_statements, and STATEMENT.
Referenced by delay_communications_statement().
we could do better
Definition at line 455 of file delay.c.
References context::backward, delay_communications_anyloop(), delay_communications_call(), delay_communications_sequence(), delay_communications_test(), FOREACH, gen_copy_seq(), gen_free_list(), gen_remove_once(), insert_statement_in_block(), instruction_sequence, instruction_tag, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_whileloop, pips_assert, pips_user_warning, STATEMENT, statement_consistent_p(), statement_instruction, and context::stats.
Referenced by delay_communications_anyloop(), delay_communications_sequence(), delay_communications_test(), delay_load_communications(), and delay_store_communications().
explore both branches independently
manage state consistency after s : currently very pessimistic: if a dma is made on a branch, it must be done at the end of the branch. A more elaborated version could be to check that same pointers are stored and that they can be merged later ...
the same for the false branch
now we have the opposite case: a dma was made on a branch but not on the other one, in that case we must do it at the end of the other branch
true branch
false branch
insert it if it's missing somewhere
Definition at line 332 of file delay.c.
References context::backward, context_dup(), copy_statement(), delay_communications_statement(), FOREACH, gen_copy_seq(), gen_free_list(), gen_remove_once(), insert_statement_in_block(), intptr_t, manage_conflicts(), STATEMENT, statement_ordering, statement_test(), context::stats, test_false, and test_true.
Referenced by delay_communications_statement().
bool delay_load_communications | ( | char * | module_name | ) |
This phase looks for load or save statements that can be put out of the loop body and move these statements, if possible.
Get the code of the module.
Go through all the statements
then a backward translation
propagate inter procedurally , except if we have no caller
clean badly generated sequences
module_name | odule_name |
Definition at line 607 of file delay.c.
References clean_up_sequences(), compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, delay_communications_init(), delay_communications_interprocedurally(), delay_communications_interprocedurally_p, delay_communications_intraprocedurally(), delay_communications_reset(), delay_communications_statement(), dependence_graph, false, get_proper_rw_effects(), module, module_name(), module_name_to_entity(), module_reorder(), context::need_flatten, NIL, pips_assert, remove_preferences(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_proper_rw_effects(), context::result, set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_proper_rw_effects(), statement_consistent_p(), and statement_flatten_declarations().
Referenced by delay_load_communications_inter(), and delay_load_communications_intra().
bool delay_load_communications_inter | ( | char * | module_name | ) |
module_name | odule_name |
Definition at line 665 of file delay.c.
References delay_communications_interprocedurally_p, delay_load_communications(), and module_name().
bool delay_load_communications_intra | ( | char * | module_name | ) |
module_name | odule_name |
Definition at line 669 of file delay.c.
References delay_communications_interprocedurally_p, delay_load_communications(), and module_name().
bool delay_store_communications | ( | char * | module_name | ) |
Get the code of the module.
Go through all the statements
a first forward translation
propagate inter procedurally , except if we have no caller
clean badly generated sequences
module_name | odule_name |
Definition at line 674 of file delay.c.
References clean_up_sequences(), compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, delay_communications_init(), delay_communications_interprocedurally(), delay_communications_interprocedurally_p, delay_communications_intraprocedurally(), delay_communications_reset(), delay_communications_statement(), dependence_graph, get_proper_rw_effects(), module, module_name(), module_name_to_entity(), module_reorder(), context::need_flatten, NIL, pips_assert, remove_preferences(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_proper_rw_effects(), context::result, set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_proper_rw_effects(), statement_consistent_p(), and statement_flatten_declarations().
Referenced by delay_store_communications_inter(), and delay_store_communications_intra().
bool delay_store_communications_inter | ( | char * | module_name | ) |
module_name | odule_name |
Definition at line 733 of file delay.c.
References delay_communications_interprocedurally_p, delay_store_communications(), and module_name().
bool delay_store_communications_intra | ( | char * | module_name | ) |
module_name | odule_name |
Definition at line 737 of file delay.c.
References delay_communications_interprocedurally_p, delay_store_communications(), and module_name().
be conservative
Definition at line 142 of file delay.c.
References conflict_sink, conflict_source, descriptor_convex, descriptor_convex_p, effect_descriptor, and sc_inclusion_p.
Referenced by dma_statements_conflict_p().
Definition at line 216 of file delay.c.
References CONFLICT, dependence_graph, dg_arc_label_conflicts, dma_conflict_p(), FOREACH, graph_vertices, intptr_t, s1, statement_ordering, SUCCESSOR, successor_arc_label, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().
Referenced by do_recurse_statements_conflict_p().
this occurs when structures are involved
dma annihilates
Definition at line 742 of file delay.c.
References array_reference_p(), CAR, CONS, ENDP, FOREACH, gen_length(), load_cumulated_rw_effects_list(), NIL, pips_assert, pips_user_warning, POP, reference_equal_p(), region, REGION, region_any_reference, region_system, region_write_p, s1, sc_equal_p, and simd_dma_stat_p().
Referenced by do_remove_redundant_communications_in_anyloop(), and do_remove_redundant_communications_in_sequence().
there should be checks there !
Definition at line 542 of file delay.c.
References context::backward, call_function, context::caller, context::caller_statement, FOREACH, gen_get_ancestor(), get_current_module_entity(), insert_statement(), promote_local_entities(), same_entity_p(), STATEMENT, statement_domain, context::stats, and translate_arguments().
Referenced by delay_communications_interprocedurally().
|
static |
helper for recurse_statements_conflict_p
Definition at line 239 of file delay.c.
References conflict_t::conflict, dma_statements_conflict_p(), gen_recurse_stop(), conflict_t::s, simd_load_stat_p(), statement_ordering, and statements_conflict_relaxed_p().
Referenced by recurse_statements_conflict_p().
helper to transform preferences in references
Definition at line 76 of file delay.c.
References cell_preference, cell_preference_p, cell_reference, cell_tag, copy_reference(), free_preference(), is_cell_reference, and preference_reference.
Referenced by remove_preferences().
|
static |
skip declarations
look for heading dma statements
look for trailing dma statements
insert them around the loop
flatten_code if needed
and remove them from the alternate list
Definition at line 851 of file delay.c.
References CAR, declaration_statement_p(), dmas_invert_p(), ENDP, FOREACH, gen_copy_seq(), gen_free_list(), gen_nreverse(), gen_remove_once(), get_referenced_entities(), insert_statement(), POP, select_independent_dmas(), sequence_statements, set_assign_list(), set_free(), set_intersection_p(), set_make(), set_pointer, simd_dma_stat_p(), STATEMENT, statement_block(), statement_block_p, statement_declarations, and statement_sequence().
Referenced by do_remove_redundant_communications_in_forloop(), do_remove_redundant_communications_in_loop(), and do_remove_redundant_communications_in_whileloop().
Definition at line 910 of file delay.c.
References do_remove_redundant_communications_in_anyloop(), forloop_body, gen_get_ancestor(), and statement_domain.
Referenced by remove_redundant_communications().
Definition at line 902 of file delay.c.
References do_remove_redundant_communications_in_anyloop(), gen_get_ancestor(), loop_body, and statement_domain.
Referenced by remove_redundant_communications().
|
static |
remove the second statements from the original sequence if we have load ; store , the store is useless and the load will be removed by a used_def_elim phase if we have store ; load, it 's the same
Definition at line 803 of file delay.c.
References dmas_invert_p(), FOREACH, gen_copy_seq(), gen_free_list(), gen_remove_once(), pips_assert, sequence_statements, simd_dma_stat_p(), STATEMENT, statement_undefined, and statement_undefined_p.
Referenced by remove_redundant_communications().
|
static |
Definition at line 906 of file delay.c.
References do_remove_redundant_communications_in_anyloop(), gen_get_ancestor(), statement_domain, and whileloop_body.
Referenced by remove_redundant_communications().
|
static |
Definition at line 292 of file delay.c.
References create_block_if_needed(), gen_insert_after(), gen_insert_before(), insert_statement(), and statement_block_p.
Referenced by delay_communications_anyloop(), delay_communications_statement(), delay_communications_test(), and manage_conflicts().
check conflicts with current stats
Definition at line 304 of file delay.c.
References FOREACH, gen_copy_seq(), gen_free_list(), gen_remove_once(), insert_statement_in_block(), STATEMENT, statements_conflict_p(), and context::stats.
Referenced by delay_communications_anyloop(), delay_communications_call(), and delay_communications_test().
|
static |
if some local variables are going to be accessed inter procedurally, promote them to global variables
Definition at line 502 of file delay.c.
References AddEntityToModuleCompilationUnit(), compare_entities(), CONS, copy_basic(), ENTITY, entity_array_p(), entity_basic(), entity_initial, entity_scalar_p(), entity_type, entity_undefined, entity_user_name(), FOREACH, formal_parameter_p(), gen_full_copy_list(), gen_sort_list(), get_current_module_entity(), get_current_module_statement(), get_referenced_entities(), local_entity_of_module_p(), make_new_array_variable_with_prefix(), make_new_scalar_variable_with_prefix(), module_entity_to_compilation_unit_entity(), NIL, pips_assert, RemoveLocalEntityFromDeclarations(), replace_entity(), SET_FOREACH, set_free(), statement_split_initializations(), type_variable, value_unknown_p, and variable_dimensions.
Referenced by do_delay_communications_interprocedurally().
checks if there is a conflict between s
and any statement in in
Definition at line 247 of file delay.c.
References conflict_t::conflict, do_recurse_statements_conflict_p(), gen_context_recurse, gen_true2(), and statement_domain.
Referenced by delay_communications_anyloop().
void remove_preferences | ( | void * | obj | ) |
entry point to transform preferences in references
delay.c
obj | bj |
Definition at line 89 of file delay.c.
References cell_domain, do_remove_preference(), gen_null(), and gen_recurse.
Referenced by delay_communications(), delay_load_communications(), delay_store_communications(), loop_annotate(), and simdizer().
Definition at line 914 of file delay.c.
References do_remove_redundant_communications_in_forloop(), do_remove_redundant_communications_in_loop(), do_remove_redundant_communications_in_sequence(), do_remove_redundant_communications_in_whileloop(), forloop_domain, gen_context_multi_recurse(), gen_true(), loop_domain, sequence_domain, and whileloop_domain.
Referenced by delay_communications().
Definition at line 832 of file delay.c.
References CONS, FOREACH, gen_free_list(), NIL, simd_dma_stat_p(), STATEMENT, and statements_conflict_p().
Referenced by do_remove_redundant_communications_in_anyloop().
This function returns true if the statement is a simd loadsave statement.
stat | tat |
Definition at line 127 of file delay.c.
References simd_load_stat_p(), and simd_store_stat_p().
Referenced by dmas_invert_p(), do_remove_redundant_communications_in_anyloop(), do_remove_redundant_communications_in_sequence(), select_independent_dmas(), simd_stat_p(), and simd_trace_call().
Definition at line 95 of file delay.c.
References call_function, entity_local_name(), get_string_property(), and same_stringn_p.
Referenced by simd_load_stat_p().
stat | tat |
Definition at line 111 of file delay.c.
References simd_load_call_p(), statement_call(), and statement_call_p().
Referenced by delay_communications_call(), do_recurse_statements_conflict_p(), and simd_dma_stat_p().
This function returns true if the statement is a simd statement.
stat | tat |
Definition at line 135 of file delay.c.
References simd_dma_stat_p(), and simd_work_stat_p().
Definition at line 105 of file delay.c.
References call_function, entity_local_name(), get_string_property(), and same_stringn_p.
Referenced by simd_store_stat_p().
stat | tat |
Definition at line 119 of file delay.c.
References simd_store_call_p(), statement_call(), and statement_call_p().
Referenced by delay_communications_call(), simd_dma_stat_p(), statements_conflict_p(), and statements_conflict_relaxed_p().
Definition at line 100 of file delay.c.
References call_function, entity_local_name(), get_string_property(), and same_stringn_p.
Referenced by simd_work_stat_p().
stat | tat |
Definition at line 115 of file delay.c.
References simd_work_call_p(), statement_call(), and statement_call_p().
Referenced by simd_stat_p().
checks if there exist a conflict between s0
and s1
according to the dependency graph
in intra procedural, a store always conflicts with a return
special hook for loop statements: dependency on the index are not well generated
Definition at line 161 of file delay.c.
References delay_communications_interprocedurally_p, dependence_graph, FOREACH, get_referenced_entities(), graph_vertices, intptr_t, loop_index, return_statement_p(), s1, set_belong_p(), set_free(), simd_store_stat_p(), statement_loop(), statement_loop_p(), statement_ordering, SUCCESSOR, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().
Referenced by delay_communications_anyloop(), manage_conflicts(), and select_independent_dmas().
same as statements_conflict_p but W-* conflicts are ignored if load_p, R-* conflicts are ignored if not load_p
in intra procedural, a store always conflicts with a return
Definition at line 192 of file delay.c.
References CONFLICT, conflict_source, delay_communications_interprocedurally_p, dependence_graph, dg_arc_label_conflicts, effect_read_p, effect_write_p, FOREACH, graph_vertices, intptr_t, return_statement_p(), s1, simd_store_stat_p(), statement_ordering, SUCCESSOR, successor_arc_label, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().
Referenced by do_recurse_statements_conflict_p().
Definition at line 484 of file delay.c.
References call_arguments, CAR, copy_statement(), ENDP, ENTITY, EXPRESSION, gen_free_list(), gen_length(), get_current_module_entity(), module_formal_parameters(), pips_assert, POP, and replace_entity_by_expression().
Referenced by do_delay_communications_interprocedurally().
|
static |
Definition at line 588 of file delay.c.
Referenced by delay_communications_init(), and delay_communications_reset().
|
static |
Definition at line 73 of file delay.c.
Referenced by delay_communications_init(), delay_communications_inter(), delay_communications_intra(), delay_communications_reset(), delay_load_communications(), delay_load_communications_inter(), delay_load_communications_intra(), delay_store_communications(), delay_store_communications_inter(), delay_store_communications_intra(), statements_conflict_p(), and statements_conflict_relaxed_p().
|
static |
Definition at line 93 of file delay.c.
Referenced by delay_communications(), delay_communications_init(), delay_communications_reset(), delay_load_communications(), delay_store_communications(), dma_statements_conflict_p(), flint_initialize_statement_def_use_variables(), flint_uninitialized_variables(), flinter(), init_statement_equivalence_table(), reduction_detection(), reduction_propagation(), redundant_load_store_elimination(), simdize_simple_statements(), statements_conflict_p(), and statements_conflict_relaxed_p().