10 Commits

29 changed files with 365 additions and 165 deletions

View File

@@ -7645,14 +7645,14 @@ SgExpression *CalculateArrayBound(SgExpression *edim, SgSymbol *ar, int flag_pri
SgSubscriptExp *sbe; SgSubscriptExp *sbe;
SgExpression *low; SgExpression *low;
if (!edim && flag_private) if (!edim && flag_private)
{ {
// Error("Illegal array bound of private/reduction array %s", ar->identifier(), 442, dvm_parallel_dir); // Error("Illegal array bound of private/reduction array %s", ar->identifier(), 442, dvm_parallel_dir);
return (edim); return (edim);
} }
if ((sbe = isSgSubscriptExp(edim)) != NULL){ //DDOT if ((sbe = isSgSubscriptExp(edim)) != NULL){ //DDOT
if (!sbe->ubound() && flag_private) if (!sbe->ubound() && flag_private)
{ {
// Error("Illegal array bound of private/reduction array %s", ar->identifier(), 442, dvm_parallel_dir); // Error("Illegal array bound of private/reduction array %s", ar->identifier(), 442, dvm_parallel_dir);
return(edim); return(edim);
} }
@@ -7675,8 +7675,8 @@ SgExpression *CalculateArrayBound(SgExpression *edim, SgSymbol *ar, int flag_pri
} }
else else
{ {
edim = Calculate(edim); edim = Calculate(edim);
if (edim->variant() != INT_VAL && flag_private ) // if (edim->variant() != INT_VAL && flag_private )
// Error("Illegal array bound of private/reduction array %s", ar->identifier(), 442, dvm_parallel_dir); // Error("Illegal array bound of private/reduction array %s", ar->identifier(), 442, dvm_parallel_dir);
return (edim); return (edim);
} }
@@ -11095,10 +11095,13 @@ SgExpression *BlockDimsProduct()
{ {
return &(*new SgRecordRefExp(*s_blockdim, "x") * *new SgRecordRefExp(*s_blockdim, "y") * *new SgRecordRefExp(*s_blockdim, "z")); return &(*new SgRecordRefExp(*s_blockdim, "x") * *new SgRecordRefExp(*s_blockdim, "y") * *new SgRecordRefExp(*s_blockdim, "z"));
} }
SgExpression *LowerShiftForArrays (SgSymbol *ar, int i, int type) SgExpression *LowerShiftForArrays (SgSymbol *ar, int i, int type)
{ {
SgExpression *e = isConstantBound(ar, i, 1); SgExpression *e = isConstantBound(ar, i, 1);
if(e) return e;
if(type==0) //private array
e = new SgValueExp(1);
else // reduction array else // reduction array
e = &(((SgExprListExp *)red_struct_list->lowBound_arg)->elem(i)->copy()); e = &(((SgExprListExp *)red_struct_list->lowBound_arg)->elem(i)->copy());
return e; return e;

View File

@@ -208,7 +208,7 @@ static void addInListIfNeed(SgSymbol *tmp, int type, reduction_operation_list *t
while (dimList) while (dimList)
{ {
allArraySub.push(dimList->lhs()); allArraySub.push(dimList->lhs());
allArraySubConv.push(make_pair(LowerShiftForArrays(tmp, rank), UpperShiftForArrays(tmp, rank))); allArraySubConv.push(make_pair(LowerShiftForArrays(tmp, rank, type), UpperShiftForArrays(tmp, rank)));
++rank; ++rank;
dimList = dimList->rhs(); dimList = dimList->rhs();
} }
@@ -222,7 +222,7 @@ static void addInListIfNeed(SgSymbol *tmp, int type, reduction_operation_list *t
bool ddot = false; bool ddot = false;
if (ex->variant() == DDOT && ex->lhs() || IS_ALLOCATABLE(tmp)) if (ex->variant() == DDOT && ex->lhs() || IS_ALLOCATABLE(tmp))
ddot = true; ddot = true;
t.correctExp.push_back(LowerShiftForArrays(tmp, rank)); t.correctExp.push_back(LowerShiftForArrays(tmp, rank, type));
// swap array's dimentionss // swap array's dimentionss
if (inNewVars(tmp->identifier())) if (inNewVars(tmp->identifier()))

View File

@@ -6263,6 +6263,14 @@ SgExpression *doShapeList(SgSymbol *ar, SgStatement *st) /* RTS2 */
l_bound = &(c1.copy()); l_bound = &(c1.copy());
} }
else { else {
if(sbe->ubound() && sbe->ubound()->variant() == STAR_RANGE) {
if(st->variant()==DVM_PARALLEL_ON_DIR )
Error("Assumed-size array in parallel loop: %s",ar->identifier(), 162,st);
else if( st->variant()==ACC_REGION_DIR)
Error("Assumed-size array in region: %s",ar->identifier(), 162,st);
else
Error("Assumed-size array: %s",ar->identifier(), 162,st);
}
u_bound = UBOUNDFunction(ar,i+1); u_bound = UBOUNDFunction(ar,i+1);
l_bound = LBOUNDFunction(ar,i+1); l_bound = LBOUNDFunction(ar,i+1);
} }
@@ -6274,6 +6282,14 @@ SgExpression *doShapeList(SgSymbol *ar, SgStatement *st) /* RTS2 */
l_bound = &(c1.copy()); l_bound = &(c1.copy());
} }
else { else {
if(pe->variant() == STAR_RANGE) {
if(st->variant()==DVM_PARALLEL_ON_DIR )
Error("Assumed-size array in parallel loop: %s",ar->identifier(), 162,st);
else if( st->variant()==ACC_REGION_DIR)
Error("Assumed-size array in region: %s",ar->identifier(), 162,st);
else
Error("Assumed-size array: %s",ar->identifier(), 162,st);
}
u_bound = UBOUNDFunction(ar,i+1); u_bound = UBOUNDFunction(ar,i+1);
l_bound = LBOUNDFunction(ar,i+1); l_bound = LBOUNDFunction(ar,i+1);
} }

View File

@@ -1390,7 +1390,7 @@ void RefInImplicitLoop(SgExpression *eim, int mode);
void RefInImplicitLoop(SgExpression *eim, int mode); void RefInImplicitLoop(SgExpression *eim, int mode);
SgSymbol *dvm000SymbolForHost(int host_dvm, SgStatement *hedr); SgSymbol *dvm000SymbolForHost(int host_dvm, SgStatement *hedr);
SgExpression *Red_grid_index(SgSymbol *sind); SgExpression *Red_grid_index(SgSymbol *sind);
SgExpression *BlockDimsProduct(); SgExpression *BlockDimsProduct();
SgExpression *LowerShiftForArrays (SgSymbol *ar, int i, int type); SgExpression *LowerShiftForArrays (SgSymbol *ar, int i, int type);
SgExpression *UpperShiftForArrays (SgSymbol *ar, int i); SgExpression *UpperShiftForArrays (SgSymbol *ar, int i);
SgExpression *coefProd(int i, SgExpression *ec); SgExpression *coefProd(int i, SgExpression *ec);

View File

@@ -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);

