Bags fix: all params and Intent(in)
This commit is contained in:
@@ -37,6 +37,41 @@ static SgType* createArrayCharType(int len, int dim)
|
||||
}
|
||||
}
|
||||
|
||||
static void findDeclsNoIntentIn(SgExpression* ex, std::vector<SgExpression*>& local, const std::map<std::string, SgStatement*>& localParams,
|
||||
std::set<std::string>& added, std::set<std::string>& IntentInadded)
|
||||
{
|
||||
if (ex)
|
||||
{
|
||||
if (ex->variant() == VAR_REF)
|
||||
{
|
||||
if (ex->symbol()->variant() == VARIABLE_NAME &&
|
||||
localParams.find(ex->symbol()->identifier()) == localParams.end())
|
||||
{
|
||||
if (added.find(ex->symbol()->identifier()) == added.end() &&
|
||||
IntentInadded.find(ex->symbol()->identifier()) == IntentInadded.end())
|
||||
{
|
||||
added.insert(ex->symbol()->identifier());
|
||||
local.push_back(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ex->variant() == ARRAY_REF)
|
||||
{
|
||||
if (ex->symbol()->variant() == VARIABLE_NAME &&
|
||||
added.find(ex->symbol()->identifier()) == added.end() &&
|
||||
IntentInadded.find(ex->symbol()->identifier()) == IntentInadded.end())
|
||||
{
|
||||
added.insert(ex->symbol()->identifier());
|
||||
local.push_back(new SgArrayRefExp(*ex->symbol()));
|
||||
}
|
||||
}
|
||||
|
||||
findDeclsNoIntentIn(ex->lhs(), local, localParams, added, IntentInadded);
|
||||
findDeclsNoIntentIn(ex->rhs(), local, localParams, added, IntentInadded);
|
||||
}
|
||||
}
|
||||
|
||||
static void findDecls(SgExpression* ex, vector<SgExpression*>& local, const map<string, SgStatement*>& localParams,
|
||||
set<string>& added)
|
||||
{
|
||||
@@ -70,6 +105,45 @@ static void findDecls(SgExpression* ex, vector<SgExpression*>& local, const map<
|
||||
}
|
||||
}
|
||||
|
||||
static void findLocalDataNoIntentIn(SgStatement* start, SgStatement* end, std::vector<SgExpression*>& local,
|
||||
std::map<std::string, SgStatement*>& localParams, std::set<std::string>& added)
|
||||
{
|
||||
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||
{
|
||||
if (st->variant() == PARAM_DECL)
|
||||
{
|
||||
auto decl = (SgParameterStmt*)st;
|
||||
for (int z = 0; z < decl->numberOfConstants(); ++z)
|
||||
localParams[decl->constant(z)->identifier()] = st;
|
||||
}
|
||||
|
||||
if (st->variant() == EXTERN_STAT)
|
||||
for (SgExpression* ex = st->expr(0); ex; ex = ex->rhs())
|
||||
added.insert(ex->lhs()->symbol()->identifier());
|
||||
}
|
||||
|
||||
std::set<std::string> IntentInadded;
|
||||
|
||||
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||
if (st->variant() == VAR_DECL || st->variant() == VAR_DECL_90)
|
||||
if (st->expr(2) && st->expr(2)->lhs()->variant() == 468) {
|
||||
SgExpression* ex = st->expr(0);
|
||||
while (ex)
|
||||
{
|
||||
if (ex->lhs())
|
||||
if (ex->lhs()->variant() == VAR_REF)
|
||||
IntentInadded.insert(ex->lhs()->symbol()->identifier());
|
||||
ex = ex->rhs();
|
||||
}
|
||||
}
|
||||
|
||||
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||
{
|
||||
if (st->variant() == VAR_DECL || st->variant() == VAR_DECL_90)
|
||||
findDeclsNoIntentIn(st->expr(0), local, localParams, added, IntentInadded);
|
||||
}
|
||||
}
|
||||
|
||||
static void findLocalData(SgStatement* start, SgStatement* end, vector<SgExpression*>& local,
|
||||
map<string, SgStatement*>& localParams, set<string>& added)
|
||||
{
|
||||
@@ -569,8 +643,8 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
||||
vector<SgExpression*> local;
|
||||
map<string, SgStatement*> localParams;
|
||||
set<string> addedToList;
|
||||
findLocalData(func->lexNext(), lastDecl, local, localParams, addedToList);
|
||||
const vector<SgStatement*> useOfMods = findUseOfModules(func->lexNext(), lastDecl);
|
||||
findLocalDataNoIntentIn(func->lexNext(), firstExec, local, localParams, addedToList);
|
||||
const vector<SgStatement*> useOfMods = findUseOfModules(func->lexNext(), firstExec);
|
||||
|
||||
SgStatement* loadBlock = new SgStatement(IF_NODE);
|
||||
SgStatement* storeBlock = new SgStatement(IF_NODE);
|
||||
@@ -938,7 +1012,7 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
||||
vector<SgExpression*> local;
|
||||
map<string, SgStatement*> localParams;
|
||||
set<string> addedToList;
|
||||
findLocalData(hedrFrom->lexNext(), lastDecl, local, localParams, addedToList);
|
||||
findLocalDataNoIntentIn(hedrFrom->lexNext(), firstExec, local, localParams, addedToList);
|
||||
if (!processedFrom.count(j->second))
|
||||
{
|
||||
SgSymbol* modS = moduleF->symbol();
|
||||
@@ -1000,13 +1074,13 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
||||
ifLoadOk->insertStmtAfter(*insertToifLoadOk[z], *ifLoadOk);
|
||||
|
||||
processedFrom[j->second] = ifLoadOk1->lexNext();
|
||||
processedFrom[j->second]->unparsestdout();
|
||||
}
|
||||
else
|
||||
{
|
||||
SgStatement * read = new SgInputOutputStmt(READ_STAT, *makeExprList({ &frmt, &unit }, false), *new SgVarRefExp(loadS[3]));
|
||||
gotoBlock->insertStmtAfter(*read, *gotoBlock);
|
||||
processedFrom[j->second] = gotoBlock->lexNext();
|
||||
firstExec->insertStmtBefore(*gotoBlock, *hedrFrom);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user