PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "linear.h"
#include "genC.h"
#include "misc.h"
#include "properties.h"
#include "ri-util.h"
Go to the source code of this file.
Macros | |
#define | DEFAULT_INT_PREFIX "I_" |
Default prefixes. More... | |
#define | DEFAULT_FLOAT_PREFIX "F_" |
#define | DEFAULT_LOGICAL_PREFIX "L_" |
#define | DEFAULT_COMPLEX_PREFIX "C_" |
#define | DEFAULT_STRING_PREFIX "S_" |
#define | DEFAULT_POINTER_PREFIX "P_" |
#define | DEFAULT_STRUCT_PREFIX "ST_" |
#define | DEFAULT_UNION_PREFIX "U_" |
#define | DEFAULT_ENUM_PREFIX "E_" |
#define | DEFAULT_DERIVED_STRUCT_PREFIX "DS_" |
#define | DEFAULT_DERIVED_UNION_PREFIX "DU_" |
#define | DEFAULT_DERIVED_ENUM_PREFIX "DE_" |
#define | PLACE_HOLDER_PREFIX_STRING "PLACE__HOLDER_" |
Generate special variables to represent declarations such as "struct s;". More... | |
Functions | |
static bool | unique_entity_name_p (const char *name, entity in_module) |
Handling of entity as program variables (see also entity.c for generic entities) More... | |
bool | variable_entity_p (entity e) |
See also macro entity_variable_p()... More... | |
bool | symbolic_constant_entity_p (entity e) |
BEGIN_EOLE. More... | |
void | AddEntityToDeclarations (entity e, entity module) |
END_EOLE. More... | |
void | RemoveLocalEntityFromDeclarations (entity e, entity module, statement s) |
static void | GenericAddLocalEntityToDeclarations (entity e, entity module, statement s, bool add_declaration_statement_p) |
See the two user interfaces below. More... | |
void | AddLocalEntityToDeclarations (entity e, entity module, statement s) |
Add the variable entity e to the list of variables of the function module. More... | |
void | AddLocalEntityToDeclarationsOnly (entity e, entity module, statement s) |
Add the variable entity e to the list of variables of the function module. More... | |
void | AddEntityToCurrentModule (entity e) |
Add a variable entity to the current module declarations. More... | |
void | AddEntityToCurrentModuleWithoutDeclaration (entity e) |
Add a variable entity to the current module declarations. More... | |
entity | make_global_entity_from_local (entity local) |
entity | make_stderr_variable () |
If the parser has not (yet) encountered "stderr", a PIPS transformation or instrumentation phase may need "stderr" to generate AST code. More... | |
entity | make_scalar_entity (const char *name, const char *module_name, basic base) |
entity make_scalar_entity(name, module_name, base) More... | |
entity | make_derived_entity (const char *name, const char *module_name, type t) |
void | reset_unique_variable_numbers () |
entity | generate_variable_with_unique_name_to_module (const char *seed_name, const char *prefix, const char *suffix, entity module) |
Generate a new variable name from a seed name to a module. More... | |
entity | generic_clone_variable_with_unique_name (entity old_variable, statement declaration_statement, string prefix, string suffix, entity module, bool insert_p) |
clone a variable with a new name. More... | |
entity | clone_variable_with_unique_name (entity old_variable, statement declaration_statement, string prefix, string suffix, entity module) |
Clone a variable with a new user name. More... | |
entity | make_new_scalar_variable_with_prefix (const char *prefix, entity module, basic b) |
Create a new scalar variable of type b in the given module. More... | |
entity | make_new_derived_entity_with_prefix (const char *prefix, entity module, type t) |
derived from make_new_scalar_variable_with_prefix More... | |
entity | make_new_scalar_variable (entity module, basic b) |
static entity | make_array_entity (const char *name, const char *module_name, basic base, list dimensions) |
Create an array entity. More... | |
entity | make_new_array_variable_with_prefix (const char *prefix, entity module, basic b, list dimensions) |
J'ai ameliore la fonction make_new_scalar_variable_with_prefix More... | |
entity | make_new_array_variable (entity module, basic b, list dimensions) |
entity | make_temporary_pointer_to_array_entity_with_prefix (char *prefix, entity efrom, entity module, expression from) |
entity | make_temporary_pointer_to_array_entity (entity efrom, expression from, entity module) |
entity | make_new_module_variable (entity module, int d) |
Make a new module integer variable of name X<d>. More... | |
entity | make_new_entity (basic ba, int kind) |
entity | find_or_create_scalar_entity (const char *name, const char *module_name, tag base) |
Looks for an entity which should be a scalar of the specified basic. More... | |
entity | find_or_create_typed_entity (string name, const char *module_name, tag base) |
Looks for an entity of the specified basic. More... | |
entity | make_scalar_integer_entity (const char *name, const char *module_name) |
Create an integer variable of name "name" in module of name "module_name". More... | |
bool | entity_scalar_p (entity e) |
The concrete type of e is a scalar type. More... | |
bool | entity_integer_scalar_p (entity e) |
for variables (like I), not constants (like 1)! use integer_constant_p() for constants More... | |
bool | integer_scalar_entity_p (entity e) |
integer_scalar_entity_p() is obsolete; use entity_integer_scalar_p() More... | |
bool | entity_static_variable_p (entity e) |
return true if the entity is declared with the keyword static More... | |
bool | entity_atomic_reference_p (entity e) |
Any reference r such that reference_variable(r)==e accesses all bytes (or bits) allocated to variable e. More... | |
bool | entity_non_pointer_scalar_p (entity e) |
dimension | entity_ith_dimension (entity e, int i) |
Another semantics would be: is this reference r to e a kill for e? In general, this cannot be answered at the entity level only (see previous function) and the reference itself must be passed as an argument. More... | |
bool | entity_unbounded_p (entity e) |
bool entity_unbounded_p(entity e) input : an array entity output : true if the last dimension of the array is unbounded (*), false otherwise. More... | |
bool | array_with_numerical_bounds_p (entity a) |
bool array_with_numerical_bounds_p(entity a) input : an array entity output : true if all bounds of all dimensions are numerical false otherwise (adjustable arrays, formal parameters). More... | |
int | variable_entity_dimension (entity v) |
variable_entity_dimension(entity v): returns the dimension of variable v; scalar have dimension 0. More... | |
void | remove_variable_entity (entity v) |
entity | make_integer_constant_entity (_int c) |
entity make_integer_constant_entity(int c) make entity for integer constant c More... | |
int | add_variable_to_area (entity a, entity v) |
int | add_C_variable_to_area (entity a, entity v) |
int | add_any_variable_to_area (entity a, entity v, bool is_fortran_p) |
int | new_add_any_variable_to_area (entity a, entity v, bool is_fortran_p) |
bool | formal_parameter_p (entity v) |
bool | static_global_variable_p (entity v) |
Is v a global variable declared local to a C file such "static int i;". More... | |
bool | global_variable_p (entity v) |
Is v a global variable such as "int i;". More... | |
bool | variable_return_p (entity v) |
True if a variable is the pseudo-variable used to store value returned by a function: More... | |
bool | formal_context_variable_p (entity v) |
Such pseudo-variables are generated by the points-to analysis. More... | |
bool | variable_is_a_module_formal_parameter_p (entity a_variable, entity a_module) |
bool | variable_in_common_p (entity v) |
true if v is in a common. More... | |
bool | variable_static_p (entity v) |
true if v appears in a SAVE statement, or in a DATA statement, or is declared static i C. More... | |
bool | variable_dynamic_p (entity v) |
bool | variable_stack_p (entity v) |
bool | variable_heap_p (entity v) |
bool | variable_in_module_p (entity v, entity m) |
This test can only be applied to variables, not to functions, subroutines or commons visible from a module. More... | |
bool | variable_in_list_p (entity e, list l) |
bool | entity_volatile_variable_p (entity v) |
bool | volatile_variable_p (variable v) |
bool | qualified_variable_p (entity v, unsigned int is_qualified) |
The variable may turn out to be a function. More... | |
bool | const_variable_p (entity v) |
void | discard_module_declaration_text (entity a_module) |
Discard the decls_text string of the module code to make the prettyprinter ignoring the textual declaration and remake all from the declarations without touching the corresponding property (PRETTYPRINT_ALL_DECLARATIONS). More... | |
entity | get_ith_dummy (string prefix, string suffix, int i) |
Returns a numbered entity the name of which is suffix + number, the module of which is prefix. More... | |
expression | generate_string_for_alternate_return_argument (string i) |
entity | generate_pseudo_formal_variable_for_formal_label (const char *p, int l) |
bool | formal_label_replacement_p (entity fp) |
bool | actual_label_replacement_p (expression eap) |
Assumes that eap is a call. More... | |
bool | call_contains_alternate_returns_p (call c) |
entity | make_new_index_entity (entity old_index, string suffix) |
bool | implicit_c_variable_p (entity v) |
expression | variable_initial_expression (entity v) |
Returns a copy of the initial (i.e. More... | |
bool | self_initialization_p (entity v) |
Check if a variable is initialized by itself as "int a = a;" is legal C code according to gcc. More... | |
bool | same_scalar_location_p (entity e1, entity e2) |
FI: transferred from semantics (should be used for effect translation as well) More... | |
list | struct_variable_to_fields (entity v) |
Assume that v is declared as a struct. More... | |
entity | make_place_holder_variable (entity de) |
bool | place_holder_variable_p (entity ph) |
Variables | |
static int | unique_integer_number = 0 |
static int | unique_float_number = 0 |
static int | unique_logical_number = 0 |
static int | unique_complex_number = 0 |
static int | unique_string_number = 0 |
static int | count_tmp = 0 |
These globals variables count the number of temporary and auxiliary entities. More... | |
static int | count_aux = 0 |
list | integer_entities = list_undefined |
Make a new variable entity which name is one letter prefix + one incrementing number. More... | |
list | real_entities = list_undefined |
list | logical_entities = list_undefined |
list | complex_entities = list_undefined |
list | double_entities = list_undefined |
list | char_entities = list_undefined |
#define DEFAULT_COMPLEX_PREFIX "C_" |
Definition at line 433 of file variable.c.
#define DEFAULT_DERIVED_ENUM_PREFIX "DE_" |
Definition at line 441 of file variable.c.
#define DEFAULT_DERIVED_STRUCT_PREFIX "DS_" |
Definition at line 439 of file variable.c.
#define DEFAULT_DERIVED_UNION_PREFIX "DU_" |
Definition at line 440 of file variable.c.
#define DEFAULT_ENUM_PREFIX "E_" |
Definition at line 438 of file variable.c.
#define DEFAULT_FLOAT_PREFIX "F_" |
Definition at line 431 of file variable.c.
#define DEFAULT_INT_PREFIX "I_" |
Default prefixes.
Definition at line 430 of file variable.c.
#define DEFAULT_LOGICAL_PREFIX "L_" |
Definition at line 432 of file variable.c.
#define DEFAULT_POINTER_PREFIX "P_" |
Definition at line 435 of file variable.c.
#define DEFAULT_STRING_PREFIX "S_" |
Definition at line 434 of file variable.c.
#define DEFAULT_STRUCT_PREFIX "ST_" |
Definition at line 436 of file variable.c.
#define DEFAULT_UNION_PREFIX "U_" |
Definition at line 437 of file variable.c.
#define PLACE_HOLDER_PREFIX_STRING "PLACE__HOLDER_" |
Generate special variables to represent declarations such as "struct s;".
This special character string does not have to be exported, except to make sure it is unique
Definition at line 2057 of file variable.c.
bool actual_label_replacement_p | ( | expression | eap | ) |
Assumes that eap is a call.
eap | ap |
Definition at line 1811 of file variable.c.
References call_function, entity_user_name(), expression_call_p(), expression_syntax, and syntax_call.
Referenced by call_contains_alternate_returns_p(), and words_regular_call().
COMMONs are supposed to have the same layout in each routine
the local areas are StaticArea and DynamicArea in fortran
the areas are localStaticArea, localDynamicArea, moduleStaticArea, globalStaticArea in C; but we also mange the stack for variable of dependent types, the heap area to model dynamic allocation and the formal area to model the formal context in C.
FI: I have a (temporary?) problem with some stub functional variables generated by the points-to analysis. In fact, the should be declared as pointers to functions, not as functions. I also have problem with overloaded stubs...
is_fortran_p | s_fortran_p |
Definition at line 1386 of file variable.c.
References area_layout, area_size, CONS, DYNAMIC_RAM_OFFSET, ENTITY, entity_type, gen_in_list_p(), gen_nconc(), NIL, overloaded_type_p(), pips_internal_error, SizeOfArray(), top_level_entity_p(), type_area, type_variable_p, and ultimate_type().
Referenced by add_C_variable_to_area(), add_variable_to_area(), make_global_entity_from_local(), and make_scalar_integer_entity().
Definition at line 1381 of file variable.c.
References add_any_variable_to_area().
Referenced by CCompilationUnitMemoryAllocations(), CModuleMemoryAllocation(), create_stub_entity(), entity_flow_or_context_sentitive_heap_location(), generic_make_entity_copy_with_new_name(), make_scalar_entity(), outliner_patch_parameters(), and step_parameter().
Definition at line 1376 of file variable.c.
References add_any_variable_to_area().
Referenced by create_private_integer_variable_for_new_module(), create_private_variable_for_new_module(), do_split_structure(), generic_make_entity_copy_with_new_name(), GetFullyDefinedReturnCodeVariable(), make_array_entity(), make_emulated_shared_variable(), make_new_entity(), make_new_local_variables(), make_scalar_entity(), and step_local_RT_Integer().
void AddEntityToCurrentModule | ( | entity | e | ) |
Add a variable entity to the current module declarations.
There is no declaration local to a statement in Fortran:
Definition at line 260 of file variable.c.
References AddLocalEntityToDeclarations(), c_module_p(), get_current_module_entity(), get_current_module_statement(), and statement_undefined.
Referenced by atomize_this_expression(), comEngine_make_new_scalar_variable(), complexity_sigma(), create_counter(), create_new_ent_list(), do_atomize_call(), do_loop_expansion(), do_loop_nest_unswitching(), do_loop_unroll_with_prologue(), do_scalar_renaming_in_vertex(), do_split_structure_parameter(), do_symbolic_tiling(), do_terapix_argument_handler(), find_or_create_newInd(), fix_loop_index_sign(), generate_optimized_code_for_loop_nest(), generate_scalar_variables(), generate_scalar_variables_from_list(), hpfc_new_variable(), inline_expression_call(), loop_to_complexity(), make_loadsave_statement(), make_new_entity(), make_new_index_entity(), make_new_simd_vector_with_prefix(), make_shuffle_statement(), process_true_call_stat(), regenerate_toggles(), sesamify(), set_the_i(), simd_atomize_this_expression(), simd_loop_unroll(), simplify_subscript(), st_compute_ith_local_index(), terapix_loop_handler(), and terapix_optimize_accumulator().
void AddEntityToCurrentModuleWithoutDeclaration | ( | entity | e | ) |
Add a variable entity to the current module declarations.
There is no declaration local to a statement in Fortran:
Definition at line 271 of file variable.c.
References AddLocalEntityToDeclarationsOnly(), c_module_p(), get_current_module_entity(), get_current_module_statement(), and statement_undefined.
END_EOLE.
Add a global variable e to the variable declarations of a module.
It does nothing if e is already in the list.
In the general case you should use AddLocalEntityToDeclarations() or AddEntityToCurrentModule() instead.
Since in C, variables should be added to the statement declarations too, only use this function for special stuff like compilation unit and special area delarations in the module bootstrapping.
Add the variable to the module declarations
Add the declaration only if not already here:
module | odule |
Definition at line 108 of file variable.c.
References code_declarations, CONS, ENTITY, entity_consistent_p(), EntityCode(), gen_chunk_undefined_p, gen_find_eq(), module, and pips_assert.
Referenced by add_entity_to_declarations(), AddCommonToModule(), AddEntityToHostAndNodeModules(), AddEntityToModule(), array_scalar_access_to_bank_communication(), array_scalar_access_to_compute_communication(), build_new_variable(), clone_variable_with_new_name(), create_bound_entity(), create_local_index(), create_local_index2(), create_new_common_variable(), create_private_integer_variable_for_new_module(), create_state_variable(), create_stub_entity(), declare_common_variables_in_module(), DeclareIntrinsic(), DeclareVariable(), entity_flow_or_context_sentitive_heap_location(), find_entity(), generic_make_entity_copy_with_new_name(), GenericAddLocalEntityToDeclarations(), gfc2pips_namespace(), init_c_areas(), init_c_implicit_variables(), init_host_and_node_entities(), InitAreas(), inline_expression_call(), insert_run_time_communications(), loop_strip_mine(), make_common_entity(), make_empty_module(), make_emulated_shared_variable(), make_new_local_variables(), MakeCommon(), MakeCurrentFunction(), MakeDerivedEntity(), MakeExternalFunction(), module_to_wp65_modules(), new_synonym(), reference_conversion_computation(), and ScanFormalParameters().
Add the variable entity e to the list of variables of the function module.
For a C module, the variable is also added as local to the given statement s. A global variable to a module should be added to the global statement module (given by get_current_module_statement() for example. The consistency of the internal representation is maintained.
e | variable entity to add |
module | entity |
s | statement where entity must be added. A new declaraton statement for e is added. It can be statement_undefined in the case of a Fortran module |
module | odule |
Definition at line 233 of file variable.c.
References GenericAddLocalEntityToDeclarations(), and module.
Referenced by AddEntityToCompilationUnit(), AddEntityToCurrentModule(), do_clone_entity(), do_group_constants_terapix(), do_kernelize(), do_split_structures(), effects_to_dma(), FixCReturnStatements(), generic_clone_variable_with_unique_name(), inline_expression_call(), make_new_simd_vector_with_prefix(), make_reduction_vector_entity(), mpi_initialize(), outliner_parameters(), outliner_scan(), redeclaration_enter_statement(), sac_make_new_variable(), statements_localize_declarations(), step_RT_set_local_declarations(), and terapix_loop_optimizer().
Add the variable entity e to the list of variables of the function module.
For a C module, the variable is also added as local to the given statement s. A global variable to a module should be added to the global statement module (given by get_current_module_statement() for example. The consistency of the internal representation is not maintained, but this is useful for the controlizer.
e | variable entity to add |
module | entity |
s | statement where entity must be added. No new declaration ststement is added. It can be statement_undefined in the case of a Fortran module |
module | odule |
Definition at line 253 of file variable.c.
References GenericAddLocalEntityToDeclarations(), and module.
Referenced by AddEntityToCurrentModuleWithoutDeclaration(), clean_up_sequences_rewrite(), copy_write_statement_with_cumulated_regions(), and generic_clone_variable_with_unique_name().
bool array_with_numerical_bounds_p(entity a) input : an array entity output : true if all bounds of all dimensions are numerical false otherwise (adjustable arrays, formal parameters).
modifies : nothing comment :
Definition at line 1266 of file variable.c.
References dimension_lower, dimension_upper, entity_ith_dimension(), expression_with_constant_signed_integer_value_p(), and NumberOfDimension().
Referenced by MakeEquivAtom().
Definition at line 1835 of file variable.c.
References actual_label_replacement_p(), call_arguments, EXPRESSION, and FOREACH.
Referenced by text_test().
entity clone_variable_with_unique_name | ( | entity | old_variable, |
statement | declaration_statement, | ||
string | prefix, | ||
string | suffix, | ||
entity | module | ||
) |
Clone a variable with a new user name.
old_variable | is the variable to clone |
declaration_statement | is the enclosing sequence (block) defining the scope where the new variable is visible. It must be a statement of kind sequence. |
prefix | is the prefix to prepend to the variable name |
suffix | is the suffix to append to the variable name |
module | is the entity of the module the variable will belong to |
Is there is already a variable with this name, new names are tried with numerical suffixes.
The clone variable is added to the declaration list of "statement_declaration" and to the code declarations of module "module". A new declaration statement is inserted in the sequence of "declaration_statement". This maintains the consistency of PIPS internal representation for C and Fortran code.
old_variable | ld_variable |
declaration_statement | eclaration_statement |
prefix | refix |
suffix | uffix |
module | odule |
Definition at line 562 of file variable.c.
References generic_clone_variable_with_unique_name(), module, old_variable, and prefix.
Referenced by move_declaration_control_node_declarations_to_statement().
Definition at line 1687 of file variable.c.
References is_qualifier_const, and qualified_variable_p().
Referenced by EvalSyntax(), expression_constant(), extended_expression_constant_p(), global_source_to_sinks(), and reference_dependence_variable_check_and_add().
void discard_module_declaration_text | ( | entity | a_module | ) |
Discard the decls_text string of the module code to make the prettyprinter ignoring the textual declaration and remake all from the declarations without touching the corresponding property (PRETTYPRINT_ALL_DECLARATIONS).
RK, 31/05/1994.
a_module | _module |
Definition at line 1696 of file variable.c.
References code_decls_text, entity_code(), free(), and strdup().
Referenced by add_entity_to_declarations(), atomizer(), and linearize_array_generic().
Any reference r such that reference_variable(r)==e accesses all bytes (or bits) allocated to variable e.
In other words, any write of e is a kill. At least, if the reference indices are NIL in the case of pointers.
The Newgen type of e must be "variable".
FI: This function is much too naive because array dimensions may be hidden anywhere in a chain of typdef types. It might be much better to use type_depth() or to write a more specific function. Well, for some unknown reason, type_depth is not the answer.
Kludge to work in case the dimension is part of the typedef or part of the type.
if(ENDP(variable_dimensions(uvt)) && ENDP(variable_dimensions(vt))) {
The property is not true for overloaded, string, derived (typedef is impossible here)
Definition at line 1163 of file variable.c.
References basic_bit_p, basic_complex_p, basic_float_p, basic_int_p, basic_logical_p, basic_pointer_p, entity_type, pips_assert, type_depth(), type_variable, type_variable_p, ultimate_type(), and variable_basic.
Referenced by impact_check_in_path(), and TestCoupleOfReferences().
for variables (like I), not constants (like 1)! use integer_constant_p() for constants
The integer type may be signed or unsigned.
Definition at line 1130 of file variable.c.
References basic_int_p, entity_scalar_p(), entity_type, type_variable, ultimate_type(), and variable_basic.
Referenced by entity_to_formal_integer_parameters(), evaluate_var_to_complexity(), expression_int_scalar(), hpfc_overlap_kill_unused_scalars_rewrite(), loop_variant_list(), normalize_reference(), NormalizeReference(), sc_entity_to_formal_integer_parameters(), and scalar_written_in_call().
Another semantics would be: is this reference r to e a kill for e? In general, this cannot be answered at the entity level only (see previous function) and the reference itself must be passed as an argument.
FI: I'm not sure of the best location for this function in ri-util (no file reference.c).
Definition at line 1228 of file variable.c.
References CAR, CDR, DIMENSION, entity_type, NIL, pips_assert, type_variable, type_variable_p, and variable_dimensions.
Referenced by array_with_numerical_bounds_p(), create_init_common_param_for_arrays(), declaration_with_overlaps(), entity_ith_bounds(), entity_unbounded_p(), expr_compute_local_index(), get_entity_dimensions(), get_ith_dim_new_declaration(), hpfc_compute_distribute_constraints(), and hpfc_compute_unicity_constraints().
The property is not true for overloaded, string, derived
Definition at line 1193 of file variable.c.
References basic_bit_p, basic_complex_p, basic_float_p, basic_int_p, basic_logical_p, ENDP, entity_basic_concrete_type(), type_variable, type_variable_p, variable_basic, and variable_dimensions.
The concrete type of e is a scalar type.
The programmer cannot index this variable.
Note: variable e may appear indexed somewhere in the PIPS internal representation if this is linked to some semantics.
Definition at line 1113 of file variable.c.
References ENDP, entity_type, pointer_type_p(), type_variable, type_variable_p, ultimate_type(), and variable_dimensions.
Referenced by address_of_scalar(), alias_check_in_caller(), alias_check_in_module(), AnalyzeData(), append_declaration_sc_if_exact_without_constraints(), array_bound_check_instrumentation(), assign_tmp_to_exp(), atomizer_of_loop(), call_STEP_subroutine3(), check_fortran_declaration_dependencies(), comp_regions_of_read(), comp_regions_of_write(), create_step_regions(), dimensions_to_dma(), do_clone_entity(), do_group_constants_terapix(), do_group_count_elements_reduce(), do_scalar_renaming(), do_split_structure(), effects_to_dma(), entities_maymust_conflict_p(), entity_integer_scalar_p(), entity_local_variable_p(), expression_reference_number(), expression_to_polynome(), find_or_create_scalar_entity(), find_tmp_of_exp(), generate_call_init_regionArray(), generic_effects_maymust_read_or_write_scalar_entity_p(), get_entity_step_commsize(), heap_intrinsic_to_post_pv(), icm_loop_rwt(), InitCompDesc(), initialize_and_verify_common_variable(), initialize_and_verify_local_variable(), inline_expression_call(), insert_initialization(), make_fields_assignment_instruction(), normalize_microcode(), other_cool_enough_for_a_last_substitution(), points_to_reference_to_type(), process_static_initialization(), promote_local_entities(), reference_scalar_p(), region_translation(), remove_unread_variables(), set_add_scalars(), simd_vector_entity_p(), simplify_dg(), store_expression(), store_initial_value(), text_comp_regions(), verify_used_before_set_expression(), and verify_used_before_set_statement_flt().
return true if the entity is declared with the keyword static
Definition at line 1146 of file variable.c.
References entity_storage, ram_section, static_area_p(), storage_ram, and storage_ram_p.
Referenced by cumul_and_update_effects_of_statement(), declaration_to_post_pv(), do_scalar_renaming(), module_to_value_mappings(), move_declaration_control_node_declarations_to_statement(), redeclaration_enter_statement(), split_initializations_in_statement(), xml_Chain_Graph(), xml_Compute_and_Need(), and xml_Region_Parameter().
bool entity_unbounded_p(entity e) input : an array entity output : true if the last dimension of the array is unbounded (*), false otherwise.
modifies : nothing comment :
Definition at line 1252 of file variable.c.
References entity_ith_dimension(), NumberOfDimension(), and unbounded_dimension_p().
See also entity_register_p()
Definition at line 1637 of file variable.c.
References entity_type, pips_assert, type_variable, type_variable_p, and volatile_variable_p().
Looks for an entity which should be a scalar of the specified basic.
If found, returns it, else one is created.
If the entity is not a scalar, it aborts.
name | ame |
module_name | odule_name |
base | ase |
Definition at line 1025 of file variable.c.
References base, concatenate(), entity_basic_p(), entity_domain, entity_scalar_p(), entity_undefined, gen_find_tabulated(), make_scalar_entity(), MakeBasic(), module_name(), MODULE_SEP_STRING, and pips_assert.
Referenced by create_state_variable(), get_ith_dummy(), make_host_and_node_modules(), and region_entity_variable_to_new_declare_entity().
Looks for an entity of the specified basic.
If found, returns it, else one is created.
name | ame |
module_name | odule_name |
base | ase |
Definition at line 1046 of file variable.c.
References base, concatenate(), entity_basic_p(), entity_domain, entity_undefined, gen_find_tabulated(), make_scalar_entity(), MakeBasic(), module_name(), MODULE_SEP_STRING, and pips_assert.
Referenced by argument_bound_entity(), and hpfc_init_run_time_entities().
Such pseudo-variables are generated by the points-to analysis.
See also entity_in_formal_area_p()
Definition at line 1535 of file variable.c.
References entity_storage, formal_area_p(), ram_section, storage_ram, and storage_ram_p.
Referenced by create_values_for_simple_effect().
string lsp = "FORMAL_RETURN_LABEL_";
fp | p |
Definition at line 1797 of file variable.c.
References entity_local_name(), and get_string_property().
Referenced by DeclareVariable(), MakeFormalParameter(), text_entity_declaration(), and words_parameters().
Definition at line 1489 of file variable.c.
References entity_storage, and storage_formal_p.
Referenced by alias_propagation(), array_bound_check_instrumentation(), compute_points_to_gen_set(), compute_points_to_kill_set(), create_pointer_to_array_stub_points_to(), create_stub_entity(), dag_compute_outputs(), do_array_expansion(), do_check_isolate_statement_preconditions_on_call(), do_gpu_qualify_pointers(), do_slightly_rename_entities(), do_split_structure(), do_split_structure_return_hook(), entity_formal_p(), entity_may_conflict_with_a_formal_parameter_p(), entity_to_declaring_statement(), expand_points_to_domain(), formal_parameter_points_to_cell_p(), freia_cleanup_sequence_rec(), generic_points_to_cells_translation(), generic_transformer_intra_to_inter(), init_dynamic_check_list(), init_points_to_analysis(), initialization_list_to_statements(), initialize_dynamic_check_list(), inline_expression_call(), interprocedural_abc_call(), make_loadsave_statement(), MakeEquivAtom(), new_local_image_variable(), normalize_microcode(), offset_in_caller(), points_to_cells_parameters(), points_to_function_projection(), points_to_set_block_projection(), potential_out_effects_p(), promote_local_entities(), reference_to_points_to(), retype_formal_parameters(), source_to_sinks(), split_structures(), statement_insertion_fix_access(), statements_localize_declarations(), terapix_suitable_loop_bound_walker(), update_unstructured_declarations(), UpdateEntity(), used_before_set(), variable_to_abstract_location(), verify_formal_and_common_variables(), and wipeout_entity().
string lsp = "FORMAL_RETURN_LABEL_";
let's assume that there are fewer than 999 formal label arguments
Generate a variable of type CHARACTER*(*). See gram.y, "lg_fortran_type:". It is postponed to MakeFormalParameter
fs may already exists if a ParserError occured or if an edit of the source file occured
Not so sure because CleanUpEntities() is called later, not before. This function is cvalled by the parser before the module declaration rule is reduced.
Too bad for the memory leaks: they should not occur frequently
Too early because the current_module_entity is not yet fully defined.
AddEntityToDeclarations(fs, get_current_module_entity());
Definition at line 1744 of file variable.c.
References buffer, concatenate(), entity_domain, entity_initial, entity_name, entity_storage, entity_type, entity_undefined, free(), full_name, gen_find_tabulated(), get_string_property(), make_entity, MODULE_SEP_STRING, pips_assert, pips_debug, storage_undefined, strdup(), string_undefined, type_undefined, and value_undefined.
expression generate_string_for_alternate_return_argument | ( | string | i | ) |
Definition at line 1721 of file variable.c.
References buffer, expression_undefined, MakeCharacterConstantExpression(), pips_assert, and strdup().
entity generate_variable_with_unique_name_to_module | ( | const char * | seed_name, |
const char * | prefix, | ||
const char * | suffix, | ||
entity | module | ||
) |
Generate a new variable name from a seed name to a module.
seed_name | is the main name of the variable name to generate |
prefix | is the prefix to prepend to the variable name |
suffix | is the suffix to append to the variable name |
module | is the entity of the module the variable will belong to |
Is there is already a variable with this name, a new one is tried with some numerical suffixes.
First try a basic name without numeric suffix:
Free the old name since it was already used:
And try a new one with a number suffix:
seed_name | eed_name |
prefix | refix |
suffix | uffix |
module | odule |
Definition at line 460 of file variable.c.
References asprintf, BLOCK_SEP_STRING, fortran_module_p(), free(), make_entity, module, module_local_name(), module_name(), MODULE_SEP_STRING, prefix, storage_undefined, type_undefined, unique_entity_name_p(), value_undefined, and variable_name().
Referenced by generic_clone_variable_with_unique_name().
entity generic_clone_variable_with_unique_name | ( | entity | old_variable, |
statement | declaration_statement, | ||
string | prefix, | ||
string | suffix, | ||
entity | module, | ||
bool | insert_p | ||
) |
clone a variable with a new name.
The new variable is added in the different declaration lists.
insert_p | If true, for C code, a new declaration statement is inserted in "declaration_statement" to maintain the internal representation consistency. Else, no new declaration statement is inserted and the internal representation is no longer consistent for C code. |
See useful interface below
Clone the attributes of the old variable into the new one:
old_variable | ld_variable |
declaration_statement | eclaration_statement |
prefix | refix |
suffix | uffix |
module | odule |
insert_p | nsert_p |
Definition at line 509 of file variable.c.
References AddLocalEntityToDeclarations(), AddLocalEntityToDeclarationsOnly(), copy_storage(), copy_type(), copy_value(), entity_initial, entity_storage, entity_type, entity_user_name(), generate_variable_with_unique_name_to_module(), module, new_variable, old_variable, and prefix.
Referenced by clone_variable_with_unique_name(), and move_declaration_control_node_declarations_to_statement().
|
static |
See the two user interfaces below.
SG: fix the entity storage if undefined it basically recompute the offset of a scalar variable I have not found how to do it for a variable size array, so I just dropped the case -> a variable size array must be allocated in a different area, STACK_AREA, where offsets are not computed
current_offset_of_area fails if SizeOfArray is not computable because e is a varying length array
The variable e should be allocated in the Stack area
Both in C and Fortran, all variables and useful entities are stored in code_declarations, in the symbol table.
In C, the variables, but the formal parameters, are local to a statement
If undeclared in s, variable e is added in the statement_declarations field.
The entity may have already been declared... This could be an assert but Serge seems to redeclare several times the same variables when performing inlining
The C prettyprinter is not based on code_declarations or statement_declarations but on declaration statements, which happen to be continue statement for the time being.
To preserve the source layout, declarations are statements
Definition at line 152 of file variable.c.
References add_declaration_statement(), AddEntityToDeclarations(), c_module_p(), CONS, current_offset_of_area(), declaration_statement_p(), dynamic_area, DYNAMIC_AREA_LOCAL_NAME, ENTITY, entity_empty_label(), entity_name, entity_storage, entity_variable_p, FindEntity(), gen_chunk_undefined_p, gen_find_eq(), gen_nconc(), insert_statement(), make_continue_statement(), make_ram(), make_storage_ram(), module, module_local_name(), NIL, pips_assert, pips_user_warning, SizeOfArray(), statement_block_p, statement_declarations, statement_undefined_p, and storage_undefined_p.
Referenced by AddLocalEntityToDeclarations(), and AddLocalEntityToDeclarationsOnly().
Returns a numbered entity the name of which is suffix + number, the module of which is prefix.
Used by some macros to return dummy and primed variables for system of constraints.
moved to ri-util from hpfc on BC's request. FC 08/09/95
prefix | refix |
suffix | uffix |
Definition at line 1711 of file variable.c.
References assert, buffer, find_or_create_scalar_entity(), is_basic_int, and prefix.
Referenced by compute_entity_to_declaration_constraints().
Is v a global variable such as "int i;".
This is OK for C, but Fortran deals with commons.
Definition at line 1510 of file variable.c.
References entity_module_name(), global_variable_p(), and TOP_LEVEL_MODULE_NAME.
Referenced by create_values_for_simple_effect(), filter_formal_context_according_to_actual_context(), generic_transformer_intra_to_inter(), global_variable_p(), and new_filter_formal_context_according_to_actual_context().
Definition at line 1877 of file variable.c.
References entity_user_name(), IMPLICIT_VARIABLE_NAME_1, and IMPLICIT_VARIABLE_NAME_2.
Referenced by c_text_entities(), inline_expression_call(), and solve_name_clashes().
integer_scalar_entity_p() is obsolete; use entity_integer_scalar_p()
Definition at line 1137 of file variable.c.
References basic_int_p, entity_type, NIL, type_variable, type_variable_p, ultimate_type(), variable_basic, and variable_dimensions.
Referenced by allocate_module_value_mappings().
|
static |
Create an array entity.
module_name | is the name of the module part of the entity name |
name | is the user name of the entity |
base | is the basic type for the array |
dimensions | is the list of dimensions for the array |
Definition at line 752 of file variable.c.
References add_variable_to_area(), asprintf, base, basic_tag, DYNAMIC_AREA_LOCAL_NAME, entity_domain, entity_initial, entity_storage, entity_type, entity_undefined_p, f(), FindEntity(), free(), full_name, gen_find_tabulated(), is_basic_overloaded, is_storage_ram, local_name_to_top_level_entity(), make_entity, make_ram(), make_storage(), make_value_unknown(), MakeTypeVariable(), module_name(), MODULE_SEP_STRING, NIL, pips_debug, storage_undefined, type_undefined, and value_undefined.
Referenced by make_new_array_variable_with_prefix().
name | ame |
module_name | odule_name |
Definition at line 378 of file variable.c.
References concatenate(), copy_type(), entity_domain, entity_initial, entity_storage, entity_type, entity_undefined, full_name, gen_find_tabulated(), make_entity, make_storage_rom(), make_value_unknown(), message_assert, module_name(), MODULE_SEP_STRING, pips_debug, storage_undefined, strdup(), type_undefined, and value_undefined.
Referenced by make_new_derived_entity_with_prefix().
local | ocal |
Definition at line 281 of file variable.c.
References add_any_variable_to_area(), asprintf, copy_type(), copy_value(), DYNAMIC_AREA_LOCAL_NAME, entity_initial, entity_local_name(), entity_storage, entity_to_module_entity(), entity_type, entity_undefined, entity_undefined_p, f(), FindEntity(), FindOrCreateEntity(), fortran_module_p(), free(), local_name_to_top_level_entity(), make_ram(), make_storage_ram(), NIL, strdup(), and TOP_LEVEL_MODULE_NAME.
Referenced by inline_expression_call().
entity make_integer_constant_entity(int c) make entity for integer constant c
WARNING : the basic integer size is fixed to sizeof(_int)
64 bits numbers are printed in decimal in 20 digits, so with - and \0 32 is enough.
make entity for the constant c
Definition at line 1345 of file variable.c.
References concatenate(), entity_domain, entity_undefined, gen_find_tabulated(), is_basic_int, is_constant_int, is_type_functional, is_type_variable, is_value_constant, make_basic(), make_constant(), make_entity, make_functional(), make_storage_rom(), make_type(), make_value(), make_variable(), MODULE_SEP_STRING, NIL, num, strdup(), and TOP_LEVEL_MODULE_NAME.
Referenced by add_pragma_to_sequence(), operator_neutral_element(), regions_to_loops(), remove_simple_scalar_pointers(), scalar_to_array(), and verify_used_before_set_call().
module | odule |
dimensions | imensions |
Definition at line 793 of file variable.c.
References make_new_array_variable_with_prefix(), and module.
Referenced by effects_to_dma().
entity make_new_array_variable_with_prefix | ( | const char * | prefix, |
entity | module, | ||
basic | b, | ||
list | dimensions | ||
) |
J'ai ameliore la fonction make_new_scalar_variable_with_prefix
afin de l'etendre a des tableau
prefix | refix |
module | odule |
dimensions | imensions |
Definition at line 785 of file variable.c.
References make_array_entity(), module, module_local_name(), module_name(), and prefix.
Referenced by do_clone_entity(), do_group_constants_terapix(), inline_expression_call(), internal_make_new_array_variable(), make_new_array_variable(), make_reduction_vector_entity(), outliner_smart_references_computation(), and promote_local_entities().
derived from make_new_scalar_variable_with_prefix
declare the entity at the highest scope
Find the first matching non-already existent variable name:
Free the already allocated name in the previous iteration that was conflicting:
Use a default type-dependent variable name since the programmer gave none:
prefix | refix |
module | odule |
Definition at line 685 of file variable.c.
References asprintf, BLOCK_SEP_STRING, DEFAULT_DERIVED_ENUM_PREFIX, DEFAULT_DERIVED_STRUCT_PREFIX, DEFAULT_DERIVED_UNION_PREFIX, free(), is_type_enum, is_type_struct, is_type_union, make_derived_entity(), module, module_local_name(), module_name(), pips_debug, pips_internal_error, prefix, strdup(), type_tag, unique_entity_name_p(), unique_float_number, unique_integer_number, unique_logical_number, and variable_name().
Referenced by do_clone_entity().
The first letter of the local name depends on the basic: int --> I real --> F (float single precision) others --> O
The three following letters are whether "TMP", for temporaries or "AUX" for auxiliary variables.
The first part of the full name is the concatenation of the define constant ATOMIZER_MODULE_NAME and the local name of the module entity.
ATOMIZER_MODULE_NAME discarded : it is a bug ! RK, 31/05/1994. name = strdup(concatenate(ATOMIZER_MODULE_NAME, entity_local_name(mod_ent), MODULE_SEP_STRING, prefix, num, (char *) NULL));
Create a true dynamic variable. RK, 31/05/1994 :
Is the following useless :
The new entity is stored in the list of entities of the same type.
ba | a |
kind | ind |
Definition at line 898 of file variable.c.
References add_variable_to_area(), AddEntityToCurrentModule(), asprintf, AUX_ENT, basic_float, basic_tag, char_entities, complex_entities, CONS, count_aux, count_tmp, double_entities, DOUBLE_PRECISION_SIZE, dynamic_area, DYNAMIC_AREA_LOCAL_NAME, ENTITY, entity_local_name(), entity_storage, FindEntity(), get_current_module_entity(), integer_entities, is_basic_complex, is_basic_float, is_basic_int, is_basic_logical, is_basic_string, is_storage_ram, is_type_variable, is_value_unknown, logical_entities, make_entity, make_ram(), make_storage(), make_type(), make_value(), make_variable(), mod_ent, module_local_name(), MODULE_SEP_STRING, NIL, prefix, real_entities, storage_undefined, TMP_ENT, user_error, and UU.
Referenced by assign_tmp_to_exp(), and atomizer_of_external().
add a terminal suffix till a new name is found.
old_index | ld_index |
suffix | uffix |
Definition at line 1851 of file variable.c.
References AddEntityToCurrentModule(), asprintf, copy_type(), copy_value(), entity_initial, entity_module_name(), entity_name, entity_type, free(), global_name_to_user_name(), make_entity, module, module_name_to_entity(), old_name(), storage_undefined, and unique_entity_name_p().
Referenced by loop_strip_mine(), make_index_prime_entity(), make_local_tile_index_entity(), make_tile_index_entity(), and simd_loop_unroll().
Make a new module integer variable of name X<d>.
module | odule |
Definition at line 830 of file variable.c.
References asprintf, entity_undefined, free(), make_scalar_integer_entity(), module, module_local_name(), num, and unique_entity_name_p().
Referenced by array_scalar_access_to_bank_communication(), array_scalar_access_to_compute_communication(), build_new_variable(), insert_run_time_communications(), reference_conversion_computation(), and regions_to_loops().
module | odule |
Definition at line 741 of file variable.c.
References make_new_scalar_variable_with_prefix(), and module.
Referenced by atom_cse_expression(), atomize_condition(), atomize_or_associate_for_level(), do_atomize_call(), do_atomize_if_different_level(), do_loop_expansion(), do_loop_nest_unswitching(), do_symbolic_tiling(), enclose_in_a_parallel_loop(), generate_optimized_code_for_loop_nest(), generate_parallel_body(), generate_read_of_ref_for_all(), generate_read_of_ref_for_computer(), generate_update_distributed_value_from_host(), hpfc_new_variable(), make_temporary_scalar_entity(), outliner_extract_loop_bound(), promote_statement(), sac_make_new_variable(), sesamify(), simplify_subscript(), st_compute_ith_local_index(), and terapix_loop_optimizer().
Create a new scalar variable of type b in the given module.
The variable name is constructed with "<prefix><number>" If the given prefix is the empty string, some standard prefixes are used, based on the type.
In Fortran, the prefix is forced to upper case to be consistent with PIPS Fortran internal representation. All the default prefixes are assumed to be uppercase strings.
In C this function is added to current module only.
It is not clear why the default prefix is (re)computed in the repeat until loop rather than before entering it.
Find the first matching non-already existent variable name:
Free the already allocated name in the previous iteration that was conflicting:
Use a default type-dependent variable name since the programmer gave none:
prefix | refix |
module | odule |
Definition at line 592 of file variable.c.
References asprintf, basic_derived, basic_tag, basic_ultimate(), BLOCK_SEP_STRING, DEFAULT_COMPLEX_PREFIX, DEFAULT_ENUM_PREFIX, DEFAULT_FLOAT_PREFIX, DEFAULT_INT_PREFIX, DEFAULT_LOGICAL_PREFIX, DEFAULT_POINTER_PREFIX, DEFAULT_STRING_PREFIX, DEFAULT_STRUCT_PREFIX, DEFAULT_UNION_PREFIX, entity_type, fortran_module_p(), free(), is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_pointer, is_basic_string, make_scalar_entity(), module, module_local_name(), module_name(), pips_debug, pips_internal_error, prefix, strdup(), strupper(), type_enum_p, type_struct_p, type_tag, type_union_p, ultimate_type(), unique_complex_number, unique_entity_name_p(), unique_float_number, unique_integer_number, unique_logical_number, unique_string_number, and variable_name().
Referenced by comEngine_make_new_scalar_variable(), complexity_sigma(), create_counter(), create_new_ent_list(), do_clone_entity(), do_group_constants_terapix(), do_loop_unroll_with_prologue(), do_scalar_renaming_in_vertex(), find_or_create_newInd(), fix_loop_index_sign(), generate_scalar_variables(), generate_scalar_variables_from_list(), inline_expression_call(), loop_to_complexity(), make_complexity_unknown(), make_loadsave_statement(), make_new_scalar_variable(), make_new_simd_vector_with_prefix(), make_place_holder_variable(), make_temporary_pointer_to_array_entity_with_prefix(), MakeAssignedOrComputedGotoInst(), MakeDoInst(), mpi_initialize(), mpi_make_ctx(), outliner_smart_references_computation(), process_true_call_stat(), promote_local_entities(), set_the_i(), and statements_localize_declarations().
de | e |
Definition at line 2059 of file variable.c.
References entity_undefined, entity_undefined_p, get_current_module_entity(), make_basic_derived(), make_new_scalar_variable_with_prefix(), and PLACE_HOLDER_PREFIX_STRING.
entity make_scalar_entity(name, module_name, base)
FI: this creates an inconsistency between the module declarations and the content of the DYNAMIC area.
FI: I would have expected is_value_unknown, especially with a RAM storage!
name | ame |
module_name | odule_name |
base | ase |
Definition at line 331 of file variable.c.
References add_C_variable_to_area(), add_variable_to_area(), base, basic_tag, c_module_p(), concatenate(), DYNAMIC_AREA_LOCAL_NAME, entity_domain, entity_initial, entity_storage, entity_type, entity_undefined, f(), FindEntity(), full_name, gen_find_tabulated(), is_basic_overloaded, is_storage_ram, local_name_to_top_level_entity(), make_entity, make_ram(), make_storage(), make_value_unknown(), MakeTypeVariable(), message_assert, module_name(), module_name_to_entity(), MODULE_SEP_STRING, NIL, offset, pips_debug, place_holder_variable_p(), storage_undefined, strdup(), type_undefined, and value_undefined.
Referenced by alloc_instrumentation(), find_or_create_scalar_entity(), find_or_create_typed_entity(), make_new_scalar_variable_with_prefix(), old_array_bound_check_instrumentation(), sprintf_check_expression(), terapix_optimize_accumulator(), and Tiling_buffer_allocation().
entity make_scalar_integer_entity | ( | const char * | name, |
const char * | module_name | ||
) |
Create an integer variable of name "name" in module of name "module_name".
name | ame |
module_name | odule_name |
Definition at line 1068 of file variable.c.
References add_any_variable_to_area(), concatenate(), DYNAMIC_AREA_LOCAL_NAME, entity_initial, entity_storage, entity_type, entity_undefined_p, f(), FindEntity(), fortran_module_p(), full_name, hash_warn_on_redefinition(), is_basic_int, is_storage_ram, is_value_constant, local_name_to_top_level_entity(), make_basic(), make_constant_litteral(), make_entity, make_ram(), make_storage(), make_value(), MakeTypeVariable(), module_name(), MODULE_SEP_STRING, NIL, pips_assert, pips_debug, storage_undefined, strdup(), type_undefined, and value_undefined.
Referenced by create_local_index(), create_local_index2(), create_tile_basis(), find_entity(), make_new_module_variable(), module_to_wp65_modules(), sc_add_new_variable_name(), and terapix_loop_handler().
entity make_stderr_variable | ( | void | ) |
If the parser has not (yet) encountered "stderr", a PIPS transformation or instrumentation phase may need "stderr" to generate AST code.
This happens with array_bound_check at least.
It's a global variable
Unfortunately, I do not have an unknown basic to use... It should be a FILE * pointer...
Its type is variable, scalar,
its storage must be the static area of top-level
Its initial value is unknown
Definition at line 302 of file variable.c.
References DEFAULT_INTEGER_TYPE_SIZE, entity_initial, entity_storage, entity_type, entity_undefined_p, f(), FindEntity(), FindOrCreateEntity(), make_basic_int(), make_ram(), make_storage_ram(), make_value_unknown(), MakeTypeVariable(), NIL, pips_assert, STATIC_AREA_LOCAL_NAME, STDERR_NAME, TOP_LEVEL_MODULE_NAME, and UNKNOWN_RAM_OFFSET.
Referenced by make_C_print_statement().
entity make_temporary_pointer_to_array_entity | ( | entity | efrom, |
expression | from, | ||
entity | module | ||
) |
efrom | from |
from | rom |
module | odule |
Definition at line 819 of file variable.c.
References make_temporary_pointer_to_array_entity_with_prefix(), and module.
Referenced by inline_expression_call().
entity make_temporary_pointer_to_array_entity_with_prefix | ( | char * | prefix, |
entity | efrom, | ||
entity | module, | ||
expression | from | ||
) |
Make the pointer type
Create the variable as a pointer
Set its initial
prefix | refix |
efrom | from |
module | odule |
from | rom |
Definition at line 801 of file variable.c.
References copy_basic(), copy_expression(), entity_initial, entity_type, expression_undefined_p, gen_full_copy_list(), make_basic_pointer(), make_cast(), make_expression(), make_new_scalar_variable_with_prefix(), make_syntax_cast(), make_type_variable(), make_value_expression(), make_value_unknown(), make_variable(), module, NIL, normalized_undefined, prefix, type_variable, variable_basic, and variable_dimensions.
Referenced by effects_to_dma(), and make_temporary_pointer_to_array_entity().
COMMONs are supposed to havethe same layout in each routine
the local areas are StaticArea and DynamicArea in fortran
the areas are localStaticArea, localDynamicArea, moduleStaticArea, globalStaticArea in C
FI: should only happens with stack_area_p(a)...
C language
By definition of the stack area, the offset is unknown because the size of the cariables is unknown statically. E.g. dependent types. This may happen in C99 or in Fortran 77 extensions.
FI: the points-to analysis is going to modify the symbol table under some properties... Maybe it would be better not to track buckets and abstract buckets declared in the heap?
is_fortran_p | s_fortran_p |
Definition at line 1436 of file variable.c.
References area_layout, area_size, CONS, dynamic_area_p(), DYNAMIC_RAM_OFFSET, ENTITY, entity_name, entity_type, gen_in_list_p(), gen_nconc(), heap_area_p(), NIL, pips_assert, pips_internal_error, SizeOfArray(), stack_area_p(), static_area_p(), top_level_entity_p(), and type_area.
ph | h |
Definition at line 2069 of file variable.c.
References entity_local_name(), f(), and PLACE_HOLDER_PREFIX_STRING.
Referenced by analyzable_scalar_entity_p(), c_text_related_entities(), CCompilationUnitMemoryAllocations(), CModuleMemoryAllocation(), create_values_for_simple_effect(), dump_common_layout(), make_declarations_statement(), make_scalar_entity(), module_to_value_mappings(), and words_variable_or_function().
The variable may turn out to be a function.
is_qualified | s_qualified |
Definition at line 1666 of file variable.c.
References entity_type, FOREACH, QUALIFIER, qualifier_tag, type_variable, type_variable_p, and variable_qualifiers.
Referenced by const_variable_p().
void remove_variable_entity | ( | entity | v | ) |
FI: this is pretty dangerous as it may leave tons of dangling pointers; I use it to correct early declarations of types functions as variables; I assume that no pointers to v exist in statements because we are still in the declaration phasis.
Memory leaks: I do not know if NewGen free_entity() is recursive.
Definition at line 1306 of file variable.c.
References code_declarations, code_undefined, entity_initial, entity_module_name(), entity_module_p(), entity_storage, entity_undefined, entity_undefined_p, f(), free_entity(), gen_remove(), local_name_to_top_level_entity(), pips_assert, pips_internal_error, ram_function, storage_ram, storage_ram_p, storage_rom_p, storage_tag, storage_undefined_p, and value_code.
Referenced by remove_ghost_variable_entities().
this take care of removing useless declaration statements
module | odule |
Definition at line 120 of file variable.c.
References declaration_statement_p(), ENDP, entity_declarations, FOREACH, free_statement(), gen_copy_seq(), gen_free_list(), gen_remove(), gen_remove_once(), instruction_block, module, RemoveLocalEntityFromDeclarations(), STATEMENT, statement_block(), statement_block_p, statement_declarations, statement_instruction, and statement_undefined_p.
Referenced by do_kernelize(), do_reduction_detection(), promote_local_entities(), RemoveLocalEntityFromDeclarations(), rename_statement_declarations(), and statement_clean_declarations_helper().
void reset_unique_variable_numbers | ( | void | ) |
Definition at line 421 of file variable.c.
References unique_complex_number, unique_float_number, unique_integer_number, and unique_logical_number.
Referenced by open_module(), and set_resources_for_module().
FI: transferred from semantics (should be used for effect translation as well)
e1 or e2 may be a formal parameter as shown by the benchmark m from CEA and the call to SOURCE by the MAIN, parameter NPBF (FI, 13/1/93)
I do not understand why I should return false since they actually have the same location for this call site. However, there is no need for a translate_global_value() since the usual formal/actual binding must be enough.
e1 | 1 |
e2 | 2 |
Definition at line 1992 of file variable.c.
References entity_name, entity_storage, entity_undefined, pips_debug, ram_offset, ram_section, ram_undefined, s1, storage_ram, and storage_ram_p.
Referenced by expression_equal_in_context_p(), translate_global_value(), and translate_to_module_frame().
Check if a variable is initialized by itself as "int a = a;" is legal C code according to gcc.
sd v referenced in e?
Definition at line 1966 of file variable.c.
References expression_to_reference_list(), expression_undefined_p, FOREACH, gen_free_list(), NIL, REFERENCE, reference_variable, and variable_initial_expression().
Is v a global variable declared local to a C file such "static int i;".
Definition at line 1498 of file variable.c.
References compilation_unit_p(), entity_module_name(), and static_global_variable_p().
Referenced by create_stub_entity(), filter_formal_context_according_to_actual_context(), new_filter_formal_context_according_to_actual_context(), source_to_sinks(), and static_global_variable_p().
Assume that v is declared as a struct.
Return the list of its fields.
Apart from a possible assert, the same function should work for a union.
Definition at line 2045 of file variable.c.
References derived_type_to_fields(), and entity_basic_concrete_type().
Referenced by analyzed_struct_p(), and struct_initialization_to_points_to().
BEGIN_EOLE.
Definition at line 83 of file variable.c.
References entity_initial, entity_storage, storage_rom_p, storage_undefined, symbolic_constant, value_symbolic_p, and value_undefined.
Referenced by constant_expression_supporting_references(), and generic_constant_expression_supporting_entities().
Handling of entity as program variables (see also entity.c for generic entities)
Check that "name" can be used as a new variable name in module "in_module". Should work for C and for Fortran. Apparently, should work whether name is already a global name or not, hence the derivation of user_name
Of course, not really debugged for Fortran:-(.
first recover a user_name from global_name
first check in entity declaration, where all entities are added At least AddEntityToDeclarations keep this information up to date
everything seems ok, do a last check with gen_fin_tabulated
Definition at line 49 of file variable.c.
References BLOCK_SEP_CHAR, concatenate(), ENTITY, entity_declarations, entity_domain, entity_user_name(), FOREACH, gen_chunk_undefined_p, gen_find_tabulated(), global_name_to_user_name(), module_local_name(), MODULE_SEP_STRING, and same_string_p.
Referenced by generate_variable_with_unique_name_to_module(), make_new_derived_entity_with_prefix(), make_new_index_entity(), make_new_module_variable(), and make_new_scalar_variable_with_prefix().
Definition at line 1586 of file variable.c.
References dynamic_area_p(), entity_storage, entity_type, ram_section, storage_ram, storage_ram_p, and type_variable_p.
Referenced by deal_with_similars(), and dynamic_variables_to_values().
variable_entity_dimension(entity v): returns the dimension of variable v; scalar have dimension 0.
This is not necessarily the dimensions because of typedefs. Another function is able to collect dimensions hidden in typedefs, but also via fields: see type_depth().
Definition at line 1293 of file variable.c.
References DIMENSION, entity_type, FOREACH, pips_assert, type_variable, type_variable_p, and variable_dimensions.
Referenced by deal_with_similars(), declaration_with_overlaps(), generate_remapping_system(), hpfc_unstutter_dummies(), prepare_context(), remapping_variables(), struct_variable_to_pointer_locations(), vertex_partially_invariant_p(), xml_Argument(), xml_AssignArgument(), xml_declarations(), xml_FormalVariables(), xml_GlobalVariables(), xml_LocalVariables(), and xml_ParameterUseToArrayBound().
See also macro entity_variable_p()...
variable.c
Definition at line 70 of file variable.c.
References entity_storage, storage_ram_p, and storage_undefined.
Referenced by entities_maymust_conflict_p(), inline_expression_call(), partial_eval_declarations(), referencenodeclfilter(), retype_formal_parameters(), and value_alias().
Definition at line 1600 of file variable.c.
References entity_storage, entity_type, heap_area_p(), ram_section, storage_ram, storage_ram_p, and type_variable_p.
Referenced by xml_Chain_Graph(), xml_Compute_and_Need(), xml_GlobalVariables(), xml_Region_Parameter(), xml_TaskParameters(), and xml_Type_Entity().
true if v is in a common.
Definition at line 1570 of file variable.c.
References entity_special_area_p(), entity_storage, entity_type, ram_section, storage_ram, storage_ram_p, and type_variable_p.
Referenced by add_aliases_for_current_call_site(), alias_check(), array_bound_check_instrumentation(), bottom_up_abc_reference(), impact_check(), init_dynamic_check_list(), initialize_dynamic_check_list(), list_of_same_or_equivalence_arguments(), same_section_common_variable_in_list_p(), translate_to_module_frame(), used_before_set(), verify_used_before_set_call(), verify_used_before_set_statement_flt(), and words_declaration().
Definition at line 1623 of file variable.c.
References CAR, CDR, ENTITY, NIL, and same_entity_p().
Referenced by add_aliases_for_current_call_site(), and text_equivalences().
This test can only be applied to variables, not to functions, subroutines or commons visible from a module.
Definition at line 1610 of file variable.c.
References code_declarations, entity_initial, entity_is_argument_p(), entity_module_name(), module_local_name(), pips_assert, and value_code.
Referenced by external_value_name(), and update_common_layout().
expression variable_initial_expression | ( | entity | v | ) |
Returns a copy of the initial (i.e.
initialization) expression of variable v. If v's inital value is a constants or a code block, it is converted to the corresponding expression.
Could have been called entity_to_initialization_expression(), or entity_to_initial_expression(), but it only makes sense for variables.
FI: not sure this is used in C; also, the constant field could be used as well.
Definition at line 1899 of file variable.c.
References CAR, code_initializations, constant_int, constant_int_p, copy_expression(), ENDP, entity_initial, entity_name, entity_type, exp, expression_undefined, gen_length(), instruction_expression, int_to_expression(), pips_assert, pips_internal_error, pips_user_warning, pointer_type_p(), sequence_statements, STATEMENT, statement_instruction, symbolic_expression, ultimate_type(), value_code, value_code_p, value_constant, value_constant_p, value_expression, value_expression_p, value_intrinsic_p, value_reference_p, value_symbolic, value_symbolic_p, value_tag, value_undefined_p, and value_unknown_p.
Referenced by c_data_to_prec_for_variables(), declaration_statement_to_points_to(), declaration_to_transformer(), declaration_to_transformer_list(), global_source_to_sinks(), move_declaration_control_node_declarations_to_statement(), partial_eval_declaration(), propagate_preconditions_in_declarations(), redeclaration_enter_statement(), rename_statement_declarations(), self_initialization_p(), and split_initializations_in_statement().
Well, the variable is a formal parameter of the module:
The variable is in the declaration of the module but is not a formal parameter:
The variable is not in the declaration of the module:
a_variable | _variable |
a_module | _module |
Definition at line 1547 of file variable.c.
References a_variable, code_declarations, ENTITY, entity_initial, entity_storage, FOREACH, storage_formal_p, and value_code.
Referenced by create_values_for_simple_effect(), statement_has_a_module_formal_argument_write_effect_p(), and translate_to_module_frame().
True if a variable is the pseudo-variable used to store value returned by a function:
Definition at line 1522 of file variable.c.
References entity_storage, and storage_return_p.
Referenced by entities_maymust_conflict_p(), statement_has_a_module_formal_argument_write_effect_p(), transformer_filter_subsumed_variables(), and variable_to_abstract_location().
Definition at line 1593 of file variable.c.
References entity_storage, entity_type, ram_section, stack_area_p(), storage_ram, storage_ram_p, and type_variable_p.
Referenced by dynamic_variables_to_values().
true if v appears in a SAVE statement, or in a DATA statement, or is declared static i C.
The size of v in bytes can
Definition at line 1579 of file variable.c.
References entity_storage, entity_type, ram_section, static_area_p(), storage_ram, storage_ram_p, and type_variable_p.
Referenced by c_data_to_prec_for_variables(), cell_out_of_scope_p(), declaration_statement_to_points_to(), declaration_to_transformer(), declaration_to_transformer_list(), generic_module_initial_pointer_values(), initialize_and_verify_local_variable(), inline_expression_call(), inline_has_static_declaration(), outliner_independent_recursively(), points_to_set_block_projection(), redeclaration_enter_statement(), text_entity_declaration(), and words_declaration().
See also entity_register_p()
Definition at line 1649 of file variable.c.
References FOREACH, QUALIFIER, qualifier_volatile_p, and variable_qualifiers.
Referenced by analyzed_type_p(), entity_volatile_variable_p(), and pointer_expression_to_transformer().
list char_entities = list_undefined |
Definition at line 896 of file variable.c.
Referenced by make_new_entity().
list complex_entities = list_undefined |
Definition at line 894 of file variable.c.
Referenced by make_new_entity().
|
static |
Definition at line 865 of file variable.c.
Referenced by make_new_entity().
|
static |
These globals variables count the number of temporary and auxiliary entities.
Each time such a variable is created, the corresponding counter is incremented.
FI: this must be wrong. A function to reset count_tmp and count_aux is needed if tpips or wpips are to work in a consistent way! gcc complains that they are not used... but they are defined!
Definition at line 864 of file variable.c.
Referenced by make_new_entity().
list double_entities = list_undefined |
Definition at line 895 of file variable.c.
Referenced by make_new_entity().
list integer_entities = list_undefined |
Make a new variable entity which name is one letter prefix + one incrementing number.
The function name should be changed. Useless function according to previous ones ?
This entity is either a new temporary or a new auxiliary variable. The parameter "kind" gives the kind of entity to produce. "ba" gives the basic (ie the type) of the entity to create.
The number of the temporaries is given by a global variable named "count_tmp". The number of the auxiliary variables is given by a global variable named "count_aux". These lists memorize all the new created entities of each type. They are used for the declarations of these new variables : temporaries and auxiliaries.
Definition at line 891 of file variable.c.
Referenced by initialize_global_variables(), insert_new_declarations(), make_new_entity(), and reset_global_variables().
list logical_entities = list_undefined |
Definition at line 893 of file variable.c.
Referenced by make_new_entity().
list real_entities = list_undefined |
Definition at line 892 of file variable.c.
Referenced by make_new_entity().
|
static |
Definition at line 417 of file variable.c.
Referenced by make_new_scalar_variable_with_prefix(), and reset_unique_variable_numbers().
|
static |
Definition at line 415 of file variable.c.
Referenced by make_new_derived_entity_with_prefix(), make_new_scalar_variable_with_prefix(), and reset_unique_variable_numbers().
|
static |
New Temporary Variables MANAGEMENT
Definition at line 414 of file variable.c.
Referenced by make_new_derived_entity_with_prefix(), make_new_scalar_variable_with_prefix(), and reset_unique_variable_numbers().
|
static |
Definition at line 416 of file variable.c.
Referenced by make_new_derived_entity_with_prefix(), make_new_scalar_variable_with_prefix(), and reset_unique_variable_numbers().
|
static |
Definition at line 418 of file variable.c.
Referenced by make_new_scalar_variable_with_prefix().