PIPS
|
#include "genC.h"
#include "constants.h"
#include "misc.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "database.h"
#include "pipsdbm.h"
#include "workspace-util.h"
#include "properties.h"
#include "control.h"
#include "resources.h"
#include "effects-generic.h"
#include "transformations.h"
#include "accel-util.h"
Go to the source code of this file.
Functions | |
static void | guard_expanded_statement (statement s, expression guard) |
create a guard guard around statement s More... | |
static void | guard_expanded_statement_if_needed (statement s, expression guard, loop parent_loop) |
create a guard guard around statement s if needed it is needed when a not-private variable (that is not in parent_loop locals) is written by the statement More... | |
static void | do_loop_expansion (statement st, expression size, bool center, bool apply_guard) |
bool | loop_expansion (const char *module_name) |
loop_expansion.c More... | |
static void | do_loop_expansion_init (statement st, expression size) |
creates a new statement that perfom the expansion of the loop this statement is flagged for further processing More... | |
bool | loop_expansion_init (const char *module_name) |
first step of the loop expansion process: create a statement to insert and flag it with a pragma More... | |
|
static |
this gets (e-b)/i , that is the number of iterations in the loop
the expanded nb_iter will be refered as efactor = factor* size
get_current_module_statement is inaccurate here, but if factor is store independant ... icm should work better ! st would be better
we must check for loop_index() in range_lower
set the guard on all statement that need it
update loop fields either by a constant, or by a new entity with appropriate init
insert statement in the end, otherwise pips gets disturbed
Definition at line 158 of file loop_expansion.c.
References AddEntityToCurrentModule(), AND_OPERATOR_NAME, basic_of_expression(), copy_expression(), DIVIDE_OPERATOR_NAME, entity_intrinsic(), entity_to_expression(), entity_undefined, entity_undefined_p, expression_constant_p(), expression_undefined, free_expression(), get_current_module_entity(), get_current_module_statement(), get_referenced_entities(), GREATER_OR_EQUAL_OPERATOR_NAME, guard_expanded_statement_if_needed(), insert_statement(), int_to_expression(), LESS_OR_EQUAL_OPERATOR_NAME, loop_body, loop_index, loop_range, make_assign_statement(), make_new_scalar_variable(), make_op_exp(), MakeBinaryCall(), MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, pips_user_warning, PLUS_OPERATOR_NAME, range_increment, range_lower, range_to_expression(), range_to_nbiter, range_upper, set_belong_p(), set_free(), statement_loop(), statement_undefined, and statement_undefined_p.
Referenced by loop_expansion().
|
static |
creates a new statement that perfom the expansion of the loop this statement is flagged for further processing
compute the range of new loop range lower will be next step of loop
this gets (e-b)/i , that is the number of iterations in the loop
this gets the expanded nb_iter
Definition at line 335 of file loop_expansion.c.
References add_pragma_str_to_statement(), clone_statement(), copy_expression(), DIVIDE_OPERATOR_NAME, entity_empty_label(), expression_constant_p(), free_clone_context(), get_current_module_entity(), get_current_module_statement(), get_string_property(), insert_statement(), instruction_to_statement(), int_to_expression(), loop_body, loop_index, loop_range, make_clone_context(), make_execution_sequential(), make_instruction_loop(), make_loop(), make_op_exp(), make_range(), MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, NIL, pips_user_warning, PLUS_OPERATOR_NAME, range_increment, range_lower, range_to_expression(), range_to_nbiter, and statement_loop().
Referenced by loop_expansion_init().
|
static |
create a guard guard around statement s
s | statement to guard |
guard | guard to apply |
update_instruction force us to copy
Definition at line 81 of file loop_expansion.c.
References AND_OPERATOR_NAME, copy_expression(), copy_statement(), entity_intrinsic(), make_empty_statement, make_instruction_test(), make_test(), MakeBinaryCall(), statement_test(), statement_test_p(), test_condition, and update_statement_instruction().
Referenced by guard_expanded_statement_if_needed().
|
static |
create a guard guard around statement s if needed it is needed when a not-private variable (that is not in parent_loop locals) is written by the statement
s | statement to guard |
guard | guard to apply |
parent_loop | set of enclosing loop locals |
map guard on each block
map on loop body if range independant from loop_index(parent_loop)
an io effect implies a guard too
Definition at line 115 of file loop_expansion.c.
References EFFECT, effect_entity(), effect_write_p, FOREACH, gen_free_list(), get_referenced_entities(), guard_expanded_statement(), io_effect_p(), load_cumulated_rw_effects_list(), loop_body, loop_index, loop_locals, loop_range, set_assign_list(), set_belong_p(), set_free(), set_make(), set_pointer, STATEMENT, statement_block(), statement_block_p, statement_loop(), statement_loop_p(), and statement_to_declarations().
Referenced by do_loop_expansion().
bool loop_expansion | ( | const char * | module_name | ) |
first case: statement inserted by loop_expansion_init were illegal
generate guard if no statement to merge or no statement to clean
remove the test statement
second case: statement inserted by loop_expansion_init were legal
remove the test statement and merge
ok for the ui part, let's do something !
commit changes
< we may have add statements
module_name | odule_name |
Definition at line 261 of file loop_expansion.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, do_loop_expansion(), empty_extensions(), empty_string_p(), ENDP, entity_undefined_p, find_label_entity(), find_loop_from_label(), find_statements_with_pragma(), FOREACH, free_extensions(), gen_free_list(), get_bool_property(), get_current_module_entity(), get_current_module_name(), get_current_module_statement(), get_string_property(), get_string_property_or_ask(), make_continue_instruction(), module_name(), module_name_to_entity(), module_reorder(), pips_user_error, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), STATEMENT, statement_extensions, statement_undefined_p, string_to_expression(), and update_statement_instruction().
bool loop_expansion_init | ( | const char * | module_name | ) |
first step of the loop expansion process: create a statement to insert and flag it with a pragma
ok for the ui part, let's do something !
commit changes
< we may have add statements
module_name | odule_name |
Definition at line 401 of file loop_expansion.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, do_loop_expansion_init(), empty_string_p(), entity_undefined_p, find_label_entity(), find_loop_from_label(), get_current_module_entity(), get_current_module_statement(), get_string_property(), get_string_property_or_ask(), module_name(), module_name_to_entity(), module_reorder(), pips_user_error, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), statement_undefined_p, and string_to_expression().