updated version, fixed code style
This commit is contained in:
@@ -20,6 +20,7 @@ static void RemoveEmptyPoints(ArrayAccessingIndexes& container)
|
||||
{
|
||||
ArrayAccessingIndexes resultContainer;
|
||||
unordered_set<string> toRemove;
|
||||
|
||||
for (auto& [arrayName, accessingSet] : container)
|
||||
{
|
||||
vector<vector<ArrayDimension>> points;
|
||||
@@ -28,6 +29,7 @@ static void RemoveEmptyPoints(ArrayAccessingIndexes& container)
|
||||
if (!arrayPoint.empty())
|
||||
points.push_back(arrayPoint);
|
||||
}
|
||||
|
||||
if (points.size() < accessingSet.GetElements().size() && !points.empty())
|
||||
resultContainer[arrayName] = points;
|
||||
|
||||
@@ -36,13 +38,10 @@ static void RemoveEmptyPoints(ArrayAccessingIndexes& container)
|
||||
}
|
||||
|
||||
for (const string& name : toRemove)
|
||||
{
|
||||
container.erase(name);
|
||||
}
|
||||
|
||||
for (auto& [arrayName, accessingSet] : resultContainer)
|
||||
{
|
||||
container[arrayName] = accessingSet;
|
||||
}
|
||||
}
|
||||
|
||||
static void Collapse(Region* region)
|
||||
@@ -67,6 +66,7 @@ static void Collapse(Region* region)
|
||||
region->array_use[arrayName] = region->array_use[arrayName].Union(diff);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayAccessingIndexes useUnion;
|
||||
for (auto& byBlock : region->getBasickBlocks())
|
||||
for (auto& [arrayName, arrayRanges] : byBlock->array_use)
|
||||
@@ -104,6 +104,7 @@ static void SolveDataFlowIteratively(Region* DFG)
|
||||
newIn.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const auto& [arrayName, accessSet] : prevBlock->array_out)
|
||||
{
|
||||
if (newIn.find(arrayName) != newIn.end())
|
||||
@@ -116,6 +117,7 @@ static void SolveDataFlowIteratively(Region* DFG)
|
||||
|
||||
b->array_in = move(newIn);
|
||||
ArrayAccessingIndexes newOut;
|
||||
|
||||
if (b->array_def.empty())
|
||||
newOut = b->array_in;
|
||||
else if (b->array_in.empty())
|
||||
@@ -151,22 +153,20 @@ static void SolveDataFlow(Region* DFG)
|
||||
Collapse(DFG);
|
||||
}
|
||||
|
||||
unsigned long long CalculateLength(const AccessingSet& array)
|
||||
/*unsigned long long CalculateLength(const AccessingSet& array)
|
||||
{
|
||||
if (array.GetElements().empty())
|
||||
return 0;
|
||||
|
||||
unsigned long long result = 1;
|
||||
for (const auto& range : array.GetElements())
|
||||
{
|
||||
for (const auto& dim : range)
|
||||
{
|
||||
result *= (dim.step * dim.tripCount);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void AddPrivateArraysToLoop(LoopGraph* loop, const ArrayAccessingIndexes& privates, set<SgStatement*>& insertedPrivates)
|
||||
return result;
|
||||
}*/
|
||||
|
||||
static void AddPrivateArraysToLoop(LoopGraph* loop, const ArrayAccessingIndexes& privates, set<SgStatement*>& insertedPrivates)
|
||||
{
|
||||
SgStatement* spfStat = new SgStatement(SPF_ANALYSIS_DIR);
|
||||
spfStat->setlineNumber(loop->loop->lineNumber());
|
||||
|
||||
Reference in New Issue
Block a user