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.
Functions | |
void | check_fortran_declaration_dependencies (list ldecl) |
Regeneration of declarations from the symbol table. More... | |
list | get_common_members (entity common, entity __attribute__((unused)) module, bool __attribute__((unused)) only_primary) |
The fprint_functional() and fprint_environment() functions are moved from syntax/declaration.c. More... | |
void | print_C_common_layout (FILE *fd, entity c, bool debug_p) |
void | fprint_functional (FILE *fd, functional f) |
This function is called from c_parse() via ResetCurrentModule() and fprint_environment() More... | |
void | fprint_environment (FILE *fd, entity m) |
void | fprint_C_environment (FILE *fd, entity m) |
void | fprint_any_environment (FILE *fd, entity m, bool is_fortran) |
void | split_initializations_in_statement (statement s) |
Transform a declaration with an initialization statement into 2 parts, a declaration statement and an initializer statement. More... | |
void | dump_functional (functional f, string_buffer result) |
void check_fortran_declaration_dependencies | ( | list | ldecl | ) |
Regeneration of declarations from the symbol table.
declarations.c
Regeneration of declarations... #define LIST_SEPARATOR (is_fortran? ", " : ",")
Check that each declaration only depends on previous declarations
Formal parameters are put in ldecl right away when parsing the SUBROUTINE or FUNCTION statement. The placement of their actual declaration is unknown. They may depend on PARAMETERs declared later
Should be a ParserError() when called from ProcessEntries()...
ldecl | decl |
Definition at line 47 of file declarations.c.
References CAR, ENDP, ENTITY, entity_initial, entity_scalar_p(), entity_storage, entity_symbolic_p, entity_type, entity_user_name(), FOREACH, fortran_type_supporting_entities(), gen_free_list(), gen_position(), list_undefined, NIL, pips_user_error, pips_user_warning, POP, storage_formal_p, type_variable_p, and value_symbolic_p.
Referenced by text_entity_declaration().
void dump_functional | ( | functional | f, |
string_buffer | result | ||
) |
FI: we could do nothing or put "void". I choose to put "void" to give more information about the internal representation.
NL
NL
NL
An argument can be functional, but not (yet) a result.
result | esult |
Definition at line 581 of file declarations.c.
References basic_pointer, basic_pointer_p, basic_to_string(), concatenate(), ENDP, f(), FOREACH, functional_parameters, functional_result, gen_length(), parameter_type, pips_assert, pips_internal_error, string_buffer_append(), type_functional, type_functional_p, type_tag, type_to_string(), type_unknown_p, type_varargs, type_varargs_p, type_variable, type_variable_p, type_void_p, variable_basic, and variable_dimensions.
Referenced by get_symbol_table(), and words_type().
rank of formal parameter
return variable
To simplify validation, at the expense of some information about the parsing process.
In C, no return entity is created (yet). See MakeCurrentModule().
List of implicitly and explicitly declared variables, functions and areas
List of external variables and functions and areas
Formal parameters
Return variable
Structure of each area/common
fd | d |
is_fortran | s_fortran |
Definition at line 297 of file declarations.c.
References area_size, basic_to_string(), code_declarations, code_externs, compare_entities(), ENDP, ENTITY, entity_initial, entity_module_p(), entity_name, entity_storage, entity_type, entity_undefined, entity_undefined_p, formal_offset, fprint_functional(), fprintf(), gen_copy_seq(), gen_free_list(), gen_sort_list(), MAP, module_local_name(), pips_assert, print_C_common_layout(), print_common_layout(), SizeOfArray(), storage_formal, storage_formal_p, storage_return_p, storage_rom_p, storage_undefined_p, type_area, type_area_p, type_functional, type_functional_p, type_to_string(), type_variable, type_variable_p, value_code, and variable_basic.
Referenced by fprint_C_environment(), and fprint_environment().
void fprint_C_environment | ( | FILE * | fd, |
entity | m | ||
) |
fd | d |
Definition at line 292 of file declarations.c.
References fprint_any_environment().
Referenced by ResetCurrentCompilationUnitEntity(), and ResetCurrentModule().
void fprint_environment | ( | FILE * | fd, |
entity | m | ||
) |
fd | d |
Definition at line 287 of file declarations.c.
References fprint_any_environment().
Referenced by EndOfProcedure(), make_array_communication_module(), make_scalar_communication_module(), make_start_ru_module(), make_wait_ru_module(), ProcessEntry(), and store_new_module().
void fprint_functional | ( | FILE * | fd, |
functional | f | ||
) |
This function is called from c_parse() via ResetCurrentModule() and fprint_environment()
(void) fprintf(fd, " %s:", type_to_string(ta));
Well, seems to occur for C compilation units, instead of void...
An argument can be functional, but not (yet) a result.
fd | d |
Definition at line 227 of file declarations.c.
References basic_to_string(), count, ENDP, f(), FOREACH, fprintf(), functional_parameters, functional_result, PARAMETER, parameter_type, pips_assert, pips_internal_error, type_functional, type_functional_p, type_tag, type_to_string(), type_unknown_p, type_varargs, type_varargs_p, type_variable, type_variable_p, type_void_p, and variable_basic.
Referenced by DeclareVariable(), fprint_any_environment(), and UpdateFunctionalType().
list get_common_members | ( | entity | common, |
entity __attribute__((unused)) | module, | ||
bool __attribute__((unused)) | only_primary | ||
) |
The fprint_functional() and fprint_environment() functions are moved from syntax/declaration.c.
C Version of print_common_layout this is called by fprint_environment(). This function is much simpler than Fortran Version
Definition at line 106 of file declarations.c.
References area_layout, CAR, CDR, CONS, ENDP, ENTITY, entity_storage, entity_type, entity_undefined, gen_nreverse(), NIL, pips_assert, storage_ram_p, type_area, and type_area_p.
Referenced by dump_common_layout(), and print_C_common_layout().
Look for variables aliased with a variable in this common
fd | d |
debug_p | ebug_p |
Definition at line 129 of file declarations.c.
References area_size, arguments_difference(), arguments_union(), DYNAMIC_RAM_OFFSET, ENDP, ENTITY, entity_module_name(), entity_name, entity_storage, entity_type, fprintf(), gen_free_list(), get_common_members(), get_current_module_entity(), MAP, NIL, pips_assert, ram_offset, ram_shared, SizeOfArray(), sort_list_of_entities(), storage_ram, storage_ram_p, type_area, UNDEFINED_RAM_OFFSET, and user_warning.
Referenced by fprint_any_environment().
void split_initializations_in_statement | ( | statement | s | ) |
Transform a declaration with an initialization statement into 2 parts, a declaration statement and an initializer statement.
gen_recurse callback on exiting statements. For a declaration to be split:
generate C99 code
The initialization of a static variable cannot be split
if this transformation led to an uninitialized const, remove the const qualifier
This is not very smart... You do not need pcs in C99 since you are going to add the assignment statements just after the current declaration statement...
Chain the new list within the current statement list
Move to the next original element nsl
Move to the next statement
Move to the next statement
generate C89 code
Do nothing ?
Definition at line 437 of file declarations.c.
References brace_expression_to_statements(), brace_expression_to_updated_type(), CAR, CDR, CONS, declaration_statement_p(), ENDP, ENTITY, entity_array_p(), entity_basic_concrete_type(), entity_initial, entity_module_name(), entity_qualifiers(), entity_static_variable_p(), entity_to_expression(), entity_type, entity_user_name(), expression_is_C_rhs_p(), expression_undefined_p, FOREACH, gen_copy_seq(), gen_free_list(), gen_last(), gen_nconc(), gen_remove_once(), get_bool_property(), get_current_module_name(), instruction_block, list_undefined, make_assign_statement(), make_value_unknown(), NIL, pips_user_warning, POP, QUALIFIER, qualifier_const_p, same_string_p, STATEMENT, statement_block(), statement_block_p, statement_declarations, statement_instruction, struct_type_p(), type_variable, value_unknown_p, variable_initial_expression(), and variable_qualifiers.
Referenced by MakeForloopWithIndexDeclaration(), and statement_split_initializations().