PIPS
|
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "text.h"
#include "cloning.h"
#include "newgen.h"
#include "naming.h"
#include "ri-util.h"
#include "pipsdbm.h"
Go to the source code of this file.
Functions | |
const char * | entity_module_unambiguous_user_name (entity, entity) |
Warning! Do not modify this file that is automatically generated! More... | |
const char * | entity_unambiguous_user_name (entity) |
const char * | entity_minimal_name (entity) |
Do preserve scope informations. More... | |
const char * | entity_minimal_user_name (entity) |
Do not preserve scope information. More... | |
void | print_arguments (list) |
entity | string_to_entity (const char *, entity) |
very simple conversion from string to expression only handles entities and numeric values at the time being More... | |
list | string_to_entities (const char *, const char *, entity) |
split a string using seed as separator and call string_to_entity on each chunk More... | |
expression | string_to_expression (const char *, entity) |
expressions.c More... | |
list | string_to_expressions (const char *, const char *, entity) |
split a string using seed as separator and call string_to_expression on each chunk More... | |
list | base_to_list (Pbase) |
misc_paf_utils.c More... | |
Pbase | list_to_base (list) |
Pbase list_to_base(list l): returns the Pbase that contains the variables of list "l", of entities, in the same order. More... | |
expression | make_max_exp (entity, expression, expression) |
================================================================ More... | |
entity | make_nlc_entity (int *) |
================================================================ More... | |
entity | make_nsp_entity (void) |
entity make_nsp_entity() Makes a new NSP (for New Structural Parameter) . More... | |
entity | make_nub_entity (void) |
================================================================ More... | |
entity | current_module (entity) |
================================================================ More... | |
bool | undefined_statement_list_p (list) |
================================================================= More... | |
entity | expression_int_scalar (expression) |
================================================================ More... | |
entity | scalar_assign_call (call) |
entity scalar_assign_call((call) c) Detects if the call is an assignement and if the value assigned is a scalar. More... | |
void | scalar_written_in_call (call, list *, list *, list *) |
scalar_written_in_call((call) the_call) Detects and puts a scalar written in an assignement call, in the global list Gscalar_written_forward if Genclosing_loops or Genclosing_tests are not empty. More... | |
list | module_declarations (entity) |
module.c More... | |
list | current_module_declarations (void) |
list | module_entities (entity) |
Return a list of all variables and functions accessible somewhere in a module. More... | |
entity | module_entity_to_compilation_unit_entity (entity) |
Retrieve the compilation unit containing a module definition. More... | |
bool | language_module_p (entity, string) |
void | AddEntityToCompilationUnit (entity, entity) |
Add an entity to the current's module compilation unit declarations we have to generate its statement if none created before due to limitation of pipsmake, it is not always possible to make sure from pipsmake that this ressource is created. More... | |
void | RemoveEntityFromCompilationUnit (entity, entity) |
Remove an entity from the current's module compilation unit declarations. More... | |
void | AddEntityToModuleCompilationUnit (entity, entity) |
list | module_to_all_declarations (entity) |
string | compilation_unit_of_module (const char *) |
The output is undefined if the module is referenced but not defined in the workspace, for instance because its code should be synthesized. More... | |
string | module_name_to_input_file_name (const char *) |
To be checked for static functions... More... | |
Variables | |
int | Gcount_nsp |
================================================================ More... | |
int | Gcount_nub |
Add an entity to the current's module compilation unit declarations we have to generate its statement if none created before due to limitation of pipsmake, it is not always possible to make sure from pipsmake that this ressource is created.
For example in INLINING (!) we would like to tell pipsmake we need the CODE resource from all module callers.
[in] | e | is the entity to add |
[in] | cu | is the compilation unit |
SG: when adding a new entity to compilation unit, one should check the entity is not already present but an entity with the same name may already be defined there so check this with a very costly test
cu | u |
Definition at line 198 of file module.c.
References AddLocalEntityToDeclarations(), c_module_p(), compilation_unit_parser(), controlizer(), db_get_memory_resource(), db_put_or_update_memory_resource(), db_resource_required_or_available_p(), db_touch_resource(), declare_new_typedef(), ENTITY, entity_declarations, entity_undefined_p, entity_user_name(), FOREACH, get_current_module_entity(), get_current_module_statement(), module_local_name(), module_reorder(), reset_current_module_entity(), reset_current_module_statement(), same_string_p, set_current_module_entity(), set_current_module_statement(), set_keyword_typedef_table(), statement_undefined, statement_undefined_p, and typedef_entity_p().
Referenced by AddEntityToModuleCompilationUnit(), outliner_independent_recursively(), and type_to_named_type().
module | odule |
Definition at line 301 of file module.c.
References AddEntityToCompilationUnit(), DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, ENTITY, entity_local_name(), entity_type, FOREACH, gen_free_list(), module, module_entity_to_compilation_unit_entity(), NIL, and type_supporting_entities().
Referenced by dimensions_to_dma(), initialization_list_to_statements(), inline_expression_call(), make_dma_transfert(), outliner_file(), outliner_independent_recursively(), promote_local_entities(), step_parameter(), and wrap_argument().
Most includes are centralized here.
Definition at line 47 of file misc_paf_utils.c.
string compilation_unit_of_module | ( | const char * | module_name | ) |
The output is undefined if the module is referenced but not defined in the workspace, for instance because its code should be synthesized.
Fabien Coelho suggests to build a default compilation unit where all synthesized module codes would be located.
module_name | odule_name |
Definition at line 350 of file module.c.
================================================================
entity current_module(entity mod): returns the current module entity, that is the entity of the module in which we are working currently. If the entity "mod" is undefined, it returns the static entity already known; Else, the static entity is updated to the entity "mod".
mod | od |
Definition at line 250 of file misc_paf_utils.c.
References current_mod, debug(), entity_module_p(), entity_undefined, and pips_assert.
list current_module_declarations | ( | void | ) |
Definition at line 78 of file module.c.
References get_current_module_entity(), and module_declarations().
Referenced by add_declaration_information(), and module_to_value_mappings().
const char* entity_minimal_name | ( | entity | e | ) |
Do preserve scope informations.
This function does not allocate a new string, which implies to keep the scope information in the name of extraprocedural variables and functions.
Definition at line 214 of file naming.c.
References entity_more_or_less_minimal_name().
Referenced by DisplayDad(), effect_words_reference(), flint_check_uninitialized_variables_in_statement(), flint_initialize_statement_def_use_variables(), generic_value_name(), pips_region_user_name(), pips_user_value_name(), print_arguments(), print_value_mappings(), region_translation(), text_transformer(), and variable_local_name().
const char* entity_minimal_user_name | ( | entity | e | ) |
Do not preserve scope information.
A new string is allocated.
Definition at line 223 of file naming.c.
References entity_more_or_less_minimal_name().
Referenced by equal_must_vreference(), is_entity_in_list(), opkill_may_vreference(), opkill_must_vreference(), points_to_compare_cell(), points_to_compare_cells(), points_to_compare_location(), points_to_compare_ptr_cell(), points_to_words_reference(), remove_from_effective_parameters(), and remove_from_formal_parameters().
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/workspace-util/workspace-util-local.h instead, to add your own modifications. header file built by cproto workspace_util-local.h WORKSPACE-UTIL Library: Functions dealing with the internal representation at the workspace level, mixing calls to pipsdbm, naming-util and ri-util. cproto-generated files naming.c
Warning! Do not modify this file that is automatically generated!
Based on entity_user_name, but preserves scoping information when needed to avoid ambiguity between two or more variables with the same name.
A variable or function name can be used for an external or static entity in the compilation unit, it can be used as function parameter, and then declared within the function at any scope level.
This function cannot directly be used in an interprocedural setting as it is only related to one module.
It is assumed that no new string is allocated, but a pointer to an existing string is returned.
The current implementation is extremely ineffective, especially for a very unlikely, although mystifying, problem.
FI: this function does not seem to be used in Libs or Passes. Its implementation is based on module_entities(), which is not in ri-util...
No problem in Fortran
Definition at line 68 of file naming.c.
References c_module_p(), ENTITY, entity_local_name(), entity_user_name(), FOREACH, gen_free_list(), module_entities(), and same_string_p.
Referenced by entity_unambiguous_user_name().
const char* entity_unambiguous_user_name | ( | entity | e | ) |
Definition at line 91 of file naming.c.
References entity_module_unambiguous_user_name(), and get_current_module_entity().
Referenced by entity_more_or_less_minimal_name().
entity expression_int_scalar | ( | expression | exp | ) |
================================================================
entity expression_int_scalar((expression) exp) Returns the scalar entity if this expression is a scalar.
exp | xp |
Definition at line 299 of file misc_paf_utils.c.
References debug(), entity_integer_scalar_p(), entity_local_name(), entity_undefined, exp, expression_syntax, is_syntax_reference, reference_variable, syntax_reference, and syntax_tag.
Referenced by get_sp_of_call_p(), scalar_assign_call(), and terapix_optimize_accumulator().
FI: does not work with static functions
SG: must check if the ressource exist (not always the case)
SG: be positive ! (needed for Hpfc)
lid | id |
Definition at line 166 of file module.c.
References db_get_memory_resource(), db_resource_p(), entity_module_p(), lname(), and module_local_name().
Pbase list_to_base(list l): returns the Pbase that contains the variables of list "l", of entities, in the same order.
Definition at line 60 of file misc_paf_utils.c.
References base_reversal(), CAR, CDR, ENTITY, NIL, VALUE_ONE, and vect_add_elem().
Referenced by adg_dataflowgraph(), analyze_quast(), base_complete(), broadcast_conditions(), broadcast_of_dataflow(), clean_list_of_unk(), completer_base(), completer_n_base(), do_array_expansion(), do_solve_hardware_constraints_on_nb_proc(), extract_lattice(), include_time_in_base(), make_dual(), make_list_of_unk(), make_primal(), mapping_on_broadcast(), partial_broadcast_coefficients(), prepare_reindexing(), rectangularization_region(), search_scc_bdt(), stmt_bdt_directions(), system_inversion_restrict(), and valuer().
expression make_max_exp | ( | entity | ent, |
expression | exp1, | ||
expression | exp2 | ||
) |
================================================================
expression make_max_exp(entity ent, expression exp1, expression exp2) computes MAX( exp1, exp2 ) if exp1 and exp2 are constant expressions. If it is not the case, it returns MAX( exp1, exp2 )
pips_debug(7, "doing MAX( %s, %s ) \n",
expression_to_string(exp1),
expression_to_string(exp2) );
ent | nt |
exp1 | xp1 |
exp2 | xp2 |
Definition at line 78 of file misc_paf_utils.c.
References expression_constant_p(), expression_to_int(), int_to_expression(), and MakeBinaryCall().
Referenced by loop_normalize_of_loop().
================================================================
entity make_nlc_entity(int *Gcount_nlc):
Returns a new entity. Its local name is "NLC#", where '#' represents the value of "Gcount_nlc". This variable counts the number of NLCs variables.
These entities have a special full name. The first part of it is the concatenation of the define constant STATIC_CONTROLIZE_MODULE_NAME and the local name of the current module.
The type ("basic") of these variables is INTEGER.
These variables are local to the current module, so they have a "storage_ram" with DYNAMIC "area".
NLC means Normalized Loop Counter.
Gcount_nlc | count_nlc |
Definition at line 117 of file misc_paf_utils.c.
References asprintf, concatenate(), current_offset_of_area(), debug(), dynamic_area, DYNAMIC_AREA_LOCAL_NAME, entity_local_name(), entity_storage, FindOrCreateEntity(), Gcount_nlc, get_current_module_entity(), is_basic_int, is_storage_ram, is_type_variable, is_value_unknown, make_basic(), make_entity, make_ram(), make_storage(), make_type(), make_value(), make_variable(), mod_ent, module_local_name(), MODULE_SEP_STRING, NIL, NLC_PREFIX, num, ram_undefined, STATIC_CONTROLIZE_MODULE_NAME, storage_ram, strdup(), UU, and UUINT.
Referenced by loop_normalize_of_loop().
entity make_nsp_entity | ( | void | ) |
entity make_nsp_entity() Makes a new NSP (for New Structural Parameter) .
Definition at line 165 of file misc_paf_utils.c.
References asprintf, concatenate(), current_offset_of_area(), debug(), dynamic_area, DYNAMIC_AREA_LOCAL_NAME, entity_local_name(), entity_storage, FindOrCreateEntity(), Gcount_nsp, get_current_module_entity(), is_basic_int, is_storage_ram, is_type_variable, is_value_unknown, make_basic(), make_entity, make_ram(), make_storage(), make_type(), make_value(), make_variable(), mod_ent, module_local_name(), MODULE_SEP_STRING, NIL, NSP_PREFIX, num, ram_undefined, STATIC_CONTROLIZE_MODULE_NAME, storage_ram, strdup(), UU, and UUINT.
Referenced by get_sp_of_call_p().
entity make_nub_entity | ( | void | ) |
================================================================
entity make_nub_entity() Makes a new NUB (for New Upper Bound) .
Definition at line 206 of file misc_paf_utils.c.
References asprintf, concatenate(), current_offset_of_area(), debug(), dynamic_area, DYNAMIC_AREA_LOCAL_NAME, entity_local_name(), entity_storage, FindOrCreateEntity(), Gcount_nub, get_current_module_entity(), is_basic_int, is_storage_ram, is_type_variable, is_value_unknown, make_basic(), make_entity, make_ram(), make_storage(), make_type(), make_value(), make_variable(), mod_ent, module_local_name(), MODULE_SEP_STRING, NIL, NUB_PREFIX, num, ram_undefined, STATIC_CONTROLIZE_MODULE_NAME, storage_ram, strdup(), UU, and UUINT.
module.c
module.c
Retrieve all declarations linked to a module, but the local variables private to loops. Allocate and build a new list which will have to be freed by the caller.
This function has been implemented twice.
It may be useless because code_declarations() is supposed to contain all module declarations, regardless of where the declarations happens.
FI: maybe we should also look up the declarations in the compilation unit...
Definition at line 58 of file module.c.
References code_declarations, entity_initial, fprintf(), gen_copy_seq(), get_current_module_declarations(), ifdebug, list_undefined_p, pips_debug, print_entities(), set_current_module_declarations(), and value_code.
Referenced by add_parameter_variable_to_module(), add_private_variable_to_module(), create_parameter_for_new_module(), current_module_declarations(), and module_entities().
Return a list of all variables and functions accessible somewhere in a module.
Make sure you only have entities in list cudl
Definition at line 85 of file module.c.
References code_declarations, entity_initial, entity_list_p(), gen_copy_seq(), gen_nconc(), module_declarations(), module_entity_to_compilation_unit_entity(), pips_assert, and value_code.
Referenced by entity_module_unambiguous_user_name().
Retrieve the compilation unit containing a module definition.
The implementation is clumsy.
It would be nice to memoize the information as with get_current_module_entity().
It would be much nicer to keep a resource like INPUT_FILE_NAME, say COMPILATION_UNIT_NAME.
The entity returned may be undefined.
The resource does not always exist.
For Fortran code to start with.
For synthesized code too: initializer, outliner... (although pass outline might build a compilation unit...
Let's assume that synthesized module "foo" has "foo!" a compilation unit name and it never is a static function.
Definition at line 116 of file module.c.
References compilation_unit_entity_p(), concatenate(), db_get_memory_resource(), db_resource_p(), end, entity_domain, entity_name, entity_undefined, entity_undefined_p, FILE_SEP_CHAR, FILE_SEP_STRING, free(), gen_find_tabulated(), local_name_to_top_level_entity(), module_local_name(), pips_assert, pips_internal_error, static_module_name_p(), strdup(), and strndup().
Referenced by AddEntityToModuleCompilationUnit(), ensure_comment_consistency(), module_entities(), outliner_parameters(), promote_local_entities(), and update_unstructured_declarations().
string module_name_to_input_file_name | ( | const char * | module_name | ) |
To be checked for static functions...
module_name | odule_name |
Definition at line 376 of file module.c.
References asprintf, c_module_p(), db_get_current_workspace_directory(), db_get_memory_resource(), db_resource_p(), entity_undefined_p, free(), module_name(), module_name_to_entity(), pips_assert, pips_basename(), string_undefined, and WORKSPACE_SRC_SPACE.
Definition at line 323 of file module.c.
References c_module_p(), code_declarations, CONS, db_get_memory_resource(), ENTITY, entity_initial, entity_is_argument_p(), entity_local_name(), FOREACH, gen_copy_seq(), gen_free_list(), gen_nconc(), module_name(), NIL, statement_to_declarations(), and value_code.
Referenced by all_data_to_precondition(), and generic_module_initial_pointer_values().
void print_arguments | ( | list | args | ) |
args | rgs |
Definition at line 228 of file naming.c.
References entity_minimal_name(), and print_homogeneous_arguments().
Referenced by ComputeAddresses(), fuse_sequences_in_unstructured(), MakeEntryCommon(), recompute_loop_transformer(), TestDependence(), and update_common_layout().
Remove an entity from the current's module compilation unit declarations.
[in] | e | is the entity to remove |
[in] | cu | is the compilation unit |
cu | u |
Definition at line 265 of file module.c.
References c_module_p(), controlizer(), db_get_memory_resource(), db_put_or_update_memory_resource(), db_resource_required_or_available_p(), db_touch_resource(), entity_declarations, entity_undefined_p, gen_remove(), get_current_module_entity(), get_current_module_statement(), module_local_name(), module_reorder(), remove_declaration_statement(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), statement_declarations, statement_undefined, and statement_undefined_p.
entity scalar_assign_call((call) c) Detects if the call is an assignement and if the value assigned is a scalar.
If it is so, it returns this scalar.
Definition at line 328 of file misc_paf_utils.c.
References binary_call_lhs, call_function, debug(), ENTITY_ASSIGN_P, entity_name, entity_undefined, and expression_int_scalar().
Referenced by scalar_written_in_call(), and sp_feautrier_scalar_assign_call().
scalar_written_in_call((call) the_call) Detects and puts a scalar written in an assignement call, in the global list Gscalar_written_forward if Genclosing_loops or Genclosing_tests are not empty.
the_call | he_call |
ell | ll |
etl | tl |
swfl | wfl |
Definition at line 352 of file misc_paf_utils.c.
References ADD_ELEMENT_TO_LIST, debug(), ENTITY, entity_integer_scalar_p(), entity_undefined, NIL, and scalar_assign_call().
Referenced by loop_normalize_of_statement().
split a string using seed
as separator and call string_to_entity on each chunk
str | tr |
seed | eed |
module | odule |
Definition at line 276 of file naming.c.
References CONS, ENTITY, entity_undefined_p, FOREACH, free(), gen_free_list(), gen_map(), gen_nreverse(), module, NIL, STRING, string_to_entity(), and strsplit().
very simple conversion from string to expression only handles entities and numeric values at the time being
try float conversion
no negative integer entity in pips
first find all relevant entities
this an heuristic to find the one with a suiting scope error prone
try at the compilation unit level
try at top level
module | odule |
Definition at line 237 of file naming.c.
References compilation_unit_of_module(), empty_string_p(), ENTITY, entity_declarations, entity_name, entity_undefined, entity_undefined_p, entity_user_name(), f(), FindEntity(), float_to_entity(), FOREACH, int_to_entity(), module, module_local_name(), module_name(), same_string_p, and TOP_LEVEL_MODULE_NAME.
Referenced by do_solve_hardware_constraints(), string_to_entities(), and string_to_expression().
expression string_to_expression | ( | const char * | s, |
entity | module | ||
) |
try to parse s
in the context of module module
only simple expressions are found
try to find simple expression
unary operators
inary operators
module | odule |
Definition at line 50 of file expressions.c.
References DIVIDE_OPERATOR_NAME, entity_intrinsic(), entity_to_expression(), entity_undefined_p, expression_undefined, expression_undefined_p, free(), free_expression(), int, MakeBinaryCall(), MakeUnaryCall(), MINUS_OPERATOR_NAME, module, MULTIPLY_OPERATOR_NAME, PLUS_OPERATOR_NAME, strdup(), string_to_entity(), and UNARY_MINUS_OPERATOR_NAME.
Referenced by loop_expansion(), loop_expansion_init(), maxima_simplify(), and string_to_expressions().
split a string using seed
as separator and call string_to_expression on each chunk
str | tr |
seed | eed |
module | odule |
Definition at line 98 of file expressions.c.
References CONS, EXPRESSION, expression_undefined_p, FOREACH, free(), gen_free_list(), gen_map(), gen_nreverse(), module, NIL, STRING, string_to_expression(), and strsplit().
Referenced by symbolic_tiling().
=================================================================
bool undefined_statement_list_p( (list) l ) AL 04/93 Returns true if l is made of 2 undefined or continue statement.
Newgen does not support list of undefined objects
Definition at line 272 of file misc_paf_utils.c.
References CAR, CDR, continue_statement_p(), debug(), gen_length(), NIL, STATEMENT, and statement_undefined.
Referenced by loop_normalize_of_unstructured().
|
extern |
================================================================
Definition at line 158 of file misc_paf_utils.c.
Referenced by make_nsp_entity().
|
extern |
Definition at line 160 of file misc_paf_utils.c.
Referenced by make_nub_entity().