fixed module analysis
This commit is contained in:
@@ -373,14 +373,14 @@ namespace Distribution
|
|||||||
vector<vector<vType>> vertByTrees;
|
vector<vector<vType>> vertByTrees;
|
||||||
set<vType> unqieTrees = G.FindTrees(trees, vertByTrees);
|
set<vType> unqieTrees = G.FindTrees(trees, vertByTrees);
|
||||||
|
|
||||||
__spf_print(needPrint, "GRAPH size: |V| = %d, |E| = %d\n", G.GetNumberOfV(), G.GetNumberOfE() / 2);
|
__spf_print(needPrint, " GRAPH size: |V| = %d, |E| = %d\n", G.GetNumberOfV(), G.GetNumberOfE() / 2);
|
||||||
__spf_print(needPrint, "TREES count %d\n", (int)unqieTrees.size());
|
__spf_print(needPrint, " TREES count %d\n", (int)unqieTrees.size());
|
||||||
vector<unsigned char> tmp;
|
vector<unsigned char> tmp;
|
||||||
for (int z = 0; z < vertByTrees.size(); ++z)
|
for (int z = 0; z < vertByTrees.size(); ++z)
|
||||||
if (vertByTrees[z].size())
|
if (vertByTrees[z].size())
|
||||||
__spf_print(needPrint, "TREES %d: V = %d, E = %d\n", z, (int)vertByTrees[z].size(), G.MakeConnected(vertByTrees[z][0], tmp).second);
|
__spf_print(needPrint, " TREES %d: V = %d, E = %d\n", z, (int)vertByTrees[z].size(), G.MakeConnected(vertByTrees[z][0], tmp).second);
|
||||||
else
|
else
|
||||||
__spf_print(needPrint, "TREES %d: V = %d, E = %d\n", z, 0, 0);
|
__spf_print(needPrint, " TREES %d: V = %d, E = %d\n", z, 0, 0);
|
||||||
|
|
||||||
toDelArcs = G.CreateMaximumSpanningTree();
|
toDelArcs = G.CreateMaximumSpanningTree();
|
||||||
return make_pair(allOnlySecondType, globalSum);
|
return make_pair(allOnlySecondType, globalSum);
|
||||||
@@ -401,7 +401,7 @@ namespace Distribution
|
|||||||
maxElem = std::max(maxElem, cycleShortInfo);
|
maxElem = std::max(maxElem, cycleShortInfo);
|
||||||
|
|
||||||
if (maxElem != 0 && needPrint)
|
if (maxElem != 0 && needPrint)
|
||||||
printf("SAPFOR: max elem for cache %lld, in MB: %f\n", maxElem, maxElem / 1024. / 1024. * sizeof(unsigned));
|
printf(" SAPFOR: max elem for cache %lld, in MB: %f\n", maxElem, maxElem / 1024. / 1024. * sizeof(unsigned));
|
||||||
|
|
||||||
unsigned *fastCache = new unsigned[maxElem];
|
unsigned *fastCache = new unsigned[maxElem];
|
||||||
memset(fastCache, 0, sizeof(unsigned) * maxElem);
|
memset(fastCache, 0, sizeof(unsigned) * maxElem);
|
||||||
@@ -409,7 +409,7 @@ namespace Distribution
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
if (needPrint)
|
if (needPrint)
|
||||||
{
|
{
|
||||||
sprintf(buf, "PROF: [%d TREE]:\n", k);
|
sprintf(buf, " PROF: [%d TREE]:\n", k);
|
||||||
addToGlobalBufferAndPrint(buf);
|
addToGlobalBufferAndPrint(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -296,12 +296,8 @@ static SgStatement* findModWithName(const vector<SgStatement*>& modules, const s
|
|||||||
static map<SgStatement*, set<SgSymbol*>> symbolsForFunc;
|
static map<SgStatement*, set<SgSymbol*>> symbolsForFunc;
|
||||||
static set<string> allFiles;
|
static set<string> allFiles;
|
||||||
|
|
||||||
static const set<SgSymbol*>& getModeulSymbols(SgStatement *func)
|
static void getModuleSymbols(SgStatement* func, set<SgSymbol*>& symbs)
|
||||||
{
|
{
|
||||||
if (symbolsForFunc.find(func) != symbolsForFunc.end())
|
|
||||||
return symbolsForFunc[func];
|
|
||||||
|
|
||||||
set<SgSymbol*> symbs;
|
|
||||||
SgSymbol* s = func->symbol()->next();
|
SgSymbol* s = func->symbol()->next();
|
||||||
while (s)
|
while (s)
|
||||||
{
|
{
|
||||||
@@ -309,6 +305,20 @@ static const set<SgSymbol*>& getModeulSymbols(SgStatement *func)
|
|||||||
symbs.insert(s);
|
symbs.insert(s);
|
||||||
s = s->next();
|
s = s->next();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const set<SgSymbol*>& getModuleSymbols(SgStatement *func)
|
||||||
|
{
|
||||||
|
if (symbolsForFunc.find(func) != symbolsForFunc.end())
|
||||||
|
return symbolsForFunc[func];
|
||||||
|
|
||||||
|
set<SgSymbol*> symbs;
|
||||||
|
getModuleSymbols(func, symbs);
|
||||||
|
|
||||||
|
//if function in contains
|
||||||
|
func = func->controlParent();
|
||||||
|
if (isSgProgHedrStmt(func))
|
||||||
|
getModuleSymbols(func, symbs);
|
||||||
|
|
||||||
symbolsForFunc[func] = symbs;
|
symbolsForFunc[func] = symbs;
|
||||||
return symbolsForFunc[func];
|
return symbolsForFunc[func];
|
||||||
@@ -317,17 +327,13 @@ static const set<SgSymbol*>& getModeulSymbols(SgStatement *func)
|
|||||||
SgSymbol* getNameInLocation(SgStatement* func, const string& varName, const string& locName)
|
SgSymbol* getNameInLocation(SgStatement* func, const string& varName, const string& locName)
|
||||||
{
|
{
|
||||||
map<string, SgSymbol*> altNames;
|
map<string, SgSymbol*> altNames;
|
||||||
for (const auto& s : getModeulSymbols(func))
|
for (const auto& s : getModuleSymbols(func))
|
||||||
{
|
{
|
||||||
SgSymbol* orig = OriginalSymbol(s);
|
SgSymbol* orig = OriginalSymbol(s);
|
||||||
|
//any suitable symbol can be used
|
||||||
if (orig->identifier() == varName && orig->scope()->symbol()->identifier() == locName)
|
if (orig->identifier() == varName && orig->scope()->symbol()->identifier() == locName)
|
||||||
{
|
|
||||||
if (altNames.count(s->identifier()))
|
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
|
||||||
|
|
||||||
altNames[s->identifier()] = s;
|
altNames[s->identifier()] = s;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (altNames.size() > 0)
|
if (altNames.size() > 0)
|
||||||
return altNames.begin()->second;
|
return altNames.begin()->second;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2393"
|
#define VERSION_SPF "2394"
|
||||||
|
|||||||
Reference in New Issue
Block a user