WIP: testing on big data

This commit is contained in:
2025-05-27 23:34:45 +03:00
parent 6a84171382
commit b137ea5ef3
5 changed files with 86 additions and 19 deletions

View File

@@ -1945,11 +1945,18 @@ Instruction* findInstructionAfterLoop(const std::vector<SAPFOR::BasicBlock*>& lo
return nullptr; // не нашли
}
void exploreLoops(map<FuncInfo*, vector<SAPFOR::BasicBlock*>>* fullIR) {
bool isEqual(const char* cstr, const std::string& str) {
return str == cstr;
}
void exploreLoops(map<FuncInfo*, vector<SAPFOR::BasicBlock*>>* fullIR, const char* fileName) {
for (auto& i : *fullIR)
{
//for (auto j : i.second)
// printBlock(j);
// printblock(j);
if (!isEqual(fileName, i.first->fileName))
continue;
map<int, int> visited;
for (auto i : i.second)
@@ -2005,24 +2012,24 @@ void exploreLoops(map<FuncInfo*, vector<SAPFOR::BasicBlock*>>* fullIR) {
if (firstInstruction->getOperator()->variant() == FOR_NODE) {
SgForStmt* stmt = isSgForStmt(firstInstruction->getOperator());
cout << "for loop" << endl << stmt->sunparse() << endl;
cout << "for loop" << endl;// << stmt->sunparse() << endl;
}
else if (firstInstruction->getOperator()->variant() == WHILE_NODE) {
SgWhileStmt* stmt = isSgWhileStmt(firstInstruction->getOperator());
cout << (stmt->conditional() == NULL ? "infinit" : "") << "while loop" << endl << stmt->sunparse() << endl;
cout << (stmt->conditional() == NULL ? "infinit" : "") << "while loop" << endl;//<< stmt->sunparse() << endl;
}
else if (firstInstruction->getOperator()->variant() == DO_WHILE_NODE) {
SgWhileStmt* stmt = isSgDoWhileStmt(firstInstruction->getOperator());
cout << "do while loop" << endl << stmt->sunparse() << endl;
cout << "do while loop" << endl;// << stmt->sunparse() << endl;
}
else if (firstInstruction->getOperator()->variant() == LOOP_NODE) {
cout << "not known loop" << endl << firstInstruction->getOperator()->sunparse() << endl;
cout << "not known loop" << endl;// << firstInstruction->getOperator()->sunparse() << endl;
}
else {
cout << "goto loop" << firstInstruction->getOperator()->sunparse() << endl;
cout << "goto loop" << endl;// firstInstruction->getOperator()->sunparse() << endl;
}
cout << "loop start line " << tmpLoop->lineNum << endl;