PIPS
|
#include "safescale.h"
#include "workspace-util.h"
#include "text-util.h"
#include "syntheses.h"
#include "preprocessor.h"
Go to the source code of this file.
Functions | |
static void | check_if_statement_contains_comment (statement s, void *a_context) |
lint More... | |
static list | get_statements_with_comments_containing (string comment_portion, statement stat) |
Building a list with statements containing comments. More... | |
static string | get_externalized_and_analyzed_function_name (statement stat, int *stats_nb) |
Return the identified function name of the externalized portion of code by searching comment matching tags EXTERNALIZED_CODE_PRAGMA_ANALYZED_TOP Set the number of statements of this externalizable statement. More... | |
static void | search_sequence_containing (statement s, void *a_context) |
Get sequence containing a searched context. More... | |
static statement | sequence_statement_containing (statement root_statement, statement searched_stat) |
Get statement containing a searched statement. More... | |
static list | compute_regions_union (list l_in, list l_out) |
Compute union of exact regions. More... | |
static bool | internal_compute_distribution_context (statement externalized_code, hash_table *ht_params, hash_table *ht_private, hash_table *ht_in_regions, hash_table *ht_out_regions, void *key_value) |
Compute internal distribution context for statement externalized_code. More... | |
static bool | compute_distribution_context (list l_stats, statement module_stat, entity module, hash_table *ht_stats, hash_table *ht_params, hash_table *ht_private, hash_table *ht_in_regions, hash_table *ht_out_regions) |
Compute distribution context for statement externalized_code. More... | |
static entity | create_parameter_variable_for_new_module (entity a_variable, string new_name, string new_module_name, entity module, int param_nb) |
Create a variable declared as a parameter in specified module. More... | |
static entity | create_private_variable_for_new_module (entity a_variable, string new_name, string new_module_name, entity module) |
Create a private variable in specified module. More... | |
static string | get_externalized_function_param_name (entity variable, int param_nb) |
Return EXTERNALIZED_FUNCTION_PARAM_NAME. More... | |
static string | get_externalized_function_private_param_name (entity variable) |
Return EXTERNALIZED_FUNCTION_PRIVATE_PARAM_NAME. More... | |
static void | add_parameter_variable_to_module (reference ref, entity module, statement stat, string new_module_name, int param_nb) |
Declare in the newly created module a new variable and replace all occurences to the old variable by the new created. More... | |
static void | add_private_variable_to_module (reference ref, entity module, statement stat, string new_module_name) |
Declare in the newly created module a new variable and replace all occurences to the old variable by the new created. More... | |
static list | references_for_regions (list l_regions) |
Return a list of references corresponding to a list of regions. More... | |
static entity | create_module_with_statement (statement stat, string new_module_name, list l_params, list l_priv) |
Dynamically build a new module with specified statement. More... | |
static void | replace_in_sequence_statement_with (statement old_stat, statement new_stat, statement root_stat) |
Replace statement old_stat by statement new_stat and assert that this statement is contained in a sequence. More... | |
static void | distribute_code (string function_name, statement externalized_code, statement module_stat, list l_params, list l_priv) |
Externalize a specified code portion. More... | |
static void | distribute (statement module_stat, entity module) |
Distribute for main module module with root statement stat. More... | |
bool | safescale_distributor (const char *module_name) |
externalization.c More... | |
Variables | |
static entity | dynamic_area = entity_undefined |
Main phase for block code externalization. More... | |
|
static |
Declare in the newly created module a new variable and replace all occurences to the old variable by the new created.
Assert that entity represent a value code
Get the variable name
Definition at line 511 of file externalization.c.
References code_declarations, CONS, create_parameter_variable_for_new_module(), ENTITY, entity_initial, entity_local_name(), entity_module_p(), entity_type, get_externalized_function_param_name(), is_mode_reference, make_dummy_unknown(), make_mode(), make_parameter(), module, module_declarations(), module_functional_parameters, new_variable, PARAMETER, pips_assert, pips_debug, ref, reference_variable, replace_reference(), UU, value_code, and variable_name().
Referenced by create_module_with_statement().
|
static |
Declare in the newly created module a new variable and replace all occurences to the old variable by the new created.
Assert that entity represent a value code
Get the variable name
Creates the variable
Definition at line 541 of file externalization.c.
References code_declarations, CONS, create_private_variable_for_new_module(), ENTITY, entity_initial, entity_local_name(), entity_module_p(), get_externalized_function_private_param_name(), module, module_declarations(), new_variable, pips_assert, pips_debug, ref, reference_variable, replace_reference(), value_code, and variable_name().
Referenced by create_module_with_statement().
|
static |
lint
Adding in the statement containing comments in the list of statements
Definition at line 43 of file externalization.c.
References CONS, free(), STATEMENT, statement_comments, statement_with_empty_comment_p(), and strdup().
Referenced by get_statements_with_comments_containing().
|
static |
Compute distribution context for statement externalized_code.
Init hashtables
Register new externalized function
Definition at line 366 of file externalization.c.
References entity_local_name(), get_externalized_and_analyzed_function_name(), hash_defined_p(), hash_pointer, hash_put(), hash_table_make(), internal_compute_distribution_context(), MAP, module, pips_debug, pips_internal_error, pips_user_warning, sequence_statement_containing(), and STATEMENT.
Referenced by distribute().
Compute union of exact regions.
Definition at line 192 of file externalization.c.
References CONS, entity_local_name(), gen_copy_seq(), gen_length(), gen_nth(), gen_remove(), MAP, pips_debug, pips_internal_error, print_region, print_regions(), region, REGION, region_entity, region_must_union(), region_scalar_p, and same_entity_p().
Referenced by internal_compute_distribution_context().
|
static |
Dynamically build a new module with specified statement.
Deal with private variables
Deal with parameter variables
Definition at line 587 of file externalization.c.
References add_new_module(), add_parameter_variable_to_module(), add_private_variable_to_module(), copy_language(), gen_length(), get_current_module_entity(), ifdebug, make_empty_subroutine(), MAP, module_language, pips_debug, prettyprint_language_is_fortran_p(), print_statement(), ref, REFERENCE, and references_for_regions().
Referenced by distribute_code().
|
static |
Create a variable declared as a parameter in specified module.
Test if entity exists and create it if not
Definition at line 430 of file externalization.c.
References a_variable, concatenate(), copy_type(), copy_value(), entity_domain, entity_initial, entity_type, entity_undefined, gen_find_tabulated(), make_entity, make_formal(), make_storage_formal(), module, MODULE_SEP_STRING, new_variable, pips_internal_error, and strdup().
Referenced by add_parameter_variable_to_module().
|
static |
Create a private variable in specified module.
Test if entity exists and create it if not
Definition at line 453 of file externalization.c.
References a_variable, add_variable_to_area(), base, basic_tag, concatenate(), copy_type(), copy_value(), DYNAMIC_AREA_LOCAL_NAME, entity_domain, entity_global_name(), entity_initial, entity_storage, entity_type, entity_undefined, FindEntity(), gen_find_tabulated(), is_basic_overloaded, is_storage_ram, make_entity, make_ram(), make_storage(), module, MODULE_SEP_STRING, new_variable, NIL, pips_debug, pips_internal_error, storage_undefined, strdup(), type_variable, and variable_basic.
Referenced by add_private_variable_to_module().
|
static |
Distribute for main module module with root statement stat.
Definition at line 741 of file externalization.c.
References compute_distribution_context(), distribute_code(), EXTERNALIZED_CODE_PRAGMA_ANALYZED_TOP, gen_length(), get_statements_with_comments_containing(), hash_get(), HASH_MAP, hash_table_free(), module, and pips_debug.
Referenced by safescale_distributor().
|
static |
Externalize a specified code portion.
Insert an analyzed tag
Definition at line 677 of file externalization.c.
References concatenate(), CONS, create_module_with_statement(), entity_empty_label(), EXPRESSION, EXTERNALIZED_CODE_PRAGMA_CALL, free(), gen_consistent_p(), is_instruction_call, make_call(), make_entity_expression(), make_instruction(), make_statement(), make_synchronization_none(), malloc(), MAP, NIL, pips_assert, pips_debug, print_statement(), ref, REFERENCE, reference_variable, references_for_regions(), replace_in_sequence_statement_with(), statement_consistent_p(), statement_extensions, statement_number, statement_ordering, and strdup().
Referenced by distribute().
Return the identified function name of the externalized portion of code by searching comment matching tags EXTERNALIZED_CODE_PRAGMA_ANALYZED_TOP Set the number of statements of this externalizable statement.
Definition at line 100 of file externalization.c.
References EXTERNALIZED_CODE_PRAGMA_ANALYZED_TOP, free(), gen_nth(), instruction_sequence, instruction_tag, is_instruction_sequence, malloc(), pips_debug, print_statement(), sequence_statements, STATEMENT, statement_comments, statement_instruction, statement_with_empty_comment_p(), and strdup().
Referenced by compute_distribution_context().
Return EXTERNALIZED_FUNCTION_PARAM_NAME.
Definition at line 484 of file externalization.c.
References buffer, entity_user_name(), EXTERNALIZED_FUNCTION_PARAM_NAME, and strdup().
Referenced by add_parameter_variable_to_module().
Return EXTERNALIZED_FUNCTION_PRIVATE_PARAM_NAME.
Definition at line 497 of file externalization.c.
References buffer, entity_user_name(), EXTERNALIZED_FUNCTION_PRIVATE_PARAM_NAME, and strdup().
Referenced by add_private_variable_to_module().
|
static |
Building a list with statements containing comments.
Set searched string
Reset and get list of statements
Definition at line 65 of file externalization.c.
References check_if_statement_contains_comment(), free(), gen_context_recurse, gen_true2(), ifdebug, NIL, pips_debug, pips_user_error, print_statement(), statement_domain, and strdup().
Referenced by distribute().
|
static |
Compute internal distribution context for statement externalized_code.
Store results in hash_tables
Definition at line 262 of file externalization.c.
References compare_effect_reference(), compute_regions_union(), gen_sort_list(), hash_defined_p(), hash_put(), ifdebug, load_statement_in_regions(), load_statement_local_regions(), load_statement_out_regions(), NIL, pips_debug, pips_user_warning, print_regions(), regions_dup(), regions_read_regions(), regions_write_regions(), RegionsEntitiesInfDifference(), w_r_combinable_p(), and w_w_combinable_p().
Referenced by compute_distribution_context().
Return a list of references corresponding to a list of regions.
Definition at line 568 of file externalization.c.
References CONS, EFFECT, effect_any_reference, entity_local_name(), MAP, NIL, pips_debug, print_reference(), ref, REFERENCE, and reference_variable.
Referenced by create_module_with_statement(), and distribute_code().
|
static |
Replace statement old_stat by statement new_stat and assert that this statement is contained in a sequence.
Definition at line 632 of file externalization.c.
References CONS, gen_nreverse(), ifdebug, instruction_sequence, MAP, NIL, pips_assert, pips_debug, print_statement(), sequence_statement_containing(), sequence_statements, STATEMENT, and statement_instruction.
Referenced by distribute_code().
bool safescale_distributor | ( | const char * | module_name | ) |
Set and get the current properties concerning regions
Get the resources
Set dynamic_area
Get the READ, WRITE, IN and OUT regions of the module
Do the job
Restructuring code to avoid imbricated sequences if some portions are found to allow more than one INIT
Reorder the module because new statements have been added
Update/release resources
module_name | odule_name |
Definition at line 774 of file externalization.c.
References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, distribute(), dynamic_area, DYNAMIC_AREA_LOCAL_NAME, entity_undefined, entity_undefined_p, FindOrCreateEntity(), free_value_mappings(), gen_consistent_p(), get_regions_properties(), module, module_local_name(), module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), pips_assert, pips_debug, print_statement(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_out_effects(), reset_proper_rw_effects(), reset_rw_effects(), set_bool_property(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_out_effects(), set_proper_rw_effects(), set_rw_effects(), simple_restructure_statement(), and statement_consistent_p().
|
static |
Get sequence containing a searched context.
Definition at line 156 of file externalization.c.
References instruction_sequence, instruction_tag, is_instruction_sequence, MAP, sequence_statements, STATEMENT, and statement_instruction.
Referenced by sequence_statement_containing().
|
static |
Get statement containing a searched statement.
Definition at line 176 of file externalization.c.
References gen_context_recurse, gen_true2(), search_sequence_containing(), and statement_domain.
Referenced by compute_distribution_context(), and replace_in_sequence_statement_with().
|
static |
Main phase for block code externalization.
Definition at line 772 of file externalization.c.
Referenced by safescale_distributor().