PIPS
|
#include "local.h"
#include "prettyprint.h"
#include "effects-generic.h"
#include "effects-simple.h"
Go to the source code of this file.
Macros | |
#define | NB_SIMPLIFY_PASSES 1 |
Set to 2 if we want to simplify in two passes. More... | |
#define | FLOW_DEPENDANCE 1 |
#define | ANTI_DEPENDANCE 2 |
#define | OUTPUT_DEPENDANCE 4 |
#define | INPUT_DEPENDANCE 8 |
#define | ALL_DEPENDANCES (FLOW_DEPENDANCE|ANTI_DEPENDANCE|OUTPUT_DEPENDANCE) |
Variables | |
static int | reference_level =0 |
static bool | expression_invariant = false |
static set | invariant_entities = set_undefined |
of entity More... | |
static list | indices = NIL |
static int | depth = 0 |
static list | depending_indices |
of entity More... | |
static bool | it_depends |
#define ALL_DEPENDANCES (FLOW_DEPENDANCE|ANTI_DEPENDANCE|OUTPUT_DEPENDANCE) |
#define NB_SIMPLIFY_PASSES 1 |
Definition at line 258 of file icm.c.
References action_read_p, action_write_p, ANTI_DEPENDANCE, conflict_sink, conflict_source, effect_action, FLOW_DEPENDANCE, INPUT_DEPENDANCE, and OUTPUT_DEPENDANCE.
Referenced by dependance_vertices_p(), and remove_dependance_from_conflicts().
region | of statement |
Definition at line 536 of file icm.c.
References region, set_belong_p(), and vertex_to_statement().
Referenced by icm_ignore_this_successor(), invariant_ignore_this_successor(), SimplifyGraph(), SimplifyInvariantVertex(), SimplifyRedundantVertex(), and SupressDependances().
|
static |
max of (val_e2, 0)
memory leak
Definition at line 1254 of file icm.c.
References copy_expression(), entity_intrinsic(), expression_constant_p(), expression_to_int(), free_expression(), INT_GENERIC_CONVERSION_NAME, int_to_expression(), make_op_exp(), MakeBinaryCall(), MakeUnaryCall(), and MAX_OPERATOR_NAME.
Referenced by icm_loop_rwt().
Test the existence of a given dependence between two vertices v1, v2.
Note:
Definition at line 282 of file icm.c.
References action_dependance_p(), ANTI_DEPENDANCE, cone_levels, cone_undefined, CONFLICT, conflict_cone, debug(), dg_arc_label_conflicts, FLOW_DEPENDANCE, fprintf(), ifdebug, INPUT_DEPENDANCE, INT, level, MAP, OUTPUT_DEPENDANCE, statement_number, SUCCESSOR, successor_arc_label, successor_vertex, vertex_successors, and vertex_to_statement().
Referenced by exist_non_self_dependance_from_vertex_p(), icm_ignore_this_successor(), invariant_ignore_this_successor(), SimplifyInvariantVertex(), SimplifyRedundantVertex(), vertex_invariant_p(), and vertex_redundant_p().
Set whether s depends from enclosing indices.
Definition at line 1202 of file icm.c.
References depending_indices, gen_recurse_stop(), it_depends, and statement_depend_of_indices_p().
Referenced by drop_it().
|
static |
of statement
of vertex
Group of vertices : all are variants
One statement...
which is invariant
Added to the list
Invariant is partially invariant...
NL: I can't explain why we have to add the declaration statement as an invariant statement, but it's seem that it work, and permit some optimizations...
Added to the list
Invariant is partially invariant...
NL: I'm not totally sure of the explanation I propose below The variable declared inside the loop can be consider as invariant variable because there values only be important inside the loop and not outside. so from the outside of the loop these variables doesn't exist and so can be consider as invariant?
lsccs | of scc |
region | of statement |
partially_invariant | of statement |
Definition at line 848 of file icm.c.
References CAR, declaration_statement_p(), FOREACH, gen_length(), invariant_entities, invariant_vertex_to_invariant_entities(), level, region, SCC, scc_vertices, set_add_element(), set_free(), set_make(), set_pointer, SimplifyInvariantVertex(), VERTEX, vertex_invariant_p(), vertex_partially_invariant_p(), and vertex_to_statement().
Referenced by SupressDependances().
|
static |
of statement
of vertex
Group of vertices : all are no redundant
One statement...
which is redundant
lsccs | of scc |
region | of statement |
partially_invariant | of statement |
Definition at line 1045 of file icm.c.
References CAR, gen_length(), level, MAP, redundant(), region, SCC, scc_vertices, set_add_element(), set_belong_p(), set_free(), set_make(), set_pointer, SimplifyRedundantVertex(), VERTEX, vertex_redundant_p(), and vertex_to_statement().
Referenced by SupressDependances().
|
static |
WARNING : We must recompute proper_effects for the program !!! So we directly call the pass !!!!!
Definition at line 1350 of file icm.c.
References gen_multi_recurse(), gen_null(), generic_effects_reset_all_methods(), icm_loop_rwt(), init_proper_rw_effects(), loop_domain, proper_effects_of_module_statement(), reset_proper_rw_effects(), set_methods_for_proper_simple_effects(), statement_domain, stmt_filter(), and stmt_rewrite().
Referenced by icm_codegen().
assert?
Definition at line 1228 of file icm.c.
References depending_indices, does_it_depend(), execution_parallel_p, gen_multi_recurse(), gen_null(), it_depends, loop_domain, loop_execution, NIL, pop_depending_index(), push_depending_index(), and statement_domain.
Referenced by icm_loop_rwt().
void dump_sef | ( | statement_effects | se | ) |
se | e |
Definition at line 75 of file icm.c.
References EFFECT, effects_effects, fprintf(), gen_length(), MAP, print_words(), STATEMENT_EFFECTS_MAP, statement_number, and words_effect().
|
static |
Definition at line 327 of file icm.c.
References dependance_vertices_p(), level, MAP, SUCCESSOR, successor_vertex, and vertex_successors.
Referenced by SimplifyInvariantVertex(), and SimplifyRedundantVertex().
le | of expression |
Definition at line 648 of file icm.c.
References exp, EXPRESSION, expression_invariant, gen_null(), gen_recurse, MAP, ref_flt(), and reference_domain.
Referenced by vertex_partially_invariant_p().
|
static |
Compute has_level hash and has_indices tables
LOOP
STATEMENT
Simplify the dependance graph
Definir le mapping entre les vertex originaux et les vertex copies
CodeGenerate reload the proper_rw_effects table, so we must reset before...
Generate the code (CodeGenerate don't use the first parameter...)
big hack
Remove dummy loops.
region | of statement |
Definition at line 1382 of file icm.c.
References CodeGenerate(), copy_graph(), db_get_memory_resource(), debug_off, debug_on, drop_dummy_loops(), free_graph(), gen_free_list(), gen_multi_recurse(), gen_null(), get_current_module_name(), graph_undefined, ifdebug, indices, invariant_entities, level, loop_domain, loop_level_in(), loop_level_out(), NB_SIMPLIFY_PASSES, NIL, pips_debug, prettyprint_dependence_graph(), print_statement(), reference_level, region, reset_proper_rw_effects(), set_free(), set_make(), set_pointer, set_proper_rw_effects(), SimplifyGraph(), statement_domain, statement_mark(), and statement_undefined.
Referenced by invariant_code_motion().
region | of statement |
Definition at line 547 of file icm.c.
References ALL_DEPENDANCES, common_ignore_this_vertex(), dependance_vertices_p(), level, region, and successor_vertex.
Referenced by SimplifyGraph().
Assume here that index is a scalar variable... :-)
memory leak...
Definition at line 1294 of file icm.c.
References compute_final_index_value(), copy_expression(), drop_it(), entity_name, entity_scalar_p(), fprintf(), ifdebug, instruction_undefined, loop_body, loop_index, loop_range, make_assign_statement(), make_factor_expression(), make_instruction_block(), make_statement_list, pips_assert, pips_debug, range_increment, range_lower, range_upper, statement_instruction, statement_number, and update_statement_instruction().
Referenced by drop_dummy_loops().
Definition at line 635 of file icm.c.
References expression_invariant, gen_recurse_stop(), invariant_entities, and set_belong_p().
Referenced by ref_flt().
bool invariant_code_motion | ( | const char * | module_name | ) |
Phase that hoists loop invariant code out of loops.
[in] | module_name |
Prepare some stuffs and call icm_codegen...
module_name | odule_name |
Definition at line 1495 of file icm.c.
References clean_up_sequences(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dg, enclosing, fprintf(), get_current_module_statement(), graph_undefined, graph_undefined_p, icm_codegen(), ifdebug, local_name_to_top_level_entity(), mod_stat, module, module_name(), module_reorder(), pips_debug, pips_internal_error, print_statement(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), rice_statement(), set_bool_property(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), statement_consistent_p(), and statement_undefined.
|
static |
region | of statement |
Definition at line 570 of file icm.c.
References common_ignore_this_vertex(), dependance_vertices_p(), FLOW_DEPENDANCE, level, region, and successor_vertex.
Referenced by SupressDependances().
of entity
of effect
rs | of entity |
Definition at line 178 of file icm.c.
References EFFECT, effect_any_reference, effect_write_p, load_proper_rw_effects_list(), MAP, reference_variable, set_add_element(), set_belong_p(), and vertex_to_statement().
Referenced by DoInvariantsStatements().
Definition at line 227 of file icm.c.
References CONS, depth, ENTITY, indices, and loop_index.
Referenced by icm_codegen().
|
static |
|
static |
Definition at line 1217 of file icm.c.
References CAR, CDR, depending_indices, ENTITY, free(), loop_index, NIL, and pips_assert.
Referenced by drop_it().
|
static |
Definition at line 99 of file icm.c.
References cone_levels, conflict_cone, conflict_sink, conflict_source, fprintf(), INT, level, MAP, print_words(), and words_effect().
Referenced by prettyprint_successor(), and remove_dependance_from_conflicts().
|
static |
Definition at line 119 of file icm.c.
References CONFLICT, dg_arc_label_conflicts, fprintf(), MAP, prettyprint_conflict(), statement_number, successor_arc_label, successor_vertex, and vertex_to_statement().
Referenced by prettyprint_vertex(), and remove_dependances_from_successors().
|
static |
Definition at line 136 of file icm.c.
References fprintf(), MAP, prettyprint_successor(), statement_number, SUCCESSOR, vertex_successors, and vertex_to_statement().
Referenced by remove_dependance().
void print_list_entities | ( | list | l | ) |
l | of entity |
Definition at line 151 of file icm.c.
References ENTITY, entity_name, fprintf(), and MAP.
Referenced by statement_depend_of_indices_p().
Definition at line 1210 of file icm.c.
References CONS, depending_indices, ENTITY, and loop_index.
Referenced by drop_it().
Definition at line 642 of file icm.c.
References inv_entity_filter(), and reference_variable.
Referenced by expressions_invariant_p().
|
static |
of successor
v2 | Successors of this vertex are updated |
Definition at line 488 of file icm.c.
References ANTI_DEPENDANCE, FLOW_DEPENDANCE, fprintf(), ifdebug, INPUT_DEPENDANCE, OUTPUT_DEPENDANCE, pips_debug, prettyprint_vertex(), remove_dependances_from_successors(), statement_number, vertex_successors, and vertex_to_statement().
Referenced by SimplifyInvariantVertex(), and SimplifyRedundantVertex().
|
static |
of conflict
of conflict
of level
of level
memory leak : levels
memory leak : conflicts
conflicts | of conflict |
Definition at line 369 of file icm.c.
References action_dependance_p(), cone_levels, cone_undefined, CONFLICT, conflict_cone, CONS, FOREACH, fprintf(), ifdebug, MAP, NIL, prettyprint_conflict(), and remove_dependance_from_levels().
Referenced by remove_dependances_from_successors().
of level
of level
memory leak : levels
levels | of level |
Definition at line 346 of file icm.c.
References CONS, gen_nconc(), INT, level, MAP, and NIL.
Referenced by remove_dependance_from_conflicts().
|
static |
of successor
of successor
of conflict
of conflict
memory leak : lc
memory leak : successors
Definition at line 428 of file icm.c.
References CONS, dg_arc_label_conflicts, fprintf(), ifdebug, MAP, NIL, prettyprint_successor(), remove_dependance_from_conflicts(), SUCCESSOR, successor_arc_label, successor_vertex, and successors().
Referenced by remove_dependance().
of scc
Find sccs
Check if the component is strongly connected
region | of statement |
Definition at line 1092 of file icm.c.
References common_ignore_this_vertex(), count, FindAndTopSortSccs(), FOREACH, fprintf(), gen_free_list(), icm_ignore_this_successor(), ifdebug, level, pips_debug, print_statement(), region, reset_sccs_drivers(), SCC, scc_vertices, set_free(), set_make(), SET_MAP, set_pointer, set_sccs_drivers(), statement_number, strongly_connected_p(), SupressDependances(), and vertices_to_statements().
Referenced by icm_codegen(), and SupressDependances().
of vertex
region | Successors of this vertex are updated of statement |
Definition at line 806 of file icm.c.
References ANTI_DEPENDANCE, common_ignore_this_vertex(), dependance_vertices_p(), exist_non_self_dependance_from_vertex_p(), FLOW_DEPENDANCE, FOREACH, level, OUTPUT_DEPENDANCE, region, remove_dependance(), set_add_element(), set_empty_p(), set_free(), set_make(), SET_MAP, set_pointer, SUCCESSOR, successor_vertex, vertex_successors, and vertex_to_statement().
Referenced by DoInvariantsStatements().
of vertices
region | Successors of this vertex are updated of statement |
Definition at line 1005 of file icm.c.
References ANTI_DEPENDANCE, common_ignore_this_vertex(), dependance_vertices_p(), exist_non_self_dependance_from_vertex_p(), FLOW_DEPENDANCE, FOREACH, level, OUTPUT_DEPENDANCE, region, remove_dependance(), set_add_element(), set_empty_p(), set_free(), set_make(), SET_MAP, set_pointer, SUCCESSOR, successor_vertex, vertex_successors, and vertex_to_statement().
Referenced by DoRedundantsStatements().
of effect
Ignore the first indicies...
indices | of entity |
Definition at line 596 of file icm.c.
References CDR, EFFECT, effect_any_reference, ENTITY, fprintf(), ifdebug, indices, level, load_proper_rw_effects_list(), MAP, pips_debug, print_list_entities(), reference_level, reference_variable, and statement_number.
Referenced by does_it_depend(), and vertex_invariant_p().
Definition at line 213 of file icm.c.
References depth, gen_copy_seq(), gen_nreverse(), and indices.
Referenced by icm_codegen().
of scc
of statement
Find sccs considering only flow dependances
Forward simplification
Backward simplification
region | of statement |
Definition at line 1144 of file icm.c.
References common_ignore_this_vertex(), count, DoInvariantsStatements(), DoRedundantsStatements(), FindAndTopSortSccs(), fprintf(), gen_free_list(), gen_nreverse(), ifdebug, invariant_ignore_this_successor(), level, NB_SIMPLIFY_PASSES, pips_debug, print_statement(), region, reset_sccs_drivers(), set_free(), set_make(), SET_MAP, set_pointer, set_sccs_drivers(), SimplifyGraph(), and statement_number.
Referenced by SimplifyGraph().
Test if the statement is dependent of ALL loop indexes >= level
If there is a flow dependence from v to v, then v is not variant
If there is a flow dependence from y to v and if y is not invariant, then v is not invariant
region | of statement |
invariant | of statement |
Definition at line 736 of file icm.c.
References dependance_vertices_p(), FLOW_DEPENDANCE, graph_vertices, level, MAP, pips_debug, region, set_belong_p(), statement_depend_of_indices_p(), statement_number, VERTEX, and vertex_to_statement().
Referenced by DoInvariantsStatements().
|
static |
Looking for write effects only
Which kind of reference we have ?
An array access with well known indices
An array access with unknow indices
A scalar variable
invariant | of statement |
Definition at line 668 of file icm.c.
References EFFECT, effect_any_reference, effect_write_p, expressions_invariant_p(), load_proper_rw_effects_list(), MAP, NIL, pips_debug, ref, reference_indices, reference_variable, statement_number, variable_entity_dimension(), and vertex_to_statement().
Referenced by DoInvariantsStatements().
|
static |
Test if the statement is depandant of ALL loop indexes >= level
This condition is not required, but putting a statement depending of indicies after the loop is tiedous (setting the value to the bound+1...)
Test if we are not always writing at the same adress ie. is not partially_invariant.
If there is a flow dependance from v to y and if y is not redundant, then v is not redundant
region | of statement |
partially_invariant | of statement |
redundant | of statement |
Definition at line 935 of file icm.c.
References dependance_vertices_p(), FLOW_DEPENDANCE, FOREACH, level, pips_debug, redundant(), region, set_belong_p(), statement_number, SUCCESSOR, successor_vertex, vertex_successors, and vertex_to_statement().
Referenced by DoRedundantsStatements().
Vertex_to_statement looks for the statement that is pointed to by vertex v.
This information is kept in a static hash_table named OrderingToStatement. See ri-util/ordering.c for more information.
Definition at line 45 of file util.c.
References dg_vertex_label_statement, ordering_to_statement(), and vertex_vertex_label.
Referenced by adg_dup_disjunctive_nodes(), adg_list_same_order_in_dg(), adg_same_order_in_dg(), allocate_task_to_cluster(), bdsc_code_instrumentation(), bottom_level(), check_tiling_legality(), check_way_between_two_statements(), clean_sdg(), common_ignore_this_vertex(), communications_construction(), contains_level_l_dependence(), dependance_vertices_p(), dg_vertex_dup(), dma_statements_conflict_p(), do_reduction_detection(), do_reduction_propagation(), do_redundant_load_store_elimination(), do_scalar_renaming_in_graph(), do_scalar_renaming_in_successors(), do_scalar_renaming_in_vertex(), DoInvariantsStatements(), DoRedundantsStatements(), end_idle_clusters(), find_covering_reference_path(), find_level_l_loop_statement(), flint_initialize_statement_def_use_variables(), graph_to_live_writes(), ignore_this_conflict(), init_statement_equivalence_table(), initialization(), invariant_vertex_to_invariant_entities(), IsolatedStatement(), make_filtered_dg_or_dvdg(), parse_instrumented_file(), predecessors(), prettyprint_successor(), prettyprint_vertex(), print_loopnest_dependence_cone(), print_SDGs(), PrintScc(), quick_privatize_graph(), quick_privatize_loop(), ready_node(), remove_dependance(), rice_update_dependence_graph(), scc_region(), schedule_failsafe(), search_parallel_loops(), sequence_dg(), SimplifyInvariantVertex(), SimplifyRedundantVertex(), some_conflicts_between(), statement_conflicts_p(), statement_to_vertex(), statements_conflict_p(), statements_conflict_relaxed_p(), stats_has_rw_conf_p(), step_analyse_CHAINS_DG(), successor_only_has_rr_conflict_p(), successors(), t_level(), tlevel_decrease(), topological_sort(), TopSortSccs(), update_priority_values(), vertex_invariant_p(), vertex_partially_invariant_p(), vertex_redundant_p(), vertex_to_chains(), vertices_to_statements(), xml_Chain_Graph(), and zeroing_multiple_edges().
of statement
vl | of vertex |
ss | of statement |
Definition at line 166 of file icm.c.
References MAP, set_add_element(), VERTEX, and vertex_to_statement().
Referenced by SimplifyGraph().
|
static |
of entity
Definition at line 1195 of file icm.c.
Referenced by does_it_depend(), drop_it(), pop_depending_index(), and push_depending_index().
|
static |
Definition at line 205 of file icm.c.
Referenced by loop_level_in(), loop_level_out(), and statement_mark().
Definition at line 63 of file icm.c.
Referenced by expressions_invariant_p(), and inv_entity_filter().
Definition at line 204 of file icm.c.
Referenced by basic_and_indices_to_basic(), copy_n_reference(), copy_write_statement_with_cumulated_regions(), do_array_to_pointer_walk_expression(), do_check_isolate_statement_preconditions_on_call(), do_group_constants_terapix(), do_isolate_statement_preconditions_satisified_p(), do_linearize_array_reference(), do_outliner_smart_replacment(), filter_regions(), gather_local_indices(), gfc2pips_array_ref2indices(), icm_codegen(), indice_p(), io_comp_regions(), isolate_patch_reference(), loop_level_in(), loop_level_out(), loop_nest_to_local_variables(), make_base_phi_variables(), make_send_receive_conversion(), make_start_ru_module(), MakeAtom(), reference_offset(), replace_entity_by_expression_expression_walker(), simdizer_auto_tile(), statement_depend_of_indices_p(), statement_mark(), xml_array_in_task(), xml_Chain_Graph(), xml_data(), xml_references(), and xml_tiling().
|
static |
of entity
Definition at line 64 of file icm.c.
Referenced by DoInvariantsStatements(), icm_codegen(), and inv_entity_filter().
|
static |
Definition at line 1196 of file icm.c.
Referenced by does_it_depend(), and drop_it().
|
static |
Definition at line 61 of file icm.c.
Referenced by icm_codegen(), and statement_depend_of_indices_p().