View File

@@ -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)
{ {

View File

@@ -598,7 +598,6 @@ void fillInfoFromDirectives(const LoopGraph *loopInfo, ParallelDirective *direct
void removeOmpDir(void* stIn) void removeOmpDir(void* stIn)
{ {
SgStatement* st = (SgStatement*)stIn; SgStatement* st = (SgStatement*)stIn;
vector<OmpDir> resultAll;
char* lineS = st->comments(); char* lineS = st->comments();
if (!lineS) if (!lineS)
@@ -647,7 +646,7 @@ vector<OmpDir> parseOmpDirs(void* stIn, const set<string> &globalPriv, bool forD
char* lineS = st->comments(); char* lineS = st->comments();
if (!lineS) if (!lineS)
return resultAll; return resultAll;
vector<string> split; vector<string> split;
splitString(lineS, '\n', split); splitString(lineS, '\n', split);

View File

@@ -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;

View File

@@ -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);
} }
} }
} }

View File

@@ -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);

View File

@@ -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);
} }
} }
} }
@@ -1336,7 +1344,7 @@ static bool matchCallAndDefinition(const FuncParam &funcParDef, const FuncParam&
messages[file].push_back(Messages(NOTE, line, bufR, bufE, 1013)); messages[file].push_back(Messages(NOTE, line, bufR, bufE, 1013));
__spf_print(1, "Function '%s': different type of call and def parameter %d\n", funcName.c_str(), i + 1); __spf_print(1, "Function '%s': different type of call and def parameter %d\n", funcName.c_str(), i + 1);
} }
result = false; //result = false;
} }
} }
else //TODO else //TODO
@@ -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);
} }
} }
} }

