code refactoring

This commit is contained in:
ALEXks
2024-02-20 11:12:00 +03:00
parent 3221934db8
commit 8402f8c7e9
24 changed files with 1623 additions and 1174 deletions

View File

@@ -9683,6 +9683,21 @@ void RemoteAccessDirective(SgStatement *stmt)
RemoteVariableList(stmt->symbol(),stmt->expr(0),stmt);
}
SgExpression *AlignmentListForRemoteDir(int nt, SgExpression *axis[], SgExpression *coef[], SgExpression *cons[])
{ // case of RTS2 interface
SgExpression *arglist=NULL, *el, *e;
for(int i=0; i<nt; i++)
{
e = AlignmentLinear(axis[i],ReplaceFuncCall(coef[i]),cons[i]);
(el = new SgExprListExp(*e))->setRhs(arglist);
arglist = el;
}
(el = new SgExprListExp(*ConstRef(nt)))->setRhs(arglist); // add rank to axis list
arglist = el;
return arglist;
}
void RemoteVariableList1(SgSymbol *group,SgExpression *rml, SgStatement *stmt)
{ SgStatement *if_st,*end_st = NULL;
SgExpression *el, *es;
@@ -9751,7 +9766,10 @@ void RemoteVariableList(SgSymbol *group, SgExpression *rml, SgStatement *stmt)
return;
if(IN_COMPUTE_REGION && group)
err("Asynchronous REMOTE_ACCESS clause in compute region",574,stmt);
if(group && parloop_by_handler == 2 && stmt->variant() != DVM_PARALLEL_ON_DIR ) { // case of REMOTE_ACCESS directive
err("Illegal directive in -Opl2 mode. Asynchronous operations are not supported in this mode", 649, stmt);
group = NULL;
}
if(group){
if_st = doIfThenConstrForRemAcc(group,cur_st);
end_st = cur_st; //END IF
@@ -9824,7 +9842,7 @@ void RemoteVariableList(SgSymbol *group, SgExpression *rml, SgStatement *stmt)
} else {
axis[n] = &c0.copy();
coef[n] = &c0.copy();
cons[n] = &(es->lhs()->copy() - *Exprn( LowerBound(el->lhs()->symbol(),n))) ;
cons[n] = parloop_by_handler == 2 ? &es->lhs()->copy() : &(es->lhs()->copy() - *Exprn( LowerBound(el->lhs()->symbol(),n))) ;
ind_deb[n] = &(cons[n]->copy());
//init[n] = &c0.copy();
//last[n] = &c0.copy();
@@ -9869,6 +9887,22 @@ void RemoteVariableList(SgSymbol *group, SgExpression *rml, SgStatement *stmt)
//buffer_head = DVM000(ibuf);
ar = NULL;
}
// adding attribute REMOTE_VARIABLE
rem_var *remv = new rem_var;
remv->ncolon = nc;
remv->index = ibuf;
remv->amv = group ? 1 : iamv;
remv->buffer = NULL; /*ACC*/
(el->lhs())->addAttribute(REMOTE_VARIABLE,(void *) remv, sizeof(rem_var));
// case of RTS2-interface
if(parloop_by_handler==2) {
if(stmt->variant() != DVM_PARALLEL_ON_DIR) {
doCallAfter(RemoteAccess_H2(header_rf(ar,ibuf,1), el->lhs()->symbol(), HeaderRef(el->lhs()->symbol()), AlignmentListForRemoteDir(n,axis,coef,cons)));
}
continue;
}
// creating buffer for remote elements of array
iaxis = ndvm;
if (stmt->variant() == DVM_PARALLEL_ON_DIR) {
@@ -9920,17 +9954,9 @@ void RemoteVariableList(SgSymbol *group, SgExpression *rml, SgStatement *stmt)
}
InsertNewStatementAfter(D_RmBuf( HeaderRef(el->lhs()->symbol()),GetAddresDVM( header_rf(ar,ibuf,1)),n,ideb),cur_st,cur_st->controlParent());
}
SET_DVM(iaxis);
//adding attribute REMOTE_VARIABLE
rem_var *remv = new rem_var;
remv->ncolon = nc;
remv->index = ibuf;
remv->amv = group ? 1 : iamv;
remv->buffer = NULL; /*ACC*/
(el->lhs())->addAttribute(REMOTE_VARIABLE,(void *) remv, sizeof(rem_var));
SET_DVM(iaxis);
}
if(group) {
cur_st = cur_st->lexNext()->lexNext();//IF THEN after ELSE
doAssignStmtAfter(WaitBG(GROUP_REF(group,1)));