fdvmDDe (1158418), страница 6
Текст из файла (страница 6)
}
DO label In+2 = 0, Nn+2-1. . . n+2 k
DO label Ik = 0, Nk-1
}
DO label In+1 = 0, Nn+1-1, snif (In+1 .LE. Nn+1) then
m = sn n+1 k
else
m = Nn+1 - In+1
endif
input:
IF(tstio( ) .eq. 0 ) READ (...) (BUF(j), j = 1, N1 * ...*Nn * m)
| n 1 |
copying-arrray-section (BUF(1 : N1 * ...*Nn* m),
| n 1 |
A(1: N1,...,1:Nn , In+1 +1: In+1 +m , In+2 +1, ..., Ik +1) )
| n 1 | n+1 k | n+2 k |
output:
copying-arrray-section (BUF(1 : N1 * ...*Nl* m),
n 1
A(1: N1,...,1:Nn , In+1 +1: In+1 +m , In+2 +1, ..., Ik +1) )
| n 1 | n+1 k | n+2 k |
IF(tstio( ) .eq. 0 ) WRITE (...) (BUF(j), j = 1, N1 * ...*Nn * m)
| n 1 |
label CONTINUE
(An operation of copying-arrray-section is implemented by Lib-DVM function arrcpy( ).)
5.3Restructuring parse tree (module stmt.cpp)
The functions for restucturing parse tree compose the module stmt.cpp.
| void InsertNewStatementAfter( | SgStatement | *stat, | ||
| stat | - pointer to the inserted statement | |||
| current | - pointer to the statement after which stat is inserted | |||
| cp | - pointer to the control parent for stat | |||
The statement stat is inserted in the parse tree (program) after statement current and its control parent is cp.
| void InsertNewStatementBefore( | SgStatement | *stat, | ||
| stat | - pointer to the inserted statement | |||
| current | - pointer to the statement before which stat is inserted | |||
The statement stat is inserted in the parse tree (program) before statement current.
void doAssignStmt ( SgExpression *re )
| re | - pointer to the expression that is the right part of the assignment statement |
Creates the assign statement with right part re :
dvm000(i) = re
and inserts it before the statement pointed by global variable where.
SgExpression *LeftPart_AssignStmt ( SgExpression *re )
| re | - pointer to the expression that is the right part of the assignment statement |
Creates the assign statement with right part re :
dvm000(i) = re
and inserts it before the statement where (global variable). The function returns left part of this statement.
| void doAssignTo ( | SgExpression | *le, | ||
| le | - pointer to the expression that is the left part of the assignment statement | |||
| re | - pointer to the expression that is the right part of the assignment statement | |||
Creates the assign statement:
le = re
and inserts it before the statement where (global variable).
| void doAssignTo_After ( | SgExpression | *le, | ||
| le | - pointer to the expression that is the left part of the assignment statement | |||
| re | - pointer to the expression that is the right part of the assignment statement | |||
Creates the assign statement:
le = re
and inserts it after current statement cur_st (global variable).
| void doAssignStmtAfter( | SgExpression | *re ); | ||
| re | - pointer to the expression that is the right part of the assignment statement | |||
Creates the assign statement with right part re :
dvm000(i) = re
and inserts it after the current statement cur_st (global variable).
| void doAssignStmtBefore( | SgExpression | *re, | ||
| re | - pointer to the expression that is the right part of the assignment statement | |||
| current | - pointer to the statement | |||
Creates the assign statement with right part re :
dvm000(i) = re
and inserts it before the statement current.
void Extract_Stmt ( SgStatement *st )
| st | - pointer to the statement |
Removes the statement st from the parse tree.
void ReplaceByIfStmt ( SgStatement *st )
| st | - pointer to the statement |
Replaces the statement st by IF statement:
IF (tstio( ) .NE. 0) st
| void ReplaceDoNestLabel( | SgStatement | *last_st, | ||
| last_st | - pointer to the statement ending DO statement nest | |||
| new_lab | - pointer to the new label | |||
Replaces the label of DO statement nest, which is ended with last_st, by new_lab and inserts CONTINUE statement.
DO 1 I1 = 1,N1 DO new_lab I1 = 1,N1
DO 1 I2 = 1,N2 DO new_lab I2 = 1,N2
. . . . . .
DO 1 Ik = 1,Nk DO new_lab Ik = 1,Nk
. . . . . .
1 last-statement 1 last-statement
new_lab CONTINUE
| void ReplaceDoNestLabel_Above ( | SgStatement | *last_st, | ||
| last_st | - pointer to the statement ending DO statement nest | |||
| from_st | - pointer to the statement | |||
| new_lab | - pointer to the new label | |||
Replaces the label of DO statements, located above statement from_st and ended with statement last_st, by new_lab and inserts CONTINUE statement.
DO 1 I1 = 1,N1 DO new_lab I1 = 1,N1
. . . . . .
DO 1 Ik = 1,Nk DO new_lab Ik = 1,Nk
CDVM$ PARALLEL (J1,...,Jm) ON ... CDVM$ PARALLEL (J1,...,Jm) ON ...
DO 1 J1 = 1,N1 DO 1 J1 = 1,N1
. . . . . .
DO 1 Jm = 1,Nm DO 1 Jm = 1,Nm
. . . . . .
1 last_statement 1 last_statement
new_lab CONTINUE
| void ReplaceDoLabel ( | SgStatement | *last_st, | ||
| last_st | - pointer to the last statement of DO construct | |||
| new_lab | - pointer to the new label | |||
Replaces the label of DO statement by new_lab and inserts CONTINUE statement.
DO 1 I = 1,N DO new_lab I = 1,N
. . . . . .
1 last-statement 1 last-statement
new_lab CONTINUE
void ReplaceContext ( SgStatement *stmt )
| stmt | - pointer to the statement |
If the statement stmt or logical IF statement including it is last statement of DO-loop body, the function replaces the label of DO statements nest and inserts CONTINUE statement (ReplaceDoNestLabel(stmt)). If the control parent of statement stmt is logical IF statement, this function replaces it with IF_THEN construct.
void LogIf_to_IfThen ( SgStatement *stmt )
| stmt | - pointer to the statement |
Replaces logical IF statement:
IF ( condition ) stmt
by construct:
IF ( condition ) THEN
stmt
ENDIF
SgStatement *doIfThenConstr ( SgSymbol *ar )
| ar | - pointer to the symbol of array |
Creates construct:
IF ( ar(1) .EQ. 0) THEN
ENDIF
and returns the pointer to IF statement.
int isDoEndStmt ( SgStatement *stmt )
| stmt | - pointer to the statement |
If the statement stmt is the last statement of DO loop body, the function returns 1 else it returns 0.
SgStatement *lastStmtOfDo ( SgStatement *stdo )
| stdo | - pointer to the DO statement |
Returns the pointer to the last statement of DO loop body.
int isParallelLoopEndStmt ( SgStatement *stmt )
| stmt | - pointer to the statement |
If the statement stmt is the last statement of parallel loop, the function returns 1 else it returns 0.
5.4Translating HPF-DVM constructs (module hpf.cpp)
The module hpf.cpp is intended for translating constructs of HPF-DVM language.
5.4.1Processing distributed array references in HPF-DVM
| int SearchDistArrayRef ( | SgExpression | *e, | ||
| e | - pointer to the expression | |||
| stmt | - pointer to the statement which contains the expression e | |||
This function looks the expression e for distributed array references, adds the attribute REMOTE_VARIABLE to the reference, generates statements for loading the value of each distributed array element into buffer, and inserted them before statement stmt (calls BufferDistArrayRef( )).
If there are distributed array references in expression e,.it returns 1, else – 0.
The function is called from TransFunc( ) when an executable statement outside the range of INDEPENDENT loop is processing.
| void BufferDistArrayRef ( | SgExpression | *e, | ||
| e | - pointer to the distributed array element reference | |||
| stmt | - pointer to the statement which contains the expression e | |||
Generates statements for loading the value of distributed array element to buffer and inserting them before statement stmt , adds the attribute REMOTE_VARIABLE to distributed array reference e.
| SgExpression *IND_ModifiedDistArrayRef( | SgExpression | *e, | |
| e | - pointer to the distributed array element reference | ||
| st | - pointer to the assignment statement which contains the expression e | ||
The function analyzes the distributed array element reference in left part of assignment statement whether that may be used as target for mapping index space of INDEPENDENT loop nest. It returns the target or NULL.















