improved private arrays analysis
This commit is contained in:
@@ -311,7 +311,7 @@ static bool checkDimensionLength(const AccessingSet& array, const map<tuple<int,
|
||||
return false;
|
||||
}
|
||||
|
||||
static void addPrivateArraysToLoop(LoopGraph* loop, const arrayAccessingIndexes& privates, set<SgStatement*>& insertedPrivates,
|
||||
static int addPrivateArraysToLoop(LoopGraph* loop, const arrayAccessingIndexes& privates, set<SgStatement*>& insertedPrivates,
|
||||
map<string, vector<Messages>>& SPF_messages,
|
||||
const map<tuple<int, string, string>, pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays)
|
||||
{
|
||||
@@ -367,7 +367,7 @@ static void addPrivateArraysToLoop(LoopGraph* loop, const arrayAccessingIndexes&
|
||||
}
|
||||
}
|
||||
|
||||
void findPrivateArrays(map<string, vector<LoopGraph*>>& loopGraph, map<FuncInfo*,
|
||||
int findPrivateArrays(map<string, vector<LoopGraph*>>& loopGraph, map<FuncInfo*,
|
||||
vector<SAPFOR::BasicBlock*>>& FullIR,
|
||||
set<SgStatement*>& insertedPrivates,
|
||||
map<string, vector<Messages>>& SPF_messages,
|
||||
@@ -419,4 +419,26 @@ void findPrivateArrays(map<string, vector<LoopGraph*>>& loopGraph, map<FuncInfo*
|
||||
addPrivateArraysToLoop(loop, result[loop], insertedPrivates, SPF_messages, declaredArrays);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [loop, accesing] : result)
|
||||
{
|
||||
if (accesing.size())
|
||||
{
|
||||
__spf_print(1, "found for loop on line %d in file %s\n", loop->lineNum, loop->fileName.c_str());
|
||||
for (const auto& [name, accesingSet] : accesing)
|
||||
{
|
||||
const auto& byDimention = accesingSet.GetElements();
|
||||
__spf_print(1, " for array %s with dimention %d\n", name.c_str(), byDimention.size());
|
||||
|
||||
for (int z = 0; z < byDimention.size(); ++z)
|
||||
{
|
||||
__spf_print(1, " dim %d (start, step, tripCount):\n", z);
|
||||
for (auto& elem : byDimention[z])
|
||||
__spf_print(1, " [%ld %ld %ld]\n", elem.start, elem.step, elem.tripCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return insertedPrivates.size();
|
||||
}
|
||||
Reference in New Issue
Block a user