Compare commits
6 Commits
7bca67b75c
...
replace_io
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8ddc94734 | ||
| db5062c416 | |||
| b71df882fb | |||
|
|
2d25a61ee7 | ||
| 3378ae5fbd | |||
|
|
446f4d54d7 |
@@ -723,7 +723,7 @@ static void fillIn(FuncInfo *currF, SgExpression *ex, const map<string, int> &pa
|
||||
{
|
||||
if (ex)
|
||||
{
|
||||
if (!isInFuncPar && (ex->variant() == VAR_REF || isArrayRef(ex)))
|
||||
if (!isInFuncPar && (ex->variant() == VAR_REF || ex->variant() == ARRAY_REF))
|
||||
{
|
||||
const char *name = ex->symbol()->identifier();
|
||||
if (name && name != string(""))
|
||||
@@ -880,7 +880,7 @@ static void fillInOut(FuncInfo *currF, SgStatement *start, SgStatement *last, co
|
||||
for (auto ex = read->itemList(); ex; ex = ex->rhs())
|
||||
{
|
||||
SgExpression* item = ex->lhs();
|
||||
if (item->variant() == VAR_REF || isArrayRef(item))
|
||||
if (item && (item->variant() == VAR_REF || item->variant() == ARRAY_REF))
|
||||
{
|
||||
string symb = "";
|
||||
if (item->symbol())
|
||||
@@ -901,7 +901,7 @@ static void fillInOut(FuncInfo *currF, SgStatement *start, SgStatement *last, co
|
||||
if (item->rhs())
|
||||
queue.push(item->rhs());
|
||||
|
||||
if (item->variant() == VAR_REF || isArrayRef(item))
|
||||
if (item->variant() == VAR_REF || item->variant() == ARRAY_REF)
|
||||
{
|
||||
string symb = "";
|
||||
if (item->symbol())
|
||||
|
||||
@@ -504,7 +504,7 @@ static void replaceArrayInFragment(SgSymbol* replace_symb,
|
||||
}
|
||||
}
|
||||
|
||||
static bool ioReginBorder(SgStatement* stat, SgStatement* last_io_bound)
|
||||
static bool ioRegionBorder(SgStatement* stat, SgStatement* last_io_bound)
|
||||
{
|
||||
auto var = stat->variant();
|
||||
|
||||
@@ -535,14 +535,24 @@ static bool ioReginBorder(SgStatement* stat, SgStatement* last_io_bound)
|
||||
if (last_io_bound && last_io_bound->lastNodeOfStmt() && last_io_bound->lastNodeOfStmt() == stat)
|
||||
return true;
|
||||
|
||||
int parent_var;
|
||||
|
||||
if (var == CONTROL_END && border_stats.find(stat->controlParent()->variant()) != border_stats.end())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
FuncInfo* getCurrentFuncInfo(const vector<FuncInfo*>& fileFuncInfo, int line)
|
||||
{
|
||||
for (auto* func : fileFuncInfo)
|
||||
{
|
||||
if (func->linesNum.first <= line && line <= func->linesNum.second)
|
||||
return func;
|
||||
}
|
||||
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
|
||||
const map<string, vector<FuncInfo*>>& allFuncInfo,
|
||||
map<string, vector<Messages>>& SPF_messages,
|
||||
@@ -562,6 +572,8 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
|
||||
if (SgFile::switchToFile(current_file_name) == -1)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
FuncInfo *current_func_info = NULL;
|
||||
|
||||
auto func_info_it = allFuncInfo.find(current_file_name);
|
||||
if (func_info_it == allFuncInfo.end())
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
@@ -588,13 +600,12 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
|
||||
{
|
||||
curr_stmt = lines.stats.first->GetOriginal();
|
||||
end = lines.stats.second->GetOriginal()->lexNext();
|
||||
current_func_info = getCurrentFuncInfo(func_info_it->second, curr_stmt->lineNumber());
|
||||
}
|
||||
|
||||
map<SgSymbol*, set<SgStatement*>> need_replace;
|
||||
SgStatement* last_io_bound = NULL;
|
||||
|
||||
FuncInfo *current_func_info = NULL;
|
||||
|
||||
while (curr_stmt != end)
|
||||
{
|
||||
if (!curr_stmt)
|
||||
@@ -604,18 +615,7 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
|
||||
|
||||
if (var == PROC_HEDR || var == PROG_HEDR || var == FUNC_HEDR)
|
||||
{
|
||||
current_func_info = NULL;
|
||||
for (auto *func_info : func_info_it->second)
|
||||
{
|
||||
if (func_info->funcName == curr_stmt->symbol()->identifier())
|
||||
{
|
||||
current_func_info = func_info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!current_func_info)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
current_func_info = getCurrentFuncInfo(func_info_it->second, curr_stmt->lineNumber());
|
||||
|
||||
curr_stmt = curr_stmt->lexNext();
|
||||
while (curr_stmt && !isSgExecutableStatement(curr_stmt))
|
||||
@@ -628,7 +628,7 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
|
||||
break;
|
||||
}
|
||||
|
||||
if (ioReginBorder(curr_stmt, last_io_bound))
|
||||
if (ioRegionBorder(curr_stmt, last_io_bound))
|
||||
{
|
||||
for (const auto& by_array_to_copy : need_replace)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2473"
|
||||
#define VERSION_SPF "2476"
|
||||
|
||||
Reference in New Issue
Block a user