View File

@@ -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;
} }

View File

@@ -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;

View File

@@ -211,6 +211,40 @@ static inline SgSymbol* createSymbAndDecl(const string& funcName, const string&
return newS; return newS;
} }
static SgStatement* findDuplicateInHidden(SgStatement* data)
{
SgStatement* clone = NULL;
auto itF = hiddenData.find(current_file->filename());
if (itF == hiddenData.end())
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
for (auto& func : itF->second)
{
if (func->fileName() != string(data->fileName()))
continue;
SgStatement* st = func->lexNext();
SgStatement* last = func->lastNodeOfStmt();
while (st != last)
{
if (data->lineNumber() == st->lineNumber() && data->variant() == st->variant())
{
clone = st;
break;
}
st = st->lexNext();
}
if (clone)
break;
}
checkNull(clone, convertFileName(__FILE__).c_str(), __LINE__);
return clone;
}
static SgValueExp* oneExpr = NULL; static SgValueExp* oneExpr = NULL;
static SgValueExp* zeroExpr = NULL; static SgValueExp* zeroExpr = NULL;
@@ -237,11 +271,14 @@ static vector<SgExpression*> getLowBounds(SgSymbol* arrayS)
int consistInAllocates = 0; int consistInAllocates = 0;
const string origName = OriginalSymbol(copyFrom)->identifier(); const string origName = OriginalSymbol(copyFrom)->identifier();
for (auto& data : getAttributes<SgStatement*, SgStatement*>(decl, set<int>{ ALLOCATE_STMT })) for (auto data : getAttributes<SgStatement*, SgStatement*>(decl, set<int>{ ALLOCATE_STMT }))
{ {
if (data->variant() != ALLOCATE_STMT) if (data->variant() != ALLOCATE_STMT)
continue; continue;
if (data->getFileId() != current_file_id)
data = findDuplicateInHidden(data);
SgExpression* iter = data->expr(0); SgExpression* iter = data->expr(0);
while (iter) while (iter)
@@ -1613,8 +1650,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 +1757,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;
} }

View File

