replace_io_arrays #67

Merged
Alexander_KS merged 5 commits from replace_io_arrays into master 2025-10-01 18:13:01 +00:00
Showing only changes of commit 453105d273 - Show all commits

View File

@@ -17,6 +17,11 @@ using std::pair;
#define DEBUG_TRACE 0
static inline bool isArrayDeclaration(SgStatement* st)
{
return isSgDeclarationStatement(st) || st->variant() == DIM_STAT || st->variant() == COMM_STAT;
}
static SgExpression* findExprWithVariant(SgExpression* exp, int variant)
{
if (exp)
@@ -644,18 +649,17 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
newDeclsToInclude,
copied_syms);
// original declaration statement
auto *decl_stmt = SgStatement::getStatementByFileAndLine(decl_place.first, decl_place.second);
if (!decl_stmt || !isSgDeclarationStatement(decl_stmt))
if (!decl_stmt || !isArrayDeclaration(decl_stmt))
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
auto dynamic_array = checkAssumedShape(decl_stmt, array_name);
while (decl_stmt && !isSgExecutableStatement(decl_stmt))
{
if (isSgDeclarationStatement(decl_stmt) &&
if (isArrayDeclaration(decl_stmt) &&
decl_stmt->expr(0) &&
decl_stmt->expr(0)->lhs() &&
decl_stmt->expr(0)->lhs()->symbol() == copied_symbol.second)
@@ -667,7 +671,7 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
}
// created declaration statement
if (!decl_stmt || !isSgDeclarationStatement(decl_stmt))
if (!decl_stmt || !isArrayDeclaration(decl_stmt))
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
// insert !$SPF ANALYSIS(PROCESS_PRIVATE(array)) directive before declaration statement