PIPS
|
Go to the source code of this file.
Macros | |
#define | START_COMMENT_LINE "CcDd*!#\n" |
Warning! Do not modify this file that is automatically generated! More... | |
#define | HASH_SIZE 1013 |
definition of implementation dependent constants More... | |
#define | FORMATLENGTH (4096) |
#define | LOCAL static |
#define | abs(v) (((v) < 0) ? -(v) : (v)) |
#define | Warning(f, m) (user_warning(f,"Warning between lines %d and %d\n%s\n",line_b_I,line_e_I,m) ) |
extern char * getenv(); More... | |
#define | FatalError(f, m) (pips_internal_error("Fatal error between lines %d and %d\n%s\n",line_b_I,line_e_I,m)) |
Functions | |
int | syn_lex () |
void | syn_reset_lex () |
int | syn_parse () |
void | syn_error (const char *) |
int | SafeSizeOfArray (entity) |
cproto-generated files More... | |
void | InitAreas (void) |
void | save_all_entities (void) |
functions for the SAVE declaration More... | |
void | SaveEntity (entity) |
These two functions transform a dynamic variable into a static one. More... | |
void | MakeVariableStatic (entity, bool) |
void | ProcessSave (entity) |
void | save_initialized_variable (entity) |
void | SaveCommon (entity) |
this function transforms a dynamic common into a static one. More... | |
void | PrintData (cons *, cons *) |
a debugging function, just in case ... More... | |
void | AnalyzeData (list, list) |
this function scans at the same time a list of datavar and a list of dataval. More... | |
void | MakeDataStatement (list, list) |
Receives as first input an implicit list of references, including implicit DO, and as second input an list of value using pseudo-intrinsic REPEAT_VALUE() to replicate values. More... | |
void | DeclarePointer (entity, entity, list) |
void | DeclareVariable (entity, type, list, storage, value) |
void DeclareVariable(e, t, d, s, v): update entity e description as declaration statements are encountered. More... | |
void | DeclareIntrinsic (entity) |
Intrinsic e is used in the current module. More... | |
bool | fortran_relevant_area_entity_p (entity) |
These tests are needed to check area consistency when dumping or printing a symbol table. More... | |
void | initialize_common_size_map (void) |
void | reset_common_size_map (void) |
void | reset_common_size_map_on_error (void) |
bool | common_to_defined_size_p (entity) |
size_t | common_to_size (entity) |
void | set_common_to_size (entity, size_t) |
void | update_common_to_size (entity, size_t) |
entity | MakeCommon (entity) |
MakeCommon: This function creates a common block. More... | |
entity | NameToCommon (string) |
void | AddVariableToCommon (entity, entity) |
This function adds a variable v to a common block c. More... | |
int | CurrentOffsetOfArea (entity, entity) |
void | update_common_sizes (void) |
void | InitImplicit (void) |
this function initializes the data structure used to compute implicit types More... | |
void | cr_implicit (tag, int, int, int) |
this function updates the data structure used to compute implicit types. More... | |
type | ImplicitType (entity) |
This function computes the Fortran implicit type of entity e. More... | |
bool | implicit_type_p (entity) |
This function checks that entity e has an undefined or an implicit type which can be superseded by another declaration. More... | |
void | retype_formal_parameters (void) |
If an IMPLICIT statement is encountered, it must be applied to the formal parameters, and, if the current module is a function, to the function result type and to the variable used internally when a value is assigned to the function (see MakeCurrentFunction) More... | |
type | MakeFortranType (tag, value) |
this function creates a type that represents a fortran type. More... | |
int | OffsetOfReference (reference) |
This function computes the numerical offset of a variable element from the begining of the variable. More... | |
int | ValueOfIthLowerBound (entity, int) |
this function returns the size of the ith lower bound of a variable e. More... | |
int | SizeOfRange (range) |
This function computes the size of a range, ie. More... | |
int | IsIntegerScalar (entity) |
FI: should be moved in ri-util; this function returns true if e is a zero dimension variable of basic type integer. More... | |
void | update_user_common_layouts (entity) |
Check... More... | |
bool | update_common_layout (entity, entity) |
(Re)compute offests of all variables allocated in common c from module m and update (if necessary) the size of common c for the whole program or set of modules in the current workspace. More... | |
entity | SafeFindOrCreateEntity (const char *, const char *) |
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a function or subroutine call as functional parameter. More... | |
void | add_entity_to_declarations (string, string, enum basic_utype tag, void *) |
FI: I do not understand the naming here, or the parameter. More... | |
entity | MakeParameter (entity, expression) |
lint More... | |
expression | MakeImpliedDo (syntax, range, cons *) |
expressions from input output lists might contain implied do loops. More... | |
expression | loop_to_implieddo (loop) |
syntax | MakeAtom (entity, cons *, expression, expression, int) |
MakeAtom: this function creates a syntax, ie. More... | |
cons * | MakeIoList (cons *) |
This function takes a list of io elements (i, j, t(i,j)), and returns the same list, with a cons cell pointing to a character constant expression 'IOLIST=' before each element of the original list. More... | |
list | FortranExpressionList (list) |
Make sure that no call to implied do is in l. More... | |
expression | MakeFortranBinaryCall (entity, expression, expression) |
expression | MakeFortranUnaryCall (entity, expression) |
syntax | CheckLeftHandSide (syntax) |
If a left hand side is a call, it should be a substring operator or a macro. More... | |
entity | make_Fortran_constant_entity (string, tag, size_t) |
void | ResetChains (void) |
undefine chains between two successives calls to parser More... | |
void | SetChains (void) |
initialize chains before each call to the parser More... | |
atom | MakeEquivAtom (syntax) |
this function creates an atom of an equivalence chain. More... | |
void | StoreEquivChain (chain) |
This function is called when an equivalence chain has been completely parsed. More... | |
void | ComputeEquivalences (void) |
This function merges all the equivalence chains to take into account equivalences due to transitivity. More... | |
int | AddOrMergeChain (chain) |
this function adds a chain ct to the set of equivalences. More... | |
int | ChainIntersection (cons *, cons *) |
this function returns true if the there is a variable that occurs in both atom lists. More... | |
cons * | MergeTwoChains (cons *, cons *) |
this function merges two equivalence chains whose intersection is not empty, ie. More... | |
void | PrintChains (equivalences) |
two debugging functions, just in case ... More... | |
void | PrintChain (chain) |
bool | entity_in_equivalence_chains_p (entity) |
bool | entity_in_equivalence_chain_p (entity, chain) |
void | ComputeAddresses (void) |
This function computes an address for every variable. More... | |
void | SaveChains (void) |
Initialize the shared fields of aliased variables. More... | |
void | reset_current_label_string (void) |
string | get_current_label_string (void) |
void | set_current_label_string (string) |
bool | empty_current_label_string_p (void) |
bool | ParserError (const char *, const char *) |
void | BeginingOfParsing (void) |
this function is called for each new file (FI: once?) FI: I do not understand how this works. More... | |
bool | hpfc_parser (const string) |
parser for HPFC. More... | |
bool | parser (const string) |
void | init_parser_properties (void) |
void | init_ghost_variable_entities (void) |
procedure.c More... | |
void | substitute_ghost_variable_in_expression (expression, entity, entity) |
void | substitute_ghost_variable_in_statement (statement, entity, entity) |
void | remove_ghost_variable_entities (bool) |
void | add_ghost_variable_entity (entity) |
void | reify_ghost_variable_entity (entity) |
It is possible to change one's mind and effectively use an entity which was previously assumed useless. More... | |
bool | ghost_variable_entity_p (entity) |
void | BeginingOfProcedure (void) |
this function is called each time a new procedure is encountered. More... | |
void | update_called_modules (entity) |
void | remove_from_called_modules (entity) |
macros are added, although they should not have been. More... | |
void | AbortOfProcedure (void) |
void | EndOfProcedure (void) |
This function is called when the parsing of a procedure is completed. More... | |
void | UpdateFunctionalType (entity, list) |
This function analyzes the CurrentFunction formal parameter list to determine the CurrentFunction functional type. More... | |
void | remove_module_entity (entity) |
void | MakeCurrentFunction (type, int, const char *, list) |
this function creates one entity cf that represents the Fortran function f being analyzed. More... | |
void | ResetEntries (void) |
void | AbortEntries (void) |
bool | EmptyEntryListsP (void) |
void | AddEntryLabel (entity) |
void | AddEntryTarget (statement) |
void | AddEntryEntity (entity) |
void | AddEffectiveFormalParameter (entity) |
Keep track of the formal parameters for the current module. More... | |
bool | IsEffectiveFormalParameterP (entity) |
entity | SafeLocalToGlobal (entity, type) |
A local entity might have been created but found out later to be global, depending on the order of declaration statements (see MakeExternalFunction()). More... | |
type | MakeResultType (entity, type) |
The result type of a function may be carried by e, by r or be implicit. More... | |
entity | LocalToGlobal (entity) |
instruction | MakeEntry (entity, list) |
An ENTRY statement is substituted by a labelled continue. More... | |
void | ProcessEntries (void) |
entity | NameToFunctionalEntity (string) |
void | TypeFunctionalEntity (entity, type) |
entity | MakeExternalFunction (entity, type) |
entity | DeclareExternalFunction (entity) |
void | MakeFormalParameter (entity, entity, int) |
This function transforms an untyped entity into a formal parameter. More... | |
void | ScanFormalParameters (entity, list) |
this function scans the formal parameter list. More... | |
void | UpdateFormalStorages (entity, list) |
this function check and set if necessary the storage of formal parameters in lfp. More... | |
void | append_data_current_stmt_buffer_to_declarations (void) |
void | parser_reset_all_reader_buffers (void) |
void | init_parser_reader_properties (void) |
int | syn_wrap (void) |
void | ScanNewFile (void) |
La fonction a appeler pour l'analyse d'un nouveau fichier. More... | |
int | IsCapKeyword (char *) |
Fonction appelee par sslex sur la reduction de la regle de reconnaissance des mot clefs. More... | |
int | PipsGetc (FILE *) |
Routine de lecture pour l'analyseur lexical, lex ou flex. More... | |
int | GetChar (FILE *) |
Routine de lecture physique. More... | |
int | ReadLine (FILE *) |
All physical lines of a statement are put together in a unique buffer called "line_buffer". More... | |
int | ReadStmt (FILE *) |
regroupement des lignes du statement en une unique ligne sans continuation More... | |
void | CheckParenthesis (void) |
int | FindDoWhile (void) |
This function is redundant with FindDo() but much easier to understand. More... | |
int | FindDo (void) |
int | FindImplicit (void) |
int | FindIfArith (void) |
void | FindIf (void) |
void | FindAutre (void) |
int | FindAssign (void) |
void | FindPoints (void) |
size_t | FindProfZero (int) |
size_t | FindMatchingPar (size_t) |
int | StmtEqualString (char *, int) |
int | CapitalizeStmt (char[], int) |
int | NeedKeyword (void) |
void | dump_current_statement (void) |
int | get_statement_number (void) |
eturn the line number of the statement being parsed More... | |
void | parser_reset_StmtHeap_buffer (void) |
statement.c More... | |
statement | LabelToStmt (string) |
this functions looks up in table StmtHeap for the statement s whose label is l. More... | |
void | CheckAndInitializeStmt (void) |
this function looks for undefined labels. More... | |
void | NewStmt (entity, statement) |
this function stores a new association in table StmtHeap: the label of statement s is e. More... | |
void | ResetBlockStack (void) |
bool | IsBlockStackEmpty (void) |
bool | IsBlockStackFull (void) |
void | PushBlock (instruction, string) |
instruction | PopBlock (void) |
entity | MakeLabel (const char *) |
statement | MakeNewLabelledStatement (entity, instruction) |
statement | ReuseLabelledStatement (statement, instruction) |
statement | MakeStatement (entity, instruction) |
This function makes a statement. More... | |
void | LinkInstToCurrentBlock (instruction, bool) |
this function links the instruction i to the current block of statements. More... | |
instruction | MakeEmptyInstructionBlock (void) |
this function creates an empty block More... | |
instruction | MakeZeroOrOneArgCallInst (char *, expression) |
this function creates a simple Fortran statement such as RETURN, CONTINUE, ... More... | |
instruction | MakeGotoInst (string) |
this function creates a goto instruction. More... | |
instruction | make_goto_instruction (entity) |
In a "go to" instruction, the label does not appear explictly. More... | |
instruction | MakeComputedGotoInst (list, expression) |
instruction | MakeAssignedGotoInst (list, entity) |
instruction | MakeAssignedOrComputedGotoInst (list, expression, bool) |
instruction | MakeAssignInst (syntax, expression) |
this function creates an affectation statement. More... | |
void | update_functional_type_result (entity, type) |
Update of the type returned by function f. More... | |
void | update_functional_type_with_actual_arguments (entity, list) |
instruction | MakeCallInst (entity, cons *) |
this function creates a call statement. More... | |
void | MakeDoInst (syntax, range, string) |
this function creates a do loop statement. More... | |
void | MakeWhileDoInst (expression, string) |
This function creates a while do loop statement. More... | |
expression | fix_if_condition (expression) |
instruction | MakeLogicalIfInst (expression, instruction) |
this function creates a logical if statement. More... | |
instruction | MakeArithmIfInst (expression, string, string, string) |
this function transforms an arithmetic if statement into a set of regular tests. More... | |
void | MakeBlockIfInst (expression, int) |
this function and the two next ones create a block if statement. More... | |
int | MakeElseInst (bool) |
This function is used to handle either an ELSE or an ELSEIF construct. More... | |
void | MakeEndifInst (void) |
void | MakeEnddoInst (void) |
string | NameOfToken (int) |
statement | make_check_io_statement (string, expression, entity) |
Generate a test to jump to l if flag f is TRUE Used to implement control effects of IO's due to ERR= and END=. More... | |
instruction | MakeIoInstA (int, list, list) |
this function creates an IO statement. More... | |
instruction | MakeIoInstB (int, expression, expression, expression, expression) |
this function creates a BUFFER IN or BUFFER OUT io statement. More... | |
instruction | MakeSimpleIoInst1 (int, expression unit) |
instruction | MakeSimpleIoInst2 (int, expression, list) |
void | reset_first_statement (void) |
void | set_first_format_statement (void) |
bool | first_executable_statement_seen (void) |
bool | first_format_statement_seen (void) |
void | check_in_declarations (void) |
void | check_first_statement (void) |
This function is called each time an executable statement is encountered but is effective the first time only. More... | |
void | SubstituteAlternateReturns (const char *) |
return.c More... | |
bool | SubstituteAlternateReturnsP (void) |
entity | GetReturnCodeVariable (void) |
bool | ReturnCodeVariableP (entity) |
void | ResetReturnCodeVariable (void) |
bool | uses_alternate_return_p (void) |
void | uses_alternate_return (bool) |
void | set_current_number_of_alternate_returns (void) |
void | reset_current_number_of_alternate_returns (void) |
int | get_current_number_of_alternate_returns (void) |
list | add_formal_return_code (list) |
Update the formal and actual parameter lists by adding the return code variable as last argument. More... | |
list | add_actual_return_code (list) |
void | add_alternate_return (string) |
list | get_alternate_returns (void) |
void | set_alternate_returns (void) |
void | reset_alternate_returns (void) |
void | soft_reset_alternate_returns (void) |
ParserError() cannot guess if it has been performed or not, because it is reinitialized before and after each call statement. More... | |
instruction | generate_return_code_checks (list) |
instruction | MakeReturn (expression) |
void | GenerateReturn (void) |
Generate a unique call to RETURN per module. More... | |
void | print_malloc_info (FILE *) |
malloc-info.c More... | |
void | print_full_malloc_info (FILE *) |
void | parser_init_macros_support (void) |
macros.c More... | |
void | parser_close_macros_support (void) |
bool | parser_entity_macro_p (entity) |
void | parser_add_a_macro (call, expression) |
void | reset_substitute_expression_in_expression (void) |
void | parser_macro_expansion (expression) |
void | parser_substitute_all_macros (statement) |
void | parser_substitute_all_macros_in_expression (expression) |
void | syn_restart (FILE *) |
void | syn_pop_buffer_state (void) |
int | syn_get_lineno (void) |
FILE * | syn_get_in (void) |
FILE * | syn_get_out (void) |
int | syn_get_leng (void) |
char * | syn_get_text (void) |
void | syn_set_lineno (int) |
void | syn_set_in (FILE *) |
void | syn_set_out (FILE *) |
int | syn_get_debug (void) |
void | syn_set_debug (int) |
int | syn_lex_destroy (void) |
void * | syn_alloc (yy_size_t) |
void * | syn_realloc (void *, yy_size_t) |
void | syn_free (void *) |
Variables | |
FILE * | syn_in |
lex yacc interface More... | |
entity | DynamicArea |
These global variables are declared in ri-util/util.c. More... | |
entity | StaticArea |
entity | HeapArea |
entity | StackArea |
entity | AllocatableArea |
char | vcid_syntax_expression [] |
expression.c More... | |
char | vcid_syntax_equivalence [] |
equivalence.c More... | |
char * | CurrentFN |
parser.c More... | |
cons * | FormalParameters |
the current function More... | |
const char * | CurrentPackage |
the name of the current package, i.e. More... | |
int | line_b_I |
Indicates where the current instruction (in fact statement) starts and ends in the input file and gives its label. More... | |
int | line_e_I |
int | line_b_C |
int | line_e_C |
char | lab_I [6] |
char | FormatValue [(4096)] |
a string that will contain the value of the format in case of format statement More... | |
bool | InParserError |
Parser error handling. More... | |
char * | Comm |
reader.c More... | |
char * | PrevComm |
char * | CurrComm |
int | iComm |
int | iPrevComm |
int | iCurrComm |
int | ici |
syn_yacc.c More... | |
type | CurrentType |
to count control specifications in IO statements More... | |
intptr_t | CurrentTypeSize |
the type in a type or dimension or common statement More... | |
int | syn_char |
int | syn_nerrs |
int | syn_leng |
scanner.c More... | |
FILE * | syn_out |
int | syn_lineno |
int | syn__flex_debug |
char * | syn_text |
#define FatalError | ( | f, | |
m | |||
) | (pips_internal_error("Fatal error between lines %d and %d\n%s\n",line_b_I,line_e_I,m)) |
#define HASH_SIZE 1013 |
#define START_COMMENT_LINE "CcDd*!#\n" |
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/syntax/syntax-local.h instead, to add your own modifications. header file built by cproto syntax-local.h Legal characters to start a comment line
'
' is added to cope with empty lines Empty lines with SPACE and TAB characters are be preprocessed and reduced to an empty line by GetChar().
#define Warning | ( | f, | |
m | |||
) | (user_warning(f,"Warning between lines %d and %d\n%s\n",line_b_I,line_e_I,m) ) |
void AbortEntries | ( | void | ) |
Useless entities should be reset
the current module statement is used when processing entries
Definition at line 1473 of file procedure.c.
References CleanLocalEntities(), effective_formal_parameters, ENTITY, entry_entities, entry_labels, entry_targets, error_reset_current_module_statement(), free_entity(), gen_free_list(), MAP, and NIL.
Referenced by ParserError().
void AbortOfProcedure | ( | void | ) |
get rid of ghost variable entities
Definition at line 386 of file procedure.c.
References ghost_variable_entities, list_undefined_p, remove_ghost_variable_entities(), and ResetBlockStack().
Referenced by ParserError().
apl | pl |
Definition at line 222 of file return.c.
References CONS, ENDP, entity_to_expression(), EXPRESSION, gen_nconc(), get_alternate_returns(), GetFullyDefinedReturnCodeVariable(), hide_rc_p, NIL, and substitute_rc_p.
Referenced by MakeCallInst().
void add_alternate_return | ( | string | label_name | ) |
label_name | abel_name |
Definition at line 242 of file return.c.
References alternate_returns, arguments_add_entity(), entity_undefined, line_b_I, line_e_I, MakeLabel(), pips_user_warning, and substitute_rc_p.
void add_entity_to_declarations | ( | string | name, |
string | area_name, | ||
enum basic_utype | tag, | ||
void * | val | ||
) |
FI: I do not understand the naming here, or the parameter.
The name of the new variable must be a global name, whereas the name of the area is a local name. And the area does not have to be the stack area...
Why is this variable called "stack area" when it can be any area?
name | ame |
area_name | rea_name |
val | al |
Definition at line 1969 of file declaration.c.
References AddEntityToDeclarations(), CurrentOffsetOfArea(), discard_module_declaration_text(), entity_initial, entity_storage, entity_type, FindEntity(), FindOrCreateTopLevelEntity(), get_current_module_entity(), make_basic(), make_ram(), make_storage_ram(), make_type_variable(), make_value_unknown(), make_variable(), module_local_name(), module_name(), and NIL.
Update the formal and actual parameter lists by adding the return code variable as last argument.
To avoid an explicit check in gram.y which is large enough, the additions are conditional to the alternate return substitution.
Type, storage and initial value are set up later in MakeFormalParameter()
fpl | pl |
Definition at line 209 of file return.c.
References CONS, ENTITY, gen_nconc(), GetReturnCodeVariable(), hide_rc_p, NIL, substitute_rc_p, and uses_alternate_return_p().
Referenced by MakeCurrentFunction().
void add_ghost_variable_entity | ( | entity | e | ) |
Definition at line 275 of file procedure.c.
References arguments_add_entity(), ghost_variable_entities, list_undefined_p, and pips_assert.
Referenced by SafeLocalToGlobal().
void AddEffectiveFormalParameter | ( | entity | f | ) |
Keep track of the formal parameters for the current module.
Definition at line 1529 of file procedure.c.
References arguments_add_entity(), effective_formal_parameters, and f().
Referenced by MakeEntry().
void AddEntryEntity | ( | entity | e | ) |
Definition at line 1523 of file procedure.c.
References arguments_add_entity(), and entry_entities.
Referenced by MakeEntry().
void AddEntryLabel | ( | entity | l | ) |
Definition at line 1513 of file procedure.c.
References arguments_add_entity(), and entry_labels.
Referenced by MakeEntry().
void AddEntryTarget | ( | statement | s | ) |
Definition at line 1518 of file procedure.c.
References CONS, entry_targets, gen_nconc(), NIL, and STATEMENT.
Referenced by MakeEntry().
this function adds a chain ct to the set of equivalences.
if the intersection with all other chains is empty, ct is just added to the set. Otherwise ct is merged with the chain that intersects ct.
ct | t |
Definition at line 269 of file equivalence.c.
References CAR, CDR, CHAIN, chain_atoms, ChainIntersection(), CONS, EQUIADD, EQUIMERGE, equivalences_chains, FinalEquivSet, make_chain(), MergeTwoChains(), and NIL.
Referenced by ComputeEquivalences().
This function adds a variable v to a common block c.
v's storage must be undefined.
c's size used to be indirectly updated by CurrentOffsetOfArea() but this is meaningless because v's type and dimensions are unknown. The layouts of commons are updated later by update_common_sizes() called from EndOfProcedure().
Definition at line 1108 of file declaration.c.
References area_layout, CONS, DeclareVariable(), ENTITY, entity_blockdata_p(), entity_initial, entity_local_name(), entity_name, entity_storage, entity_type, entity_undefined, FatalError, FindOrCreateEntity(), gen_nconc(), get_current_module_entity(), get_current_module_name(), ImplicitType(), intrinsic_entity_p(), is_storage_ram, line_b_I, line_e_I, make_ram(), make_storage(), module_local_name(), NIL, ParserError(), pips_user_warning, storage_rom_p, storage_tag, storage_undefined, type_area, type_undefined, type_undefined_p, user_warning, value_defined_p(), and value_undefined.
this function scans at the same time a list of datavar and a list of dataval.
it tries to match datavar to dataval and to compute initial values for zero dimension variable of basic type integer.
ldvr is a list of datavar.
ldvl is a list of dataval.
FI: this assertion must be usually wrong! pips_assert("AnalyseData", gen_length(ldvr) == gen_length(ldvl));
Variable is in static area or in a user declared common
Variable must be in a user declared common
Variable must be in static area
entity e initial field is set here with the data information.
if (entity_defined_p(e))
ldvr | dvr |
ldvl | dvl |
Definition at line 352 of file declaration.c.
References CAR, CDR, constant_call_p, constant_int_p, copy_constant(), DATAVAL, dataval_constant, dataval_nboccurrences, DATAVAR, datavar_nbelements, datavar_variable, dynamic_area_p(), entity_blockdata_p(), entity_initial, entity_local_name(), entity_name, entity_scalar_p(), entity_storage, entity_undefined_p, free_value(), gen_length(), get_bool_property(), get_current_module_entity(), is_storage_ram, is_value_constant, make_ram(), make_storage(), make_value(), module_local_name(), NIL, ParserError(), pips_assert, pips_debug, pips_user_warning, ram_section, SaveEntity(), static_area_p(), StaticArea, storage_ram, storage_ram_p, storage_tag, storage_undefined_p, UNKNOWN_RAM_OFFSET, user_warning, value_undefined_p, value_unknown_p, and Warning.
void append_data_current_stmt_buffer_to_declarations | ( | void | ) |
int[]
Definition at line 276 of file reader.c.
References code_decls_text, concatenate(), EntityCode(), free(), get_current_module_entity(), lStmt, malloc(), stmt_buffer, and strdup().
void BeginingOfParsing | ( | void | ) |
this function is called for each new file (FI: once?) FI: I do not understand how this works.
It has an effect only once during a pips process lifetime. The error handling routine resets CurrentPackage to NULL, as it is when the pips process is started.
Should I:
A modify the error handling routine to reset CurrentPackage to TOP_LEVEL_MODULE_NAME?
B reset CurrentPackage to TOP_LEVEL_MODULE_NAME each time the parser is entered?
I choose A.
the current package is initialized
Definition at line 208 of file parser.c.
References CurrentPackage, and TOP_LEVEL_MODULE_NAME.
Referenced by the_actual_parser().
void BeginingOfProcedure | ( | void | ) |
this function is called each time a new procedure is encountered.
reset_current_module_entity();
Definition at line 301 of file procedure.c.
References called_modules, InitImplicit(), and NIL.
la 1ere lettre n'est pas modifiee
Definition at line 1308 of file reader.c.
References lStmt, ParserError(), and stmt_buffer.
Referenced by FindAssign(), FindAutre(), FindDo(), FindDoWhile(), FindIf(), FindIfArith(), FindImplicit(), and NeedKeyword().
this function returns true if the there is a variable that occurs in both atom lists.
opc1 | pc1 |
opc2 | pc2 |
Definition at line 302 of file equivalence.c.
References ATOM, atom_equivar, CAR, CDR, gen_eq(), and NIL.
Referenced by AddOrMergeChain().
void check_first_statement | ( | void | ) |
This function is called each time an executable statement is encountered but is effective the first time only.
It mainly copies the declaration text in the symbol table because it is impossible (very difficult) to reproduce it in a user-friendly manner.
The declaration text stops at the first executable statement or at the first FORMAT statement.
dynamic local buffer
we must read the input file from the begining and up to the line_b_I-1 th line, and the texte read must be stored in buffer
declaration_lines = line_b_I-1;
buffer[ibuffer++] = in_comment? c : toupper(c);
Constant strings must be taken care of
Standard version
For Cathare-2, get rid of 100 to 200 MB of declaration text:
strdup(buffer);
free(buffer), buffer=NULL;
kill the first statement's comment because it's already included in the declaration text
FI: I'd rather keep them together!
clean up the declarations
Common sizes are not yet known because ComputeAddresses() has not been called yet
It might seem logical to perform these calls from EndOfProcedure() here. But at least ComputeAddresses() is useful for implictly declared variables. These calls are better located in EndOfProcedure().
Definition at line 2004 of file statement.c.
References buffer, buffer_size, code_decls_text, cpt, CurrentFN, debug(), declaration_lines, EntityCode(), format_seen, get_current_module_entity(), line_b_C, line_b_I, malloc(), pips_assert, safe_fclose(), safe_fopen(), seen, START_COMMENT_LINE, and UNDEF.
void check_in_declarations | ( | void | ) |
A FORMAT statement has been found in the middle of the declarations
Definition at line 1976 of file statement.c.
References format_seen, get_bool_property(), ParserError(), pips_user_warning, and seen.
void CheckAndInitializeStmt | ( | void | ) |
this function looks for undefined labels.
a label is undefined if a goto to that label has been encountered and if no statement with this label has been parsed.
Definition at line 113 of file statement.c.
References CurrentStmt, instruction_undefined, label_local_name(), ParserError(), stmt::s, statement_instruction, statement_label, StmtHeap_buffer, and user_warning.
Referenced by EndOfProcedure().
If a left hand side is a call, it should be a substring operator or a macro.
If it is a call to an intrinsic with no arguments, the intrinsic is in fact masqued by a local variable.
If s is not OK, it is freed and a new_s is allocated.
OK for substrings: They are processed later by MakeAssignInst()
Oupss... This must be a local variable
A call to an intrinsic cannot be a lhs: statement function? Let's hope it works...
Must be a macro...
Definition at line 542 of file expression.c.
References call_arguments, call_function, ENDP, entity_local_name(), entity_name, entity_type, f(), FindOrCreateEntity(), free_syntax(), get_current_module_name(), intrinsic_entity_p(), is_syntax_reference, make_reference(), make_syntax(), NIL, pips_debug, pips_user_error, reference_variable, reify_ghost_variable_entity(), SUBSTRING_FUNCTION_NAME, syntax_call, syntax_reference, syntax_reference_p, syntax_undefined, type_to_string(), type_variable_p, and user_warning.
void CheckParenthesis | ( | void | ) |
Warning("CheckParenthesis",
Definition at line 1032 of file reader.c.
References IS_QUOTED, lStmt, ParserError(), ProfZeroEgal, ProfZeroVirg, and stmt_buffer.
Referenced by PipsGetc().
Definition at line 980 of file declaration.c.
References common_size_map, hash_get(), and HASH_UNDEFINED_VALUE.
Referenced by MakeCommon().
Definition at line 990 of file declaration.c.
References common_size_map, entity_name, hash_get(), HASH_UNDEFINED_VALUE, and pips_internal_error.
Referenced by ComputeAddresses(), CurrentOffsetOfArea(), fortran_relevant_area_entity_p(), update_common_layout(), and update_common_sizes().
void ComputeAddresses | ( | void | ) |
This function computes an address for every variable.
Three different cases are adressed: variables in user-declared commons, static variables and dynamic variables.
Variables may have:
All variables explictly declared in a common have a storage fully defined within this common (see update_common_layout() which must have been called before entering ComputeAddresses()). If such a variable occurs in an equivalence chain, all other variables of this chain will have an address in this common. The exact address depends on the offset stored in the atom.
The variables allocated in the static and dynamic areas are handled differently from variables explicitly declared in a common because the programmer does not have a direct control over the offset as within a common declaration. An arbitrary allocation is performed. The same kind of processing is done for chains containing a static variable or only dynamic variables (i.e. each variable in the chain has an undefined storage).
Static variables obviously have a partially defined storage since they are recognized as static.
Each equivalence chain should be either attached to a user-declared common or to the static area or to the dynamic area of the current module.
Static and dynamic chains are processed in a similar way. The size of each chain is computed and the space for the chain is allocated in the corresponding area. As for user-declared commons (but with no good reason?) only one representant of each chain is added to the layouts of the area.
When the processing of equivalenced variables is completed, non-equivalenced static or dynamic (i.e. variables with undefined storage) variables are allocated.
Finally equivalenced variables are appended to the layouts of the static and dynamic areas. This makes update_common_layout() unapplicable.
As a result, variables declared in the static and dynamic area are not ordered by increasing offsets.
the default section for variables with no address is the dynamic area.
Try to locate the area for the current equivalence chain. Only one variable should have a well-defined storage. Or no variables have one because the equivalence chain is located in the dynamic area.
Compute the total size of the chain. This only should be used for the static and dynamic areas
FI: I do not understand why this assignment is not better guarded. Maybe, because lc's later use is guarded.
A variable may be located in a static area because of a SAVE (?) or a DATA statement and be equivalenced with a variable in a common.
Same as above but in a different order
Let's hope this is due to a DATA and not to a SAVE
Compute the offset and set the storage information for each variable in the equivalence chain that has no storage yet.
check that the offset is positive
Static aliases cannot be added right away because implicitly declared static variables still have to be added whereas aliased variables are assumed to be put behind in the layout list. Except the first one.
Well, I'm not so sure!
Add e in sc'layout and check that sc's size does not have to be increased as for: COMMON /FOO/X REAL Y(100) EQUIVALENCE (X,Y)
Dynamic aliases cannot be added right away because implicitly declared dynamic variables still have to be added whereas aliased variables are assumed to be put behind in the layout list. Except the first one.
If sc really is a common, i.e. neither the dynamic nor the static area, check its size
Varying size arrays must be stack allocated. This is an implicit extension that is not compatible with EQUIVALENCE
This test will fail for stack allocatable varying length character strings because of function SizeOfElements() which cannot indicate failure. Let's wait for the problem...
Try to reallocate in stack area
Formal parameters can have varying sizes
Allocatable arrays can have varying sizes
Could be declared explicitly or implicitly STATIC or be EQUIVALENCEd with such a variable. It could be declared in a COMMON.
The array size is known at compile time. Allocate in synamic area.
All declared variables are scanned and stored in the dynamic area if their storage is still undefined or in the static area if their offsets are still unkown.
This should be the case for all non-aliased static variables and most dynamic variables.
area da = type_area(entity_type(DynamicArea));
area_layout(da) = gen_nconc(area_layout(da), CONS(ENTITY, e, NIL));
area sa = type_area(entity_type(StaticArea));
area_layout(sa) = gen_nconc(area_layout(sa), CONS(ENTITY, e, NIL));
Must be stack area
Add aliased dynamic variables
neither gen_concatenate() nor gen_append() are OK
side effect on area_layout
Add aliased static variables
neither gen_concatenate() nor gen_append() are OK
side effect on area_layout
The sizes of the static and dynamic areas are now known
Definition at line 503 of file equivalence.c.
References area_layout, area_size, arguments_add_entity(), ATOM, atom_equioff, atom_equivar, CAR, CDR, CHAIN, chain_atoms, code_declarations, common_to_size(), CONS, current_offset_of_area(), DynamicArea, ENDP, ENTITY, entity_is_argument_p(), entity_local_name(), entity_name, entity_storage, entity_type, EntityCode(), equivalences_chains, equivalences_undefined, FatalError, FinalEquivSet, gen_nconc(), get_bool_property(), get_current_module_entity(), HeapArea, ifdebug, is_storage_ram, make_ram(), make_storage(), NIL, ParserError(), pips_assert, pips_debug, pips_internal_error, pips_user_warning, print_arguments(), ram_offset, ram_section, SafeSizeOfArray(), SizeOfArray(), StackArea, StaticArea, storage_formal_p, storage_ram, storage_ram_p, storage_undefined, storage_undefined_p, top_level_entity_p(), type_area, type_variable_p, UNKNOWN_RAM_OFFSET, update_common_to_size(), and user_warning.
Referenced by EndOfProcedure().
void ComputeEquivalences | ( | void | ) |
This function merges all the equivalence chains to take into account equivalences due to transitivity.
It is called at the end of the parsing.
They should be properly initialized by SetChains if (FinalEquivSet == equivalences_undefined) { FinalEquivSet = make_equivalences(NIL); }
Definition at line 215 of file equivalence.c.
References AddOrMergeChain(), CAR, CDR, CHAIN, ENDP, EQUIMERGE, equivalences_chains, FinalEquivSet, free_equivalences(), make_equivalences(), NIL, pips_debug, PrintChains(), and TempoEquivSet.
Referenced by EndOfProcedure().
this function updates the data structure used to compute implicit types.
the implicit type for the range of letters defined by lettre_d and lettre_f has tag t and length l. tag is_basic_string is temporarely forbidden.
lettre_d | ettre_d |
lettre_f | ettre_f |
Definition at line 1284 of file declaration.c.
References FatalError, int_implicit, IS_UPPER, and tag_implicit.
Referenced by InitImplicit().
the local areas are StaticArea, DynamicArea, HeapArea, StackArea
Definition at line 1195 of file declaration.c.
References area_layout, area_size, common_to_size(), CONS, ENTITY, entity_type, gen_nconc(), NIL, SafeSizeOfArray(), top_level_entity_p(), type_area, and update_common_to_size().
Referenced by add_entity_to_declarations(), and gfc2pips_code2instruction__TOP().
It might be better to declare an unknown type as result type but I decided to fix the problem later. When a call is later encountered, the result type is set to void.
e | entity to be turned into external function or subroutine, except if it is a formal functional parameter. |
Definition at line 2426 of file procedure.c.
References entity_initial, entity_storage, entity_type, entity_undefined, MakeExternalFunction(), module_local_name(), ParserError(), pips_user_warning, storage_defined_p(), storage_formal_p, type_functional_p, type_undefined, type_undefined_p, and value_intrinsic_p.
void DeclareIntrinsic | ( | entity | e | ) |
Intrinsic e is used in the current module.
Definition at line 918 of file declaration.c.
References AddEntityToDeclarations(), entity_undefined, get_current_module_entity(), intrinsic_entity_p(), and pips_assert.
It is assumed that decl_tableau can be ignored for EDF examples
A varying dimension is impossible in the dynamic area for address computation. A heap area must be added.
dims = decl_dims;
No specific type for SUN pointers
EDF code contains several declaration for a unique pointer
ptr | tr |
pointed_array | ointed_array |
decl_dims | ecl_dims |
Definition at line 546 of file declaration.c.
References basic_int_p, CONS, CreateIntrinsic(), DeclareVariable(), DIMENSION, ENDP, entity_local_name(), entity_type, get_bool_property(), get_current_module_entity(), HeapArea, implicit_type_p(), int_to_expression(), is_basic_int, is_storage_ram, line_b_I, line_e_I, list_undefined, make_dimension(), make_ram(), make_storage(), MakeBasic(), MakeNullaryCall(), MakeTypeVariable(), NIL, ParserError(), pips_user_warning, storage_undefined, type_undefined, type_undefined_p, type_variable, type_variable_p, UNBOUNDED_DIMENSION_NAME, UNKNOWN_RAM_OFFSET, value_undefined, and variable_basic.
void DeclareVariable(e, t, d, s, v): update entity e description as declaration statements are encountered.
Examples of sequences:
INTEGER*4 T DIMENSION T(10) SAVE T
or COMMON /TOTO/X,Y CHARACTER*30 X DIMENSION X(10)
or EXTERNAL F INTEGER F
The input code is assumed correct. As the standard states, IMPLICIT statements must occur before any declaration.
Parameters: e is an entity which should be either a variable or a funtion; it may already have a type et, of kind variable or functional; the type variable may have a dimension; variable or functional implicit types, as well as undefined type, can be superseded by the new type t; a NIL type dimension can be superseded by d; how should area entities be handled ??? t is a type of kind "variable" (functional types are not accepted; functional declaration are handled by ??? ) or undefined; it should have no dimensions; d is a (possibly) empty list of dimensions; the empty list is handled as the undefined list; each dimension is an expression s is the storage, possibly undefined; v is the initial value, possibly undefined
Most problems occur because of the great number of combinations between the entity type et (undefined, variable, functional) and the entity type dimension etd (NIL ot not) giving 7 cases on one hand, the type t and the dimensions d giving 4 cases on the other hand. That is 28 different behaviors.
No sharing is introduced between t and et. However d and s are directly used in e fields.
no new information: do nothing
update functional type
the old type should be gen_freed...
set dimension etd if NIL
set dimension etd if NIL
update type
I: to check update_common_layout
FI: it should be redefined and the offset be updated, maybe in check_common_area(); 1 Feb. 1994
Exception: since it is a synthetic variable, it is unlikely to be typed explicitly. But it can appear in later PIPS regenerated declarations. Unless there is a clash with a user variable.
No problem, but do not free t because this is performed in gram.y
free_type(t);
If the return variable is retyped, the function must be retyped
the pointed area has just been freed!
Meaningless warning when the result variable is declared the first time with the function itself user_warning("DeclareVariable", "Attempt to retype function %s with result of type " "%s with very same type %s\n", module_local_name(f), basic_to_string(old), basic_to_string(new));
Definition at line 670 of file declaration.c.
References AddEntityToDeclarations(), basic_to_string(), basic_type_size(), basic_undefined, copy_basic(), copy_type(), debug(), entity_initial, entity_local_name(), entity_name, entity_storage, entity_type, f(), formal_label_replacement_p(), fprint_functional(), fprintf(), free_type(), functional_result, get_current_module_entity(), ifdebug, implicit_type_p(), ImplicitType(), is_type_area, is_type_functional, is_type_variable, line_b_I, line_e_I, list_undefined, make_value_unknown(), MakeTypeVariable(), module_local_name(), NIL, ParserError(), pips_assert, pips_internal_error, pips_user_warning, same_basic_and_scalar_p(), storage_ram_p, storage_return_p, storage_undefined, storage_undefined_p, type_equal_p(), type_functional, type_functional_p, type_tag, type_undefined, type_undefined_p, type_variable, type_variable_p, user_warning, value_undefined, variable_basic, and variable_dimensions.
Referenced by AddVariableToCommon(), DeclarePointer(), MakeAssignedGotoInst(), MakeAtom(), MakeCurrentFunction(), and SaveEntity().
void dump_current_statement | ( | void | ) |
Preprocessed statement: Spaces have been eliminated as well as continuation lines, keyword have been emphasized and variables capitalized.
Skip the initial lines
line_b_I, line_e_I
Copy the data lines
Definition at line 1354 of file reader.c.
References CurrentFN, line_b_I, line_e_I, pips_assert, safe_fclose(), safe_fopen(), and syn_in.
bool empty_current_label_string_p | ( | void | ) |
Definition at line 87 of file parser.c.
References lab_I, and same_string_p.
Referenced by MakeElseInst().
bool EmptyEntryListsP | ( | void | ) |
Definition at line 1506 of file procedure.c.
References empty, entry_entities, entry_labels, and NIL.
Referenced by EndOfProcedure(), MakeEntry(), and the_actual_parser().
void EndOfProcedure | ( | void | ) |
This function is called when the parsing of a procedure is completed.
It performs a few calculations which cannot be done on the fly such as address computations for static and dynamic areas and commons.
And it writes the internal representation of the CurrentFunction with a call to gen_free (?).
get rid of ghost variable entities and substitute them if necessary
we generate the last statement to carry a label or a comment
|| iPrevComm != 0
we generate statement last+1 to eliminate returns
Check the block stack
are there undefined gotos ?
The following calls could be located in check_first_statement() which is called when the first executable statement is encountered. At that point, many declaration related problems should be fixed or fixeable. But additional undeclared variables will be added to the dynamic area and their addresses must be computed. At least, ComputeAddresses() must stay here.. so I keep all these calls together.
Must be performed before equivalence resolution, for user declared commons whose declarations are stronger than equivalences
Use equivalence chains to update storages of equivalenced and of variables implicitly declared in DynamicArea, or implicitly thru DATA or explicitly thru SAVE declared in StaticArea
Initialize the shared field in ram storage
Now that retyping and equivalences have been taken into account:
Why keep it in (apparent) declaration order rather than alphabetical order? Because some later processing may be based on this assumption. Sort can be performed before printouts.
remove hpfc special routines if required.
done here. affects callees and code. FC.
the current package is re-initialized
Definition at line 979 of file procedure.c.
References called_modules, callees_consistent_p(), CAR, CheckAndInitializeStmt(), code_declarations, ComputeAddresses(), ComputeEquivalences(), CONS, CurrentPackage, DB_PUT_MEMORY_RESOURCE, dump_arguments(), DynamicArea, EmptyEntryListsP(), entity_declarations, entity_name, entity_undefined, EntityCode(), FormalParameters, fprint_environment(), fprintf(), function_body, gen_free_list(), gen_nreverse(), GenerateReturn(), get_bool_property(), get_current_module_entity(), hpf_directive_string_p(), ifdebug, IsBlockStackEmpty(), keep_directive_in_code_p(), lab_I, LinkInstToCurrentBlock(), make_callees(), make_continue_instruction(), MAPL, module_local_name(), NIL, parser_close_macros_support(), parser_substitute_all_macros(), ParserError(), pips_debug, PopBlock(), process_static_initializations(), ProcessEntries(), remove_ghost_variable_entities(), reset_common_size_map(), reset_current_module_entity(), reset_current_module_statement(), ResetChains(), ResetReturnCodeVariable(), SaveChains(), set_current_module_statement(), statement_consistent_p(), StaticArea, STRING, SubstituteAlternateReturns(), TOP_LEVEL_MODULE_NAME, update_common_sizes(), update_user_common_layouts(), UpdateFunctionalType(), and uses_alternate_return().
Definition at line 420 of file equivalence.c.
References ATOM, atom_equivar, CAR, chain_atoms, ENDP, entity_name, pips_debug, and POP.
Referenced by entity_in_equivalence_chains_p().
Apparently, TempoEquivSet stays undefined when there are no equivalences
Definition at line 403 of file equivalence.c.
References CAR, CHAIN, ENDP, entity_in_equivalence_chain_p(), equivalences_chains, equivalences_undefined_p, POP, and TempoEquivSet.
Referenced by remove_ghost_variable_entities().
int FindAssign | ( | void | ) |
Definition at line 1197 of file reader.c.
References CapitalizeStmt(), iStmt, lStmt, ProfZeroEgal, stmt_buffer, and StmtEqualString().
Referenced by PipsGetc().
void FindAutre | ( | void | ) |
Definition at line 1169 of file reader.c.
References CapitalizeStmt(), iStmt, NeedKeyword(), ProfZeroEgal, stmt_buffer, and StmtEqualString().
Referenced by PipsGetc().
int FindDo | ( | void | ) |
Let's skip a loop label to look for a while construct
Definition at line 1087 of file reader.c.
References CapitalizeStmt(), iStmt, ProfZeroEgal, ProfZeroVirg, stmt_buffer, and StmtEqualString().
Referenced by PipsGetc().
int FindDoWhile | ( | void | ) |
This function is redundant with FindDo() but much easier to understand.
I leave it as documentation. FI.
Definition at line 1073 of file reader.c.
References CapitalizeStmt(), iStmt, ProfZeroEgal, and StmtEqualString().
void FindIf | ( | void | ) |
Definition at line 1150 of file reader.c.
References CapitalizeStmt(), FindMatchingPar(), iStmt, stmt_buffer, and StmtEqualString().
Referenced by PipsGetc().
int FindIfArith | ( | void | ) |
Definition at line 1134 of file reader.c.
References CapitalizeStmt(), FindMatchingPar(), iStmt, stmt_buffer, and StmtEqualString().
Referenced by PipsGetc().
int FindImplicit | ( | void | ) |
Definition at line 1114 of file reader.c.
References CapitalizeStmt(), FindProfZero(), iStmt, lStmt, NeedKeyword(), ProfZeroEgal, SIZE_UNDEF, and StmtEqualString().
Referenced by PipsGetc().
Definition at line 1267 of file reader.c.
References IS_QUOTED, lStmt, pips_assert, SIZE_UNDEF, and stmt_buffer.
Referenced by FindIf(), and FindIfArith().
void FindPoints | ( | void | ) |
Definition at line 1220 of file reader.c.
References iStmt, lStmt, OperateurPoints, stmt_buffer, and StmtEqualString().
Referenced by PipsGetc().
Definition at line 1248 of file reader.c.
References IS_QUOTED, iStmt, lStmt, SIZE_UNDEF, and stmt_buffer.
Referenced by FindImplicit().
bool first_executable_statement_seen | ( | void | ) |
bool first_format_statement_seen | ( | void | ) |
Definition at line 1970 of file statement.c.
References format_seen.
expression fix_if_condition | ( | expression | e | ) |
with the f77 compiler, this is equivalent to e.NE.0 if e is an integer expression.
Definition at line 1293 of file statement.c.
References entity_intrinsic(), expression_undefined, int_to_expression(), integer_expression_p(), line_b_I, line_e_I, logical_expression_p(), MakeBinaryCall(), NON_EQUAL_OPERATOR_NAME, ParserError(), and pips_user_warning.
Referenced by MakeBlockIfInst(), and MakeLogicalIfInst().
These tests are needed to check area consistency when dumping or printing a symbol table.
Definition at line 940 of file declaration.c.
References common_size_map, common_to_size(), hash_table_undefined, heap_area_p(), and stack_area_p().
Make sure that no call to implied do is in l.
Definition at line 492 of file expression.c.
References EXPRESSION, expression_implied_do_p(), MAP, and ParserError().
instruction generate_return_code_checks | ( | list | labels | ) |
The reset is controlled from gram.y, as is the set
pips_debug(2, "Additional statement generated for hide_rc_p:\n");
print_statement(s_init_rcv);
}
labels | abels |
Definition at line 337 of file return.c.
References CONS, ENDP, ENTITY, entity_to_expression(), expression_undefined, FOREACH, gen_free_list(), GetFullyDefinedReturnCodeVariable(), hide_rc_p, instruction_block, instruction_block_p, instruction_consistent_p(), instruction_undefined, label_local_name(), make_get_rc_statement(), MakeComputedGotoInst(), NIL, pips_assert, STATEMENT, and STRING.
Referenced by MakeCallInst().
void GenerateReturn | ( | void | ) |
Generate a unique call to RETURN per module.
statement c = MakeStatement(l, make_continue_instruction());
Definition at line 499 of file return.c.
References CONS, end_label_local_name, expression_undefined, get_statement_number(), instruction_consistent_p(), instruction_undefined, int_to_expression(), lab_I, LinkInstToCurrentBlock(), make_instruction_block(), make_set_rc_statement(), MakeLabel(), MakeStatement(), MakeZeroOrOneArgCallInst(), NIL, src, STATEMENT, statement_number, statement_undefined, strdup(), substitute_rc_p, and uses_alternate_return_p().
Referenced by EndOfProcedure().
list get_alternate_returns | ( | void | ) |
Definition at line 258 of file return.c.
References alternate_returns.
Referenced by add_actual_return_code(), and MakeCallInst().
string get_current_label_string | ( | void | ) |
Definition at line 76 of file parser.c.
References lab_I.
Referenced by MakeElseInst().
int get_current_number_of_alternate_returns | ( | void | ) |
Definition at line 197 of file return.c.
References current_number_of_alternate_returns.
int get_statement_number | ( | void | ) |
eturn the line number of the statement being parsed
Definition at line 1392 of file reader.c.
References StmtLineNumber.
Referenced by GenerateReturn(), make_get_rc_statement(), MakeArithmIfInst(), MakeAssignedOrComputedGotoInst(), MakeCallInst(), MakeLogicalIfInst(), MakeNewLabelledStatement(), MakeReturn(), MakeStatement(), and ReuseLabelledStatement().
int GetChar | ( | FILE * | fp | ) |
Routine de lecture physique.
In case an error occurs, buffer must be emptied. Since i_getchar and l_getchar cannot be touched by the error handling routine, changes of fp are tracked in GetChar() and dynamically tested. Kludge suggested by Fabien Coelho to avoid adding more global variables. (FI)
Empty (or rather invisible) lines made of TAB and SPACE characters are replaced by the string "\n".
This section (probably) is made obsolete by the new function parser_reset_all_reader_buffers(). The user_warning() is replaced by a pips_error(). Test: Cachan/bug10
If a file has just been opened
if the buffer is not empty, which may never occur if previous_fp == NULL, perform a buffer reset
A whole input line is read to process TABs and empty lines
large for expansion
Fortran has a limited character set. See standard section 3.1. This cannot be handled here as you do not know if you are in a string constant or not. You cannot convert the double quote into a simple quote because you may generate an illegal string constant. Maybe the best would be to uncomment the next test. FI, 21 February 1992 if( c == '"') FatalError("GetChar","Illegal double quote character"); "
FI: let's delay and do it in ReadLine: if (islower(c)) c = toupper(c);
for (i = 0; i < (8-Column%8); i++) {
Ignore carriage returns introduced by VMS, MSDOS or MACOS...
buffer[l_getchar++] = (col > 72) ? ' ' : c;
buffer[l_getchar++] = (col > 72) ? '
' : c;
last columns cannot be copied because we might be inside a character string
i_getchar = l_getchar = UNDEF;
LineNumber += 1;
fp | p |
Definition at line 614 of file reader.c.
References Column, debug(), getchar_buffer, getchar_buffer_size, i_getchar, ifdebug, init_getchar_buffer(), l_getchar, LineNumber, parser_warn_for_columns_73_80, pips_internal_error, resize_getchar_buffer(), START_COMMENT_LINE, UNDEF, and user_warning.
Referenced by ReadLine().
entity GetReturnCodeVariable | ( | void | ) |
Cannot be asserted because the return_code_variable may either be a formal parameter if the current module uses multiple return, or a dynamic variable if it does not and if it calls a subroutine using alternate returns
Definition at line 95 of file return.c.
References entity_undefined_p, FindEntity(), FindOrCreateEntity(), get_current_module_name(), get_string_property(), and return_code_variable.
Referenced by add_formal_return_code(), GetFullyDefinedReturnCodeVariable(), and make_set_rc_statement().
Definition at line 292 of file procedure.c.
References entity_is_argument_p(), ghost_variable_entities, list_undefined_p, and pips_assert.
Referenced by NameToFunctionalEntity(), and SafeFindOrCreateEntity().
parser for HPFC.
just a different input file not to touch the original source file. this parser should be selected/activated automatically.
module | odule |
Definition at line 286 of file parser.c.
References module, and the_actual_parser().
This function checks that entity e has an undefined or an implicit type which can be superseded by another declaration.
The first letter of e's name is used to determine the implicit type. The implicit type of a functional entity is its result type.
ASSERT
to please gcc
Definition at line 1358 of file declaration.c.
References basic_complex, basic_float, basic_int, basic_logical, basic_string, basic_tag, constant_int, entity_local_name(), entity_name, entity_type, FatalError, functional_result, int, int_implicit, is_basic_complex, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_string, IS_UPPER, pips_internal_error, tag_implicit, type_functional, type_functional_p, type_tag, type_undefined, type_variable, type_variable_p, value_constant, and variable_basic.
Referenced by DeclarePointer(), DeclareVariable(), retype_formal_parameters(), and TypeFunctionalEntity().
This function computes the Fortran implicit type of entity e.
The first letter of e's name is used.
It should be now called FortranImplicitType()
Definition at line 1311 of file declaration.c.
References entity_local_name(), FatalError, int, int_implicit, is_basic_complex, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_string, is_constant_int, IS_UPPER, is_value_constant, make_basic(), make_constant(), make_value(), MakeTypeVariable(), NIL, pips_internal_error, tag_implicit, type_undefined, and value_undefined.
Referenced by AddVariableToCommon(), DeclareVariable(), MakeAtom(), MakeCurrentFunction(), MakeFormalParameter(), MakeParameter(), MakeResultType(), mpi_type_mpi_comm(), mpi_type_mpi_request(), mpi_type_mpi_status(), retype_formal_parameters(), TypeFunctionalEntity(), and UpdateFunctionalType().
void init_ghost_variable_entities | ( | void | ) |
Definition at line 69 of file procedure.c.
References ghost_variable_entities, list_undefined_p, NIL, and pips_assert.
void init_parser_properties | ( | void | ) |
Definition at line 296 of file parser.c.
References init_parser_reader_properties().
Referenced by the_actual_parser().
void init_parser_reader_properties | ( | void | ) |
Definition at line 434 of file reader.c.
References get_bool_property(), init_comment_buffers(), and parser_warn_for_columns_73_80.
Referenced by init_parser_properties().
void InitAreas | ( | void | ) |
Definition at line 100 of file declaration.c.
References ABSTRACT_LOCATION, AddEntityToDeclarations(), CurrentPackage, DYNAMIC_AREA_LOCAL_NAME, DynamicArea, ENTITY_DYNAMIC_AREA, ENTITY_HEAP_AREA, entity_initial, entity_kind, ENTITY_STACK_AREA, ENTITY_STATIC_AREA, entity_storage, entity_type, FindOrCreateEntity(), get_current_module_entity(), HEAP_AREA_LOCAL_NAME, HeapArea, is_type_area, make_area(), make_storage_rom(), make_type(), make_value_unknown(), NIL, set_common_to_size(), STACK_AREA_LOCAL_NAME, StackArea, STATIC_AREA_LOCAL_NAME, and StaticArea.
Referenced by gfc2pips_namespace(), and MakeCurrentFunction().
void initialize_common_size_map | ( | void | ) |
Definition at line 947 of file declaration.c.
References common_size_map, hash_pointer, hash_table_make(), hash_table_undefined, and pips_assert.
Referenced by gfc2pips_namespace(), and MakeCurrentFunction().
void InitImplicit | ( | void | ) |
this function initializes the data structure used to compute implicit types
Definition at line 1271 of file declaration.c.
References cr_implicit(), DefaultLengthOfBasic(), is_basic_float, and is_basic_int.
Referenced by BeginingOfProcedure().
bool IsBlockStackEmpty | ( | void | ) |
Definition at line 209 of file statement.c.
References CurrentBlock.
Referenced by EndOfProcedure(), LinkInstToCurrentBlock(), and PopBlock().
bool IsBlockStackFull | ( | void | ) |
Definition at line 215 of file statement.c.
References CurrentBlock, and MAXBLOCK.
Referenced by PushBlock().
int IsCapKeyword | ( | char * | s | ) |
Fonction appelee par sslex sur la reduction de la regle de reconnaissance des mot clefs.
Elle recherche si le mot 's' est un mot clef, retourne sa valeur si oui, et indique une erreur si non.
la chaine s est mise en majuscules
just to avoid a gcc warning
OTREACHED
Definition at line 515 of file reader.c.
References buffer, debug(), int, keywidx, keywtbl, ParserError(), pips_assert, UNDEF, and user_warning.
Definition at line 1534 of file procedure.c.
References effective_formal_parameters, entity_is_argument_p(), and f().
Referenced by MakeEntry().
FI: should be moved in ri-util; this function returns true if e is a zero dimension variable of basic type integer.
Definition at line 1647 of file declaration.c.
References basic_int_p, entity_type, NIL, type_variable, type_variable_p, variable_basic, and variable_dimensions.
this functions looks up in table StmtHeap for the statement s whose label is l.
Definition at line 94 of file statement.c.
References CurrentStmt, statement_undefined, and StmtHeap_buffer.
Referenced by make_goto_instruction(), MakeStatement(), and NewStmt().
void LinkInstToCurrentBlock | ( | instruction | i, |
bool | number_it | ||
) |
this function links the instruction i to the current block of statements.
if i is the last instruction of the block (i and the block have the same label), the current block is popped from the stack. in fortran, one instruction migth end more than one block.
A label cannot be used twice
a CONTINUE instruction must be added to carry the label, because blocks cannot be labelled
The above continue is not a user statement an should not be numbered
OK, an argument could be added to MakeStatement()...
decrement_statement_number();
instruction_block(i) = CONS (STATEMENT, c, ls);
pips_assert("Why do you want to number a block?!?", false);
OK, let's be cool and ignore this request to save the caller a test
s = MakeStatement(entity_empty_label(), i);
s = instruction_to_statement(i);
s = instruction_to_statement(i);
Because of labelled loop desugaring, new_i may be different from i
Only desugared constructs such as labelled loop, computed go to or IO with error handling should produce blocks. Such blocks should be non-empty and not commented.
Sometimes, we generate blocks with only one statement in it. E.g. alternate returns pips_assert("The block has at least two statements", !ENDP(CDR(instruction_block(new_i))));
For keeping pragma attached to a loop attached to it, we have to find the loop instruction within the block
while i is the last instruction of the current block ...
number_it | umber_it |
Definition at line 529 of file statement.c.
References BlockStack, CAR, CDR, CONS, continue_statement_p(), CurrentBlock, empty_comments, ENDP, entity_empty_label_p(), instruction_block, instruction_block_p, instruction_identification(), iPrevComm, IsBlockStackEmpty(), lab_I, label_local_name(), MakeLabel(), MakeStatement(), ParserError(), pips_assert, pips_debug, pips_internal_error, PopBlock(), PrevComm, reset_current_label_string(), STATEMENT, statement_comments, statement_instruction, statement_loop_p(), statement_undefined, strdup(), and user_log().
Referenced by EndOfProcedure(), GenerateReturn(), MakeBlockIfInst(), MakeDoInst(), MakeElseInst(), MakeEnddoInst(), MakeEndifInst(), and MakeWhileDoInst().
Definition at line 1801 of file procedure.c.
References SafeLocalToGlobal(), and type_undefined.
Referenced by MakeEntry(), and MakeExternalFunction().
expression loop_to_implieddo | ( | loop | l | ) |
Fix last parameter
Definition at line 167 of file expression.c.
References FOREACH, gen_nreverse(), instruction_sequence, instruction_sequence_p, loop_body, loop_index, loop_range, make_arg_from_stmt(), make_reference(), make_syntax_reference(), MakeImpliedDo(), NIL, sequence_statements, and statement_instruction.
Referenced by gfc2pips_code2instruction_(), and make_arg_from_stmt().
statement make_check_io_statement | ( | string | n, |
expression | u, | ||
entity | l | ||
) |
Generate a test to jump to l if flag f is TRUE Used to implement control effects of IO's due to ERR= and END=.
Should not use MakeStatement() directly or indirectly to avoid counting these pseudo-instructions
Definition at line 1691 of file statement.c.
References CONS, EXPRESSION, FindEntity(), instruction_to_statement(), IO_EFFECTS_PACKAGE_NAME, is_instruction_test, make_empty_block_statement(), make_goto_instruction(), make_instruction(), make_reference(), make_test(), NIL, reference_to_expression(), and statement_consistent_p().
Referenced by MakeIoInstA().
name | ame |
bt | t |
size | ize |
Definition at line 597 of file expression.c.
References make_C_or_Fortran_constant_entity(), and ParserError().
instruction make_goto_instruction | ( | entity | l | ) |
In a "go to" instruction, the label does not appear explictly.
It is replaced by the statement to be jumped at. If the statement carrying the label has been encountered before, everything is fine. Else the target statement has to be synthesized blindly ahead of time.
Definition at line 706 of file statement.c.
References empty_comments, empty_extensions(), entity_name, instruction_undefined, is_instruction_goto, LabelToStmt(), make_instruction(), make_statement(), make_synchronization_none(), NewStmt(), NIL, STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, and statement_undefined.
Referenced by make_check_io_statement(), and MakeGotoInst().
instruction MakeArithmIfInst | ( | expression | e, |
string | l1, | ||
string | l2, | ||
string | l3 | ||
) |
this function transforms an arithmetic if statement into a set of regular tests.
long but easy to understand without comments.
e is the test expression. e is inserted in the instruction returned (beware of sharing)
l1, l2, l3 are the three labels of the original if statement.
IF (E) 10, 20, 30
becomes
IF (E .LT. 0) THEN GOTO 10 ELSE IF (E .EQ. 0) THEN GOTO 20 ELSE GOTO 30 ENDIF ENDIF
FI: Should be improved by testing equality between l1, l2 and l3 Cases observed: l1 == l2 l2 == l3 l1 == l3 Plus, just in case, l1==l2==l3
This must be quite unusual, but the variables in e have to be dereferenced to respect the use-def chains, e may have side effects,...
If the optimizer is very good, the absolute value of e should be checked positive?
General case
l1 | 1 |
l2 | 2 |
l3 | 3 |
Definition at line 1399 of file statement.c.
References copy_expression(), CreateIntrinsic(), get_statement_number(), instruction_to_statement(), instruction_undefined, int_to_expression(), is_instruction_test, make_empty_block_statement(), make_instruction(), make_test(), MakeBinaryCall(), MakeGotoInst(), MakeUnaryCall(), s1, and statement_number.
instruction MakeAssignedGotoInst | ( | list | ll, |
entity | i | ||
) |
ll | l |
Definition at line 734 of file statement.c.
References DeclareVariable(), entity_to_expression(), MakeAssignedOrComputedGotoInst(), NIL, storage_undefined, type_undefined, and value_undefined.
instruction MakeAssignedOrComputedGotoInst | ( | list | ll, |
expression | ce, | ||
bool | assigned | ||
) |
ce might have side effects
ce can be used several times without side effects
We cannot know yet if ce has side effects
expression_intrinsic_operation_p(ce): a user call may be hidden at a lower level and some intrinsics may have side effects and it might be more efficient not to recompute a complex expression several times
Prefix starts with I to avoid an explicit declaration and a regeneration of declarations by the prettyprinter.
Assigned GO TO: if the current label is not in the list, this is an error in Fortran 90. ISO/IEC 1539 Section 8.2.4 page 108. Same in Fortran 77 standard, Section 11-2.
Update the statement numbers of all possibly allocated statements
MakeStatement won't increment the current statement number because this is a block... so it has to be done here
FatalError("parser", "computed goto statement prohibited\n");
ll | l |
ce | e |
assigned | ssigned |
Definition at line 747 of file statement.c.
References call_constant_p, CAR, CONS, copy_expression(), ENDP, entity_domain, entity_to_expression(), EQUAL_OPERATOR_NAME, expression_syntax, expression_undefined, gen_find_tabulated(), gen_length(), get_current_module_entity(), get_statement_number(), instruction_consistent_p(), instruction_to_statement(), instruction_undefined, int_to_expression(), is_basic_int, is_instruction_test, list_undefined, make_assign_statement(), make_basic(), make_empty_statement, make_entity_fullname(), make_instruction(), make_instruction_block(), make_new_scalar_variable_with_prefix(), make_test(), MakeBinaryCall(), MakeGotoInst(), MakeZeroOrOneArgCallInst(), NIL, pips_internal_error, POP, s_init, STATEMENT, statement_number, statement_undefined, statement_undefined_p, STOP_FUNCTION_NAME, stop_statement_p(), STRING, syntax_call, syntax_call_p, syntax_reference_p, and TOP_LEVEL_MODULE_NAME.
Referenced by MakeAssignedGotoInst(), and MakeComputedGotoInst().
instruction MakeAssignInst | ( | syntax | l, |
expression | e | ||
) |
this function creates an affectation statement.
l is a reference (the left hand side).
e is an expression (the right hand side).
Let us keep the statement function definition somewhere.
Preserve the current comments as well as the information about the macro substitution
FI: we stumble here when a Fortran macro is used.
FI: we stumble here when a Fortran PARAMETER is used as lhs.
Definition at line 848 of file statement.c.
References ASSIGN_SUBSTRING_FUNCTION_NAME, call_arguments, call_function, concatenate(), CONS, entity_empty_label(), entity_initial, entity_intrinsic(), entity_local_name(), entity_name, EXPRESSION, expression_undefined, FatalError, free_syntax(), gen_append(), get_bool_property(), instruction_undefined, is_instruction_call, make_assign_instruction(), make_call(), make_continue_statement(), make_expression(), make_instruction(), make_instruction_block(), NIL, normalized_undefined, parser_add_a_macro(), ParserError(), pips_debug, STATEMENT, statement_comments, strdup(), SUBSTRING_FUNCTION_NAME, syntax_call, syntax_call_p, syntax_reference_p, user_warning, and value_symbolic_p.
syntax MakeAtom | ( | entity | e, |
cons * | indices, | ||
expression | fc, | ||
expression | lc, | ||
int | HasParenthesis | ||
) |
MakeAtom: this function creates a syntax, ie.
a reference, a call or a range.
there are a few good cases: e is a variable and its dimensionality is equal to the number of expressions in indices, e is a function, e is a constant or a symbolic constant.
there are a few bad cases: e is a zero dimension variable and indices is not equal to NIL (see comments of MakeExternalFunction), e is not known and the list indices is not empty (it is a call to a user function), e is not known and the list indices is empty (it is an implicit declaration).
in this function, we first try to transform bad cases into good ones, and then to create a syntax.
e is a variable or a function.
indices is a list of expressions (arguments or indices).
fc and lc are substring bound expressions.
HasParenthesis is a bool that tells if the reference to e was done with () or not. this is mandatory to make the difference between a call to a function and a reference to a function.
checking errors ...
It can be a PARAMETER or a functional variable or...
Not enough information to decide to stop or not.
ParserError("MakeAtom", "unsupported use of a functional entity\n");
fixing bad cases
FI: to handle parameterless function calls like t= second() - 11 March 1993
if (indices == NULL) {
It has already been declared and should not be redeclared because it may be an entry formal parameter which is not declared in the current module. If e represents an entry formal parameter (although its top-level name is the current module), it does not belong to the declarations of the current module. Hence, it is hard to assert something here.
However, e has to be typed and valued.
e = MakeExternalFunction(e, type_undefined);
use expression list to compute argument types
FI: same as in previous paragraph
if (variable_dimensions(type_variable(te))==NULL && indices!=NULL) {
if (variable_dimensions(type_variable(te))==NULL && (indices!=NULL || HasParenthesis)) {
use expression list to compute argument types
FI: probleme here for character returning function! You have to know if you are dealing with a substring operator or a function call.
Fortunately, according to SUN f77 compiler, you are not allowed to take the substring of a function call!
In fact, only check compatability... if requested!
here, bad cases have been transformed into good ones.
substring
pips_assert("Substring can only be applied to a string", basic_string_p(bt));
Probably an extension we would have liked to have for the DREAM-UP project.
The upper bound may be unknown for formal parameters and for allocatable arrays and cannot be retrieved from the type declaration
ParserError("MakeAtom", "Substrings are not implemented\n");
e is either called or passed as argument to a function. It cannot be a PARAMETER or its value would be known.
e is either called or passed as argument to a function, or it is a PARAMETER, in which case, it must really be called.
indices | ndices |
fc | c |
lc | c |
HasParenthesis | asParenthesis |
Definition at line 222 of file expression.c.
References basic_string, basic_string_p, basic_type_size(), CONS, CreateIntrinsic(), debug(), DeclareVariable(), entity_initial, entity_intrinsic(), entity_local_name(), entity_name, entity_storage, entity_type, EXPRESSION, expression_undefined, FatalError, gen_length(), get_bool_property(), ImplicitType(), indices, int_to_expression(), is_syntax_call, is_syntax_reference, make_call(), make_expression(), make_reference(), make_syntax(), make_value_unknown(), MakeExternalFunction(), MakeNullaryCall(), NIL, normalized_undefined, ParserError(), pips_debug, pips_internal_error, ref, storage_formal_p, storage_undefined, storage_undefined_p, SUBSTRING_FUNCTION_NAME, syntax_undefined, type_area_p, type_functional_p, type_statement_p, type_undefined, type_undefined_p, type_unknown_p, type_variable, type_variable_p, type_void_p, UNBOUNDED_DIMENSION_NAME, update_called_modules(), update_functional_type_with_actual_arguments(), user_warning, value_code_p, value_symbolic_p, value_undefined, value_undefined_p, value_unknown_p, variable_basic, and variable_dimensions.
void MakeBlockIfInst | ( | expression | e, |
int | elsif | ||
) |
this function and the two next ones create a block if statement.
the true and the else part of the test are two empty blocks. e is the test expression.
the true block is pushed on the stack. it will contain the next statements, and will end with a else statement or an endif statement.
if a else statement is reached, the true block is popped and the false block is pushed to gather the false part statements. if no else statement is found, the true block will be popped with the endif statement and the false block will remain empty.
elsif | lsif |
Definition at line 1498 of file statement.c.
References BlockStack, CurrentBlock, fix_if_condition(), is_instruction_test, LinkInstToCurrentBlock(), make_instruction(), make_test(), MakeEmptyInstructionBlock(), MakeLabel(), MakeStatement(), and PushBlock().
instruction MakeCallInst | ( | entity | e, |
cons * | l | ||
) |
this function creates a call statement.
e is the called function. l is the argument list, a list of expressions.
ParserError("MakeCallInst", "Formal functional parameters are not supported " "by PIPS.\n");
FI: Before you can proceed to update_functional_type_result(), you may have to fix the type of e. Basically, if its type is not functional, it should be made functional with result void. I do not fix the problem in the parser because tons of other problems are going to appear, at least one for each PIPS analysis, starting with effects, proper, cumulated, regions, transformers, preconditions,... No quick fix, but a special effort made after an explicit decision.
The following assertion is no longer true when fucntions are passed as actual arguments.
pips_assert("e itself is returned", MakeExternalFunction(e, MakeTypeVoid()) == e);
l | callee list of actual parameters |
Definition at line 1091 of file statement.c.
References add_actual_return_code(), CONS, ENDP, entity_name, entity_storage, generate_return_code_checks(), get_alternate_returns(), get_statement_number(), instruction_block, instruction_block_p, instruction_to_statement(), instruction_undefined, is_instruction_call, is_type_void, make_call(), make_instruction(), make_type(), MakeExternalFunction(), MakeTypeVoid(), pips_assert, pips_user_warning, STATEMENT, statement_number, storage_formal_p, storage_undefined_p, SubstituteAlternateReturnsP(), update_called_modules(), update_functional_type_result(), update_functional_type_with_actual_arguments(), and UU.
MakeCommon: This function creates a common block.
pips creates static common blocks. This is not true in the ANSI standard stricto sensu, but true in most implementations.
A common declaration can be made out of several common statements. MakeCommon() is called for each common statement, although it only is useful the first time.
common e may already exist because it was encountered in another module but not have been registered as known by the current module. It may also already exist because it was encountered in the same module, but AddEntityToDeclarations() does not duplicate declarations.
FI: for a while, common sizes were always reset to 0, even when several common statements were encountered in the same module for the same common. This did not matter because offsets in commons are recomputed once variable types and dimensions are all known.
Definition at line 1047 of file declaration.c.
References AddEntityToDeclarations(), common_to_defined_size_p(), get_current_module_entity(), make_common_entity(), and set_common_to_size().
Referenced by MakeEntryCommon(), and NameToCommon().
instruction MakeComputedGotoInst | ( | list | ll, |
expression | e | ||
) |
ll | l |
Definition at line 727 of file statement.c.
References MakeAssignedOrComputedGotoInst().
Referenced by generate_return_code_checks().
this function creates one entity cf that represents the Fortran function f being analyzed.
if f is a Fortran FUNCTION, a second entity is created; this entity represents the variable that is used in the function body to return a value. both entities share the same name and the type of the result entity is equal to the type of cf's result.
t is the type of the function result if it has been given by the programmer as in INTEGER FUNCTION F(A,B,C)
msf indicates if f is a main, a subroutine or a function.
cf is the current function
lfp is the list of formal parameters
current function
the body of the current function
the second entity, used to store the function result
to split the entity name space between mains, commons, blockdatas and regular modules
full current function name
global entity with conflicting name
Check that there is no such common: This test is obsolete because the standard does not prohibit the use of the same name for a common and a function. However, it is not a good programming practice
if(!type_undefined_p(entity_type(cf)) || ! storage_undefined_p(entity_storage(cf)) || !value_undefined_p(entity_initial(cf)))
Clean up existing local entities in case of a recompilation.
A block data may be declared in an EXTERNAL statement, see Standard 8-9
remove_variable_entity(ce);
Let's hope cf is not an intrinsic
Unfortunately, an intrinsics cannot be redefined, just like a user function or subroutine after editing because intrinsics are not handled like user functions or subroutines. They are not added to the called_modules list of other modules, unless the redefining module is parsed FIRST. There is not mechanism in PIPS to control the parsing order.
set ghost variable entities to NIL
This procedure is called when the whole module declaration statement has been parsed. The formal parameters have already been declared and the ghost variables checked. The call was moved in gram.y, reduction rule for psf_keyword.
init_ghost_variable_entities();
initialize equivalence chain lists to NIL
the intended result type t for a main or a subroutine should be undefined
The parameters part of cf's functional type is not created because the types of formal parameters are not known yet. This is performed later by UpdateFunctionalType().
If a call to the function has been encountered before, it's already typed. However, this information is discarded.
a function has a rom storage
a function has an initial value 'code' that contains an empty block
FI: This NULL string is a catastrophy for the strcmp used later to check the content of the stack. Any string, including the empty string "", would be better. icf is used to link new instructions/statement to the current block. Only the first block is not pushed for syntactic reasons. The later blocks will be pushed for DO's and IF's.
PushBlock(icf, (string) NULL);
No common has yet been declared
Generic areas are created for memory allocation.
Formal parameters are created. Alternate returns can be ignored or substituted.
a result entity is created
esult = FindOrCreateEntity(CurrentPackage, entity_local_name(cf));
CleanLocalEntities() does not remove any entity
msf | sf |
cfn | fn |
lfp | fp |
Definition at line 1239 of file procedure.c.
References add_formal_return_code(), AddEntityToDeclarations(), BLOCKDATA_PREFIX, CleanLocalEntities(), code_declarations, code_undefined_p, COMMON_PREFIX, concatenate(), CurrentPackage, DeclareVariable(), ENDP, entity_domain, entity_initial, entity_local_name(), entity_name, entity_storage, entity_type, entity_undefined, entity_undefined_p, FatalError, FindEntity(), FindOrCreateEntity(), free(), free_type(), function_body, gen_find_tabulated(), get_string_property(), ImplicitType(), InitAreas(), initialize_common_size_map(), instruction_to_statement(), intrinsic_entity_p(), is_storage_return, is_type_functional, is_type_void, is_value_code, MAIN_PREFIX, make_code(), make_functional(), make_language_fortran(), make_sequence(), make_storage(), make_storage_rom(), make_type(), make_value(), MakeEmptyInstructionBlock(), module_local_name(), MODULE_SEP_STRING, NIL, ParserError(), pips_debug, pips_user_warning, prefix, PushBlock(), remove_module_entity(), ScanFormalParameters(), set_current_module_entity(), SetChains(), strdup(), string_undefined, SubstituteAlternateReturns(), TK_BLOCKDATA, TK_FUNCTION, TK_PROGRAM, TOP_LEVEL_MODULE_NAME, type_undefined, type_undefined_p, user_warning, UU, value_code, value_code_p, value_undefined, and value_undefined_p.
Receives as first input an implicit list of references, including implicit DO, and as second input an list of value using pseudo-intrinsic REPEAT_VALUE() to replicate values.
Generates a call statement to STATIC-INITIALIZATION(), with a call to DATA_LIST to prefix ldr (unlike IO list). Processes the information as AnalyzeData() used to do it. Add the new data call statement to the initializations field of the current module.
ldr | dr |
ldv | dv |
Definition at line 524 of file declaration.c.
References code_initializations, CONS, DATA_LIST_FUNCTION_NAME, entity_code(), entity_undefined, entity_undefined_p, EXPRESSION, expression_undefined, FindEntity(), gen_nconc(), get_current_module_entity(), iPrevComm, make_call_expression(), make_call_statement(), NIL, pips_assert, PrevComm, sequence_statements, STATEMENT, statement_undefined, STATIC_INITIALIZATION_NAME, strdup(), and TOP_LEVEL_MODULE_NAME.
this function creates a do loop statement.
s is a reference to the do variable.
r is the range of the do loop.
l is the label of the last statement of the loop.
This free is not nice for the caller! Nor for the debugger.
Let's build a sequence with loop range assignments
Definition at line 1167 of file statement.c.
References CONS, entity_to_expression(), entity_undefined, FatalError, free_syntax(), get_bool_property(), get_current_module_entity(), instruction_to_statement(), is_basic_int, is_execution_sequential, is_instruction_loop, LinkInstToCurrentBlock(), make_assign_instruction(), make_basic(), make_execution(), make_instruction(), make_instruction_block(), make_loop(), make_new_scalar_variable_with_prefix(), MakeEmptyInstructionBlock(), MakeLabel(), NIL, NORMALIZE_EXPRESSION, normalized_linear_p, PushBlock(), range_increment, range_lower, range_upper, reference_indices, reference_variable, STATEMENT, syntax_reference, syntax_reference_p, and UU.
This function is used to handle either an ELSE or an ELSEIF construct.
No open block can be closed by this ELSE
Generate a CONTINUE to carry the comments but not the label because the ELSE is not represented in the IR and cannot carry comments. The ELSEIF is transformed into an IF which can carry comments and label but the prettyprint of structured code is nicer if the comments are carried by a CONTINUE in the previous block. Of course, this is not good for unstructured code since comments end up far from their intended target or attached to a dead CONTINUE if the previous block ends up with a GO TO.
The current label is temporarily hidden.
generate a CONTINUE to carry the label because the ELSE is not represented in the IR
is_else_p | s_else_p |
Definition at line 1522 of file statement.c.
References BlockStack, CAR, CurrentBlock, empty_current_label_string_p(), FatalError, free(), get_current_label_string(), instruction_test, instruction_test_p, iPrevComm, LinkInstToCurrentBlock(), make_continue_instruction(), ParserError(), PopBlock(), PushBlock(), reset_current_label_string(), set_current_label_string(), STATEMENT, statement_instruction, strdup(), and test_false.
Referenced by MakeEndifInst().
instruction MakeEmptyInstructionBlock | ( | void | ) |
this function creates an empty block
Definition at line 654 of file statement.c.
References make_instruction_block(), and NIL.
Referenced by MakeBlockIfInst(), MakeCurrentFunction(), MakeDoInst(), and MakeWhileDoInst().
void MakeEnddoInst | ( | void | ) |
inkInstToCurrentBlock(MakeZeroOrOneArgCallInst("ENDDO", expression_undefined));
Although it is not really an instruction, the ENDDO statement may carry comments and be labelled when closing a DO label structure.
An unlabelled ENDDO can only close one loop. This cannot be performed by LinkInstToCurrentBlock().
Definition at line 1611 of file statement.c.
References BlockStack, CurrentBlock, lab_I, LinkInstToCurrentBlock(), make_continue_instruction(), ParserError(), and PopBlock().
void MakeEndifInst | ( | void | ) |
generate a CONTINUE to carry the comments
Definition at line 1578 of file statement.c.
References BlockStack, CurrentBlock, iPrevComm, LinkInstToCurrentBlock(), make_continue_instruction(), MakeElseInst(), ParserError(), pips_assert, and PopBlock().
instruction MakeEntry | ( | entity | e, |
list | lfp | ||
) |
An ENTRY statement is substituted by a labelled continue.
The ENTRY entity is created as in MakeExternalFunction() and MakeCurrentFunction(). list of formal parameters
current module cm
The parser expects an instruction and not a statement. I use a block wrapping to avoid tampering with lab_I.
entity e = FindOrCreateEntity(cmn, en);
result type
current chunk (temporary)
list of effective formal parameters
Name conflicts could be checked here as in MakeCurrentFunction()
Keep track of the effective formal parameters of the current module cm at the first call to MakeEntry and reallocate static variables.
Check if the static area is empty and define a specific common if not.
Too early: StaticArea is not defined yet. Postpone to ProcessEntry. if(area_size(type_area(entity_type(StaticArea)))!=0) { MakeEntryCommon(cm, StaticArea); }
Compute the result type and make sure a functional entity is being used.
In case of previous declaration in the current module
Entity e must not be destroyed if fe is a function because e must carry the result.
In case of previous declaration in the current module
Entry fe may have been encountered earlier and typed from the parameter list
This depends on what has been done in LocalToGlobal and SafeLocalToGlobal
This depends on what has been done in LocalToGlobal and SafeLocalToGlobal
A call site for fe has been encountered in another module
Should now be the normal case...
The entry formal parameters should be removed if they are not formal parameters of the current module... but they are referenced. They cannot be preserved although useless because they may be dimensionned by expressions legal for this entry but not for the current module. They should be removed later when dead code elimination let us know which variables are used by each entry.
Temporarily, the formal parameters of entry fe are declared in cm to keep the code consistent but they are supposedly not added to cm's declarations... because FindOrCreateEntity() does not update declarations. MakeAtom() does not redeclare formal parameters.
Let's assume it works for undefined storages..
Should it really be officially declared?
Remove it from the declaration list
fp may appear in a type statement and/or an executable statement: the information is now lost.
Request some post-processing
lfp | entry, local to retrieve potential explicit typing |
Definition at line 1810 of file procedure.c.
References AddEffectiveFormalParameter(), AddEntryEntity(), AddEntryLabel(), AddEntryTarget(), CAR, code_declarations, code_undefined, code_undefined_p, CONS, dump_arguments(), EmptyEntryListsP(), ENDP, ENTITY, entity_declarations, entity_function_p(), entity_initial, entity_is_argument_p(), entity_local_name(), entity_name, entity_storage, entity_type, entity_undefined, fprintf(), free_storage(), free_type(), gen_remove(), get_current_module_entity(), ifdebug, is_storage_formal, is_type_void, is_value_code, IsEffectiveFormalParameterP(), list_undefined, LocalToGlobal(), make_code(), make_continue_statement(), make_formal(), make_instruction_block(), make_language_fortran(), make_new_label(), make_sequence(), make_storage(), make_storage_rom(), make_type(), make_value(), MakeResultType(), MAP, module_local_name(), NIL, pips_assert, pips_debug, pips_internal_error, pips_user_warning, POP, SafeLocalToGlobal(), STATEMENT, storage_formal_p, storage_rom_p, storage_undefined_p, strdup(), TranslateEntryFormals(), type_undefined, type_undefined_p, TypeFunctionalEntity(), UpdateFormalStorages(), UpdateFunctionalType(), UU, value_code, value_code_p, value_undefined_p, and value_unknown_p.
this function creates an atom of an equivalence chain.
s is a reference to a variable.
reference offset
substring offset
Equivalenced variables cannot be initialized by a DATA statement: false
In case, the entity is not of type variable, reject it.
In case an adjustable array which is not a formal parameter has been encountered, reject it.
what is the offset of this reference ?
Definition at line 89 of file equivalence.c.
References array_with_numerical_bounds_p(), call_arguments, call_function, CAR, CDR, entity_local_name(), entity_storage, entity_type, EXPRESSION, expression_constant_p(), expression_syntax, expression_to_int(), formal_parameter_p(), make_atom(), module_local_name(), OffsetOfReference(), ParserError(), pips_assert, pips_debug, pips_user_warning, reference_undefined, reference_variable, storage_undefined_p, SUBSTRING_FUNCTION_NAME, syntax_call, syntax_call_p, syntax_reference, syntax_reference_p, and type_variable_p.
Assertion: fe is a (functional) global entity and the type of its result is new_r, or it is a formal functional parameter
a function has a rom storage, except for formal functions
an external function has an unknown initial value, else code would be temporarily undefined which is avoided (theoretically forbidden) in PIPS.
fe is added to CurrentFunction's entities
r | entity to be turned into external function type of result |
Definition at line 2372 of file procedure.c.
References AddEntityToDeclarations(), entity_blockdata_p(), entity_initial, entity_name, entity_storage, entity_undefined, get_current_module_entity(), LocalToGlobal(), make_storage_rom(), make_value_unknown(), MakeResultType(), pips_debug, pips_user_warning, storage_formal_p, storage_undefined, type_undefined, TypeFunctionalEntity(), and value_undefined.
Referenced by DeclareExternalFunction(), MakeAtom(), and MakeCallInst().
This function transforms an untyped entity into a formal parameter.
fp is an entity generated by FindOrCreateEntity() for instance, and nfp is its rank in the formal parameter list.
A specific type is used for the return code variable which may be adde by the parser to handle alternate returns. See return.c offset (i.e. rank) of formal parameter
fp | module of formal parameter |
nfp | formal parameter |
Definition at line 2466 of file procedure.c.
References entity_initial, entity_local_name(), entity_storage, entity_type, formal_label_replacement_p(), ImplicitType(), is_basic_int, is_basic_string, is_storage_formal, is_type_variable, make_basic(), make_formal(), make_storage(), make_type(), make_value_unknown(), make_variable(), MakeTypeVariable(), NIL, ParserError(), pips_user_warning, ReturnCodeVariableP(), SubstituteAlternateReturnsP(), and type_undefined_p.
Referenced by ScanFormalParameters().
expression MakeFortranBinaryCall | ( | entity | op, |
expression | e1, | ||
expression | e2 | ||
) |
op | p |
e1 | 1 |
e2 | 2 |
Definition at line 502 of file expression.c.
References expression_implied_do_p(), expression_undefined, MakeBinaryCall(), and ParserError().
this function creates a type that represents a fortran type.
its basic is an int (the length of the fortran type) except in case of strings where the type might be unknown, as in:
CHARACTER*(*) PF
t is a tag, eg: INTEGER, REAL, ...
v is a value that represents the length in bytes of the type.
Check compatibility between type and byte length
Accept INTEGER*1 for SIMD parallelizer and INTEGER*2 for legacy code and INTEGER*8 for 64 bit machines
Definition at line 1505 of file declaration.c.
References constant_int, DefaultLengthOfBasic(), get_bool_property(), is_basic_complex, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_string, is_constant_int, is_value_constant, make_basic(), make_constant(), make_value(), MakeTypeVariable(), NIL, ok, ParserError(), value_constant, and value_undefined.
expression MakeFortranUnaryCall | ( | entity | op, |
expression | e1 | ||
) |
op | p |
e1 | 1 |
Definition at line 519 of file expression.c.
References expression_implied_do_p(), expression_undefined, MakeUnaryCall(), and ParserError().
Referenced by gfc2pips_expr2expression(), gfc2pips_int2expression(), and gfc2pips_real2expression().
instruction MakeGotoInst | ( | string | n | ) |
this function creates a goto instruction.
n is the target label.
Definition at line 686 of file statement.c.
References entity_undefined, instruction_undefined, make_goto_instruction(), and MakeLabel().
Referenced by MakeArithmIfInst(), MakeAssignedOrComputedGotoInst(), and MakeReturn().
expression MakeImpliedDo | ( | syntax | v, |
range | r, | ||
cons * | l | ||
) |
expressions from input output lists might contain implied do loops.
with our internal representation, implied do loops are stored as calls to a special intrinsic function whose name is IMPLIED_DO_NAME and whose first argument is the range of the loop.
v is a reference to the do variable.
r is the range of the loop.
l is the list of expressions which are to be read or written according to this implied do loop.
the range is enclosed in an expression
Definition at line 115 of file expression.c.
References CONS, CreateIntrinsic(), EXPRESSION, FatalError, IMPLIED_DO_NAME, is_syntax_call, is_syntax_range, make_call(), make_expression(), make_syntax(), normalized_undefined, reference_indices, syntax_reference, and syntax_reference_p.
Referenced by loop_to_implieddo().
instruction MakeIoInstA | ( | int | keyword, |
list | lci, | ||
list | lio | ||
) |
this function creates an IO statement.
keyword indicates which io statement is to be built (READ, WRITE, ...).
lci is a list of 'control specifications'. its has the following format:
("UNIT=", 6, "FMT=", "*", "RECL=", 80, "ERR=", 20)
lio is the list of expressions to write or references to read.
The composite IO with potential branches for ERR and END
The pure io itself
virtual tests to implement ERR= and END= clauses
we scan the list of specifications to detect labels (such as in ERR=20, END=30, FMT=50, etc.), that were stored as integer constants (20, 30, 50) and that must be replaced by labels (_20, _30, _50).
here is a label
UNIT is not defined for INQUIRE (et least) Let's use LUN 0 by default for END et ERR.
keyword | eyword |
lci | ci |
lio | io |
Definition at line 1715 of file statement.c.
References call_function, CAR, CDR, CONS, constant_int_p, CreateIntrinsic(), entity_empty_label(), entity_initial, entity_local_name(), EXPRESSION, expression_syntax, expression_undefined, expression_undefined_p, free_expression(), gen_nconc(), instruction_consistent_p(), instruction_undefined, int_to_expression(), IO_EOF_ARRAY_NAME, IO_ERROR_ARRAY_NAME, is_instruction_call, is_instruction_sequence, make_call(), make_check_io_statement(), make_instruction(), make_sequence(), MakeLabel(), MakeStatement(), NameOfToken(), NIL, pips_assert, s1, STATEMENT, statement_undefined, statement_undefined_p, syntax_call, syntax_call_p, value_constant, and value_constant_p.
Referenced by MakeSimpleIoInst1().
instruction MakeIoInstB | ( | int | keyword, |
expression | e1, | ||
expression | e2, | ||
expression | e3, | ||
expression | e4 | ||
) |
this function creates a BUFFER IN or BUFFER OUT io statement.
this is not ansi fortran.
e1 is the logical unit.
nobody known the exact meaning of e2
e3 et e4 are references that indicate which variable elements are to be buffered in or out.
keyword | eyword |
e1 | 1 |
e2 | 2 |
e3 | 3 |
e4 | 4 |
Definition at line 1837 of file statement.c.
References CONS, CreateIntrinsic(), EXPRESSION, is_instruction_call, make_call(), make_instruction(), and NameOfToken().
This function takes a list of io elements (i, j, t(i,j)), and returns the same list, with a cons cell pointing to a character constant expression 'IOLIST=' before each element of the original list.
(i , j , t(i,j)) becomes ('IOLIST=' , i , 'IOLIST=' , j , 'IOLIST=' , t(i,j))
This IO list is later concatenated to the IO control list to form the argument of an IO function. The tagging is necessary because of this concatenation.
The IOLIST call used to be shared within one IO list. Since sharing is avoided in the PIPS internal representation, they are now duplicated.
to walk thru l
result list
Definition at line 468 of file expression.c.
References CDR, CONS, EXPRESSION, gen_nconc(), IO_LIST_STRING_NAME, MakeCharacterConstantExpression(), and NIL.
entity MakeLabel | ( | const char * | ) |
instruction MakeLogicalIfInst | ( | expression | e, |
instruction | i | ||
) |
this function creates a logical if statement.
the true part of the test is a block with only one instruction (i), and the false part is an empty block.
Modifications:
It is not easy to number bt because Yacc reduction order does not help...
Instruction i should not be a block, unless:
If the logical IF is labelled, the label has been stolen by the first statement in the block. This shows that label should only be affected by MakeStatement and not by desugaring routines.
statement first = STATEMENT(CAR(l));
Only the alternate return case assert: pips_assert("Block of two instructions or call with return code checks", (gen_length(l)==2 && assignment_statement_p(first)) || (statement_call_p(first)) );
Definition at line 1329 of file statement.c.
References FatalError, fix_if_condition(), get_statement_number(), instruction_block, instruction_block_p, instruction_to_statement(), instruction_undefined, is_instruction_test, make_empty_block_statement(), make_instruction(), make_test(), MAP, STATEMENT, and statement_number.
statement MakeNewLabelledStatement | ( | entity | l, |
instruction | i | ||
) |
Associate label to the first statement in the block because block cannot be labelled.
Definition at line 289 of file statement.c.
References CAR, CONS, debug(), empty_comments, empty_extensions(), entity_empty_label(), get_bool_property(), get_statement_number(), instruction_block, instruction_block_p, instruction_goto_p, instruction_identification(), instruction_loop_p, instruction_to_statement(), label_local_name(), make_block_statement(), make_continue_statement(), make_statement(), make_synchronization_none(), NewStmt(), NIL, s1, STATEMENT, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, and STATEMENT_ORDERING_UNDEFINED.
Referenced by MakeStatement().
entity MakeParameter | ( | entity | e, |
expression | x | ||
) |
lint
this function creates a PARAMETER, ie a symbolic constant.
e is an entity.
x is an expression that represents the value of e.
Take the integer part of the floating point constant
Definition at line 52 of file expression.c.
References constant_float, constant_float_p, constant_int, constant_int_p, constant_tag, entity_initial, entity_local_name(), entity_storage, entity_type, FatalError, float_type_p(), ImplicitType(), int, is_constant_int, is_type_functional, make_functional(), make_storage_rom(), make_type(), MakeValueSymbolic(), NIL, ParserError(), scalar_integer_type_p(), storage_ram_p, storage_undefined_p, symbolic_constant, type_undefined, user_warning, value_symbolic, value_undefined_p, value_unknown_p, and x.
Referenced by step_parameter().
The result type of a function may be carried by e, by r or be implicit.
A new type structure is allocated, unless r is used as new result type.
e is a function that was implicitly declared as a variable. this may happen in Fortran.
pips_assert("undefined type", r == type_undefined);
The variable may have been typed, for instance implicitly, but then it appears in a CALL statement and its new type is void. Added for formal parameters.
Well... this should be useless because e is already typed. FI: I do not believe copy_type() is necessary in spite of the non orthogonality...
Definition at line 1754 of file procedure.c.
References copy_type(), entity_name, entity_type, functional_result, ImplicitType(), pips_assert, pips_debug, pips_internal_error, type_functional, type_functional_p, type_to_string(), type_undefined, type_undefined_p, type_variable_p, and type_void_p.
Referenced by MakeEntry(), and MakeExternalFunction().
instruction MakeReturn | ( | expression | e | ) |
Assign e to the return code variable, but be sure not to count this assignment as a user instruction. Wrap if with the Go To in a block and return the block instruction.
See how code is synthesized for computed goto's...
Let's try to provide more useful information to the user
inst = MakeZeroOrOneArgCallInst("STOP", e);
Definition at line 445 of file return.c.
References call_function, concatenate(), CONS, end_label, end_label_local_name, entity_local_name(), entity_undefined, expression_call_p(), expression_syntax, expression_undefined_p, get_current_module_name(), get_statement_number(), instruction_consistent_p(), instruction_to_statement(), instruction_undefined, line_b_I, line_e_I, make_instruction_block(), make_set_rc_statement(), MakeCharacterConstantExpression(), MakeGotoInst(), MakeLabel(), MakeZeroOrOneArgCallInst(), NIL, pips_internal_error, src, STATEMENT, statement_number, strdup(), substitute_rc_p, substitute_stop_p, syntax_call, user_error, and uses_alternate_return_p().
instruction MakeSimpleIoInst1 | ( | int | keyword, |
expression | unit | ||
) |
Functionally PRINT is a special case of WRITE
keyword | eyword |
Definition at line 1854 of file statement.c.
References CONS, CreateIntrinsic(), EXPRESSION, instruction_undefined, LIST_DIRECTED_FORMAT_NAME, MakeCharacterConstantExpression(), MakeIoInstA(), MakeNullaryCall(), NIL, ParserError(), TK_BACKSPACE, TK_CLOSE, TK_ENDFILE, TK_INQUIRE, TK_OPEN, TK_PRINT, TK_READ, TK_REWIND, and TK_WRITE.
instruction MakeSimpleIoInst2 | ( | int | keyword, |
expression | f, | ||
list | io_list | ||
) |
keyword | eyword |
io_list | o_list |
Definition at line 1899 of file statement.c.
References f(), instruction_undefined, make_simple_Fortran_io_instruction(), ParserError(), TK_BACKSPACE, TK_CLOSE, TK_ENDFILE, TK_INQUIRE, TK_OPEN, TK_PRINT, TK_READ, TK_REWIND, and TK_WRITE.
Referenced by make_print_statement().
statement MakeStatement | ( | entity | l, |
instruction | i | ||
) |
This function makes a statement.
l is the label and i the instruction. We make sure that the label is not declared twice.
Comments are added by LinkInstToCurrentBlock() which calls MakeStatement() because it links the instruction by linking its statement..
GO TO statements are numbered like other statements although they are destroyed by the controlizer. To be changed.
There is an actual label
Well, there is no easy solution to handle labels when Fortran constructs such as alternate returns, computed gotos and assigned gotos are desugared because they may be part of a logical IF, unknowingly.
FI, PJ: the "rice" phase does not handle labels on DO like 100 in: 100 DO 200 I = 1, N
This should be trapped by "rice" when loops are checked to see if Allen/Kennedy's algorithm is applicable
There is not forward reference to the this label. A new statement can be safely allocated.
A forward reference has been encountered and the corresponding statement has been allocated and has been referenced by at least one go to statement.
The CONTINUE slot can be re-used. It is likely to be an artificial CONTINUE added to carry a comment. Maybe it would be better to manage lab_I in a more consistent way by resetting it as soon as it is used. But I did not find the reset!
}
No actual label, no problem
Definition at line 431 of file statement.c.
References constant_litteral_p, debug(), empty_comments, empty_extensions(), entity_empty_label_p(), entity_initial, entity_local_name(), entity_name, entity_storage, entity_type, get_bool_property(), get_statement_number(), instruction_block_p, instruction_goto_p, instruction_identification(), instruction_loop_p, instruction_undefined, LabelToStmt(), make_statement(), make_synchronization_none(), MakeNewLabelledStatement(), NIL, ParserError(), pips_assert, ReuseLabelledStatement(), statement_instruction, STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, statement_undefined, storage_rom_p, type_statement_p, user_warning, value_constant, and value_constant_p.
Referenced by GenerateReturn(), LinkInstToCurrentBlock(), MakeBlockIfInst(), and MakeIoInstA().
v may have become static because of a DATA statement (OK) or because of another SAVE (NOK)
Could be the stack or the heap area or any common
force_it | orce_it |
Definition at line 245 of file declaration.c.
References DynamicArea, entity_local_name(), entity_storage, module_local_name(), ParserError(), ram_section, SaveEntity(), StaticArea, storage_ram, storage_ram_p, storage_tag, storage_undefined, and user_warning.
Referenced by ProcessSave(), and save_initialized_variable().
void MakeWhileDoInst | ( | expression | c, |
string | l | ||
) |
This function creates a while do loop statement.
c is the loop condition l is the label of the last statement of the loop.
with the f77 compiler, this is equivalent to c.NE.0
Definition at line 1262 of file statement.c.
References entity_intrinsic(), expression_undefined, instruction_to_statement(), int_to_expression(), is_instruction_whileloop, line_b_I, line_e_I, LinkInstToCurrentBlock(), logical_expression_p(), make_evaluation_before(), make_instruction(), make_whileloop(), MakeBinaryCall(), MakeEmptyInstructionBlock(), MakeLabel(), NON_EQUAL_OPERATOR_NAME, pips_user_warning, and PushBlock().
instruction MakeZeroOrOneArgCallInst | ( | char * | s, |
expression | e | ||
) |
this function creates a simple Fortran statement such as RETURN, CONTINUE, ...
s is the name of the intrinsic function.
e is one optional argument (might be equal to expression_undefined).
la liste d'arguments
Definition at line 669 of file statement.c.
References CONS, CreateIntrinsic(), EXPRESSION, expression_undefined, is_instruction_call, make_call(), make_instruction(), and NIL.
Referenced by GenerateReturn(), gfc2pips_code2instruction__TOP(), MakeAssignedOrComputedGotoInst(), and MakeReturn().
this function merges two equivalence chains whose intersection is not empty, ie.
one variable occurs in both chains.
opc1 | pc1 |
opc2 | pc2 |
Definition at line 322 of file equivalence.c.
References abs, ATOM, atom_equioff, atom_equivar, CAR, CDR, FatalError, gen_eq(), and NIL.
Referenced by AddOrMergeChain().
just to avoid a gcc warning
token | oken |
Definition at line 1636 of file statement.c.
References FatalError, string_undefined, TK_BACKSPACE, TK_BUFFERIN, TK_BUFFEROUT, TK_CLOSE, TK_ENDFILE, TK_INQUIRE, TK_OPEN, TK_PRINT, TK_READ, TK_REWIND, and TK_WRITE.
Referenced by MakeIoInstA(), and MakeIoInstB().
Check for potential conflicts
Definition at line 1071 of file declaration.c.
References BLOCKDATA_PREFIX, COMMON_PREFIX, concatenate(), entity_undefined_p, FindEntity(), FindOrCreateEntity(), free(), MAIN_PREFIX, MakeCommon(), prefixes, strdup(), TOP_LEVEL_MODULE_NAME, and user_warning.
Ignore ghost variables, they are not in the current scope
The functional entity must be a formal parameter
The current declaration is wrong and should be fixed later, i.e. by MakeExternalFunction() or MakeCallInst()
It is the name of a blockdata
name | ame |
Definition at line 2217 of file procedure.c.
References BLOCKDATA_PREFIX, concatenate(), CurrentPackage, entity_domain, entity_storage, entity_undefined, entity_undefined_p, f(), FindOrCreateEntity(), gen_find_tabulated(), ghost_variable_entity_p(), MODULE_SEP_STRING, pips_assert, storage_formal_p, storage_undefined_p, and TOP_LEVEL_MODULE_NAME.
int NeedKeyword | ( | void | ) |
just to avoid a gcc warning
OTREACHED
Definition at line 1329 of file reader.c.
References CapitalizeStmt(), int, iStmt, keywidx, keywtbl, ParserError(), stmt_buffer, StmtEqualString(), and UNDEF.
Referenced by FindAutre(), and FindImplicit().
this function stores a new association in table StmtHeap: the label of statement s is e.
Definition at line 141 of file statement.c.
References CurrentStmt, entity_empty_label_p(), entity_name, init_StmtHeap_buffer(), stmt::l, LabelToStmt(), ParserError(), pips_assert, resize_StmtHeap_buffer(), stmt::s, statement_label, statement_undefined, StmtHeap_buffer, StmtHeap_buffer_size, and user_log().
Referenced by make_goto_instruction(), and MakeNewLabelledStatement().
This function computes the numerical offset of a variable element from the begining of the variable.
The variable must have numerical bounds for this function to work. It core dumps for adjustable arrays such as formal parameters.
Use a trick to retrieve the size in bytes of one array element and use the size of the previous dimension
Definition at line 1565 of file declaration.c.
References CAR, CDR, EXPRESSION, ExpressionToInt(), reference_indices, reference_variable, SizeOfIthDimension(), and ValueOfIthLowerBound().
Referenced by MakeEquivAtom().
bool parser | ( | const | string | ) |
string | odule |
Definition at line 291 of file parser.c.
References module, and the_actual_parser().
void parser_add_a_macro | ( | call | c, |
expression | e | ||
) |
resize!
expand macros in the macro! It is ok, because referenced macros must appear in preceding lines (F77 15-5, line 3-5).
store the result.
Definition at line 113 of file macros.c.
References call_function, current_macro_index, current_macros, current_macros_size, entity_name, find_entity_macro(), macro_t::lhs, parser_substitute_all_macros_in_expression(), ParserError(), pips_assert, pips_debug, pips_user_warning, and macro_t::rhs.
Referenced by MakeAssignInst().
void parser_close_macros_support | ( | void | ) |
what about the entity? It might exist such a real top-level entity... what if added as a callee... the entity should be destroyed... best would be to have it as a local entity, and have the calles and top-level updates delayed.
Definition at line 72 of file macros.c.
References call_function, current_macro_index, current_macros, free_call(), free_expression(), macro_t::lhs, pips_debug, and remove_from_called_modules().
Referenced by EndOfProcedure().
Definition at line 108 of file macros.c.
References find_entity_macro().
void parser_init_macros_support | ( | void | ) |
??? memory leak...
Definition at line 57 of file macros.c.
References current_macro_index, current_macros, current_macros_size, malloc(), pips_assert, and pips_debug.
Referenced by the_actual_parser().
void parser_macro_expansion | ( | expression | e | ) |
of expression
get the macro definition.
duplicated, for latter subs.
replace each formal by its actual.
MUST be a simple reference
if the replacement is a constant, or a reference without calls to external functions, it should be safe
it is important to keep the same expression, for gen_recurse use.
Definition at line 224 of file macros.c.
References call_arguments, call_function, CAR, copy_expression(), ENDP, entity_name, EXPRESSION, expression_call_p(), expression_reference_p(), expression_syntax, find_entity_macro(), free(), free_syntax(), gen_length(), macro_t::lhs, module_local_name(), pips_assert, pips_debug, pips_user_warning, POP, reference_indices, reset_substitute_expression_in_expression(), macro_t::rhs, substitute_expression_in_expression(), syntax_call, syntax_reference, syntax_undefined, and untrusted_call_p().
Referenced by parser_substitute_all_macros().
void parser_reset_all_reader_buffers | ( | void | ) |
void parser_reset_StmtHeap_buffer | ( | void | ) |
statement.c
Definition at line 85 of file statement.c.
References CurrentStmt.
Referenced by ParserError().
void parser_substitute_all_macros | ( | statement | s | ) |
Definition at line 294 of file macros.c.
References current_macro_index, expression_domain, gen_recurse, gen_true(), get_bool_property(), and parser_macro_expansion().
Referenced by EndOfProcedure(), and parser_substitute_all_macros_in_expression().
void parser_substitute_all_macros_in_expression | ( | expression | e | ) |
Definition at line 302 of file macros.c.
References parser_substitute_all_macros().
Referenced by parser_add_a_macro().
bool ParserError | ( | const char * | f, |
const char * | m | ||
) |
Maybe a routine called by ParserError() may call ParserError() e.g. AbortOfProcedure() thru remove_ghost_variables()
Get rid of partly declared variables...
Callers may already have pointers towards this function. The prettyprinter core dumps if entity_initial is destroyed. Maybe, I should clean the declarations field in code, as well as decls_text.
The error may occur before the current module entity is defined
GetChar() will reinitialize its own buffer when called
Because of the strange behavior of BeginingOfParsing
CurrentPackage = NULL;
Too bad for memory leak...
FI: let catch_error() take care of this in pipsmake since debug_on() was not activated in ParserError
Should never be executed
Definition at line 116 of file parser.c.
References AbortEntries(), AbortOfProcedure(), CleanLocalEntities(), code_declarations, code_decls_text, CurrentFN, CurrentPackage, DynamicArea, entity_initial, entity_undefined, error_reset_current_module_entity(), f(), free(), get_current_module_entity(), HeapArea, InParserError, line_b_I, line_e_I, NIL, parser_reset_all_reader_buffers(), parser_reset_StmtHeap_buffer(), reset_common_size_map_on_error(), reset_parser_recursive_call(), ResetBlockStack(), ResetChains(), ResetReturnCodeVariable(), safe_fclose(), soft_reset_alternate_returns(), StaticArea, string_undefined, SubstituteAlternateReturns(), syn_in, syn_reset_lex(), TOP_LEVEL_MODULE_NAME, user_error, uses_alternate_return(), and value_code.
Referenced by AddVariableToCommon(), AnalyzeData(), CapitalizeStmt(), check_in_declarations(), CheckAndInitializeStmt(), CheckParenthesis(), ComputeAddresses(), DeclareExternalFunction(), DeclarePointer(), DeclareVariable(), EndOfProcedure(), EvalCall(), EvalSyntax(), expression_reference_number(), find_target_position(), fix_if_condition(), fix_storage(), FortranExpressionList(), IsCapKeyword(), LinkInstToCurrentBlock(), make_Fortran_constant_entity(), MakeAssignInst(), MakeAtom(), MakeCurrentFunction(), MakeDataValueSet(), MakeElseInst(), MakeEnddoInst(), MakeEndifInst(), MakeEntryCommon(), MakeEquivAtom(), MakeFormalParameter(), MakeFortranBinaryCall(), MakeFortranType(), MakeFortranUnaryCall(), MakeParameter(), MakeSimpleIoInst1(), MakeSimpleIoInst2(), MakeStatement(), MakeVariableStatic(), NeedKeyword(), NewStmt(), parser_add_a_macro(), PopBlock(), process_static_initialization(), process_value_list(), PushBlock(), ReadLine(), ReadStmt(), remove_ghost_variable_entities(), reset_common_size_map(), SafeSizeOfArray(), SaveChains(), SaveEntity(), store_initial_value(), SubstituteAlternateReturns(), TypeFunctionalEntity(), update_called_modules(), update_functional_type_result(), uses_alternate_return(), and ValueOfIthLowerBound().
int PipsGetc | ( | FILE * | fp | ) |
Routine de lecture pour l'analyseur lexical, lex ou flex.
fp | p |
Definition at line 557 of file reader.c.
References CheckParenthesis(), FindAssign(), FindAutre(), FindDo(), FindIf(), FindIfArith(), FindImplicit(), FindPoints(), iStmt, lStmt, ReadStmt(), SIZE_UNDEF, stmt_buffer, and UNQUOTE.
instruction PopBlock | ( | void | ) |
Definition at line 238 of file statement.c.
References BlockStack, CurrentBlock, IsBlockStackEmpty(), and ParserError().
Referenced by EndOfProcedure(), LinkInstToCurrentBlock(), MakeElseInst(), MakeEnddoInst(), and MakeEndifInst().
void print_full_malloc_info | ( | FILE * | ) |
void print_malloc_info | ( | FILE * | ) |
void PrintChain | ( | chain | c | ) |
Definition at line 382 of file equivalence.c.
References ATOM, atom_equioff, atom_equivar, CAR, CDR, chain_atoms, entity_name, fprintf(), ifdebug, NIL, and pips_debug.
Referenced by PrintChains().
void PrintChains | ( | equivalences | e | ) |
two debugging functions, just in case ...
Definition at line 364 of file equivalence.c.
References CAR, CDR, CHAIN, ENDP, equivalences_chains, fprintf(), ifdebug, NIL, and PrintChain().
Referenced by ComputeEquivalences().
a debugging function, just in case ...
ldvr | dvr |
ldvl | dvl |
Definition at line 310 of file declaration.c.
References CAR, CDR, constant_int, constant_int_p, DATAVAL, dataval_constant, dataval_nboccurrences, DATAVAR, datavar_nbelements, datavar_variable, debug(), entity_name, and NIL.
void ProcessEntries | ( | void | ) |
To avoid an include of the prettyprint library and/or a compiler warning.
The declarations for cm are likely to be incorrect. They must be synthesized by the prettyprinter.
Regenerate a SOURCE_FILE .f without entries for the module itself
To avoid warnings about column 73 when the code is parsed again
Not ot duplicate DATA statements for static variables and common variables in every entry
Process each entry
Postponed to the_actual_parser() which needs to know entries were encountered
Definition at line 2171 of file procedure.c.
References CAR, code_decls_text, ENDP, ENTITY, entity_code(), entry_entities, entry_labels, entry_targets, free(), get_bool_property(), get_current_module_entity(), get_current_module_statement(), make_text_resource_and_free(), module_local_name(), NIL, pips_assert, POP, ProcessEntry(), set_bool_property(), STATEMENT, statement_label, strdup(), text_named_module(), and text_undefined.
Referenced by EndOfProcedure().
void ProcessSave | ( | entity | v | ) |
Definition at line 282 of file declaration.c.
References MakeVariableStatic().
void PushBlock | ( | instruction | i, |
string | l | ||
) |
Definition at line 221 of file statement.c.
References BlockStack, CurrentBlock, instruction_block_p, IsBlockStackFull(), ParserError(), and pips_assert.
Referenced by MakeBlockIfInst(), MakeCurrentFunction(), MakeDoInst(), MakeElseInst(), and MakeWhileDoInst().
int ReadLine | ( | FILE * | fp | ) |
All physical lines of a statement are put together in a unique buffer called "line_buffer".
Each character in each physical line is retrieved with GetChar().
on entre dans ReadLine avec Column = 1
Read all comment lines you can
Read label
Check continuation character
Keep track of the first and last comment lines and of the first and last statement lines. These two intervals may intersect.
Append current comment CurrComm to Comm if it is a continuation. Save Comm in PrevComm and CurrComm in Comm if it is a first statement line.
FI: this is all wrong
Why destroy comments because there are continuation lines?
tmp_b_C = tmp_e_C = UNDEF;
Read the rest of the line, skipping SPACEs but handling string constants
fp | p |
Definition at line 765 of file reader.c.
References Column, Comm, CommSize, CONTINUATION_LINE, CurrComm, debug(), EOF_LINE, EtatQuotes, FIRST_LINE, GetChar(), iComm, iCurrComm, ifdebug, init_line_buffer(), INQUOTEBACKSLASH, INQUOTEQUOTE, INQUOTES, iPrevComm, line_buffer, line_buffer_size, LineNumber, lLine, NONINQUOTES, ParserError(), pips_assert, pips_debug, pips_user_warning, PrevComm, QUOTE, resize_comment_buffers(), resize_line_buffer(), START_COMMENT_LINE, tmp_b_C, tmp_b_I, tmp_e_C, tmp_lab_I, and UNDEF.
Referenced by ReadStmt().
int ReadStmt | ( | FILE * | fp | ) |
regroupement des lignes du statement en une unique ligne sans continuation
It would be nice to move the current comments from Comm to PrevComm, but it is just too late because of the repeat until control structure down: ReadLine() has already been called and read the first line of the next statement. Hence, CurrComm is needed.
Memorize the line number before to find next Statement
Update the current final lines for instruction and comments
Initialize temporary beginning and end line numbers
fp | p |
Definition at line 942 of file reader.c.
References CONTINUATION_LINE, EOF_LINE, EofSeen, FIRST_LINE, ifdebug, iLine, init_stmt_buffer(), iStmt, lab_I, line_b_C, line_b_I, line_buffer, line_e_C, line_e_I, LineNumber, lLine, lStmt, ParserError(), pips_debug, ReadLine(), resize_stmt_buffer(), stmt_buffer, stmt_buffer_size, StmtLineNumber, tmp_b_C, tmp_b_I, tmp_e_C, tmp_e_I, tmp_lab_I, and UNDEF.
Referenced by PipsGetc().
void reify_ghost_variable_entity | ( | entity | e | ) |
It is possible to change one's mind and effectively use an entity which was previously assumed useless.
Definition at line 284 of file procedure.c.
References arguments_rm_entity(), entity_is_argument_p(), ghost_variable_entities, list_undefined_p, and pips_assert.
Referenced by CheckLeftHandSide().
void remove_from_called_modules | ( | entity | e | ) |
macros are added, although they should not have been.
Definition at line 354 of file procedure.c.
References called_modules, CAR, CDR, ENDP, entity_name, free(), gen_free_list(), module_local_name(), NIL, pips_debug, POP, same_string_p, and STRING.
Referenced by parser_close_macros_support().
void remove_ghost_variable_entities | ( | bool | substitute_p | ) |
The debugging message must use the variable name before it is freed
We already are in ParserError()! Too bad for the memory leak
substitute_p | ubstitute_p |
Definition at line 206 of file procedure.c.
References ENTITY, entity_in_equivalence_chains_p(), entity_local_name(), entity_name, entity_type, entity_undefined_p, function_body, ghost_variable_entities, list_undefined, list_undefined_p, local_name_to_top_level_entity(), MAP, ParserError(), pips_assert, pips_debug, remove_variable_entity(), substitute_ghost_variable_in_statement(), type_functional_p, type_undefined_p, type_variable_p, and user_warning.
Referenced by AbortOfProcedure(), and EndOfProcedure().
void remove_module_entity | ( | entity | m | ) |
It is assumed that neither variables nor areas have been declared in m but that m may have been declared by EXTERNAL in other modules.
Definition at line 1188 of file procedure.c.
References code_declarations, code_undefined_p, db_get_module_list(), entity_initial, entity_name, entity_undefined_p, free_entity(), gen_array_full_free(), gen_array_item(), gen_array_nitems(), gen_in_list_p(), gen_remove(), ifdebug, local_name_to_top_level_entity(), pips_debug, value_code, value_undefined_p, and value_unknown_p.
Referenced by MakeCurrentFunction().
void reset_alternate_returns | ( | void | ) |
Definition at line 272 of file return.c.
References alternate_returns, current_number_of_alternate_returns, gen_free_list(), list_undefined, list_undefined_p, and pips_assert.
Referenced by soft_reset_alternate_returns().
void reset_common_size_map | ( | void | ) |
Problems:
Definition at line 954 of file declaration.c.
References common_size_map, hash_table_free(), hash_table_undefined, and ParserError().
Referenced by EndOfProcedure(), and gfc2pips_namespace().
void reset_common_size_map_on_error | ( | void | ) |
Definition at line 972 of file declaration.c.
References common_size_map, hash_table_free(), and hash_table_undefined.
Referenced by ParserError().
void reset_current_label_string | ( | void | ) |
Definition at line 71 of file parser.c.
References lab_I.
Referenced by LinkInstToCurrentBlock(), and MakeElseInst().
void reset_current_number_of_alternate_returns | ( | void | ) |
Definition at line 192 of file return.c.
References current_number_of_alternate_returns.
void reset_first_statement | ( | void | ) |
Definition at line 1944 of file statement.c.
References declaration_lines, format_seen, and seen.
void reset_substitute_expression_in_expression | ( | void | ) |
Definition at line 218 of file macros.c.
References already_subs, gen_free_list(), and NIL.
Referenced by parser_macro_expansion().
void ResetBlockStack | ( | void | ) |
Definition at line 203 of file statement.c.
References CurrentBlock.
Referenced by AbortOfProcedure(), and ParserError().
void ResetChains | ( | void | ) |
undefine chains between two successives calls to parser
Definition at line 65 of file equivalence.c.
References equivalences_undefined, FinalEquivSet, free_equivalences(), and TempoEquivSet.
Referenced by EndOfProcedure(), gfc2pips_namespace(), and ParserError().
void ResetEntries | ( | void | ) |
Definition at line 1458 of file procedure.c.
References effective_formal_parameters, entry_entities, entry_labels, entry_targets, gen_free_list(), and NIL.
Referenced by the_actual_parser().
void ResetReturnCodeVariable | ( | void | ) |
Definition at line 151 of file return.c.
References entity_undefined, and return_code_variable.
Referenced by EndOfProcedure(), and ParserError().
rcv | cv |
Definition at line 145 of file return.c.
References return_code_variable.
Referenced by MakeFormalParameter().
void retype_formal_parameters | ( | void | ) |
If an IMPLICIT statement is encountered, it must be applied to the formal parameters, and, if the current module is a function, to the function result type and to the variable used internally when a value is assigned to the function (see MakeCurrentFunction)
If the current module is a function, its type should be updated.
The function signature is computed later by UpdateFunctionalType() called from EndOfProcedure: there should be no parameters in the type.
Update type of internal variable used to store the function result
nothing to be done: subroutine or main
Definition at line 1411 of file declaration.c.
References code_declarations, ENDP, ENTITY, entity_function_p(), entity_initial, entity_local_name(), entity_storage, entity_type, entity_undefined, FindEntity(), formal_parameter_p(), free_type(), functional_parameters, functional_result, get_current_module_entity(), implicit_type_p(), ImplicitType(), MAP, module_local_name(), pips_assert, pips_debug, pips_internal_error, pips_user_warning, storage_ram_p, storage_rom_p, storage_undefined_p, type_equal_p(), type_functional, type_functional_p, type_tag, type_undefined, type_variable_p, type_void_p, value_code, and variable_entity_p().
statement ReuseLabelledStatement | ( | statement | s, |
instruction | i | ||
) |
Comments probably are lost...
Here, you are in trouble because the label cannot be carried by the block. It should be carried by the first statement of the block... which has already been allocated. This only should occur with desugared constructs because they must bypass the MakeStatement() module to handle statement numbering properly.
Reuse s1, the first statement of the block, to contain the whole block. Reuse s to contain the first instruction of the block.
s only has got a label
statement_number(s) = (instruction_goto_p(i))? STATEMENT_NUMBER_UNDEFINED : get_next_statement_number();
Let's number labelled GOTO because a CONTINUE is derived later from them
Definition at line 338 of file statement.c.
References CAR, CDR, CONS, debug(), empty_comments, entity_empty_label(), get_bool_property(), get_statement_number(), instruction_block, instruction_block_p, instruction_loop_p, instruction_to_statement(), instruction_undefined_p, is_instruction_sequence, label_local_name(), make_continue_instruction(), make_instruction(), make_sequence(), NIL, pips_assert, s1, STATEMENT, statement_block_p, statement_comments, statement_instruction, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, STATEMENT_ORDERING_UNDEFINED, and statement_undefined.
Referenced by MakeStatement().
entity SafeFindOrCreateEntity | ( | const char * | package, |
const char * | name | ||
) |
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a function or subroutine call as functional parameter.
FindOrCreateEntity() will return a local variable which already is or will be in the ghost variable list. When ghost variables are eliminated the data structure using this local variable contain a pointer to nowhere.
However, SafeFindOrCreateEntity() does not solve this problem entirely. The call with a functional parameter may occur before a call to this functional parameter lets us find out it is indeed functional.
Morevover, SafeFindOrCreateEntity() does create new problem because intrinsic overloading is ignored. Fortran does not use reserved words and a local variable may have the same name as an intrinsics. The intrinsic entity returned by this function must later be converted into a local variable when it is found out that the user really wanted a local variable, for instance because it appears in a lhs. So intrinsics are not searched anymore.
This is yet another reason to split the building of the internal representation into three phases. The first phase should not assume any default type or storage. Then, type and storage are consolidated together and default type and storage are only used when no information is available. The last phase should be kind of a link edit. The references to really global variables and intrinsics have to be fixed by scanning the intermediate representation.
See also FindOrCreateEntity().
This is a request for a global variable
May be a local or a global entity
This is a request for a local or a global variable. If a local variable with name "name" exists, return it.
No such local variable yet.
Does a global variable with the same name exist and is it in the package's scope?
let s hope concatenate s buffer lasts long enough...
There is no such global variable. Let's make a new local variable
A global entity with the same local name exists.
There is such a global variable and it is in the proper scope
Here comes the mistake if the current_module_entity is not yet defined as is the case when formal parameters are parsed. Intrinsics may wrongly picked out. See capture01.f, variable DIM.
The global variable is not be in the scope.
A local variable must be created. It is later replaced by a global variable if necessary and becomes a ghost variable.
A local variable has been found
le is not a ghost variable
package | ackage |
name | le nom du package le nom de l'entite |
Definition at line 1891 of file declaration.c.
References code_declarations, concatenate(), entity_code(), entity_domain, entity_is_argument_p(), entity_undefined, entity_undefined_p, FindEntity(), full_name, gen_find_tabulated(), get_current_module_entity(), ghost_variable_entity_p(), intrinsic_entity_p(), make_entity, MODULE_SEP_STRING, package, pips_assert, storage_undefined, strdup(), TOP_LEVEL_MODULE_NAME, type_undefined, and value_undefined.
A local entity might have been created but found out later to be global, depending on the order of declaration statements (see MakeExternalFunction()).
The local entity e is (marked as) destroyed and replaced by functional entity fe.
Should we anticipate the value code, since we know it has to be a value code for a function and it may be tested later after the parsing phase of the caller but before the parsing phase of the callee, or should we wait till the code is really known?
entity_initial(fe) = make_value(is_value_unknown, UU);
FI: I need to destroy a virtual entity which does not appear in the program and wich was temporarily created by the parser when it recognized a name; however, I've no way to know if the same entity does not appear for good somewhere else in the code; does the Fortran standard let you write: LOG = LOG(3.) If yes, PIPS will core dump... PIPS also core dumps with ALOG(ALOG(X))... (8 July 1993)
remove_variable_entity(e);
ParserError("LocalToGlobal", "Formal functional parameters are not supported " "by PIPS.\n");
Definition at line 1681 of file procedure.c.
References add_ghost_variable_entity(), entity_initial, entity_local_name(), entity_name, entity_storage, entity_undefined, FatalError, FindOrCreateEntity(), is_storage_rom, is_value_code, make_code(), make_language_fortran(), make_sequence(), make_storage(), make_value(), NIL, pips_assert, pips_debug, pips_internal_error, pips_user_warning, storage_formal_p, storage_ram_p, storage_rom_p, storage_tag, storage_undefined, storage_undefined_p, strdup(), top_level_entity_p(), TOP_LEVEL_MODULE_NAME, type_undefined_p, UU, and value_undefined_p.
Referenced by LocalToGlobal(), and MakeEntry().
cproto-generated files
cproto-generated files
See ri-util/size.c: array_size()
Definition at line 83 of file declaration.c.
References entity_name, ParserError(), pips_user_warning, and SizeOfArray().
Referenced by ComputeAddresses(), CurrentOffsetOfArea(), and update_common_layout().
void save_all_entities | ( | void | ) |
functions for the SAVE declaration
FI: all variables previously allocated should be reallocated
FI: This is pretty crude... Let's hope it works
Definition at line 138 of file declaration.c.
References code_declarations, current_offset_of_area(), DynamicArea, ENTITY, entity_initial, entity_storage, entity_undefined, free_storage(), get_current_module_entity(), is_storage_ram, make_ram(), make_storage(), MAP, NIL, pips_assert, ram_section, StaticArea, storage_ram, storage_ram_p, storage_undefined, and value_code.
void save_initialized_variable | ( | entity | v | ) |
Definition at line 287 of file declaration.c.
References MakeVariableStatic().
void SaveChains | ( | void | ) |
Initialize the shared fields of aliased variables.
shared = CONS(ENTITY, atom_equivar(ATOM(CAR(pa))), shared);
Check conflicting intializations
Definition at line 859 of file equivalence.c.
References ATOM, atom_equivar, CAR, CHAIN, chain_atoms, ENDP, ENTITY, entity_initial, entity_local_name(), entity_name, entity_storage, equivalences_chains, equivalences_undefined, FinalEquivSet, gen_copy_seq(), gen_once(), MAP, MAPL, NIL, ParserError(), pips_assert, pips_debug, pips_user_warning, ram_shared, storage_ram, value_defined_p(), value_unknown_p, and variable_entities_may_conflict_p().
Referenced by EndOfProcedure().
void SaveCommon | ( | entity | c | ) |
this function transforms a dynamic common into a static one.
Definition at line 295 of file declaration.c.
References entity_type, pips_assert, type_area_p, and Warning.
void SaveEntity | ( | entity | e | ) |
These two functions transform a dynamic variable into a static one.
They are called to handle SAVE and DATA statements.
Because equivalence chains have not yet been processed, it is not possible to assign an offset or to chain the variable to the static area layout. These two updates are performed by ComputeAddresses() only called by EndOfProcedure() to make sure that all non-declared variables have been taken into account.
Let's hope functions and subroutines called are listed in the declaration list.
This cannot be done before the equivalences have been processed
Not much can be said. Maybe it is redundant, but...
Maybe the standard claims that you are not allowed to save a common variable?
The type and dimensions are still unknown
Definition at line 178 of file declaration.c.
References code_declarations, DeclareVariable(), DynamicArea, entity_initial, entity_is_argument_p(), entity_local_name(), entity_name, entity_storage, entity_type, entity_undefined_p, get_current_module_entity(), is_storage_ram, local_name_to_top_level_entity(), make_ram(), make_storage(), NIL, ParserError(), ram_offset, ram_section, StaticArea, storage_ram, storage_ram_p, storage_tag, storage_undefined, type_undefined, UNKNOWN_RAM_OFFSET, user_warning, value_code, and value_undefined.
Referenced by AnalyzeData(), fix_storage(), and MakeVariableStatic().
this function scans the formal parameter list.
each formal parameter is created with an implicit type, and then is added to CurrentFunction's declarations.
le parametre formel
son rang dans la liste
Definition at line 2503 of file procedure.c.
References AddEntityToDeclarations(), CAR, CDR, ENTITY, FormalParameters, and MakeFormalParameter().
Referenced by MakeCurrentFunction().
void ScanNewFile | ( | void | ) |
La fonction a appeler pour l'analyse d'un nouveau fichier.
on initialise la table keywidx
on met a jour la table keywidx en fonction des keywords
premier keyword commencant par keywcour[0]
on initialise les variables externes locales et non locales
Definition at line 474 of file reader.c.
References Column, EtatQuotes, iLine, int, iStmt, keywidx, keywtbl, LineNumber, lLine, lStmt, NONINQUOTES, SIZE_UNDEF, StmtLineNumber, and UNDEF.
Referenced by the_actual_parser().
void set_alternate_returns | ( | void | ) |
Definition at line 264 of file return.c.
References alternate_returns, current_number_of_alternate_returns, list_undefined_p, NIL, and pips_assert.
size | ize |
Definition at line 1004 of file declaration.c.
References common_size_map, and hash_put().
Referenced by gfc2pips_computeAdressesOfArea(), gfc2pips_namespace(), InitAreas(), and MakeCommon().
void set_current_label_string | ( | string | ln | ) |
ln | n |
Definition at line 81 of file parser.c.
References lab_I, and pips_assert.
Referenced by MakeElseInst().
void set_current_number_of_alternate_returns | ( | void | ) |
Definition at line 187 of file return.c.
References current_number_of_alternate_returns.
Referenced by gfc2pips_args().
void set_first_format_statement | ( | void | ) |
declaration_lines = line_b_I-1;
Definition at line 1952 of file statement.c.
References debug(), declaration_lines, format_seen, line_b_C, line_b_I, seen, and UNDEF.
void SetChains | ( | void | ) |
initialize chains before each call to the parser
Definition at line 76 of file equivalence.c.
References equivalences_undefined_p, FinalEquivSet, make_equivalences(), NIL, pips_assert, and TempoEquivSet.
Referenced by MakeCurrentFunction().
This function computes the size of a range, ie.
the number of iterations that would be done by a loop with this range.
See also range_count().
Definition at line 1619 of file declaration.c.
References ExpressionToInt(), FatalError, range_increment, range_lower, and range_upper.
void soft_reset_alternate_returns | ( | void | ) |
ParserError() cannot guess if it has been performed or not, because it is reinitialized before and after each call statement.
If the error occurs within a call, alternate returns must be reset. Else they should not be reset.
Definition at line 284 of file return.c.
References alternate_returns, list_undefined_p, and reset_alternate_returns().
Referenced by ParserError().
Definition at line 1290 of file reader.c.
References false, lStmt, and stmt_buffer.
Referenced by FindAssign(), FindAutre(), FindDo(), FindDoWhile(), FindIf(), FindIfArith(), FindImplicit(), FindPoints(), and NeedKeyword().
void StoreEquivChain | ( | chain | c | ) |
This function is called when an equivalence chain has been completely parsed.
It looks for the atom with the biggest offset, and then substracts this maximum offset from all atoms. The result is that each atom has its offset from the begining of the chain.
Definition at line 176 of file equivalence.c.
References abs, ATOM, atom_equioff, CAR, CDR, CHAIN, chain_atoms, CONS, equivalences_chains, equivalences_undefined_p, NIL, pips_assert, pips_debug, and TempoEquivSet.
void substitute_ghost_variable_in_expression | ( | expression | expr, |
entity | v, | ||
entity | f | ||
) |
It is assumed that v and f are defined entities and that v is of type variable and f of type functional.
ParserError() is going to request ghost variable substitution recursively and we do not want this to happen because it is going to fail again. Well, substitution won't be tried from AbortOfProcedure()...
ghost_variable_entities = NIL;
ParserError("substitute_ghost_variable_in_expression", "Functional parameters are not (yet) supported by PIPS\n");
expr | xpr |
Definition at line 75 of file procedure.c.
References call_arguments, call_function, call_undefined, entity_name, EXPRESSION, expression_syntax, f(), ifdebug, is_syntax_call, is_syntax_range, is_syntax_reference, MAP, module_local_name(), pips_assert, pips_debug, pips_user_warning, print_expression(), range_increment, range_lower, range_undefined, range_upper, ref, reference_indices, reference_undefined, reference_variable, syntax_call, syntax_range, syntax_reference, and syntax_tag.
Referenced by substitute_ghost_variable_in_statement().
It is assumed that v and f are defined entities and that v is of type variable and f of type functional.
gen_recurse() is not used to control the context better
unstructured u = unstructured_undefined;
Local variables should also be checked
Local variables should also be checked
nothing to do
stmt | tmt |
Definition at line 139 of file procedure.c.
References call_arguments, call_function, call_undefined, EXPRESSION, f(), FatalError, instruction_block, instruction_call, instruction_loop, instruction_tag, instruction_test, instruction_whileloop, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, loop_body, loop_index, loop_label, loop_range, loop_undefined, MAP, pips_assert, range_increment, range_lower, range_upper, STATEMENT, statement_instruction, statement_label, substitute_ghost_variable_in_expression(), test_condition, test_false, test_true, test_undefined, whileloop_body, whileloop_condition, whileloop_label, and whileloop_undefined.
Referenced by remove_ghost_variable_entities().
void SubstituteAlternateReturns | ( | const char * | option | ) |
return.c
option | ption |
Definition at line 59 of file return.c.
References get_bool_property(), hide_rc_p, ParserError(), substitute_rc_p, substitute_stop_p, user_log(), and user_warning.
Referenced by EndOfProcedure(), MakeCurrentFunction(), and ParserError().
bool SubstituteAlternateReturnsP | ( | void | ) |
Definition at line 81 of file return.c.
References substitute_rc_p.
Referenced by MakeCallInst(), and MakeFormalParameter().
void* syn_alloc | ( | yy_size_t | ) |
void syn_error | ( | const char * | ) |
void syn_free | ( | void * | ) |
int syn_get_debug | ( | void | ) |
FILE* syn_get_in | ( | void | ) |
int syn_get_leng | ( | void | ) |
int syn_get_lineno | ( | void | ) |
FILE* syn_get_out | ( | void | ) |
char* syn_get_text | ( | void | ) |
int syn_lex | ( | ) |
int syn_lex_destroy | ( | void | ) |
int syn_parse | ( | ) |
void syn_pop_buffer_state | ( | void | ) |
void* syn_realloc | ( | void * | , |
yy_size_t | |||
) |
void syn_reset_lex | ( | ) |
void syn_restart | ( | FILE * | ) |
void syn_set_debug | ( | int | ) |
void syn_set_in | ( | FILE * | ) |
void syn_set_lineno | ( | int | ) |
void syn_set_out | ( | FILE * | ) |
this is wrong, because we do not know if we are handling an EXTERNAL declaration, in which case the result type is type_undefined, or a function call appearing somewhere, in which case the ImplicitType should be used; maybe the unknown type should be used?
a bug is detected here: MakeExternalFunction, as its name implies, always makes a FUNCTION, even when the symbol appears in an EXTERNAL statement; the result type is infered from ImplicitType() - see just above -; let's use implicit_type_p() again, whereas the unknown type should have been used
ignore r
someone used a subroutine as a function. this happens in hpfc for declaring "pure" routines. thus I make this case being ignored. warning? FC.
memory leak of tr
This may be an undeclared formal functional argument, initially assumed to be a variable. Since it is not declared as an array but appears with arguments, it must be a functional entity.
I do not know how to get the argument types. Let's hope it's performed later...
fe | e |
Definition at line 2257 of file procedure.c.
References basic_to_string(), entity_name, entity_storage, entity_type, free_type(), functional_result, implicit_type_p(), ImplicitType(), intrinsic_entity_p(), is_type_functional, make_functional(), make_type(), NIL, overloaded_type_p(), ParserError(), pips_internal_error, storage_formal_p, type_equal_p(), type_functional, type_functional_p, type_undefined, type_variable, type_variable_p, type_void_p, user_warning, and variable_basic.
Referenced by MakeEntry(), and MakeExternalFunction().
void update_called_modules | ( | entity | e | ) |
Self recursive calls are not allowed
do not count intrinsics; user function should not be named like intrinsics
FI, 20/01/92: maybe, initializations of global entities should be more precise (storage, initial value, etc...); for the time being, I choose to ignore the potential problems with other executions of the parser and the linker
pips_internal_error("unexpected case");
Definition at line 308 of file procedure.c.
References called_modules, CAR, concatenate(), CONS, entity_domain, entity_initial, entity_local_name(), entity_undefined, gen_find_tabulated(), get_current_module_entity(), MAPL, MODULE_SEP_STRING, ParserError(), pips_debug, pips_user_warning, strdup(), STRING, TOP_LEVEL_MODULE_NAME, value_intrinsic_p, and value_undefined.
Referenced by make_get_rc_statement(), MakeAtom(), MakeCallInst(), and set_rc_function().
(Re)compute offests of all variables allocated in common c from module m and update (if necessary) the size of common c for the whole program or set of modules in the current workspace.
As a consequence, warning messages unfortunately depend on the parsing order.
Offsets used to be computed a first time when the common declaration is encountered, but the variables may be typed or dimensionned later.
This function is correct only if no equivalenced variables have been added to the layout. It should not be used for the static and dynamic areas (see below).
It is assumed that:
the layout field does not seem to be filled in for STATIC and DYNAMIC
skip variables which do not belong to the module of interest
This should now always be the case. The offset within the common is no longer computed on the fly.
If c really is a common, check its size because it may have increased. Note that decreases are not taken into account although they might occur as well.
Too late, if the common only contains one element because the MAPL has not been entered at all if we are dealing wih te last parsed module... which is always the case up to now!
Variables declared in the static and dynamic areas were assigned offsets dynamically. The result may be ok.
Special case: only one element in the common for the current procedure (and the current procedure is last one declared - which is not so special)
If c really is a common, check its size because it may have increased. Note that decreases are not taken into account although they might occur as well.
Definition at line 1746 of file declaration.c.
References area_layout, bool_to_string(), CAR, common_to_size(), current, debug(), ENDP, ENTITY, entity_special_area_p(), entity_storage, entity_type, entity_undefined, ifdebug, list_undefined, module_local_name(), pips_assert, POP, print_arguments(), ram_offset, SafeSizeOfArray(), storage_ram, storage_ram_p, top_level_entity_p(), type_area, update_common_to_size(), and variable_in_module_p().
Referenced by update_user_common_layouts().
void update_common_sizes | ( | void | ) |
I'm afraid this warning might be printed because area_size is given a wrong value by CurrentOffsetOfArea().
Definition at line 1215 of file declaration.c.
References area_size, arguments_add_entity(), common_size_map, common_to_size(), CurrentPackage, debug(), ENTITY, entity_name, entity_type, FOREACH, gen_free_list(), HASH_MAP, HASH_UNDEFINED_VALUE, intptr_t, module_local_name(), NIL, pips_assert, pips_debug, sort_list_of_entities(), tc, type_area, and user_warning.
Referenced by EndOfProcedure().
new_size | ew_size |
Definition at line 1010 of file declaration.c.
References common_size_map, and hash_update().
Referenced by ComputeAddresses(), CurrentOffsetOfArea(), and update_common_layout().
Update of the type returned by function f.
nt must be a freshly allocated object. It is included in f's data structure
The function is probably a formal parameter, its type is wrong. The return type is either void if it is called by CALL or its current implicit type.
nt | t |
Definition at line 932 of file statement.c.
References entity_storage, entity_type, entity_user_name(), f(), free_type(), functional_result, ParserError(), pips_assert, pips_internal_error, pips_user_warning, storage_formal_p, type_functional, type_functional_p, type_undefined, type_undefined_p, type_unknown_p, type_variable_p, and type_void_p.
Referenced by MakeCallInst().
OK, it is not safe: may be it's a 0-ary function
The pre-existing typing of e should match the new one
parameter p = parameter_undefined;
OK
the actual parameter list must be exhausted
as well as the type parameter list
unless the last type in the parameter list is a varargs
Definition at line 971 of file statement.c.
References basic_of_expression(), basic_overloaded_p, CAR, CDR, CONS, copy_type(), ENDP, entity_local_name(), entity_type, EXPRESSION, expression_reference(), expression_reference_p(), free_type(), functional_parameters, functional_undefined, gen_length(), gen_nconc(), get_bool_property(), is_type_variable, line_b_I, line_e_I, list_undefined, make_dummy_unknown(), make_parameter(), make_type(), make_variable(), MakeModeReference(), module_local_name(), NIL, nth_suffix(), PARAMETER, parameter_type, parameter_undefined, pips_assert, pips_user_warning, POP, reference_variable, type_equal_p(), type_functional, type_functional_p, type_undefined, type_undefined_p, type_varargs, type_varargs_p, type_variable, type_variable_p, user_warning, and variable_basic.
Referenced by MakeAtom(), and MakeCallInst().
void update_user_common_layouts | ( | entity | m | ) |
Check...
and fix, if needed!
Only user COMMONs are checked. The two implicit areas, DynamicArea and StaticArea, have not been initialized yet (see ComputeAddress() and the calls in EndOfProcedure()).
List of implicitly and explicitly declared variables, functions and areas
Structure of each area/common
User declarations of commons imply the offset and cannot conflict with equivalences, whereas static and dynamic variables must first comply with equivalences. Hence the layouts of user commons must be updated before equivalences are satisfied whereas layouts of the static and dynamic areas must be satisfied after the equiavelences have been processed.
Definition at line 1670 of file declaration.c.
References code_declarations, ENDP, ENTITY, entity_initial, entity_module_p(), entity_name, entity_special_area_p(), entity_type, fprintf(), gen_append(), gen_free_list(), ifdebug, MAP, module_local_name(), NIL, pips_assert, pips_debug, print_common_layout(), sort_list_of_entities(), type_area_p, update_common_layout(), and value_code.
Referenced by EndOfProcedure().
this function check and set if necessary the storage of formal parameters in lfp.
formal parameter chunk
formal parameter offset
Oupss... the associated area should be cleaned up... but it should ony occur in EndOfProcedure() when all implictly declared variables have been encountered...
lfp | fp |
Definition at line 2522 of file procedure.c.
References CAR, ENDP, ENTITY, entity_module_name(), entity_name, entity_storage, formal_offset, free_storage(), is_storage_formal, local_name_to_top_level_entity(), make_formal(), make_storage(), pips_assert, pips_internal_error, POP, storage_formal, storage_formal_p, storage_ram_p, and storage_undefined_p.
Referenced by MakeEntry().
This function analyzes the CurrentFunction formal parameter list to determine the CurrentFunction functional type.
l is this list.
It is called by EndOfProcedure().
FI: I do not understand this assert... at least now that functions may be typed at call sites. I do not understand why this assert has not made more damage. Only OVL in APSI (Spec-cfp95) generates a core dump. To be studied more!
This assert is guaranteed by MakeCurrentFunction() but not by retype_formal_parameters() which is called in case an intrinsic statement is encountered. It is not guaranteed by MakeExternalFunction() which uses the actual parameter list to estimate a functional type
Definition at line 1131 of file procedure.c.
References CAR, CDR, CONS, ENDP, ENTITY, entity_type, f(), fprint_functional(), fprintf(), functional_parameters, gen_nconc(), ifdebug, ImplicitType(), make_dummy_identifier(), make_parameter(), MakeModeReference(), module_local_name(), NIL, PARAMETER, pips_assert, pips_debug, type_functional, type_functional_p, and type_undefined_p.
Referenced by EndOfProcedure(), gfc2pips_namespace(), gfc2pips_parameters(), and MakeEntry().
void uses_alternate_return | ( | bool | use | ) |
use | se |
Definition at line 171 of file return.c.
References current_module_uses_alternate_returns, current_number_of_alternate_returns, get_string_property(), line_b_I, line_e_I, ParserError(), and pips_user_warning.
Referenced by EndOfProcedure(), and ParserError().
bool uses_alternate_return_p | ( | void | ) |
Definition at line 166 of file return.c.
References current_module_uses_alternate_returns.
Referenced by add_formal_return_code(), GenerateReturn(), and MakeReturn().
this function returns the size of the ith lower bound of a variable e.
Definition at line 1591 of file declaration.c.
References CAR, CDR, DIMENSION, dimension_lower, entity_type, ExpressionToInt(), ParserError(), pips_assert, type_variable, type_variable_p, and variable_dimensions.
Referenced by OffsetOfReference().
|
extern |
Definition at line 152 of file reader.c.
Referenced by init_comment_buffers(), ReadLine(), and resize_comment_buffers().
|
extern |
Definition at line 152 of file reader.c.
Referenced by init_comment_buffers(), ReadLine(), and resize_comment_buffers().
|
extern |
parser.c
parser.c
name of the current file
Definition at line 49 of file parser.c.
Referenced by check_first_statement(), dump_current_statement(), ParserError(), and the_actual_parser().
|
extern |
the name of the current package, i.e.
TOP-LEVEL or a module name?
Definition at line 58 of file parser.c.
Referenced by BeginingOfParsing(), EndOfProcedure(), get_use_entities_list(), gfc2pips_add_to_callees(), gfc2pips_check_entity_doesnt_exists(), gfc2pips_check_entity_exists(), gfc2pips_expr2entity(), gfc2pips_expr2expression(), gfc2pips_exprIO3(), gfc2pips_getTypesDeclared(), gfc2pips_int2label(), gfc2pips_namespace(), gfc2pips_parameters(), gfc2pips_symbol2entity(), gfc2pips_vars_(), InitAreas(), MakeCurrentFunction(), MakeLabel(), NameToFunctionalEntity(), ParserError(), and update_common_sizes().
|
extern |
to count control specifications in IO statements
Definition at line 101 of file syn_yacc.c.
|
extern |
the type in a type or dimension or common statement
Definition at line 103 of file syn_yacc.c.
|
extern |
These global variables are declared in ri-util/util.c.
area.c
These global variables are declared in ri-util/util.c.
functions for areas Four areas used to allocate variables which are not stored in a Fortran common. These areas are just like Fortran commons, but the dynamic area is the only non-static area according to Fortran standard. The heap and the stack area are used to deal with Fortran ANSI extensions and C, pointers and allocatable arrays, and adjustable arrays (VLA in C). The dynamic area is stack allocated by most compilers but could be statically allocated since the array sizes are known.
Areas are declared for each module. These four global variables are managed by the Fortran and C parsers and used to allocate variables in the current module. Note that the C parser uses more areas at the same time to cope with global variables.
|
extern |
the current function
entity CurrentFunction; list of formal parameters of the current function
Definition at line 55 of file parser.c.
Referenced by EndOfProcedure(), and ScanFormalParameters().
|
extern |
|
extern |
Definition at line 59 of file area.c.
Referenced by print_common_layout().
|
extern |
|
extern |
Definition at line 153 of file reader.c.
Referenced by parser_reset_all_reader_buffers(), and ReadLine().
|
extern |
Definition at line 153 of file reader.c.
Referenced by parser_reset_all_reader_buffers(), and ReadLine().
|
extern |
|
extern |
Definition at line 153 of file reader.c.
Referenced by LinkInstToCurrentBlock(), MakeDataStatement(), MakeElseInst(), MakeEndifInst(), parser_reset_all_reader_buffers(), and ReadLine().
|
extern |
Definition at line 69 of file parser.c.
Referenced by empty_current_label_string_p(), EndOfProcedure(), GenerateReturn(), get_current_label_string(), LinkInstToCurrentBlock(), MakeEnddoInst(), reset_current_label_string(), and set_current_label_string().
|
extern |
Definition at line 68 of file parser.c.
Referenced by check_first_statement(), ReadStmt(), and set_first_format_statement().
|
extern |
Indicates where the current instruction (in fact statement) starts and ends in the input file and gives its label.
Temporary versions of these variables are used because of the pipeline existing between the reader and the actual parser. The names of the temporary variables are prefixed with "tmp_". The default and reset values of these variables and their temporary versions (declared in reader.c) must be consistent.
Definition at line 68 of file parser.c.
Referenced by add_alternate_return(), AddVariableToCommon(), check_first_statement(), DeclarePointer(), DeclareVariable(), fix_if_condition(), implied_do_reference_number(), MakeReturn(), MakeWhileDoInst(), ParserError(), set_first_format_statement(), update_functional_type_with_actual_arguments(), and uses_alternate_return().
|
extern |
Definition at line 68 of file parser.c.
Referenced by ReadStmt().
|
extern |
Definition at line 68 of file parser.c.
Referenced by add_alternate_return(), AddVariableToCommon(), DeclarePointer(), DeclareVariable(), dump_current_statement(), fix_if_condition(), implied_do_reference_number(), MakeReturn(), MakeWhileDoInst(), ParserError(), ReadStmt(), update_functional_type_with_actual_arguments(), and uses_alternate_return().
|
extern |
Definition at line 152 of file reader.c.
Referenced by init_comment_buffers(), LinkInstToCurrentBlock(), MakeDataStatement(), ReadLine(), and resize_comment_buffers().
|
extern |
Definition at line 60 of file area.c.
Referenced by print_common_layout().
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Allocate addresses in commons and in the static area and in the dynamic area. The heap area is left aside.
Definition at line 33 of file equivalence.c.
|
extern |
expression.c
Definition at line 29 of file expression.c.