Compare commits
1 Commits
68808d0317
...
0d61856cef
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d61856cef |
@@ -321,17 +321,16 @@ static FuncInfo* getCurrectFunc(SgStatement* stmt, const map<string, vector<Func
|
||||
* Block of creating messages functions: *
|
||||
* ************************************* */
|
||||
|
||||
// unused:
|
||||
//static void addMessageRemoveLoop(vector<Messages>& messages, int loopLineNum)
|
||||
//{
|
||||
// __spf_print(1, "NOTE: loop on line %d was removed\n", loopLineNum);
|
||||
//
|
||||
// wstring messageE, messageR;
|
||||
// __spf_printToLongBuf(messageE, L"Loop on line %d was removed", loopLineNum);
|
||||
// __spf_printToLongBuf(messageR, R198, loopLineNum);
|
||||
//
|
||||
// messages.push_back(Messages(typeMessage::NOTE, loopLineNum, messageR, messageE, 2024));
|
||||
//}
|
||||
static void addMessageRemoveLoop(vector<Messages>& messages, int loopLineNum)
|
||||
{
|
||||
__spf_print(1, "NOTE: loop on line %d was removed\n", loopLineNum);
|
||||
|
||||
wstring messageE, messageR;
|
||||
__spf_printToLongBuf(messageE, L"Loop on line %d was removed", loopLineNum);
|
||||
__spf_printToLongBuf(messageR, R198, loopLineNum);
|
||||
|
||||
messages.push_back(Messages(typeMessage::NOTE, loopLineNum, messageR, messageE, 2024));
|
||||
}
|
||||
|
||||
static void addMessageRemovePrivateVar(vector<Messages>& messages, string varName, int loopLineNum)
|
||||
{
|
||||
@@ -698,31 +697,30 @@ static void removeExcessiveDefs(const PrivateToRemove& var)
|
||||
st->deleteStmt();
|
||||
}
|
||||
|
||||
// TODO: unused - can be removed?
|
||||
// removeEmptyLoops removes loops with empty body and create messages
|
||||
//static void removeEmptyLoops(LoopGraph* loop, vector<Messages>& messages)
|
||||
//{
|
||||
// vector<LoopGraph*> loopsToDelete;
|
||||
// vector<LoopGraph*> newChildrenVector;
|
||||
// for (auto childLoop : loop->children)
|
||||
// {
|
||||
// SgStatement* loopStmt = childLoop->loop->GetOriginal();
|
||||
// if (loopStmt->lastNodeOfStmt() == loopStmt->lexNext())
|
||||
// loopsToDelete.push_back(childLoop);
|
||||
// else
|
||||
// newChildrenVector.push_back(childLoop);
|
||||
// }
|
||||
//
|
||||
// for (auto loopToDelete : loopsToDelete)
|
||||
// {
|
||||
// addMessageRemoveLoop(messages, loopToDelete->lineNum);
|
||||
// loopToDelete->loop->extractStmt();
|
||||
// }
|
||||
//
|
||||
// loop->children.swap(newChildrenVector);
|
||||
// for (auto childLoop : loop->children)
|
||||
// removeEmptyLoops(childLoop, messages);
|
||||
//}
|
||||
static void removeEmptyLoops(LoopGraph* loop, vector<Messages>& messages)
|
||||
{
|
||||
vector<LoopGraph*> loopsToDelete;
|
||||
vector<LoopGraph*> newChildrenVector;
|
||||
for (auto childLoop : loop->children)
|
||||
{
|
||||
SgStatement* loopStmt = childLoop->loop->GetOriginal();
|
||||
if (loopStmt->lastNodeOfStmt() == loopStmt->lexNext())
|
||||
loopsToDelete.push_back(childLoop);
|
||||
else
|
||||
newChildrenVector.push_back(childLoop);
|
||||
}
|
||||
|
||||
for (auto loopToDelete : loopsToDelete)
|
||||
{
|
||||
addMessageRemoveLoop(messages, loopToDelete->lineNum);
|
||||
loopToDelete->loop->extractStmt();
|
||||
}
|
||||
|
||||
loop->children.swap(newChildrenVector);
|
||||
for (auto childLoop : loop->children)
|
||||
removeEmptyLoops(childLoop, messages);
|
||||
}
|
||||
|
||||
// removeVarFromPrivateAttributes removes var from SPF ANALYSIS PRIVATE attributes of loop
|
||||
static void removeVarFromPrivateAttributes(SgSymbol* var, LoopGraph* loop)
|
||||
@@ -846,14 +844,15 @@ void removePrivates(SgFile* file, vector<Messages>& messages,
|
||||
|
||||
//removeDeadCodeFromLoop(varToRemove.loop); // TODO: problem with reverting substitution
|
||||
removeExcessiveDefs(varToRemove);
|
||||
//removeEmptyLoops(varToRemove.loop, messages); // removing is made by REMOVE_DEAD_CODE pass
|
||||
removeEmptyLoops(varToRemove.loop, messages); // removing is made by REMOVE_DEAD_CODE pass
|
||||
|
||||
SgForStmt* loopStmt = (SgForStmt*)varToRemove.loop->loop->GetOriginal();
|
||||
FuncInfo* currFunc = getCurrectFunc(loopStmt, allFuncInfo);
|
||||
if (currFunc == nullptr)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
removeDeadCode(currFunc->funcPointer, allFuncInfo, commonBlocks);
|
||||
// TODO: problem with removing dead code before reverting substitution
|
||||
//removeDeadCode(currFunc->funcPointer, allFuncInfo, commonBlocks);
|
||||
|
||||
vector<SgArrayRefExp*> varRefs = getDirectArrayRefs(loopStmt, varToRemove.varSymbol);
|
||||
int loopLineNum = varToRemove.loop->lineNum;
|
||||
|
||||
Reference in New Issue
Block a user