@@ -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]);
} }
} }
} }
@@ -2609,17 +2609,11 @@ static bool findOmpThreadPrivDecl(SgStatement* st, map<SgStatement*, set<string>
{ {
st = st->lexNext(); st = st->lexNext();
if (st->variant() == CONTAINS_STMT)
break;
if (isSgExecutableStatement(st))
break;
auto res = parseOmpDirs(st, dummy); auto res = parseOmpDirs(st, dummy);
for (auto& dir : res) for (auto& dir : res)
for (auto& var : dir.threadPrivVars) for (auto& var : dir.threadPrivVars)
it->second.insert(var); it->second.insert(var);
} while (st != lastN); } while (st != lastN && !isSgExecutableStatement(st) && st->variant() != CONTAINS_STMT);
} }
if (it->second.find(toFind->identifier()) != it->second.end()) if (it->second.find(toFind->identifier()) != it->second.end())
@@ -2833,7 +2827,9 @@ static void findArrayRefs(SgExpression *ex, SgStatement *st, string fName, int p
const auto oldVal = itNew->second.first->GetDistributeFlagVal(); const auto oldVal = itNew->second.first->GetDistributeFlagVal();
if (oldVal == DIST::DISTR || oldVal == DIST::NO_DISTR) if (oldVal == DIST::DISTR || oldVal == DIST::NO_DISTR)
{ {
if (privates.find(symb->identifier()) != privates.end() || itNew->second.first->IsOmpThreadPrivate()) if (itNew->second.first->IsOmpThreadPrivate())
itNew->second.first->SetDistributeFlag(DIST::SPF_PRIV);
else if (privates.find(symb->identifier()) != privates.end())
{ {
//check in module //check in module
if (itNew->second.first->GetLocation().first == DIST::l_MODULE) if (itNew->second.first->GetLocation().first == DIST::l_MODULE)

View File

@@ -348,10 +348,12 @@ void fillRegionFunctions(vector<ParallelRegion*> &regions, 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())

View File

@@ -1145,6 +1145,11 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
groupActualAndRemote(file, true); groupActualAndRemote(file, true);
else if (curr_regime == RENAME_SYMBOLS) else if (curr_regime == RENAME_SYMBOLS)
runRenameSymbolsByFiles(file, &project); runRenameSymbolsByFiles(file, &project);
else if (curr_regime == REMOVE_OMP_DIRS)
{
for (SgStatement* st = file->firstStatement(); st; st = st->lexNext())
removeOmpDir(st);
}
else if (curr_regime == TEST_PASS) else if (curr_regime == TEST_PASS)
{ {
//test pass //test pass
@@ -2096,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));
@@ -2129,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)
{ {

View File

@@ -167,6 +167,7 @@ enum passes {
PRIVATE_ANALYSIS_IR, PRIVATE_ANALYSIS_IR,
FIX_COMMON_BLOCKS, FIX_COMMON_BLOCKS,
REMOVE_OMP_DIRS,
TEST_PASS, TEST_PASS,
EMPTY_PASS EMPTY_PASS
@@ -339,6 +340,7 @@ static void setPassValues()
passNames[PRIVATE_ANALYSIS_IR] = "PRIVATE_ANALYSIS_IR"; passNames[PRIVATE_ANALYSIS_IR] = "PRIVATE_ANALYSIS_IR";
passNames[FIX_COMMON_BLOCKS] = "FIX_COMMON_BLOCKS"; passNames[FIX_COMMON_BLOCKS] = "FIX_COMMON_BLOCKS";
passNames[REMOVE_OMP_DIRS] = "REMOVE_OMP_DIRS";
passNames[TEST_PASS] = "TEST_PASS"; passNames[TEST_PASS] = "TEST_PASS";
} }

View File

@@ -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)

View File

@@ -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;

View File

@@ -885,18 +885,21 @@ static void checkImplicitDirectUsage(Context* ctx, SgExpression* exp, int stmtLi
{ {
SgFunctionCallExp* funcCallExp = (SgFunctionCallExp*)exp; SgFunctionCallExp* funcCallExp = (SgFunctionCallExp*)exp;
string funcName = funcCallExp->funName()->identifier(); string funcName = funcCallExp->funName()->identifier();
auto funcInfo = findFunc(ctx->loopStmt->fileName(), funcName, ctx->allFuncInfo); FuncInfo* funcInfo = findFunc(ctx->loopStmt->fileName(), funcName, ctx->allFuncInfo);
for (int i = 0; i < funcCallExp->numberOfArgs(); ++i) if (funcInfo != nullptr)
{ {
SgExpression* funcArg = funcCallExp->arg(i); for (int i = 0; i < funcCallExp->numberOfArgs(); ++i)
if (funcInfo->funcParams.isArgOut(i)
&& funcArg->symbol() != nullptr
&& isEqSymbols(funcArg->symbol(), ctx->arraySymbol))
{ {
auto fixedVec = getFixedSubscriptsVector((SgArrayRefExp*)funcArg, ctx->dimensionsNum); SgExpression* funcArg = funcCallExp->arg(i);
fixedSubscripts.push_back(fixedVec); if (funcInfo->funcParams.isArgOut(i)
addMessageUsageInFunctionCall(ctx->messages, getDimensionVarName(ctx->arraySymbol, fixedVec), && funcArg->symbol() != nullptr
funcName, ctx->loop->lineNum, stmtLineNum); && isEqSymbols(funcArg->symbol(), ctx->arraySymbol))
{
auto fixedVec = getFixedSubscriptsVector((SgArrayRefExp*)funcArg, ctx->dimensionsNum);
fixedSubscripts.push_back(fixedVec);
addMessageUsageInFunctionCall(ctx->messages, getDimensionVarName(ctx->arraySymbol, fixedVec),
funcName, ctx->loop->lineNum, stmtLineNum);
}
} }
} }
} }
@@ -937,7 +940,7 @@ static vector<vector<FixedSubscript>> checkImplicitDirectUsage(Context* ctx)
if (funcInfo->funcParams.isArgOut(i) || // implicit direct usage if (funcInfo->funcParams.isArgOut(i) || // implicit direct usage
callArg->lhs() == nullptr) // reference to whole array callArg->lhs() == nullptr) // reference to whole array
{ {
auto& mask = getFixedSubscriptsVector((SgArrayRefExp*)callArg, ctx->dimensionsNum); auto mask = getFixedSubscriptsVector((SgArrayRefExp*)callArg, ctx->dimensionsNum);
fixedSubscripts.push_back(mask); fixedSubscripts.push_back(mask);
addMessageUsageInFunctionCall(ctx->messages, getDimensionVarName(ctx->arraySymbol, mask), addMessageUsageInFunctionCall(ctx->messages, getDimensionVarName(ctx->arraySymbol, mask),
procName, ctx->loop->lineNum, st->lineNumber()); procName, ctx->loop->lineNum, st->lineNumber());
@@ -994,7 +997,7 @@ static void checkIndirectUsage(Context* ctx, FuncInfo* curFunc, vector<Variable*
vector<SgArrayRefExp*> directArrayRefs = getDirectArrayRefs(varUse.getFunction(), varUse.getUseS()); vector<SgArrayRefExp*> directArrayRefs = getDirectArrayRefs(varUse.getFunction(), varUse.getUseS());
for (auto arrayRef : directArrayRefs) for (auto arrayRef : directArrayRefs)
{ {
auto& mask = getFixedSubscriptsVector(arrayRef, ctx->dimensionsNum); auto mask = getFixedSubscriptsVector(arrayRef, ctx->dimensionsNum);
indirectUsageMasks.push_back(mask); indirectUsageMasks.push_back(mask);
addMessageUsageInFunctionCall(ctx->messages, getDimensionVarName(ctx->arraySymbol, mask), addMessageUsageInFunctionCall(ctx->messages, getDimensionVarName(ctx->arraySymbol, mask),
curFunc->funcName, ctx->loop->lineNum, ctx->loop->lineNum); curFunc->funcName, ctx->loop->lineNum, ctx->loop->lineNum);
@@ -1231,32 +1234,40 @@ static vector<DefUseStmtsPair> buildDefUsePairs(Context* ctx, const CFG_Type& CF
{ {
vector<DefUseStmtsPair> defUsePairs; vector<DefUseStmtsPair> defUsePairs;
for (const InsertedStatement& stmt : insertedStmts) for (const InsertedStatement& useInsertedStmt : insertedStmts)
{ {
if (stmt.type != TypeOfInsertedStmt::USE) if (useInsertedStmt.type != TypeOfInsertedStmt::USE) // analysis for USE stmt
continue; continue;
int relLineNum = stmt.relatedToStmt->lineNumber(); int useLineNum = useInsertedStmt.relatedToStmt->lineNumber();
// looking for reaching definitions for the current block: // looking for reaching definitions for the current block:
auto useInsAndBlock = getInstructionAndBlockByStatement(CFGraph, stmt.insertedStmt); auto useInsAndBlock = getInstructionAndBlockByStatement(CFGraph, useInsertedStmt.insertedStmt);
auto useArg = useInsAndBlock.first->getArg1(); auto useArg = useInsAndBlock.first->getArg1();
const auto& RD_In = useInsAndBlock.second->getRD_In(); const auto& RD_In = useInsAndBlock.second->getRD_In();
const auto& RD_forUseArg = RD_In.find(useArg); const auto& RD_forUseArg = RD_In.find(useArg);
if (RD_forUseArg == RD_In.end()) // cannot find reaching definitions for argument if (RD_forUseArg == RD_In.end()) // cannot find reaching definitions for argument
{ {
addMessageCannotFindRD(ctx->messages, ctx->arraySymbol->identifier(), relLineNum); addMessageCannotFindRD(ctx->messages, ctx->arraySymbol->identifier(), useLineNum);
continue; continue;
} }
set<int> RD_defArgs = RD_forUseArg->second; // make copy set<int> RD_defArgs = RD_forUseArg->second; // make copy
// delete recursive definition from RD def args:
for (int defArgNum : RD_defArgs) for (int defArgNum : RD_defArgs)
{ {
if (defArgNum == SAPFOR::CFG_VAL::UNINIT)
continue;
auto defInsAndBlock = getInstructionAndBlockByNumber(CFGraph, defArgNum); auto defInsAndBlock = getInstructionAndBlockByNumber(CFGraph, defArgNum);
if (defInsAndBlock.first == nullptr)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
SgStatement* defStmt = defInsAndBlock.first->getOperator(); SgStatement* defStmt = defInsAndBlock.first->getOperator();
auto defInsertedStmt = findInsertedStmt(insertedStmts, defStmt); auto defInsertedStmt = findInsertedStmt(insertedStmts, defStmt);
if (stmt.relatedToStmt == defInsertedStmt->relatedToStmt) // recursive definition if (useInsertedStmt.relatedToStmt == defInsertedStmt->relatedToStmt)
{ {
RD_defArgs.erase(defArgNum); RD_defArgs.erase(defArgNum);
break; break;
@@ -1265,13 +1276,40 @@ static vector<DefUseStmtsPair> buildDefUsePairs(Context* ctx, const CFG_Type& CF
if (RD_defArgs.size() == 0) // argument is not initialized if (RD_defArgs.size() == 0) // argument is not initialized
{ {
addMessageCannotFindRD(ctx->messages, ctx->arraySymbol->identifier(), relLineNum); addMessageCannotFindRD(ctx->messages, ctx->arraySymbol->identifier(), useLineNum);
continue; continue;
} }
if (RD_defArgs.find(SAPFOR::CFG_VAL::UNINIT) != RD_defArgs.end()) // argument is not initialized
{
bool uninitArgIsOk = false;
if (RD_defArgs.size() == 2)
{
RD_defArgs.erase(SAPFOR::CFG_VAL::UNINIT);
int defArgNum = *RD_defArgs.begin();
auto defInsAndBlock = getInstructionAndBlockByNumber(CFGraph, defArgNum);
if (defInsAndBlock.first == nullptr)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
auto defInsertedStmt = findInsertedStmt(insertedStmts, defInsAndBlock.first->getOperator());
if (defInsertedStmt->relatedToStmt->lineNumber() < useLineNum &&
useInsAndBlock.second->getNumber() == defInsAndBlock.second->getNumber())
{
uninitArgIsOk = true; // argument isn't really uninitialized
}
}
if (!uninitArgIsOk)
{
addMessageCannotFindRD(ctx->messages, ctx->arraySymbol->identifier(), useLineNum);
continue;
}
}
if (RD_defArgs.size() > 1) // more than one reaching definition if (RD_defArgs.size() > 1) // more than one reaching definition
{ {
addMessageMoreThanOneRD(ctx->messages, ctx->arraySymbol->identifier(), relLineNum); addMessageMoreThanOneRD(ctx->messages, ctx->arraySymbol->identifier(), useLineNum);
continue; continue;
} }
@@ -1282,19 +1320,19 @@ static vector<DefUseStmtsPair> buildDefUsePairs(Context* ctx, const CFG_Type& CF
auto defInsertedStmt = findInsertedStmt(insertedStmts, defStmt); auto defInsertedStmt = findInsertedStmt(insertedStmts, defStmt);
if (defInsertedStmt == insertedStmts.end()) if (defInsertedStmt == insertedStmts.end())
{ {
addMessageCannotFindRD(ctx->messages, ctx->arraySymbol->identifier(), relLineNum); addMessageCannotFindRD(ctx->messages, ctx->arraySymbol->identifier(), useLineNum);
continue; continue;
} }
//don't substitute def stmt into use, if def is recursive //don't substitute def stmt into use, if def is recursive
if (defInsertedStmt->isRecursive) if (defInsertedStmt->isRecursive)
{ {
addMessageRecursiveDependency(ctx->messages, ctx->arraySymbol->identifier(), relLineNum); addMessageRecursiveDependency(ctx->messages, ctx->arraySymbol->identifier(), useLineNum);
continue; continue;
} }
SgAssignStmt* def = (SgAssignStmt*)defInsertedStmt->relatedToStmt; SgAssignStmt* def = (SgAssignStmt*)defInsertedStmt->relatedToStmt;
SgAssignStmt* use = (SgAssignStmt*)stmt.relatedToStmt; SgAssignStmt* use = (SgAssignStmt*)useInsertedStmt.relatedToStmt;
defUsePairs.push_back(make_pair(def, use)); defUsePairs.push_back(make_pair(def, use));
} }
@@ -1674,7 +1712,7 @@ void removePrivatesAnalysis(vector<LoopGraph*>& loopGraphs,
context.dimensionsNum = getDimension(arrayToRemove); context.dimensionsNum = getDimension(arrayToRemove);
context.arraySymbol = arrayToRemove; context.arraySymbol = arrayToRemove;
auto& filterMasks = checkImplicitAndIndirectUsage(&context); auto filterMasks = checkImplicitAndIndirectUsage(&context);
filterArrayRefs(&context, arrayRefs, filterMasks); filterArrayRefs(&context, arrayRefs, filterMasks);
context.explicitArrayRefs.swap(arrayRefs); context.explicitArrayRefs.swap(arrayRefs);

View File

@@ -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__);

View File

@@ -232,7 +232,7 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
list({ GET_ALL_ARRAY_DECL, CALL_GRAPH2, CODE_CHECKER_PASSES, SUBST_EXPR_RD, ARRAY_ACCESS_ANALYSIS_FOR_CORNER }) <= list({ LOOP_ANALYZER_NODIST, LOOP_ANALYZER_DATA_DIST_S0, LOOP_ANALYZER_DATA_DIST_S1, ONLY_ARRAY_GRAPH }); list({ GET_ALL_ARRAY_DECL, CALL_GRAPH2, CODE_CHECKER_PASSES, SUBST_EXPR_RD, ARRAY_ACCESS_ANALYSIS_FOR_CORNER }) <= list({ LOOP_ANALYZER_NODIST, LOOP_ANALYZER_DATA_DIST_S0, LOOP_ANALYZER_DATA_DIST_S1, ONLY_ARRAY_GRAPH });
Pass(LOOP_ANALYZER_NODIST) <= Pass(INSERT_PARALLEL_DIRS_NODIST); list({ LOOP_ANALYZER_NODIST, REMOVE_OMP_DIRS }) <= Pass(INSERT_PARALLEL_DIRS_NODIST);
Pass(CHECK_ARGS_DECL) <= Pass(CREATE_TEMPLATE_LINKS); Pass(CHECK_ARGS_DECL) <= Pass(CREATE_TEMPLATE_LINKS);
@@ -262,7 +262,7 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
list({ PREPROC_SPF, CORRECT_VAR_DECL }) <= Pass(FILL_PAR_REGIONS_LINES); list({ PREPROC_SPF, CORRECT_VAR_DECL }) <= Pass(FILL_PAR_REGIONS_LINES);
Pass(LOOP_ANALYZER_COMP_DIST) <= list({ CREATE_DISTR_DIRS, CREATE_PARALLEL_DIRS, INSERT_PARALLEL_DIRS }); list({ LOOP_ANALYZER_COMP_DIST, REMOVE_OMP_DIRS }) <= list({ CREATE_DISTR_DIRS, CREATE_PARALLEL_DIRS, INSERT_PARALLEL_DIRS });
Pass(CALL_GRAPH2) <= list({ ONLY_ARRAY_GRAPH, CREATE_NESTED_LOOPS, FIND_FUNC_TO_INCLUDE, CHECK_FUNC_TO_INCLUDE, FIND_PARAMETERS }); Pass(CALL_GRAPH2) <= list({ ONLY_ARRAY_GRAPH, CREATE_NESTED_LOOPS, FIND_FUNC_TO_INCLUDE, CHECK_FUNC_TO_INCLUDE, FIND_PARAMETERS });

View File

@@ -402,7 +402,6 @@ string removeIncludeStatsAndUnparse(SgFile *file, const char *fileName, const ch
for (SgStatement *st = file->firstStatement(); st; st = st->lexNext()) for (SgStatement *st = file->firstStatement(); st; st = st->lexNext())
{ {
removeOmpDir(st);
if (st->lineNumber() <= 0 || st->variant() < 0) if (st->lineNumber() <= 0 || st->variant() < 0)
continue; continue;
string currFileName = st->fileName(); string currFileName = st->fileName();
@@ -1154,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;
} }
@@ -4218,7 +4218,7 @@ SgProject* createProject(const char* proj_name,
for (int z = 0; z < project->numberOfFiles(); ++z) for (int z = 0; z < project->numberOfFiles(); ++z)
removeExecutableFromModuleDeclaration(&(project->file(z)), filesInProj); removeExecutableFromModuleDeclaration(&(project->file(z)), filesInProj, hiddenData[project->file(z).filename()]);
for (int z = 0; z < project->numberOfFiles(); ++z) for (int z = 0; z < project->numberOfFiles(); ++z)
{ {

View File

@@ -532,7 +532,7 @@ static const wchar_t *R197 = L"R197:";
//2024 //2024
static const wchar_t *R198 = L"R198:%d"; static const wchar_t *R198 = L"R198:%d";
//2025 //2025
static const wchar_t *R203 = L"R203:%s%s"; static const wchar_t *R203 = L"R203:%s#%s";
//3001 //3001
static const wchar_t *R108 = L"R108:%s"; static const wchar_t *R108 = L"R108:%s";

View File

@@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION_SPF "2228" #define VERSION_SPF "2234"

View File

@@ -1153,7 +1153,7 @@ void replaceStructuresToSimpleTypes(SgFile *file)
} }
} }
void removeExecutableFromModuleDeclaration(SgFile *current, const set<string> &filesInProj) void removeExecutableFromModuleDeclaration(SgFile *current, const set<string> &filesInProj, vector<SgStatement*>& hiddenData)
{ {
const string currF = current->filename(); const string currF = current->filename();
set<string> moduleInFile; set<string> moduleInFile;
@@ -1164,14 +1164,14 @@ void removeExecutableFromModuleDeclaration(SgFile *current, const set<string> &f
moduleInFile.insert(st->fileName()); moduleInFile.insert(st->fileName());
} }
vector<SgStatement*> toDel; vector<SgStatement*> toMove;
for (SgStatement* st = current->firstStatement(); st; st = st->lexNext()) for (SgStatement* st = current->firstStatement(); st; st = st->lexNext())
{ {
if (isSgProgHedrStmt(st)) if (isSgProgHedrStmt(st))
if (moduleInFile.find(st->fileName()) != moduleInFile.end()) if (moduleInFile.find(st->fileName()) != moduleInFile.end())
toDel.push_back(st); toMove.push_back(st);
} }
for (auto& elem : toDel) for (auto& elem : toMove)
elem->deleteStmt(); hiddenData.push_back(elem->extractStmt());
} }

View File

@@ -49,7 +49,7 @@ void replaceDerivedAssigns(SgFile *file, SgStatement *stToCopy, SgStatement *ins
bool isDerivedAssign(SgStatement *st); bool isDerivedAssign(SgStatement *st);
std::map<std::string, SgStatement*> createDerivedTypeDeclMap(SgStatement *forS); std::map<std::string, SgStatement*> createDerivedTypeDeclMap(SgStatement *forS);
void fillUseStatement(SgStatement* st, std::set<std::string>& useMod, std::map<std::string, std::vector<std::pair<SgSymbol*, SgSymbol*>>>& modByUse, std::map<std::string, std::vector<std::pair<SgSymbol*, SgSymbol*>>>& modByUseOnly); void fillUseStatement(SgStatement* st, std::set<std::string>& useMod, std::map<std::string, std::vector<std::pair<SgSymbol*, SgSymbol*>>>& modByUse, std::map<std::string, std::vector<std::pair<SgSymbol*, SgSymbol*>>>& modByUseOnly);
void removeExecutableFromModuleDeclaration(SgFile* current, const std::set<std::string>& filesInProj); void removeExecutableFromModuleDeclaration(SgFile* current, const std::set<std::string>& filesInProj, std::vector<SgStatement*>& hiddenData);
bool needToReplaceInterfaceName(SgStatement* interf); bool needToReplaceInterfaceName(SgStatement* interf);
std::string getOrigName(const std::string& file, const std::string& s); std::string getOrigName(const std::string& file, const std::string& s);

View File

@@ -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)