improved checkpoints
This commit is contained in:
@@ -639,11 +639,8 @@ static void processCommonStmt(SgStatement* st, set<string>& commonVariables)
|
||||
static void processVarStmt(SgStatement* st, map<string, SgStatement*>& moduleStmts, const char* funcName,
|
||||
const set<string>& inFuncParam)
|
||||
{
|
||||
SgExpression* lhs2;
|
||||
SgExpression* ex2 = st->expr(2);
|
||||
|
||||
SgExpression* ex = st->expr(0);
|
||||
SgExpression* lhs;
|
||||
SgExpression* lhs = NULL;
|
||||
|
||||
SgStatement* baseStmt = st->copyPtr();
|
||||
baseStmt->expr(0)->setLhs(NULL);
|
||||
@@ -763,9 +760,7 @@ static void insertStmtToModule(const map<string, SgStatement*>& moduleStmts, con
|
||||
for (const auto& [varName, varStmt] : moduleStmts)
|
||||
{
|
||||
string varNameNoPref = varName;
|
||||
|
||||
string::size_type pos{};
|
||||
varNameNoPref.erase(0, pos + prefixLen + 1);
|
||||
varNameNoPref.erase(0, prefixLen + 1);
|
||||
|
||||
if (commonVariables.count(varNameNoPref) == 0 && moduleParamStmts.count(varName) == 0
|
||||
&& externVars.count(varNameNoPref) == 0)
|
||||
@@ -904,7 +899,7 @@ static SgStatement* createLoadBlock(const vector<SgSymbol*>& loadS, FuncInfo*& f
|
||||
//READ from modules
|
||||
for (auto& mod : moduleNames)
|
||||
{
|
||||
SgCallStmt* call = new SgCallStmt(*new SgSymbol(FUNCTION_NAME, ("SPF_CP_" + mod).c_str()));
|
||||
SgCallStmt* call = new SgCallStmt(*new SgSymbol(FUNCTION_NAME, ("spf_cp_" + mod).c_str()));
|
||||
call->addArg(*new SgValueExp(unitNum));
|
||||
call->addArg(*new SgValueExp(0));
|
||||
ifLoadOk1->insertStmtAfter(*call, *ifLoadOk1);
|
||||
@@ -993,7 +988,7 @@ static SgStatement* createSaveBlock(const vector<SgSymbol*>& loadS, FuncInfo*& f
|
||||
//WRITE from modules
|
||||
for (auto& mod : moduleNames)
|
||||
{
|
||||
SgCallStmt* call = new SgCallStmt(*new SgSymbol(FUNCTION_NAME, ("SPF_CP_" + mod).c_str()));
|
||||
SgCallStmt* call = new SgCallStmt(*new SgSymbol(FUNCTION_NAME, ("spf_cp_" + mod).c_str()));
|
||||
call->addArg(*new SgValueExp(unitNum));
|
||||
call->addArg(*new SgValueExp(1));
|
||||
ifStoreOk->insertStmtAfter(*call, *ifStoreOk);
|
||||
@@ -1134,6 +1129,18 @@ static void processInFuncParam(FuncInfo* funcI, set<string>& inFuncParam)
|
||||
inFuncParam.insert(funcI->funcParams.identificators[i]);
|
||||
}
|
||||
|
||||
static SgStatement* getFirstExecStat(SgStatement* func)
|
||||
{
|
||||
SgStatement* firstExec = func->lexNext();
|
||||
SgStatement* last = func->lastNodeOfStmt();
|
||||
while (firstExec && firstExec != last && !isSgExecutableStatement(firstExec))
|
||||
{
|
||||
firstExec = firstExec->lastNodeOfStmt();
|
||||
firstExec = firstExec->lexNext();
|
||||
}
|
||||
return firstExec;
|
||||
}
|
||||
|
||||
static void processFunctionCallChain(SgStatement* func, const vector<FuncInfo*>& allFuncInfo, SgStatement* moduleF,
|
||||
const vector<SgSymbol*>& loadS, SgExpression* iostat, SgArrayRefExp* journal,
|
||||
SgExpression& frmt, SgExpression& unit,
|
||||
@@ -1157,27 +1164,8 @@ static void processFunctionCallChain(SgStatement* func, const vector<FuncInfo*>&
|
||||
|
||||
SgFile::switchToFile(funcFrom->fileName);
|
||||
|
||||
int callNum = 1;
|
||||
SgStatement* hedrTo = funcTo->funcPointer->GetOriginal();
|
||||
SgStatement* hedrFrom = funcFrom->funcPointer->GetOriginal();
|
||||
SgStatement* lastDecl = hedrFrom->lexNext();
|
||||
SgStatement* firstExec;
|
||||
if (isSgExecutableStatement(lastDecl))
|
||||
{
|
||||
firstExec = lastDecl;
|
||||
lastDecl = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (lastDecl && !isSgExecutableStatement(lastDecl->lexNext()))
|
||||
lastDecl = lastDecl->lexNext();
|
||||
|
||||
firstExec = lastDecl->lexNext();
|
||||
}
|
||||
|
||||
vector<SgExpression*> local;
|
||||
map<string, SgStatement*> localParams;
|
||||
set<string> addedToList;
|
||||
SgStatement* firstExec = getFirstExecStat(hedrFrom);
|
||||
|
||||
if (!processedFrom.count(funcFrom))
|
||||
{
|
||||
@@ -1246,7 +1234,6 @@ static void processFunctionCallChain(SgStatement* func, const vector<FuncInfo*>&
|
||||
|
||||
makeDeclaration(hedrFrom, { timeF });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SgFile::switchToFile(func->fileName());
|
||||
@@ -1445,7 +1432,7 @@ void createCheckpoints(SgFile* file, const map<string, CommonBlock*>& commonBloc
|
||||
SgStatement* loadBlock = createLoadBlock(loadS, funcI, iostat, journal, frmt, unit, files, fileIdx,
|
||||
numOfFiles, profS, frmtProf, unitNull, profCallS, profCallE, localVarNoParams, moduleStmts,
|
||||
commonVariables, createdModuleForIO, moduleNames, unitNum, funcName, chainLocalVarNoParamsa);
|
||||
lastDecl->insertStmtAfter(*loadBlock, *lastDecl->controlParent());
|
||||
lastDecl->insertStmtAfter(*loadBlock, *func);
|
||||
|
||||
if (funcI->isMain)
|
||||
insertInitNamesOfFiles(numOfFiles, additional, files, journal, lastDecl, false);
|
||||
@@ -1476,7 +1463,7 @@ void createCheckpoints(SgFile* file, const map<string, CommonBlock*>& commonBloc
|
||||
if (ex && ex->variant() == ONLY_NODE)
|
||||
{
|
||||
modulesDone[modName] = true;
|
||||
auto callName = new SgSymbol(VARIABLE_NAME, ("SPF_CP_" + modName).c_str());
|
||||
auto callName = new SgSymbol(VARIABLE_NAME, ("spf_cp_" + modName).c_str());
|
||||
ex->setLhs(new SgExpression(EXPR_LIST, new SgVarRefExp(callName), ex->lhs()));
|
||||
}
|
||||
}
|
||||
@@ -1495,7 +1482,7 @@ void createCheckpoints(SgFile* file, const map<string, CommonBlock*>& commonBloc
|
||||
{
|
||||
if (!elem.second)
|
||||
{
|
||||
auto callName = new SgSymbol(VARIABLE_NAME, ("SPF_CP_" + elem.first).c_str());
|
||||
auto callName = new SgSymbol(VARIABLE_NAME, ("spf_cp_" + elem.first).c_str());
|
||||
SgSymbol* modS = new SgSymbol(VARIABLE_NAME, elem.first.c_str());
|
||||
|
||||
vector<SgExpression*> onlyList;
|
||||
|
||||
@@ -2091,7 +2091,6 @@ static bool isIntrincis(const string& name)
|
||||
intrinsicF.insert(string("trailz"));
|
||||
intrinsicF.insert(string("trim"));
|
||||
intrinsicF.insert(string("xor"));
|
||||
intrinsicF.insert(string("wtime"));
|
||||
intrinsicF.insert(string("zabs"));
|
||||
intrinsicF.insert(string("zcos"));
|
||||
intrinsicF.insert(string("zexp"));
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2340"
|
||||
#define VERSION_SPF "2341"
|
||||
|
||||
Reference in New Issue
Block a user