fdvmDDe (1158418), страница 2
Текст из файла (страница 2)
| next | control parent | |||||||||||||
| | . . . | • | • | . . . | • | • | ||||||||
| | ... | • | • | • | + | ... | • | • | • | |||||||
| | ||||||||||||||||
| | ... | • | • | • | VAR_REF | ... | • | • | • | |||||||
| a | ... | b | ... | c | ... | ||||||||||||||||||||
Symbol Table
Fig. 4.4. Internal representation of the statement a = b + c.
5Detailed description of compiler modules
5.1Translating Fortran DVM constructs (module dvm.cpp)
The scheme of high level functions calls of the main module dvm.cpp is:
m
ain initialize
initVariantNames
initLibNames
initDVM
TranslateFileDVM • TransFunc
unparse (class File) InsertDebugStat
| int main ( | int | argc, |
The function processes the compilation parameters and sets compilation mode on. It initializes compiler data structures, calls the TranslateFileDVM( ) function to restructure parse tree according to the compilation mode, and calls the unparse( ) class SgFile member function for generating new source code from restructured internal form. The function returns 1 if there are found some errors in the program.
void TranslateFileDVM ( SgFile *f )
| f | - pointer to the program file |
If the compilation mode is a generating of parallel program then the TransFunc( ) function is called for each procedure of program else the InsertDebugStat( ) function is called.
void TransFunc ( SgStatement *func )
| func | - pointer to the procedure header statement |
The statements of procedure are scanned in lexical order until last statement of procedure.
Specification statements and directives processing.
A DISTRIBUTE directive is involved in list. The function builds the aligning trees processing ALIGN directives.
On scanning specification directives and statements, the LibDVM function calls for creating distributed arrays are generated and inserted in program before first executable statement. The GenDistArray( ) function creates distributed arrays (LibDVM object) for array with DISTRIBUTE attribute and all arrays immediately or ultimately aligned with it.
Executable statements and directives processing.
The distributed array element references in assignment, CALL , arithmetical IF, logical IF, IF-THEN, ELSE_IF, and computed GOTO statements are linearizing.
A DVM directive is replaced by sequence of Lib-DVM functions calls. When new statement is inserted in a program restructuring of the control graph (carrying or substituting label, replacement of logical IF statement by IF...THEN...ENDIF construct, and so on) is performed if necessary. The ReplaceContext( ), doAssignStmtAfter( ), InsertNewStatementAfter( ), InserNewStatementBefore( ) functions serve for inserting new statement in parse tree and restructuring it.
After processing last statement of procedure, the declaration statements for temporary variables that are used for argument passing, storing function value, buffering I/O, and addressing distributed arrays are created and inserted in specification part of procedure (DeclareVarDVM( )).
List of called functions:
| TempVarDVM | ChangeDistArrayRef |
| DeclareVarDVM | ChangeDistArrayRef_Left |
| RTLInit | DebugVarArrayRef |
| RTLExit | DebugVarArrayRef_Left |
| BeginBlock | ChangeArg_DistArrayRef |
| EndBlock | DebugArg_VarArrayRef |
| GetAM | ReplaceAssignByIf |
| GetVM | ReplaceContext |
| doDisRuleArrays | ParallelLoop |
| GenDistArray | AddToGroupNameList |
| GenAlignArray | AllocateArray |
| AlignTree | AssignPointer |
| InsertNewStatementBefore | CreateBoundGroup |
| InsertNewStatementAfter | ShadowList |
| doAssignStmt | Calculate |
| doAssignStmtAfter | hasNewValueClause |
| doAssignTo_After | StartBound |
| Extract_Stmt | WaitBound |
| ContinueWithLabel | SendBoun |
| RemoteAccessEnd | CreateReductionGroup |
| GoRoundEntry | ReductionList |
| BeginBLockForEntry | StartRed |
| initMask | WaitRed |
| ReplaceDoLabel | ReductionVarsStart |
| Error | doAlignRule |
| err | RealignArray |
| addToStmtList | RealignArr |
| ReplaceDoNestLabel_Above | DistObjectRef |
| CloseDoInParLoop | RedistributeArray |
| CloseParLoop | control_list_open |
| EndParLoop | ReplaceByIfStmt |
| EndPl | InsertSendIOSTAT |
| isDoEndStmt | InsertSendInquire |
| CloseLoop | InsertSendInputList |
| DebugLoop | IOcontrol |
| SeqLoopBegin | TestIOList |
| SeqLoopEndInParLoop | IO_ThroughBuffer |
| OverLoopAnalyze | D_Skpbl |
| SeqLoopEnd | D_Lnumb |
| DeleteObject | D_Fname |
| OpenInterval | St_Binter |
| CloseInterval | St_Einter |
| Value | St_Biof |
| lastStmtOfDo | St_Eiof |
| AddRemoteAccess | St_Eloop |
| RemoteVariableList | BeginDebugFragment |
| RankOfSection | EndDebugFragment |
| Rank | ArrayHeader |
| isListOfArrays | TypeControl |
| ReconfPS | CreateTaskArray |
| InitGroups | SetDoVar |
| InitHeap | PSReference |
| hasOntoClause | SearchDistArrayRef |
| DebugTaskRegion | CloseTaskRegion |
| StartTask | isParallelLoopEndStmt |
| StopAM | CreateBG |
| doIfThenConstrForPrefetch | LoadBg |
| InitRemoteGroups | IsLIFReductionOp |
| INDLoopBegin | IsReductionOp |
| IEXLoopAnalyse | OffDoVarsOfNest |
| IndependentLoop |
void InsertDebugStat ( SgStatement *func )
| func | - pointer to the procedure header statement |
The function generates the sequential program including Debugger and Performance Analyzer functions calls. Parameters of compilation (-e… and -d…) control the process of generating new statements.
VAR_REF
VAR_REF














