added refactoring of FuncInfo, fixed ACC_ROUTINE inserting
This commit is contained in:
@@ -490,9 +490,9 @@ static SAPFOR::Argument* processExpression(SgExpression* ex, vector<IR_Block*>&
|
|||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
string callName = "_ERROR_";
|
string callName = "_ERROR_";
|
||||||
for (int z = 0; z < func->pointerDetailCallsFrom.size() && callName == "_ERROR_"; ++z)
|
for (int z = 0; z < func->callsFromDetailed.size() && callName == "_ERROR_"; ++z)
|
||||||
if (func->pointerDetailCallsFrom[z].first == ex)
|
if (func->callsFromDetailed[z].pointerDetailCallsFrom.first == ex)
|
||||||
callName = func->detailCallsFrom[z].first;
|
callName = func->callsFromDetailed[z].detailCallsFrom.first;
|
||||||
|
|
||||||
SAPFOR::Argument* fArg = getFuncArg(callName);
|
SAPFOR::Argument* fArg = getFuncArg(callName);
|
||||||
|
|
||||||
@@ -1094,9 +1094,9 @@ static SgStatement* processStatement(SgStatement* st, vector<IR_Block*>& blocks,
|
|||||||
bool hasLabelArgs = processArgs(call, call->numberOfArgs(), blocks, func, commonVars, &labelsOfArgs);
|
bool hasLabelArgs = processArgs(call, call->numberOfArgs(), blocks, func, commonVars, &labelsOfArgs);
|
||||||
|
|
||||||
string callName = "_ERROR_";
|
string callName = "_ERROR_";
|
||||||
for (int z = 0; z < func->pointerDetailCallsFrom.size() && callName == "_ERROR_"; ++z)
|
for (int z = 0; z < func->callsFromDetailed.size() && callName == "_ERROR_"; ++z)
|
||||||
if (func->pointerDetailCallsFrom[z].first == st)
|
if (func->callsFromDetailed[z].pointerDetailCallsFrom.first == st)
|
||||||
callName = func->detailCallsFrom[z].first;
|
callName = func->callsFromDetailed[z].detailCallsFrom.first;
|
||||||
|
|
||||||
SAPFOR::Argument* fArg = getFuncArg(callName);
|
SAPFOR::Argument* fArg = getFuncArg(callName);
|
||||||
|
|
||||||
|
|||||||
@@ -846,8 +846,9 @@ void uniteIntervalsBetweenProcCalls(map<string, vector<SpfInterval*>> &intervals
|
|||||||
{
|
{
|
||||||
if (SgFile::switchToFile(callsTo->fileName) == -1)
|
if (SgFile::switchToFile(callsTo->fileName) == -1)
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
for (auto &callsFrom : callsTo->pointerDetailCallsFrom)
|
for (auto &callsInfo: callsTo->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& callsFrom = callsInfo.pointerDetailCallsFrom;
|
||||||
SgStatement *base = NULL;
|
SgStatement *base = NULL;
|
||||||
if (callsFrom.second == PROC_STAT)
|
if (callsFrom.second == PROC_STAT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1631,8 +1631,11 @@ void GroupShadow(const map<string, vector<FuncInfo*>>& allFuncs,
|
|||||||
for (auto& elem : byFile.second)
|
for (auto& elem : byFile.second)
|
||||||
{
|
{
|
||||||
mapF[elem->funcName] = elem;
|
mapF[elem->funcName] = elem;
|
||||||
for (auto& call : elem->detailCallsFrom)
|
for (auto& callInfo : elem->callsFromDetailed)
|
||||||
|
{
|
||||||
|
auto& call = callInfo.detailCallsFrom;
|
||||||
mapCallsF[elem->fileName][call.second].insert(call.first);
|
mapCallsF[elem->fileName][call.second].insert(call.first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
map<FuncInfo*, set<FuncInfo*>> callDeps;
|
map<FuncInfo*, set<FuncInfo*>> callDeps;
|
||||||
|
|||||||
@@ -877,6 +877,34 @@ ArraySet DvmhRegionInserter::get_used_arrs_for_block(SgStatement* st, int usage_
|
|||||||
return usages;
|
return usages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool filterFromList(SgStatement* st, const set<string>& idents, bool exclude = false)
|
||||||
|
{
|
||||||
|
bool empty = false;
|
||||||
|
SgExpression* list = st->expr(0);
|
||||||
|
vector<SgExpression*> newList;
|
||||||
|
while (list)
|
||||||
|
{
|
||||||
|
if (exclude)
|
||||||
|
{
|
||||||
|
if (idents.find(list->lhs()->symbol()->identifier()) == idents.end())
|
||||||
|
newList.push_back(list->lhs());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (idents.find(list->lhs()->symbol()->identifier()) != idents.end())
|
||||||
|
newList.push_back(list->lhs());
|
||||||
|
}
|
||||||
|
list = list->rhs();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newList.size() == 0)
|
||||||
|
empty = true;
|
||||||
|
else
|
||||||
|
st->setExpression(0, makeExprList(newList));
|
||||||
|
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
|
||||||
static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
|
static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
|
||||||
{
|
{
|
||||||
string oldFile = current_file->filename();
|
string oldFile = current_file->filename();
|
||||||
@@ -884,8 +912,7 @@ static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
|
|||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
auto copy = duplicateProcedure(func, NULL, false, false, false, true);
|
auto copy = duplicateProcedure(func, NULL, false, false, false, true);
|
||||||
|
const set<string> idents(pars.identificators.begin(), pars.identificators.end());
|
||||||
const set<string> ident(pars.identificators.begin(), pars.identificators.end());
|
|
||||||
|
|
||||||
//remove all exec
|
//remove all exec
|
||||||
SgStatement* st = copy->lexNext();
|
SgStatement* st = copy->lexNext();
|
||||||
@@ -925,26 +952,16 @@ static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
|
|||||||
|| st->variant() == DIM_STAT
|
|| st->variant() == DIM_STAT
|
||||||
|| st->variant() == INTENT_STMT)
|
|| st->variant() == INTENT_STMT)
|
||||||
{
|
{
|
||||||
SgExpression* list = st->expr(0);
|
bool empty = filterFromList(st, idents);
|
||||||
vector<SgExpression*> newList;
|
if (empty)
|
||||||
while (list)
|
|
||||||
{
|
|
||||||
if (ident.find(list->lhs()->symbol()->identifier()) != ident.end())
|
|
||||||
newList.push_back(list->lhs());
|
|
||||||
list = list->rhs();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newList.size() == 0)
|
|
||||||
{
|
{
|
||||||
SgStatement* next = st->lexNext();
|
SgStatement* next = st->lexNext();
|
||||||
toExtract.push_back(st);
|
toExtract.push_back(st);
|
||||||
st = next;
|
st = next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
st->setExpression(0, makeExprList(newList));
|
|
||||||
}
|
}
|
||||||
else
|
else if (!isDVM_stat(st) && !isSPF_stat(st))
|
||||||
toExtract.push_back(st);
|
toExtract.push_back(st);
|
||||||
|
|
||||||
if (st->variant() == CONTAINS_STMT)
|
if (st->variant() == CONTAINS_STMT)
|
||||||
@@ -963,7 +980,7 @@ static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void insertInterface(SgStatement* func, const string& iface)
|
static void insertInterface(SgStatement* func, const string& iface, const string& fName)
|
||||||
{
|
{
|
||||||
string oldFile = current_file->filename();
|
string oldFile = current_file->filename();
|
||||||
if (!func->switchToFile())
|
if (!func->switchToFile())
|
||||||
@@ -973,6 +990,18 @@ static void insertInterface(SgStatement* func, const string& iface)
|
|||||||
SgStatement* last = func->lastNodeOfStmt();
|
SgStatement* last = func->lastNodeOfStmt();
|
||||||
while (st != last)
|
while (st != last)
|
||||||
{
|
{
|
||||||
|
if (st->variant() == VAR_DECL || st->variant() == VAR_DECL_90)
|
||||||
|
{
|
||||||
|
bool empty = filterFromList(st, { fName }, true);
|
||||||
|
if (empty)
|
||||||
|
{
|
||||||
|
SgStatement* next = st->lexNext();
|
||||||
|
st->extractStmt();
|
||||||
|
st = next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isSgExecutableStatement(st))
|
if (isSgExecutableStatement(st))
|
||||||
break;
|
break;
|
||||||
st = st->lexNext();
|
st = st->lexNext();
|
||||||
@@ -1033,21 +1062,57 @@ static bool isPure(SgStatement* func)
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DvmhRegionInserter::createInterfaceBlock()
|
void DvmhRegionInserter::createInterfaceBlockForParallelFunctions()
|
||||||
{
|
{
|
||||||
for (auto& parF : parallel_functions)
|
for (auto& parF : parallel_functions)
|
||||||
{
|
{
|
||||||
for (auto& callTo : parF->callsTo)
|
for (auto& callTo : parF->callsTo)
|
||||||
{
|
{
|
||||||
if (callTo->fileName != parF->fileName)
|
if (callTo->fileName != parF->fileName && isPure(parF->funcPointer->GetOriginal()))
|
||||||
{
|
{
|
||||||
if (callTo->interfaceBlocks.find(parF->funcName) == callTo->interfaceBlocks.end()
|
insertRoutine(parF->funcPointer->GetOriginal());
|
||||||
&& parF->funcParams.countOfPars > 0
|
auto it = callTo->interfaceBlocks.find(parF->funcName);
|
||||||
&& isPure(parF->funcPointer->GetOriginal()))
|
if (it == callTo->interfaceBlocks.end())
|
||||||
{
|
{
|
||||||
insertRoutine(parF->funcPointer->GetOriginal());
|
callTo->interfaceBlocks[parF->funcName] = NULL;
|
||||||
callTo->interfaceBlocks[parF->funcName] = parF;
|
insertInterface(callTo->funcPointer, getInterfaceBlock(parF->funcPointer->GetOriginal(), parF->funcParams), parF->funcName);
|
||||||
insertInterface(callTo->funcPointer, getInterfaceBlock(parF->funcPointer->GetOriginal(), parF->funcParams));
|
}
|
||||||
|
else if (it->second) // interface not inserted as comment
|
||||||
|
{
|
||||||
|
SgStatement* st = callTo->funcPointer->GetOriginal();
|
||||||
|
|
||||||
|
string oldFile = current_file->filename();
|
||||||
|
if (!st->switchToFile())
|
||||||
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
|
SgStatement* last = st->lastNodeOfStmt();
|
||||||
|
SgStatement* iface = NULL;
|
||||||
|
|
||||||
|
st = st->lexNext();
|
||||||
|
while (st != last)
|
||||||
|
{
|
||||||
|
if (st->variant() == FUNC_HEDR || st->variant() == PROC_HEDR)
|
||||||
|
{
|
||||||
|
if (st->controlParent()->variant() == INTERFACE_STMT &&
|
||||||
|
st->symbol()->identifier() == parF->funcName)
|
||||||
|
{
|
||||||
|
iface = st;
|
||||||
|
insertRoutine(iface);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (st->variant() == CONTAINS_STMT)
|
||||||
|
break;
|
||||||
|
if (isSgExecutableStatement(st))
|
||||||
|
break;
|
||||||
|
st = st->lexNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkNull(iface, convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
|
if (SgFile::switchToFile(oldFile) == -1)
|
||||||
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1059,14 +1124,13 @@ void DvmhRegionInserter::createInterfaceBlockForOutCalls(FuncInfo* func)
|
|||||||
for (auto& callFrom : func->callsFromV)
|
for (auto& callFrom : func->callsFromV)
|
||||||
{
|
{
|
||||||
if (func->interfaceBlocks.find(callFrom->funcName) == func->interfaceBlocks.end()
|
if (func->interfaceBlocks.find(callFrom->funcName) == func->interfaceBlocks.end()
|
||||||
&& callFrom->funcParams.countOfPars > 0
|
|
||||||
&& isPure(callFrom->funcPointer->GetOriginal()))
|
&& isPure(callFrom->funcPointer->GetOriginal()))
|
||||||
{
|
{
|
||||||
if (callFrom->fileName != func->fileName)
|
if (callFrom->fileName != func->fileName)
|
||||||
insertRoutine(func->funcPointer->GetOriginal());
|
insertRoutine(func->funcPointer->GetOriginal());
|
||||||
|
|
||||||
func->interfaceBlocks[callFrom->funcName] = callFrom;
|
func->interfaceBlocks[callFrom->funcName] = callFrom;
|
||||||
insertInterface(func->funcPointer, getInterfaceBlock(callFrom->funcPointer->GetOriginal(), callFrom->funcParams));
|
insertInterface(func->funcPointer, getInterfaceBlock(callFrom->funcPointer->GetOriginal(), callFrom->funcParams), callFrom->funcName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
void insertActualDirectives(const std::vector<ParallelRegion*>* regs);
|
void insertActualDirectives(const std::vector<ParallelRegion*>* regs);
|
||||||
|
|
||||||
void updateParallelFunctions(const std::map<std::string, std::vector<LoopGraph*>>& loopGraphs);
|
void updateParallelFunctions(const std::map<std::string, std::vector<LoopGraph*>>& loopGraphs);
|
||||||
void createInterfaceBlock();
|
void createInterfaceBlockForParallelFunctions();
|
||||||
void removePrivatesFromParallelLoops();
|
void removePrivatesFromParallelLoops();
|
||||||
void addPrivatesToParallelLoops();
|
void addPrivatesToParallelLoops();
|
||||||
void addUsedArrays(std::set<DIST::Array*>& arrays);
|
void addUsedArrays(std::set<DIST::Array*>& arrays);
|
||||||
|
|||||||
@@ -357,12 +357,15 @@ static void findFuncCalls(SgStatement *parent, SgExpression *curr, vector<FuncIn
|
|||||||
correctNameIfContains(NULL, curr, elem, containsFunctions, prefix);
|
correctNameIfContains(NULL, curr, elem, containsFunctions, prefix);
|
||||||
|
|
||||||
proc->callsFrom.insert(nameOfCallFunc.begin(), nameOfCallFunc.end());
|
proc->callsFrom.insert(nameOfCallFunc.begin(), nameOfCallFunc.end());
|
||||||
proc->detailCallsFrom.push_back(make_pair(nameOfCallFunc[1], line)); // original name of call
|
|
||||||
proc->pointerDetailCallsFrom.push_back(make_pair(curr, FUNC_CALL));
|
|
||||||
proc->parentForPointer.push_back(parent);
|
|
||||||
|
|
||||||
proc->actualParams.push_back(FuncParam());
|
FuncInfoCallFrom newCall;
|
||||||
processActualParams(curr->lhs(), commonBlocks, proc->actualParams.back(), proc->externalCalls);
|
newCall.detailCallsFrom = make_pair(nameOfCallFunc[1], line); // original name of call
|
||||||
|
newCall.pointerDetailCallsFrom = make_pair(curr, FUNC_CALL);
|
||||||
|
newCall.parentForPointer = parent;
|
||||||
|
newCall.actualParams = FuncParam();
|
||||||
|
|
||||||
|
processActualParams(curr->lhs(), commonBlocks, newCall.actualParams, proc->externalCalls);
|
||||||
|
proc->callsFromDetailed.push_back(newCall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1115,13 +1118,15 @@ void functionAnalyzer(SgFile *file, map<string, vector<FuncInfo*>> &allFuncInfo,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
proc->callsFrom.insert(pureNameOfCallFunc.begin(), pureNameOfCallFunc.end());
|
proc->callsFrom.insert(pureNameOfCallFunc.begin(), pureNameOfCallFunc.end());
|
||||||
proc->detailCallsFrom.push_back(make_pair(pureNameOfCallFunc[1], st->lineNumber())); // original name of call
|
|
||||||
proc->pointerDetailCallsFrom.push_back(make_pair(st, PROC_STAT));
|
|
||||||
proc->parentForPointer.push_back(st);
|
|
||||||
|
|
||||||
proc->actualParams.push_back(FuncParam());
|
FuncInfoCallFrom newCall;
|
||||||
|
newCall.detailCallsFrom = make_pair(pureNameOfCallFunc[1], st->lineNumber()); // original name of call
|
||||||
|
newCall.pointerDetailCallsFrom = make_pair(st, PROC_STAT);
|
||||||
|
newCall.parentForPointer = st;
|
||||||
|
newCall.actualParams = FuncParam();
|
||||||
|
|
||||||
processActualParams(st->expr(0), commonBlocks, proc->actualParams.back(), proc->externalCalls);
|
processActualParams(st->expr(0), commonBlocks, newCall.actualParams, proc->externalCalls);
|
||||||
|
proc->callsFromDetailed.push_back(newCall);
|
||||||
|
|
||||||
// Add func call which we've just found
|
// Add func call which we've just found
|
||||||
NestedFuncCall funcCall(pureNameOfCallFunc[1]);
|
NestedFuncCall funcCall(pureNameOfCallFunc[1]);
|
||||||
@@ -1150,11 +1155,14 @@ void functionAnalyzer(SgFile *file, map<string, vector<FuncInfo*>> &allFuncInfo,
|
|||||||
correctNameIfContains(NULL, curr, elem, containsFunctions, prefix);
|
correctNameIfContains(NULL, curr, elem, containsFunctions, prefix);
|
||||||
|
|
||||||
proc->callsFrom.insert(nameOfCallFunc.begin(), nameOfCallFunc.end());
|
proc->callsFrom.insert(nameOfCallFunc.begin(), nameOfCallFunc.end());
|
||||||
proc->detailCallsFrom.push_back(make_pair(nameOfCallFunc[1], st->lineNumber())); // original name of call
|
|
||||||
proc->pointerDetailCallsFrom.push_back(make_pair(curr, VAR_REF));
|
|
||||||
proc->parentForPointer.push_back(st);
|
|
||||||
|
|
||||||
proc->actualParams.push_back(FuncParam());
|
FuncInfoCallFrom newCall;
|
||||||
|
newCall.detailCallsFrom = make_pair(nameOfCallFunc[1], st->lineNumber()); // original name of call
|
||||||
|
newCall.pointerDetailCallsFrom = make_pair(curr, VAR_REF);
|
||||||
|
newCall.parentForPointer = st;
|
||||||
|
newCall.actualParams = FuncParam();
|
||||||
|
|
||||||
|
proc->callsFromDetailed.push_back(newCall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1371,11 +1379,11 @@ static bool matchCallAndDefinition(SgProject* proj, const map<string, int>& file
|
|||||||
|
|
||||||
for (auto& callsTo : currF->callsTo)
|
for (auto& callsTo : currF->callsTo)
|
||||||
{
|
{
|
||||||
for (int cf = 0; cf < callsTo->detailCallsFrom.size(); ++cf)
|
for (int cf = 0; cf < callsTo->callsFromDetailed.size(); ++cf)
|
||||||
{
|
{
|
||||||
if (callsTo->detailCallsFrom[cf].first == currF->funcName)
|
if (callsTo->callsFromDetailed[cf].detailCallsFrom.first == currF->funcName)
|
||||||
{
|
{
|
||||||
auto callInfo = callsTo->pointerDetailCallsFrom[cf];
|
auto callInfo = callsTo->callsFromDetailed[cf].pointerDetailCallsFrom;
|
||||||
if (callInfo.second == VAR_REF) // external call through proc parameter
|
if (callInfo.second == VAR_REF) // external call through proc parameter
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1383,8 +1391,8 @@ static bool matchCallAndDefinition(SgProject* proj, const map<string, int>& file
|
|||||||
if (itF == files.end())
|
if (itF == files.end())
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
bool localR = matchCallAndDefinition(currF->funcParams, callsTo->actualParams[cf], currF->funcName,
|
bool localR = matchCallAndDefinition(currF->funcParams, callsTo->callsFromDetailed[cf].actualParams, currF->funcName,
|
||||||
callsTo->fileName, callsTo->detailCallsFrom[cf].second, messages);
|
callsTo->fileName, callsTo->callsFromDetailed[cf].detailCallsFrom.second, messages);
|
||||||
if (!localR)
|
if (!localR)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@@ -2256,8 +2264,9 @@ void propagateWritesToArrays(map<string, vector<FuncInfo*>> &allFuncInfo)
|
|||||||
if (!ok)
|
if (!ok)
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
for (auto &callFrom : callsTo->pointerDetailCallsFrom)
|
for (auto &callFromInfo : callsTo->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& callFrom = callFromInfo.pointerDetailCallsFrom;
|
||||||
if (callFrom.second == VAR_REF) // pass procedure through parameter
|
if (callFrom.second == VAR_REF) // pass procedure through parameter
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2429,8 +2438,9 @@ int getLvlCall(FuncInfo* currF, int lvl, const string& func, const string& file,
|
|||||||
if (currF->funcName == func)
|
if (currF->funcName == func)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (auto& callsFrom : currF->detailCallsFrom)
|
for (auto& callsFromInfo : currF->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& callsFrom = callsFromInfo.detailCallsFrom;
|
||||||
if (callsFrom.first == func && callsFrom.second == line && currF->fileName == file)
|
if (callsFrom.first == func && callsFrom.second == line && currF->fileName == file)
|
||||||
return lvl;
|
return lvl;
|
||||||
}
|
}
|
||||||
@@ -2465,12 +2475,12 @@ void setInlineAttributeToCalls(const map<string, FuncInfo*>& allFunctions,
|
|||||||
if (itNeed != inDataChains.end())
|
if (itNeed != inDataChains.end())
|
||||||
needToInline = itNeed->second;
|
needToInline = itNeed->second;
|
||||||
|
|
||||||
for (int k = 0; k < curr->detailCallsFrom.size(); ++k)
|
for (int k = 0; k < curr->callsFromDetailed.size(); ++k)
|
||||||
{
|
{
|
||||||
if (needToInline.find(curr->detailCallsFrom[k]) == needToInline.end() &&
|
if (needToInline.find(curr->callsFromDetailed[k].detailCallsFrom) == needToInline.end() &&
|
||||||
!isIntrinsicFunctionName(curr->detailCallsFrom[k].first.c_str()))
|
!isIntrinsicFunctionName(curr->callsFromDetailed[k].detailCallsFrom.first.c_str()))
|
||||||
{
|
{
|
||||||
pair<void*, int> detail = curr->pointerDetailCallsFrom[k];
|
pair<void*, int> detail = curr->callsFromDetailed[k].pointerDetailCallsFrom;
|
||||||
|
|
||||||
if (SgFile::switchToFile(curr->fileName) == -1)
|
if (SgFile::switchToFile(curr->fileName) == -1)
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
@@ -2480,7 +2490,7 @@ void setInlineAttributeToCalls(const map<string, FuncInfo*>& allFunctions,
|
|||||||
else if (detail.second == FUNC_CALL)
|
else if (detail.second == FUNC_CALL)
|
||||||
{
|
{
|
||||||
//TODO: many functions in same statement
|
//TODO: many functions in same statement
|
||||||
SgStatement* callSt = SgStatement::getStatementByFileAndLine(curr->fileName, curr->detailCallsFrom[k].second);
|
SgStatement* callSt = SgStatement::getStatementByFileAndLine(curr->fileName, curr->callsFromDetailed[k].detailCallsFrom.second);
|
||||||
if (!callSt)
|
if (!callSt)
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
//((SgExpression*)detail.first)->addAttribute(BOOL_VAL);
|
//((SgExpression*)detail.first)->addAttribute(BOOL_VAL);
|
||||||
@@ -2489,8 +2499,8 @@ void setInlineAttributeToCalls(const map<string, FuncInfo*>& allFunctions,
|
|||||||
else
|
else
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
pointsForShadowCopies.insert(make_pair(curr->fileName, curr->detailCallsFrom[k].second));
|
pointsForShadowCopies.insert(make_pair(curr->fileName, curr->callsFromDetailed[k].detailCallsFrom.second));
|
||||||
__spf_print(1, " added attribute to '%s' <%s, %d>\n", curr->detailCallsFrom[k].first.c_str(), curr->fileName.c_str(), curr->detailCallsFrom[k].second);
|
__spf_print(1, " added attribute to '%s' <%s, %d>\n", curr->callsFromDetailed[k].detailCallsFrom.first.c_str(), curr->fileName.c_str(), curr->callsFromDetailed[k].detailCallsFrom.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,16 @@ struct NestedFuncCall
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FuncInfoCallFrom {
|
||||||
|
// <name, line>
|
||||||
|
std::pair<std::string, int> detailCallsFrom;
|
||||||
|
// <pointer, SG_VAR> SgStatement for PROC_STAT, SgExpression for FUNC_CALL, VAR_REF for external calls
|
||||||
|
std::pair<void*, int> pointerDetailCallsFrom;
|
||||||
|
// parent SgStatement* of FUNC_CALL
|
||||||
|
void* parentForPointer;
|
||||||
|
FuncParam actualParams;
|
||||||
|
};
|
||||||
|
|
||||||
struct FuncInfo
|
struct FuncInfo
|
||||||
{
|
{
|
||||||
std::string funcName;
|
std::string funcName;
|
||||||
@@ -107,13 +117,14 @@ struct FuncInfo
|
|||||||
|
|
||||||
std::set<std::string> callsFrom; //calls from this function
|
std::set<std::string> callsFrom; //calls from this function
|
||||||
std::set<FuncInfo*> callsFromV;
|
std::set<FuncInfo*> callsFromV;
|
||||||
|
std::vector<FuncInfoCallFrom> callsFromDetailed;
|
||||||
|
|
||||||
//TODO: create new object for grouping this info
|
//TODO: create new object for grouping this info
|
||||||
// grouped info of calls from
|
// grouped info of calls from
|
||||||
std::vector<std::pair<std::string, int>> detailCallsFrom; // <name, line>
|
/*std::vector<std::pair<std::string, int>> detailCallsFrom; // <name, line>
|
||||||
std::vector<std::pair<void*, int>> pointerDetailCallsFrom; // <pointer, SG_VAR> SgStatement for PROC_STAT, SgExpression for FUNC_CALL, VAR_REF for external calls
|
std::vector<std::pair<void*, int>> pointerDetailCallsFrom; // <pointer, SG_VAR> SgStatement for PROC_STAT, SgExpression for FUNC_CALL, VAR_REF for external calls
|
||||||
std::vector<void*> parentForPointer; // parent SgStatement* of FUNC_CALL
|
std::vector<void*> parentForPointer; // parent SgStatement* of FUNC_CALL
|
||||||
std::vector<FuncParam> actualParams;
|
std::vector<FuncParam> actualParams;*/
|
||||||
// end/
|
// end/
|
||||||
|
|
||||||
std::map<std::string, std::set<std::string>> commonBlocks;
|
std::map<std::string, std::set<std::string>> commonBlocks;
|
||||||
@@ -176,10 +187,10 @@ struct FuncInfo
|
|||||||
std::vector<std::pair<void*, int>> GetDetailedCallInfo(const std::string &funcName)
|
std::vector<std::pair<void*, int>> GetDetailedCallInfo(const std::string &funcName)
|
||||||
{
|
{
|
||||||
std::vector<std::pair<void*, int>> result;
|
std::vector<std::pair<void*, int>> result;
|
||||||
for (int i = 0; i < pointerDetailCallsFrom.size(); ++i)
|
for (int i = 0; i < callsFromDetailed.size(); ++i)
|
||||||
{
|
{
|
||||||
if (detailCallsFrom[i].first == funcName)
|
if (callsFromDetailed[i].detailCallsFrom.first == funcName)
|
||||||
result.push_back(pointerDetailCallsFrom[i]);
|
result.push_back(callsFromDetailed[i].pointerDetailCallsFrom);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,8 +154,9 @@ void updateFuncInfo(const map<string, vector<FuncInfo*>> &allFuncInfo) // const
|
|||||||
for (auto &it : mapFuncInfo)
|
for (auto &it : mapFuncInfo)
|
||||||
{
|
{
|
||||||
FuncInfo *currInfo = it.second;
|
FuncInfo *currInfo = it.second;
|
||||||
for (auto &funcCall : currInfo->detailCallsFrom)
|
for (auto &callInfo : currInfo->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& funcCall = callInfo.detailCallsFrom;
|
||||||
auto itCalledFunc = mapFuncInfo.find(funcCall.first);
|
auto itCalledFunc = mapFuncInfo.find(funcCall.first);
|
||||||
if (itCalledFunc != mapFuncInfo.end())
|
if (itCalledFunc != mapFuncInfo.end())
|
||||||
{
|
{
|
||||||
@@ -375,7 +376,7 @@ string convertToString(const FuncInfo *currFunc)
|
|||||||
{
|
{
|
||||||
result += "|" + currFunc->funcName + "|" + to_string(currFunc->linesNum.first) +
|
result += "|" + currFunc->funcName + "|" + to_string(currFunc->linesNum.first) +
|
||||||
"#" + to_string(currFunc->linesNum.second) +
|
"#" + to_string(currFunc->linesNum.second) +
|
||||||
"#" + to_string(currFunc->detailCallsFrom.size()) +
|
"#" + to_string(currFunc->callsFromDetailed.size()) +
|
||||||
"#" + to_string(currFunc->needToInline) + "#" + to_string(currFunc->doNotInline) +
|
"#" + to_string(currFunc->needToInline) + "#" + to_string(currFunc->doNotInline) +
|
||||||
"#" + to_string(currFunc->doNotAnalyze) + "#" + to_string((int)currFunc->isMain);
|
"#" + to_string(currFunc->doNotAnalyze) + "#" + to_string((int)currFunc->isMain);
|
||||||
|
|
||||||
@@ -389,8 +390,8 @@ string convertToString(const FuncInfo *currFunc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < currFunc->detailCallsFrom.size(); ++i)
|
for (int i = 0; i < currFunc->callsFromDetailed.size(); ++i)
|
||||||
result += "|" + currFunc->detailCallsFrom[i].first + "|" + to_string(currFunc->detailCallsFrom[i].second);
|
result += "|" + currFunc->callsFromDetailed[i].detailCallsFrom.first + "|" + to_string(currFunc->callsFromDetailed[i].detailCallsFrom.second);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -721,9 +722,9 @@ void createLinksBetweenFormalAndActualParams(map<string, vector<FuncInfo*>> &all
|
|||||||
//printf("func %s :\n", func->funcName.c_str());
|
//printf("func %s :\n", func->funcName.c_str());
|
||||||
const string &name = func->funcName;
|
const string &name = func->funcName;
|
||||||
for (auto &caller : func->callsTo)
|
for (auto &caller : func->callsTo)
|
||||||
for (int i = 0; i < caller->detailCallsFrom.size(); ++i)
|
for (int i = 0; i < caller->callsFromDetailed.size(); ++i)
|
||||||
if (caller->detailCallsFrom[i].first == name)
|
if (caller->callsFromDetailed[i].detailCallsFrom.first == name)
|
||||||
addLinks(caller->actualParams[i], func->funcParams, arrayLinksByFuncCalls);
|
addLinks(caller->callsFromDetailed[i].actualParams, func->funcParams, arrayLinksByFuncCalls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,8 +823,9 @@ bool detectMpiCalls(const map<string, vector<FuncInfo*>>& allFuncInfo, map<strin
|
|||||||
{
|
{
|
||||||
for (auto& func : byFile.second)
|
for (auto& func : byFile.second)
|
||||||
{
|
{
|
||||||
for (auto& callsFromThis : func->detailCallsFrom)
|
for (auto& callInfo: func->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& callsFromThis = callInfo.detailCallsFrom;
|
||||||
if (isMpiFunction(callsFromThis.first) && funcByName.find(callsFromThis.first) == funcByName.end())
|
if (isMpiFunction(callsFromThis.first) && funcByName.find(callsFromThis.first) == funcByName.end())
|
||||||
{
|
{
|
||||||
retVal = true;
|
retVal = true;
|
||||||
|
|||||||
@@ -1613,8 +1613,9 @@ bool inliner(const string& fileName_in, const string& funcName, const int lineNu
|
|||||||
{
|
{
|
||||||
for (auto& callTo : func->callsTo)
|
for (auto& callTo : func->callsTo)
|
||||||
{
|
{
|
||||||
for (auto& callFrom : callTo->detailCallsFrom)
|
for (auto& callInfo : callTo->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& callFrom = callInfo.detailCallsFrom;
|
||||||
if (callFrom.first == funcName)
|
if (callFrom.first == funcName)
|
||||||
{
|
{
|
||||||
SgStatement* callSt = SgStatement::getStatementByFileAndLine(fileName, callFrom.second);
|
SgStatement* callSt = SgStatement::getStatementByFileAndLine(fileName, callFrom.second);
|
||||||
@@ -1719,8 +1720,9 @@ bool inliner(const string& allInFunc, const map<string, vector<FuncInfo*>>& allF
|
|||||||
if (SgFile::switchToFile(func->fileName) == -1)
|
if (SgFile::switchToFile(func->fileName) == -1)
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
for (auto& callFrom : func->detailCallsFrom)
|
for (auto& callInfo : func->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& callFrom = callInfo.detailCallsFrom;
|
||||||
bool res = inliner(func->fileName, callFrom.first, callFrom.second, allFuncInfo, SPF_messages, newSymbsToDeclare, commonBlocks, deepLvl);
|
bool res = inliner(func->fileName, callFrom.first, callFrom.second, allFuncInfo, SPF_messages, newSymbsToDeclare, commonBlocks, deepLvl);
|
||||||
result = result && res;
|
result = result && res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -927,20 +927,20 @@ static SgExpression* replaceConstatantProcedurePars(SgExpression *dimList, SgSta
|
|||||||
for (int z = 0; z < currF->callsTo.size(); ++z)
|
for (int z = 0; z < currF->callsTo.size(); ++z)
|
||||||
{
|
{
|
||||||
FuncInfo* callOfThis = currF->callsTo[z];
|
FuncInfo* callOfThis = currF->callsTo[z];
|
||||||
for (int p = 0; p < callOfThis->detailCallsFrom.size(); ++p)
|
for (int p = 0; p < callOfThis->callsFromDetailed.size(); ++p)
|
||||||
{
|
{
|
||||||
if (callOfThis->detailCallsFrom[p].first == procN)
|
if (callOfThis->callsFromDetailed[p].detailCallsFrom.first == procN)
|
||||||
{
|
{
|
||||||
for (auto& par : idxFound)
|
for (auto& par : idxFound)
|
||||||
{
|
{
|
||||||
auto parType = callOfThis->actualParams[p].parametersT[par];
|
auto parType = callOfThis->callsFromDetailed[p].actualParams.parametersT[par];
|
||||||
if (parType != SCALAR_INT_T)
|
if (parType != SCALAR_INT_T)
|
||||||
return dimList;
|
return dimList;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (callOfThis->actualParams[p].parameters[par] == NULL)
|
if (callOfThis->callsFromDetailed[p].actualParams.parameters[par] == NULL)
|
||||||
return dimList;
|
return dimList;
|
||||||
values[par].insert(((int*)(callOfThis->actualParams[p].parameters[par]))[0]);
|
values[par].insert(((int*)(callOfThis->callsFromDetailed[p].actualParams.parameters[par]))[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,10 +348,12 @@ void fillRegionFunctions(vector<ParallelRegion*> ®ions, const map<string, vec
|
|||||||
// add DEFAULT region (regionId == 0)
|
// add DEFAULT region (regionId == 0)
|
||||||
if (func->isIndirect())
|
if (func->isIndirect())
|
||||||
{
|
{
|
||||||
for (auto &elem : func->detailCallsFrom)
|
for (auto &callInfo : func->callsFromDetailed)
|
||||||
{
|
{
|
||||||
auto line = elem.second;
|
auto& callFrom = callInfo.detailCallsFrom;
|
||||||
auto call = elem.first;
|
|
||||||
|
auto line = callFrom.second;
|
||||||
|
auto call = callFrom.first;
|
||||||
auto callF = getFuncInfo(funcMap, call);
|
auto callF = getFuncInfo(funcMap, call);
|
||||||
auto regs = getAllRegionsByLine(regions, func->fileName, line).size();
|
auto regs = getAllRegionsByLine(regions, func->fileName, line).size();
|
||||||
if (callF && !getAllRegionsByLine(regions, func->fileName, line).size())
|
if (callF && !getAllRegionsByLine(regions, func->fileName, line).size())
|
||||||
|
|||||||
@@ -2101,7 +2101,6 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
|||||||
set<DIST::Array*> usedArraysInRegions;
|
set<DIST::Array*> usedArraysInRegions;
|
||||||
set<DIST::Array*> usedWriteArraysInRegions;
|
set<DIST::Array*> usedWriteArraysInRegions;
|
||||||
|
|
||||||
set<FuncInfo*> forPure;
|
|
||||||
for (int i = n - 1; i >= 0; --i)
|
for (int i = n - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
SgFile* file = &(project.file(i));
|
SgFile* file = &(project.file(i));
|
||||||
@@ -2134,16 +2133,15 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
|||||||
//add privates to parallel loops with manual parallelization in DVMH regions
|
//add privates to parallel loops with manual parallelization in DVMH regions
|
||||||
regionInserter->addPrivatesToParallelLoops();
|
regionInserter->addPrivatesToParallelLoops();
|
||||||
|
|
||||||
//create interface for 'parallel' functions
|
|
||||||
regionInserter->createInterfaceBlock();
|
|
||||||
|
|
||||||
regionInserter->addUsedArrays(usedArraysInRegions);
|
regionInserter->addUsedArrays(usedArraysInRegions);
|
||||||
regionInserter->addUsedWriteArrays(usedWriteArraysInRegions);
|
regionInserter->addUsedWriteArrays(usedWriteArraysInRegions);
|
||||||
|
|
||||||
auto parallelFuncs = regionInserter->getParallelFunctions();
|
setPureStatus(regionInserter->getParallelFunctions());
|
||||||
forPure.insert(parallelFuncs.begin(), parallelFuncs.end());
|
|
||||||
|
//create interface for 'parallel' functions and
|
||||||
|
// insert ROUTINE directive if needed
|
||||||
|
regionInserter->createInterfaceBlockForParallelFunctions();
|
||||||
}
|
}
|
||||||
setPureStatus(forPure);
|
|
||||||
|
|
||||||
for (auto& regionInserter : inserters)
|
for (auto& regionInserter : inserters)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1011,8 +1011,9 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& call : (j->second)->pointerDetailCallsFrom)
|
for (auto& callInfo : j->second->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& call = callInfo.pointerDetailCallsFrom;
|
||||||
SgStatement* st = NULL;
|
SgStatement* st = NULL;
|
||||||
|
|
||||||
if (isSgFuncHedrStmt(hedrTo) && call.second == FUNC_CALL)
|
if (isSgFuncHedrStmt(hedrTo) && call.second == FUNC_CALL)
|
||||||
|
|||||||
@@ -429,8 +429,9 @@ static void transferCommons(set<FuncInfo*>& allForChange, map <FuncInfo*, map<st
|
|||||||
if (SgFile::switchToFile(curFunc->fileName) == -1)
|
if (SgFile::switchToFile(curFunc->fileName) == -1)
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
for (auto& call : curFunc->pointerDetailCallsFrom)
|
for (auto& callInfo : curFunc->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& call = callInfo.pointerDetailCallsFrom;
|
||||||
if (isSgFuncHedrStmt(precFunc->funcPointer->GetOriginal()) && call.second == FUNC_CALL)
|
if (isSgFuncHedrStmt(precFunc->funcPointer->GetOriginal()) && call.second == FUNC_CALL)
|
||||||
{
|
{
|
||||||
SgFunctionCallExp* callExp = (SgFunctionCallExp*)call.first;
|
SgFunctionCallExp* callExp = (SgFunctionCallExp*)call.first;
|
||||||
@@ -792,8 +793,9 @@ static void transferSave(map<FuncInfo*, set<FuncInfo*>>& funcAddedVarsFuncs, vec
|
|||||||
if (SgFile::switchToFile(curFunc->fileName) == -1)
|
if (SgFile::switchToFile(curFunc->fileName) == -1)
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
for (auto& call : curFunc->pointerDetailCallsFrom)
|
for (auto& callInfo : curFunc->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& call = callInfo.pointerDetailCallsFrom;
|
||||||
if (isSgFuncHedrStmt(precFunc->funcPointer->GetOriginal()) && call.second == FUNC_CALL)
|
if (isSgFuncHedrStmt(precFunc->funcPointer->GetOriginal()) && call.second == FUNC_CALL)
|
||||||
{
|
{
|
||||||
SgFunctionCallExp* callExp = (SgFunctionCallExp*)call.first;
|
SgFunctionCallExp* callExp = (SgFunctionCallExp*)call.first;
|
||||||
@@ -1251,8 +1253,9 @@ static void transferModule(map<FuncInfo*, set<SgSymbol*>>& funcAddedVarsMods, se
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& call : curFunc->pointerDetailCallsFrom)
|
for (auto& callInfo : curFunc->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& call = callInfo.pointerDetailCallsFrom;
|
||||||
if (isSgFuncHedrStmt(precFunc->funcPointer->GetOriginal()) && call.second == FUNC_CALL)
|
if (isSgFuncHedrStmt(precFunc->funcPointer->GetOriginal()) && call.second == FUNC_CALL)
|
||||||
{
|
{
|
||||||
SgFunctionCallExp* callExp = (SgFunctionCallExp*)call.first;
|
SgFunctionCallExp* callExp = (SgFunctionCallExp*)call.first;
|
||||||
|
|||||||
@@ -118,15 +118,16 @@ static map<FuncInfo*, callInfo> countOfCalls(const map<string, vector<FuncInfo*>
|
|||||||
for (auto& elem : fromFile.second)
|
for (auto& elem : fromFile.second)
|
||||||
{
|
{
|
||||||
int p = 0;
|
int p = 0;
|
||||||
for (auto& detailed : elem->detailCallsFrom)
|
for (auto& callInfo : elem->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
auto& detailed = callInfo.detailCallsFrom;
|
||||||
auto it = mapOfFunc.find(detailed.first);
|
auto it = mapOfFunc.find(detailed.first);
|
||||||
if (it != mapOfFunc.end())
|
if (it != mapOfFunc.end())
|
||||||
{
|
{
|
||||||
auto var = variantCall.find(it->second);
|
auto var = variantCall.find(it->second);
|
||||||
auto createPackCall = createParamCalls(elem->pointerDetailCallsFrom[p], elem->fileName);
|
auto createPackCall = createParamCalls(elem->callsFromDetailed[p].pointerDetailCallsFrom, elem->fileName);
|
||||||
|
|
||||||
if (checkUniqAndAdd(var->second, createPackCall, elem->pointerDetailCallsFrom[p], elem->parentForPointer[p]))
|
if (checkUniqAndAdd(var->second, createPackCall, elem->callsFromDetailed[p].pointerDetailCallsFrom, elem->callsFromDetailed[p].parentForPointer))
|
||||||
count[it->second]++;
|
count[it->second]++;
|
||||||
}
|
}
|
||||||
++p;
|
++p;
|
||||||
@@ -554,9 +555,9 @@ static void copyGroup(const map<string, FuncInfo*> &mapOfFunc, const vector<Func
|
|||||||
findInterfaceBlockAndDuplicate(func->funcPointer->GetOriginal(), origName, newName, varOfCall);
|
findInterfaceBlockAndDuplicate(func->funcPointer->GetOriginal(), origName, newName, varOfCall);
|
||||||
|
|
||||||
// fill additional places to next replaces
|
// fill additional places to next replaces
|
||||||
for (int z = 0; z < currFunc->pointerDetailCallsFrom.size(); ++z)
|
for (int z = 0; z < currFunc->callsFromDetailed.size(); ++z)
|
||||||
{
|
{
|
||||||
pair<void*, int> place = currFunc->pointerDetailCallsFrom[z];
|
pair<void*, int> place = currFunc->callsFromDetailed[z].pointerDetailCallsFrom;
|
||||||
if (place.second == PROC_STAT)
|
if (place.second == PROC_STAT)
|
||||||
{
|
{
|
||||||
SgStatement* proc = (SgStatement*)place.first;
|
SgStatement* proc = (SgStatement*)place.first;
|
||||||
@@ -575,12 +576,12 @@ static void copyGroup(const map<string, FuncInfo*> &mapOfFunc, const vector<Func
|
|||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
vector<void*> tmp;
|
vector<void*> tmp;
|
||||||
infoAdd->second.variantCall.push_back(callVars(make_pair(copyPoint, PROC_STAT), tmp, currFunc->parentForPointer[z]));
|
infoAdd->second.variantCall.push_back(callVars(make_pair(copyPoint, PROC_STAT), tmp, currFunc->callsFromDetailed[z].parentForPointer));
|
||||||
}
|
}
|
||||||
else if (place.second == FUNC_CALL)
|
else if (place.second == FUNC_CALL)
|
||||||
{
|
{
|
||||||
SgExpression* proc = (SgExpression*)place.first;
|
SgExpression* proc = (SgExpression*)place.first;
|
||||||
SgStatement* parent = (SgStatement*)currFunc->parentForPointer[z];
|
SgStatement* parent = (SgStatement*)currFunc->callsFromDetailed[z].parentForPointer;
|
||||||
checkNull(parent, convertFileName(__FILE__).c_str(), __LINE__);
|
checkNull(parent, convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
if (SgFile::switchToFile(parent->fileName()) == -1)
|
if (SgFile::switchToFile(parent->fileName()) == -1)
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
@@ -597,7 +598,7 @@ static void copyGroup(const map<string, FuncInfo*> &mapOfFunc, const vector<Func
|
|||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
vector<void*> tmp;
|
vector<void*> tmp;
|
||||||
infoAdd->second.variantCall.push_back(callVars(make_pair(copyPoint, FUNC_CALL), tmp, currFunc->parentForPointer[z]));
|
infoAdd->second.variantCall.push_back(callVars(make_pair(copyPoint, FUNC_CALL), tmp, currFunc->callsFromDetailed[z].parentForPointer));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|||||||
@@ -1153,7 +1153,8 @@ bool isDVM_stat(SgStatement *st)
|
|||||||
(var == DVM_DISTRIBUTE_DIR) ||
|
(var == DVM_DISTRIBUTE_DIR) ||
|
||||||
(var >= HPF_TEMPLATE_STAT && var <= DVM_REDISTRIBUTE_DIR) ||
|
(var >= HPF_TEMPLATE_STAT && var <= DVM_REDISTRIBUTE_DIR) ||
|
||||||
(var >= BLOCK_OP && var <= STAGE_OP) ||
|
(var >= BLOCK_OP && var <= STAGE_OP) ||
|
||||||
(var >= INDIRECT_OP && var <= SHADOW_NAMES_OP))
|
(var >= INDIRECT_OP && var <= SHADOW_NAMES_OP) ||
|
||||||
|
(var >= ACC_REGION_DIR && var <= ACC_ASYNC_OP))
|
||||||
ret = true;
|
ret = true;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2231"
|
#define VERSION_SPF "2232"
|
||||||
|
|||||||
@@ -64,8 +64,11 @@ buildLocationOfGraph(const map<string, vector<FuncInfo*>>& allFuncInfo, const in
|
|||||||
for (auto& elem : mapOfFuncs)
|
for (auto& elem : mapOfFuncs)
|
||||||
{
|
{
|
||||||
set<string> callsFrom;
|
set<string> callsFrom;
|
||||||
for (auto& callFrom_ : elem.second->detailCallsFrom)
|
for (auto& callFromInfo : elem.second->callsFromDetailed)
|
||||||
|
{
|
||||||
|
auto& callFrom_ = callFromInfo.detailCallsFrom;
|
||||||
callsFrom.insert(callFrom_.first);
|
callsFrom.insert(callFrom_.first);
|
||||||
|
}
|
||||||
callsFrom.insert(elem.second->externalCalls.begin(), elem.second->externalCalls.end());
|
callsFrom.insert(elem.second->externalCalls.begin(), elem.second->externalCalls.end());
|
||||||
|
|
||||||
for (auto& call : callsFrom)
|
for (auto& call : callsFrom)
|
||||||
@@ -90,8 +93,11 @@ buildLocationOfGraph(const map<string, vector<FuncInfo*>>& allFuncInfo, const in
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
set<string> callsFrom;
|
set<string> callsFrom;
|
||||||
for (auto& callFrom_ : elem.second->detailCallsFrom)
|
for (auto& callFromInfo : elem.second->callsFromDetailed)
|
||||||
|
{
|
||||||
|
auto& callFrom_ = callFromInfo.detailCallsFrom;
|
||||||
callsFrom.insert(callFrom_.first);
|
callsFrom.insert(callFrom_.first);
|
||||||
|
}
|
||||||
callsFrom.insert(elem.second->externalCalls.begin(), elem.second->externalCalls.end());
|
callsFrom.insert(elem.second->externalCalls.begin(), elem.second->externalCalls.end());
|
||||||
|
|
||||||
for (auto& call : callsFrom)
|
for (auto& call : callsFrom)
|
||||||
|
|||||||
Reference in New Issue
Block a user