fixed module symbol analysis
This commit is contained in:
@@ -167,11 +167,11 @@ void DvmhRegionInserter::updateParallelFunctions(const map<string, vector<LoopGr
|
||||
}
|
||||
|
||||
static void findByUse(map<string, vector<pair<SgSymbol*, SgSymbol*>>> &modByUse, const string& varName,
|
||||
const string& locName, vector<string> &altNames)
|
||||
const set<string>& locNames, vector<string> &altNames)
|
||||
{
|
||||
for (auto& elem : modByUse)
|
||||
{
|
||||
if (elem.first == locName)
|
||||
if (locNames.count(elem.first))
|
||||
{
|
||||
for (auto& byUse : elem.second)
|
||||
{
|
||||
@@ -217,6 +217,8 @@ static string getNameByUse(SgStatement *place, const string &varName, const stri
|
||||
return varName;
|
||||
else
|
||||
{
|
||||
map<string, set<string>> graphUse;
|
||||
|
||||
set<string> useMod;
|
||||
map<string, vector<pair<SgSymbol*, SgSymbol*>>> modByUse;
|
||||
map<string, vector<pair<SgSymbol*, SgSymbol*>>> modByUseOnly;
|
||||
@@ -241,12 +243,22 @@ static string getNameByUse(SgStatement *place, const string &varName, const stri
|
||||
if (useModDone.find(useM) == useModDone.end())
|
||||
{
|
||||
auto modSt = findModWithName(modules, useM);
|
||||
if (modSt == NULL && useM == "dvmh_template_mod")
|
||||
if (modSt == NULL || useM == "dvmh_template_mod")
|
||||
continue;
|
||||
|
||||
checkNull(modSt, convertFileName(__FILE__).c_str(), __LINE__);
|
||||
fillInfo(modSt, newUseMod, modByUse, modByUseOnly);
|
||||
|
||||
set<string> tmpUse;
|
||||
fillInfo(modSt, tmpUse, modByUse, modByUseOnly);
|
||||
useModDone.insert(useM);
|
||||
|
||||
for (auto& use : tmpUse)
|
||||
{
|
||||
newUseMod.insert(use);
|
||||
|
||||
if (use != "dvmh_template_mod")
|
||||
graphUse[use].insert(useM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,8 +273,35 @@ static string getNameByUse(SgStatement *place, const string &varName, const stri
|
||||
}
|
||||
|
||||
vector<string> altNames;
|
||||
findByUse(modByUse, varName, locName, altNames);
|
||||
findByUse(modByUseOnly, varName, locName, altNames);
|
||||
findByUse(modByUse, varName, { locName }, altNames);
|
||||
findByUse(modByUseOnly, varName, { locName }, altNames);
|
||||
|
||||
if (altNames.size() == 0)
|
||||
{
|
||||
set<string> locations = { locName };
|
||||
bool changed = true;
|
||||
while (changed)
|
||||
{
|
||||
changed = false;
|
||||
for (auto& loc : locations)
|
||||
{
|
||||
if (graphUse.find(loc) != graphUse.end())
|
||||
{
|
||||
for (auto& use : graphUse[loc])
|
||||
{
|
||||
if (locations.find(use) == locations.end())
|
||||
{
|
||||
locations.insert(use);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
findByUse(modByUse, varName, locations, altNames);
|
||||
findByUse(modByUseOnly, varName, locations, altNames);
|
||||
}
|
||||
|
||||
if (altNames.size() == 0)
|
||||
return varName;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2387"
|
||||
#define VERSION_SPF "2388"
|
||||
|
||||
Reference in New Issue
Block a user