moved LoopGraph to json

This commit is contained in:
ALEXks
2025-04-01 15:28:53 +03:00
parent 381e3c5355
commit a7f199ad4c
7 changed files with 22938 additions and 27 deletions

View File

@@ -41,6 +41,7 @@
#include "../LoopAnalyzer/loop_analyzer.h"
#include "../DirectiveProcessing/insert_directive.h"
#include "../ProjectManipulation/PerfAnalyzer.h"
#include "Utils/json.hpp"
#include "BuildGraph.h"
@@ -61,6 +62,7 @@ using std::pair;
using std::tuple;
using std::to_string;
using std::make_pair;
using json = nlohmann::json;
extern set<short*> allocated;
extern set<int*> allocatedInt;
@@ -510,26 +512,7 @@ int SPF_GetGraphLoops(void*& context, int winHandler, short *options, short *pro
{
runPassesForVisualizer(projName, { LOOP_GRAPH } );
string resVal = "";
for (auto f = loopGraph.begin(); f != loopGraph.end(); ++f)
{
if (resVal != "")
resVal += "|";
int realLoops = 0;
for (int i = 0; i < f->second.size(); ++i)
if (f->second[i]->lineNum > 0)
realLoops++;
resVal += f->first + "|" + to_string(realLoops);
for (int i = 0; i < f->second.size(); ++i)
{
string localRes = "";
convertToString(f->second[i], localRes);
resVal += localRes;
}
}
string resVal = convertToJson(loopGraph).dump();
copyStringToShort(result, resVal);
retSize = (int)resVal.size() + 1;
}