added inductive variables and loop type to LoopGraph
This commit is contained in:
@@ -20,7 +20,7 @@ using std::wstring;
|
||||
|
||||
static SgSymbol* getLoopSymbol(const LoopGraph* loop)
|
||||
{
|
||||
if (!loop || !loop->isFor)
|
||||
if (!loop || !loop->isFor())
|
||||
return NULL;
|
||||
|
||||
SgForStmt* stmt = (SgForStmt*)loop->loop->GetOriginal();
|
||||
@@ -667,12 +667,12 @@ static void renameIterationVariables(LoopGraph* loop, const map<SgSymbol*, SgSym
|
||||
{
|
||||
if (loop)
|
||||
{
|
||||
string& loopName = loop->loopSymbol;
|
||||
for (auto& pair : symbols)
|
||||
string& loopName = loop->loopSymbol();
|
||||
for (auto& [from, to] : symbols)
|
||||
{
|
||||
if (pair.first->identifier() == loopName)
|
||||
if (from->identifier() == loopName)
|
||||
{
|
||||
loop->loopSymbol = (string)pair.second->identifier();
|
||||
loop->loopSymbols.replaceMainVar(to->identifier());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -691,9 +691,9 @@ static void renameVariablesInLoop(LoopGraph* loop, const map<SgSymbol*, SgSymbol
|
||||
if (st->variant() == FOR_NODE)
|
||||
{
|
||||
SgForStmt* for_st = (SgForStmt*)st;
|
||||
for (auto& pair : symbols)
|
||||
if (isEqSymbols(pair.first, for_st->symbol()))
|
||||
for_st->setDoName(*pair.second);
|
||||
for (auto& [from, to] : symbols)
|
||||
if (isEqSymbols(from, for_st->symbol()))
|
||||
for_st->setDoName(*to);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
@@ -710,12 +710,12 @@ static void renamePrivatesInMap(LoopGraph* loop, const map<SgSymbol*, SgSymbol*>
|
||||
for (auto& priv : privates->second)
|
||||
{
|
||||
bool found = false;
|
||||
for (auto& pair : symbols)
|
||||
for (auto& [from, to] : symbols)
|
||||
{
|
||||
if (isEqSymbols(priv, pair.first))
|
||||
if (isEqSymbols(priv, from))
|
||||
{
|
||||
found = true;
|
||||
newList.insert(pair.second);
|
||||
newList.insert(to);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1590,7 +1590,7 @@ static bool combine(LoopGraph* firstLoop, const vector<LoopGraph*>& nextLoops, s
|
||||
bool wasCombine = false;
|
||||
for (LoopGraph* loop : nextLoops)
|
||||
{
|
||||
if (!loop->isFor)
|
||||
if (!loop->isFor())
|
||||
return wasCombine;
|
||||
|
||||
int perfectLoop = std::min(firstLoop->perfectLoop, loop->perfectLoop);
|
||||
@@ -1723,7 +1723,7 @@ static bool tryToCombine(vector<LoopGraph*>& loopGraphs, map<LoopGraph*, set<SgS
|
||||
{
|
||||
LoopGraph* loop = loops[z];
|
||||
newloopGraphs.push_back(loop);
|
||||
if (!loop->isFor)
|
||||
if (!loop->isFor())
|
||||
continue;
|
||||
|
||||
vector<LoopGraph*> nextLoops = getNextLoops(loop, loopGraphs, -1);
|
||||
|
||||
@@ -1035,7 +1035,7 @@ int splitLoops(SgFile *file, vector<LoopGraph*> &loopGraphs, vector<Messages> &m
|
||||
|
||||
for (auto &loopPair : mapLoopGraph)
|
||||
{
|
||||
if (!loopPair.second->isFor)
|
||||
if (!loopPair.second->isFor())
|
||||
continue;
|
||||
|
||||
LoopGraph *loop = loopPair.second;
|
||||
|
||||
@@ -2257,7 +2257,7 @@ void removePrivatesAnalysis(string filename,
|
||||
{
|
||||
for (LoopGraph* loop : loopGraphs)
|
||||
{
|
||||
if (!loop->isFor)
|
||||
if (!loop->isFor())
|
||||
continue;
|
||||
|
||||
SgForStmt* loopStmt = (SgForStmt*)loop->loop->GetOriginal();
|
||||
|
||||
@@ -74,7 +74,7 @@ static void fillIterationVariables(const LoopGraph* loop, set<string>& vars, int
|
||||
{
|
||||
if (dimensions == -1)
|
||||
{
|
||||
vars.insert(loop->loopSymbol);
|
||||
vars.insert(loop->loopSymbol());
|
||||
for (LoopGraph* child : loop->children)
|
||||
fillIterationVariables(child, vars);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ static void fillIterationVariables(const LoopGraph* loop, set<string>& vars, int
|
||||
{
|
||||
for (int i = 0; i < dimensions; ++i)
|
||||
{
|
||||
vars.insert(loop->loopSymbol);
|
||||
vars.insert(loop->loopSymbol());
|
||||
if (i != dimensions - 1)
|
||||
loop = loop->children[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user