improved and fixed transformAssumedSizeParameters function
This commit is contained in:
@@ -234,9 +234,8 @@ static bool hasDvmParallel(SgStatement *func)
|
||||
return false;
|
||||
}
|
||||
|
||||
void transformAssumedSizeParameters(const map<string, vector<FuncInfo*>>& allFuncInfo)
|
||||
{
|
||||
map<string, vector<int>> assumedSizeArraysByFunc;
|
||||
static map<FuncInfo*, bool> createDvmParallelInfo(const map<string, vector<FuncInfo*>>& allFuncInfo) {
|
||||
map<FuncInfo*, bool> hasDvmParallelMap;
|
||||
|
||||
for (auto& funcByFile : allFuncInfo)
|
||||
{
|
||||
@@ -249,7 +248,63 @@ void transformAssumedSizeParameters(const map<string, vector<FuncInfo*>>& allFun
|
||||
if (prog == NULL)
|
||||
continue;
|
||||
|
||||
if (!hasDvmParallel(prog))
|
||||
hasDvmParallelMap[func] = hasDvmParallel(prog);
|
||||
}
|
||||
}
|
||||
|
||||
bool changed = true;
|
||||
while (changed)
|
||||
{
|
||||
changed = false;
|
||||
|
||||
for (auto& funcByFile : allFuncInfo)
|
||||
{
|
||||
for (auto& func : funcByFile.second)
|
||||
{
|
||||
if (!hasDvmParallelMap[func])
|
||||
{
|
||||
bool hasParallel = false;
|
||||
for (auto& callF : func->callsFromV)
|
||||
{
|
||||
if (hasDvmParallelMap[callF])
|
||||
{
|
||||
hasParallel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasParallel)
|
||||
{
|
||||
changed = true;
|
||||
hasDvmParallelMap[func] = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasDvmParallelMap;
|
||||
}
|
||||
|
||||
|
||||
void transformAssumedSizeParameters(const map<string, vector<FuncInfo*>>& allFuncInfo)
|
||||
{
|
||||
map<string, vector<int>> assumedSizeArraysByFunc;
|
||||
const map<FuncInfo*, bool> hasDvmParallelMap = createDvmParallelInfo(allFuncInfo);
|
||||
|
||||
for (auto& funcByFile : allFuncInfo)
|
||||
{
|
||||
if (SgFile::switchToFile(funcByFile.first) == -1)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
for (auto& func : funcByFile.second)
|
||||
{
|
||||
SgProgHedrStmt* prog = isSgProgHedrStmt(func->funcPointer->GetOriginal());
|
||||
if (prog == NULL)
|
||||
continue;
|
||||
|
||||
if (!hasDvmParallelMap.at(func))
|
||||
continue;
|
||||
|
||||
vector<SgSymbol*> parNames;
|
||||
@@ -259,7 +314,8 @@ void transformAssumedSizeParameters(const map<string, vector<FuncInfo*>>& allFun
|
||||
bool hasRefs = false;
|
||||
for (int z = 0; z < func->funcParams.countOfPars; ++z)
|
||||
{
|
||||
if (func->funcParams.parametersT[z] == ARRAY_T)
|
||||
if (func->funcParams.parametersT[z] == ARRAY_T ||
|
||||
func->funcParams.parametersT[z] == STRING_ARRAY_T)
|
||||
{
|
||||
auto s = prog->parameter(z);
|
||||
const string name = s->identifier();
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2476"
|
||||
#define VERSION_SPF "2477"
|
||||
|
||||
Reference in New Issue
Block a user