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

@@ -3702,13 +3702,16 @@ SgStatement *Consistent_H (int il, SgExpression *hedr, SgExpression *axis_list)
return(call);
}
SgStatement *LoopRemoteAccess_H (int il, SgExpression *hedr, SgExpression *axis_list)
{// generating subroutine call: dvmh_loop_remote_access_(const DvmType *pCurLoop, const DvmType dvmDesc[], const DvmType *pRank, /* const DvmType *pAlignmentHelper */...)
SgStatement *LoopRemoteAccess_H (int il, SgExpression *hedr, SgSymbol *ar, SgExpression *axis_list)
{// generating subroutine call: dvmh_loop_remote_access_(const DvmType *pCurLoop, const DvmType dvmDesc[], const void *baseAddr, const DvmType *pRank, /* const DvmType *pAlignmentHelper */...)
// DvmhLoopRef - result of dvmh_loop_create()
SgCallStmt *call = new SgCallStmt(*fdvm[LOOP_REMOTE]);
fmask[LOOP_REMOTE] = 2;
call->addArg(*DVM000(il));
call->addArg(*hedr);
SgType *t = (isSgArrayType(ar->type())) ? ar->type()->baseType() : ar->type();
SgExpression *base = (t->variant() != T_DERIVED_TYPE && t->variant() != T_STRING ) ? new SgArrayRefExp(*baseMemory(SgTypeInt())) : new SgArrayRefExp(*baseMemory(t));
call->addArg(*base);
AddListToList(call->expr(0), axis_list);
return(call);
}
@@ -4411,6 +4414,16 @@ SgStatement *FillLocalPart_HH(SgSymbol *loop_s, SgSymbol *shead, SgSymbol *spart
return(call);
}
SgStatement *GetRemoteBuf (SgSymbol *loop_s, int n, SgSymbol *s_buf_head)
{// generating subroutine call: dvmh_loop_get_remote_buf_(const DvmType *pCurLoop, const DvmType *pRmaIndex, DvmType rmaDesc[]);
SgCallStmt *call = new SgCallStmt(*fdvm[GET_REMOTE_BUF]);
fmask[GET_REMOTE_BUF] = 2;
call->addArg(*new SgVarRefExp(loop_s));
call->addArg(*ConstRef_F95(n));
call->addArg(*new SgArrayRefExp(*s_buf_head));
return(call);
}
//------ Calls from handlers for sequence of statements --------------------
@@ -4707,13 +4720,14 @@ SgExpression *GetDeviceNum(SgSymbol *s_loop_ref)
{ // generating function call:
// DvmType loop_get_device_num_ (DvmhLoopRef *InDvmhLoop)
// or when RTS2 is used
// DvmType dvmh_loop_get_device_num_(const DvmType *pCurLoop)
// DvmType dvmh_loop_get_device_num_C ( DvmType curLoop)
int fNum = INTERFACE_RTS2 ? GET_DEVICE_NUM_2 : GET_DEVICE_NUM ;
int fNum = INTERFACE_RTS2 ? GET_DEVICE_NUM_2 : GET_DEVICE_NUM ;
SgFunctionCallExp *fe = new SgFunctionCallExp(*fdvm[fNum]);
fe->addArg(* new SgVarRefExp(s_loop_ref));
if(INTERFACE_RTS2)
fe->addArg(SgDerefOp(*new SgVarRefExp(s_loop_ref)));
else
fe->addArg(* new SgVarRefExp(s_loop_ref));
return(fe);
}
@@ -4751,6 +4765,15 @@ SgExpression *FillBounds(SgSymbol *loop_s, SgSymbol *sBlow,SgSymbol *sBhigh,SgSy
return(fe);
}
SgExpression *LoopGetRemoteBuf(SgSymbol *loop_s, int n, SgSymbol *s_buf_head)
{// generating function call: dvmh_loop_get_remote_buf_(const DvmType *pCurLoop, const DvmType *pRmaIndex, DvmType rmaDesc[]);
SgFunctionCallExp *fe = new SgFunctionCallExp(*fdvm[GET_REMOTE_BUF_C]);
fe->addArg(SgDerefOp(*new SgVarRefExp(loop_s)));
fe->addArg(*new SgValueExp(n));
fe->addArg(*new SgArrayRefExp(*s_buf_head));
return(fe);
}
SgExpression *RedPost(SgSymbol *loop_s, SgSymbol *s_var_num, SgSymbol *sRed,SgSymbol *sLoc)
{// generating function call:
// void loop_red_post_(DvmhLoopRef *InDvmhLoop, DvmType *InRedNum, void *arrayPtr, void *locPtr)
@@ -4761,7 +4784,7 @@ SgExpression *RedPost(SgSymbol *loop_s, SgSymbol *s_var_num, SgSymbol *sRed,SgSy
int fNum = INTERFACE_RTS2 ? RED_POST_2 : RED_POST_C ;
SgFunctionCallExp *fe = new SgFunctionCallExp(*fdvm[fNum]);
fe -> addArg(* new SgVarRefExp(loop_s));
fe->addArg(* new SgVarRefExp(loop_s));
fe->addArg(SgAddrOp(* new SgVarRefExp(s_var_num)));
fe->addArg(SgAddrOp(* new SgVarRefExp(sRed)));
if(sLoc)
@@ -4893,12 +4916,14 @@ SgExpression *GuessIndexType(SgSymbol *s_loop_ref)
{// generating function call:
// loop_guess_index_type_(DvmhLoopRef *InDvmhLoop)
// or when RTS2 is used
// dvmh_loop_guess_index_type_(const DvmType *pCurLoop)
// dvmh_loop_guess_index_type_C(DvmType *curLoop)
int fNum = INTERFACE_RTS2 ? GUESS_INDEX_TYPE_2 : GUESS_INDEX_TYPE ;
SgFunctionCallExp *fe = new SgFunctionCallExp(*fdvm[fNum]);
fe -> addArg(* new SgVarRefExp(s_loop_ref));
SgFunctionCallExp *fe = new SgFunctionCallExp(*fdvm[fNum]);
if(INTERFACE_RTS2)
fe->addArg(SgDerefOp(*new SgVarRefExp(s_loop_ref)));
else
fe->addArg(*new SgVarRefExp(s_loop_ref));
return(fe);
}