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