PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "linear.h"
#include "genC.h"
#include "ri-util.h"
#include "misc.h"
Go to the source code of this file.
Functions | |
string | build_new_top_level_module_name (const char *prefix, bool prevent_suffix) |
Get a new name for a module built from a prefix. More... | |
bool | static_module_p (entity e) |
Check if the given module entity is a static module. More... | |
bool | compilation_unit_entity_p (entity e) |
Check if the given module entity is a compilation unit. More... | |
bool | variable_in_module_p2 (entity v, entity m) |
void | variable_declaration_verify (reference ref) |
void | symbolic_constant_declaration_verify (call c) |
void | add_non_declared_reference_to_declaration (reference ref) |
void | add_symbolic_constant_to_declaration (call c) |
bool | variable_declaration_coherency_p (entity module, statement st) |
static string | get_end_of_header_comments (string the_comments) |
Look for the end of header comments: More... | |
sentence | get_header_comments (entity module) |
Get the header comments (before PROGRAM, FUNCTION,...) from the text declaration: More... | |
sentence | get_declaration_comments (entity module) |
Get all the declaration comments, that are comments from the PROGRAM, FUNCTION,... More... | |
list | module_formal_parameters (entity func) |
list module_formal_parameters(entity func) input : an entity representing a function. More... | |
int | module_to_declaration_length (entity func) |
Number of user declaration lines for a module. More... | |
list | declaration_supporting_references (list dl) |
Find all references in the declaration list. More... | |
list | module_all_declarations (entity m) |
The function itself is not in its declarations. More... | |
static bool | x_language_module_p (entity m, unsigned int x) |
Simplified versions of c_module_p() and fortran_module_p(). More... | |
bool | c_language_module_p (entity m) |
bool | fortran_language_module_p (entity m) |
bool | fortran95_language_module_p (entity m) |
entity | generic_function_to_return_value (entity m, bool safe_p) |
Returns the entity rv that carries the value returned by module m, when m is not a C void function or a Fortran subroutine. More... | |
entity | function_to_return_value (entity m) |
Returns the entity rv that carries the value returned by module m, when m is not a C void function or a Fortran subroutine. More... | |
entity | any_function_to_return_value (entity m) |
Same as function_to_return_value(), but returns value_undefined when m is a C void function or a Fortran subroutine. More... | |
bool | return_value_p (entity v) |
Is entity v the return value of some function? More... | |
bool | function_return_value_p (entity v, entity f) |
Is entity v the return value of function f? More... | |
bool | void_function_p (entity m) |
Check if m is a C void function or a Fortran subroutine. More... | |
list | string_to_user_modules (const char *s) |
Build a list of functions from a string s containing SPACE separated function names. More... | |
Variables | |
static bool | module_coherent_p =true |
To have asprintf(): More... | |
static entity | checked_module = entity_undefined |
void add_non_declared_reference_to_declaration | ( | reference | ref | ) |
type t = entity_type(var);
ref | ef |
Definition at line 142 of file module.c.
References checked_module, code_declarations, concatenate(), CONS, copy_storage(), copy_type(), copy_value(), ENTITY, entity_domain, entity_initial, entity_local_name(), entity_name, entity_storage, entity_type, entity_undefined, gen_find_tabulated(), gen_nconc(), make_entity, module_local_name(), MODULE_SEP_STRING, NIL, pips_debug, ref, reference_variable, strdup(), value_code, and variable_in_module_p2().
Referenced by variable_declaration_coherency_p().
void add_symbolic_constant_to_declaration | ( | call | c | ) |
Definition at line 175 of file module.c.
References call_function, checked_module, code_declarations, concatenate(), CONS, copy_storage(), copy_type(), copy_value(), ENTITY, entity_domain, entity_initial, entity_local_name(), entity_name, entity_storage, entity_type, entity_undefined, fprintf(), gen_find_tabulated(), gen_nconc(), ifdebug, make_entity, module_local_name(), MODULE_SEP_STRING, NIL, strdup(), value_code, and value_symbolic_p.
Referenced by variable_declaration_coherency_p().
Same as function_to_return_value(), but returns value_undefined when m is a C void function or a Fortran subroutine.
Definition at line 516 of file module.c.
References generic_function_to_return_value().
Referenced by filter_formal_out_context_according_to_formal_in_context(), points_to_cell_translation(), and points_to_set_block_projection().
Get a new name for a module built from a prefix.
module.c
prefix | is the prefix string |
prevent_suffix | is a flag that prevent from adding a "_0" suffix if possible |
prefix | refix |
prevent_suffix | revent_suffix |
Definition at line 55 of file module.c.
References asprintf, entity_undefined, free(), module_name_to_entity(), prefix, and strdup().
Referenced by build_outline_name(), create_new_module_entity(), gpu_ify_statement(), gpu_memory_apply(), outline_stmts_between_pragmas_in_sequence(), and scalopragma().
Definition at line 447 of file module.c.
References is_language_c, and x_language_module_p().
Referenced by constraints_to_loop_bound(), data_to_prec_for_variables(), generic_reference_to_transformer(), make_bound_expression(), make_constraint_expression(), partial_eval_call(), and precondition_intra_to_inter().
Check if the given module entity is a compilation unit.
Definition at line 87 of file module.c.
References compilation_unit_p(), entity_name, and entity_undefined.
Referenced by c_text_related_entities(), declaration_to_post_pv(), explicit_extern_entity_p(), extern_entity_p(), filtered_declaration_list(), find_enum_of_member(), FindOrCreateCurrentEntity(), generic_function_to_return_value(), linearize_array_generic(), module_entity_to_compilation_unit_entity(), and UpdateEntity().
Find all references in the declaration list.
FI: for efficiency, the type cache used in type_supporting_references() should be moved up here
FI: we should also look up the initial values
dl | l |
Definition at line 392 of file module.c.
References ENTITY, entity_special_area_p(), entity_type, FOREACH, NIL, and type_supporting_references().
Referenced by UseFormalArguments().
Definition at line 457 of file module.c.
References is_language_fortran95, and x_language_module_p().
Referenced by data_to_prec_for_variables().
Definition at line 452 of file module.c.
References is_language_fortran, and x_language_module_p().
Referenced by arguments_are_something(), data_to_prec_for_variables(), partial_eval_call(), and precondition_intra_to_inter().
Is entity v the return value of function f?
Definition at line 529 of file module.c.
References entity_module_name(), entity_user_name(), and f().
Returns the entity rv that carries the value returned by module m, when m is not a C void function or a Fortran subroutine.
rv is supposed to be allocated early by the parser.
Definition at line 509 of file module.c.
References generic_function_to_return_value().
Referenced by C_MakeReturnStatement(), Generate_C_ReturnStatement(), intrinsic_call_to_points_to(), module_to_value_mappings(), points_to_function_projection(), user_call_to_points_to_sinks(), and words_goto_label().
Returns the entity rv that carries the value returned by module m, when m is not a C void function or a Fortran subroutine.
If safe_p, abort if the function is void. Otherwise, return an undefined_entity.
rv is supposed to be allocated early by the parser.
safe_p | afe_p |
Definition at line 469 of file module.c.
References compilation_unit_entity_p(), compute_basic_concrete_type(), entity_basic_concrete_type(), entity_defined_p(), entity_local_name(), entity_undefined, entity_user_name(), f(), FindEntity(), functional_result, pips_assert, pips_internal_error, pips_user_error, type_functional, type_functional_p, and type_void_p.
Referenced by any_function_to_return_value(), and function_to_return_value().
Get all the declaration comments, that are comments from the PROGRAM, FUNCTION,...
stuff up to the end of the declarations:
Get the textual header:
Now, gather all the comments:
Add it to the extracted_comments:
There is no newline, so this is the last comment line:
Build a string that holds the comment:
Have a look to next line if any...
module | odule |
Definition at line 275 of file module.c.
References code_decls_text, comment(), comment_string_p(), concatenate(), entity_code(), free(), get_end_of_header_comments(), is_sentence_formatted, make_sentence(), malloc(), module, and strdup().
Referenced by ensure_comment_consistency().
Look for the end of header comments:
If we are at the end of string or the line is not a comment (it must be a PROGRAM, FUNCTION,... line), it is the end of the header comment:
Look for next line
No return char: it is the last line and it is a comment... Should never happend in a real program without any useful header!
Definition at line 224 of file module.c.
References comment_string_p(), and pips_assert.
Referenced by get_declaration_comments(), and get_header_comments().
Get the header comments (before PROGRAM, FUNCTION,...) from the text declaration:
Get the textual header:
Keep room for the trailing '\0':
module | odule |
Definition at line 254 of file module.c.
References code_decls_text, entity_code(), get_end_of_header_comments(), is_sentence_formatted, make_sentence(), malloc(), and module.
Referenced by ensure_comment_consistency().
The function itself is not in its declarations.
Maybe, it should be changed in the parser?
A new list is allocated to avoid sharing with code_declarations.
Definition at line 419 of file module.c.
References CONS, ENTITY, entity_declarations, and gen_copy_seq().
Referenced by UseFormalArguments().
list module_formal_parameters(entity func) input : an entity representing a function.
output : the ordered list (of entities) of parameters of the function "func". modifies : nothing. comment : Made from "entity_to_formal_integer_parameters()" that considers only integer variables.
Dummy parameters should have been filtered out of the declarations by the parser, but let's be careful here. As a consequence, dummy parameters cannot be retrieved, except thru the type.
func | unc |
Definition at line 327 of file module.c.
References code_declarations, CONS, dummy_parameter_entity_p(), ENTITY, entity_code(), entity_initial, entity_module_p(), entity_storage, FOREACH, gen_nreverse(), list_undefined, NIL, pips_assert, storage_formal_p, and value_reference_p.
Referenced by inline_expression_call(), interprocedural_mapping(), module_initial_parameter_pv(), normalize_microcode_anotate(), sort_parameters(), translate_arguments(), xml_FormalVariables(), xml_ParameterUseToArrayBound(), and xml_TaskParameters().
Number of user declaration lines for a module.
Is it allowed? The declaration text may be destroyed or may not exist when a module is synthesized or heavily transformed.
Entity func has not been parsed yet
func | unc |
Definition at line 352 of file module.c.
References code_decls_text, code_undefined, entity_initial, entity_name, pips_internal_error, string_undefined, string_undefined_p, value_code, value_code_p, and value_undefined_p.
Referenced by make_filtered_dg_or_dvdg(), and prettyprint_dependence_graph().
Is entity v the return value of some function?
Definition at line 522 of file module.c.
References entity_module_name(), and entity_user_name().
Check if the given module entity is a static module.
Definition at line 80 of file module.c.
References entity_name, and static_module_name_p().
Referenced by c_text_related_entities(), CreateEntityFromLocalNameAndPrefix(), CreateMemberScope(), FindEntityFromLocalNameAndPrefixAndScope(), FindOrCreateCurrentEntity(), sentence_head(), and sentence_tail().
list string_to_user_modules | ( | const char * | s | ) |
Build a list of functions from a string s containing SPACE separated function names.
Beware of ambiguities that static function names may cause.
See also string_to_entities() and a similar piece of code in inlining.c that was used to code this function.
FI: warning at a very low level, with no information about the context. Might be better to return list_undefined on a conversion failure?
Definition at line 562 of file module.c.
References CONS, ENTITY, entity_undefined_p, free(), local_name_to_top_level_entity(), NIL, pips_user_warning, and strdup().
Referenced by loop_fully_unrollable_p().
void symbolic_constant_declaration_verify | ( | call | c | ) |
Definition at line 128 of file module.c.
References call_function, checked_module, entity_initial, entity_name, fprintf(), ifdebug, module_coherent_p, value_symbolic_p, and variable_in_module_p2().
module | odule |
st | t |
Definition at line 203 of file module.c.
References add_non_declared_reference_to_declaration(), add_symbolic_constant_to_declaration(), call_domain, checked_module, entity_undefined, gen_multi_recurse(), gen_true(), module, module_coherent_p, and reference_domain.
Referenced by wp65().
void variable_declaration_verify | ( | reference | ref | ) |
ref | ef |
Definition at line 116 of file module.c.
References checked_module, entity_name, fprintf(), module_coherent_p, ref, reference_variable, and variable_in_module_p2().
Definition at line 94 of file module.c.
References code_declarations, dump_arguments(), entity_initial, entity_is_argument_p(), entity_module_name(), entity_name, ifdebug, module_local_name(), pips_debug, same_string_p, and value_code.
Referenced by add_non_declared_reference_to_declaration(), symbolic_constant_declaration_verify(), and variable_declaration_verify().
Check if m is a C void function or a Fortran subroutine.
No information about m is available when false is returned.
Definition at line 538 of file module.c.
References entity_type, f(), functional_result, type_functional, type_functional_p, type_void_p, and ultimate_type().
Referenced by words_goto_label().
Simplified versions of c_module_p() and fortran_module_p().
They cannot be used before the parsing is advanced unlike the other above two functions located in preprocessor, but they only require stuff from ri-util.
Definition at line 432 of file module.c.
References code_language, entity_initial, language_tag, value_code, value_code_p, and x.
Referenced by c_language_module_p(), fortran95_language_module_p(), and fortran_language_module_p().
|
static |
Definition at line 41 of file module.c.
Referenced by add_non_declared_reference_to_declaration(), add_symbolic_constant_to_declaration(), symbolic_constant_declaration_verify(), variable_declaration_coherency_p(), and variable_declaration_verify().
To have asprintf():
Definition at line 40 of file module.c.
Referenced by symbolic_constant_declaration_verify(), variable_declaration_coherency_p(), and variable_declaration_verify().