PIPS
|
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "text.h"
#include "constants.h"
#include "text-util.h"
#include "misc.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "workspace-util.h"
Go to the source code of this file.
Functions | |
list | module_declarations (entity m) |
High-level functions about modules, using pipsdbm and ri-util and some global variables assumed properly set. More... | |
list | current_module_declarations () |
list | module_entities (entity m) |
Return a list of all variables and functions accessible somewhere in a module. More... | |
entity | module_entity_to_compilation_unit_entity (entity m) |
Retrieve the compilation unit containing a module definition. More... | |
bool | language_module_p (entity m, string lid) |
void | AddEntityToCompilationUnit (entity e, entity cu) |
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 e, entity cu) |
Remove an entity from the current's module compilation unit declarations. More... | |
void | AddEntityToModuleCompilationUnit (entity e, entity module) |
list | module_to_all_declarations (entity m) |
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. More... | |
string | module_name_to_input_file_name (const char *module_name) |
To be checked for static functions... More... | |
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().
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.
References asprintf, c_module_p(), compilation_unit_name, db_get_memory_resource(), db_resource_p(), entity_undefined_p, FILE_SEP_STRING, free(), module_name(), module_name_to_entity(), pips_assert, pips_basename(), and string_undefined.
Referenced by actual_c_parser(), add_new_module_from_text(), build_real_resources(), cast_STEP_ARG(), create_module_with_statement(), entity_from_user_name(), entity_more_or_less_minimal_name(), freia_data2d_field(), generic_initializer(), inline_expression_call(), linearize_array_generic(), normalize_microcode(), outliner_file(), outliner_scan(), simd_memory_packing(), sort_parameters(), step_compile_generated_module(), step_parameter(), string_to_entity(), and update_referenced_entities().
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().
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().
High-level functions about modules, using pipsdbm and ri-util and some global variables assumed properly set.
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().
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.