Compare commits
1 Commits
798052e565
...
fae76c98cb
| Author | SHA1 | Date | |
|---|---|---|---|
| fae76c98cb |
@@ -54,7 +54,7 @@ set(VS_CALLS src/VisualizerCalls/get_information.cpp
|
||||
src/VisualizerCalls/SendMessage.h
|
||||
src/VisualizerCalls/BuildGraph.cpp
|
||||
src/VisualizerCalls/BuildGraph.h)
|
||||
|
||||
|
||||
set(VERIF src/VerificationCode/CorrectVarDecl.cpp
|
||||
src/VerificationCode/IncludeChecker.cpp
|
||||
src/VerificationCode/StructureChecker.cpp
|
||||
@@ -76,8 +76,7 @@ set(UTILS src/Utils/AstWrapper.h
|
||||
src/Utils/utils.h
|
||||
src/Utils/version.h
|
||||
src/Utils/module_utils.h
|
||||
src/Utils/module_utils.cpp
|
||||
src/Utils/json.hpp)
|
||||
src/Utils/module_utils.cpp)
|
||||
|
||||
set(OMEGA src/SageAnalysisTool/OmegaForSage/add-assert.cpp
|
||||
src/SageAnalysisTool/OmegaForSage/affine.cpp
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define DVMH_REG_RD 0
|
||||
#define DVMH_REG_WT 1
|
||||
|
||||
@@ -1427,15 +1428,21 @@ static set<DIST::Array*>
|
||||
|
||||
for (auto& realArray : realRef)
|
||||
{
|
||||
if (added.count(realArray) != 0)
|
||||
continue;
|
||||
|
||||
if (!realArray->IsNotDistribute())
|
||||
if (added.count(realArray) != 0 || !realArray->IsNotDistribute())
|
||||
continue;
|
||||
|
||||
SgStatement* declStat = NULL;
|
||||
|
||||
if (realArray->GetLocation().first == DIST::l_COMMON)
|
||||
if (realArray->GetLocation().first != DIST::l_COMMON)
|
||||
{
|
||||
if (std::count(usedAll.begin(), usedAll.end(), realArray) == 0)
|
||||
{
|
||||
auto declInfo = *realArray->GetDeclInfo().begin();
|
||||
declStat = SgStatement::getStatementByFileAndLine(declInfo.first, declInfo.second);
|
||||
checkNull(declStat, convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
commonArrays.insert(realArray);
|
||||
auto decls = realArray->GetDeclInfo();
|
||||
@@ -1464,19 +1471,6 @@ static set<DIST::Array*>
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (realArray->GetLocation().first == DIST::l_MODULE)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
if (std::count(usedAll.begin(), usedAll.end(), realArray) == 0)
|
||||
{
|
||||
auto declInfo = *realArray->GetDeclInfo().begin();
|
||||
declStat = SgStatement::getStatementByFileAndLine(declInfo.first, declInfo.second);
|
||||
checkNull(declStat, convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
if (declStat)
|
||||
{
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/AstWrapper.h"
|
||||
#include "../Utils/json.hpp"
|
||||
|
||||
#include "../DirectiveProcessing/directive_parser.h"
|
||||
#include "../DynamicAnalysis/gCov_parser_func.h"
|
||||
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "../Transformations/array_assign_to_loop.h"
|
||||
|
||||
using std::vector;
|
||||
@@ -40,8 +40,6 @@ using std::string;
|
||||
using std::wstring;
|
||||
using std::pair;
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
#define DEBUG 0
|
||||
static inline void insertLabels(SgExpression *lb, map<int, vector<int>> &gotoLabels, const int line)
|
||||
{
|
||||
@@ -920,7 +918,7 @@ void* LoopGraph::getRealStat(const char* file) const
|
||||
}
|
||||
|
||||
extern int PASSES_DONE[EMPTY_PASS];
|
||||
static int getLoopState(const LoopGraph* currLoop)
|
||||
static void printToBuffer(const LoopGraph *currLoop, const int childSize, char buf[512])
|
||||
{
|
||||
int loopState = 0; // 0 - unknown, 1 - good, 2 - bad
|
||||
if (PASSES_DONE[CREATE_TEMPLATE_LINKS] ||
|
||||
@@ -936,14 +934,8 @@ static int getLoopState(const LoopGraph* currLoop)
|
||||
if (currLoop->hasLimitsToParallel())
|
||||
loopState = 2;
|
||||
}
|
||||
|
||||
return loopState;
|
||||
}
|
||||
|
||||
static void printToBuffer(const LoopGraph *currLoop, const int childSize, char buf[512])
|
||||
{
|
||||
sprintf(buf, "#%d#%d#%d#%d#%d#%d#%d#%d",
|
||||
currLoop->lineNum, currLoop->lineNumAfterLoop, currLoop->perfectLoop, currLoop->hasGoto, currLoop->hasPrints, childSize, getLoopState(currLoop),
|
||||
currLoop->lineNum, currLoop->lineNumAfterLoop, currLoop->perfectLoop, currLoop->hasGoto, currLoop->hasPrints, childSize, loopState,
|
||||
currLoop->hasNonRectangularBounds);
|
||||
}
|
||||
|
||||
@@ -955,90 +947,36 @@ static int calculateNormalChildSize(const LoopGraph *currLoop)
|
||||
return count;
|
||||
}
|
||||
|
||||
static json convertToJson(const LoopGraph* currLoop)
|
||||
void convertToString(const LoopGraph *currLoop, string &result)
|
||||
{
|
||||
json loop;
|
||||
const auto& file = currLoop->fileName;
|
||||
if (currLoop && currLoop->lineNum > 0)
|
||||
{
|
||||
loop["file"] = file;
|
||||
loop["line"] = currLoop->lineNum;
|
||||
loop["lineNumAfterLoop"] = currLoop->lineNumAfterLoop;
|
||||
loop["perfectLoop"] = currLoop->perfectLoop;
|
||||
loop["loopState"] = getLoopState(currLoop);
|
||||
loop["hasNonRectangularBounds"] = (int)currLoop->hasNonRectangularBounds;
|
||||
char buf[512];
|
||||
result += "#" + std::to_string(currLoop->calls.size());
|
||||
for (int i = 0; i < currLoop->calls.size(); ++i)
|
||||
result += "#" + currLoop->calls[i].first + "#" + std::to_string(currLoop->calls[i].second);
|
||||
printToBuffer(currLoop, calculateNormalChildSize(currLoop), buf);
|
||||
result += string(buf);
|
||||
|
||||
json calls = json::array();
|
||||
for (auto& [func, line] : currLoop->calls)
|
||||
{
|
||||
json call;
|
||||
call["line"] = line;
|
||||
call["funcName"] = func;
|
||||
call["canBeInlined"] = 0;
|
||||
call["parentLineOffset"] = 0;
|
||||
result += "#" + std::to_string(currLoop->linesOfExternalGoTo.size());
|
||||
for (int i = 0; i < currLoop->linesOfExternalGoTo.size(); ++i)
|
||||
result += "#" + std::to_string(currLoop->linesOfExternalGoTo[i]);
|
||||
|
||||
calls.push_back(call);
|
||||
}
|
||||
loop["funcCalls"] = calls;
|
||||
result += "#" + std::to_string(currLoop->linesOfInternalGoTo.size());
|
||||
for (int i = 0; i < currLoop->linesOfInternalGoTo.size(); ++i)
|
||||
result += "#" + std::to_string(currLoop->linesOfInternalGoTo[i]);
|
||||
|
||||
json e_gotos = json::array();
|
||||
for (auto& line : currLoop->linesOfExternalGoTo)
|
||||
e_gotos.push_back(line);
|
||||
loop["extGotos"] = e_gotos;
|
||||
result += "#" + std::to_string(currLoop->linesOfIO.size());
|
||||
for (auto& i : currLoop->linesOfIO)
|
||||
result += "#" + std::to_string(i);
|
||||
|
||||
json i_gotos = json::array();
|
||||
for (auto& line : currLoop->linesOfInternalGoTo)
|
||||
i_gotos.push_back(line);
|
||||
loop["intGotos"] = i_gotos;
|
||||
result += "#" + std::to_string(currLoop->linesOfStop.size());
|
||||
for (auto& i : currLoop->linesOfStop)
|
||||
result += "#" + std::to_string(i);
|
||||
|
||||
json ios = json::array();
|
||||
for (auto& line : currLoop->linesOfIO)
|
||||
ios.push_back(line);
|
||||
loop["ios"] = ios;
|
||||
|
||||
json stops = json::array();
|
||||
for (auto& line : currLoop->linesOfStop)
|
||||
stops.push_back(line);
|
||||
loop["stops"] = stops;
|
||||
|
||||
json children = json::array();
|
||||
for (const auto& ch : currLoop->children)
|
||||
{
|
||||
auto conv = convertToJson(ch);
|
||||
if (!conv.empty())
|
||||
children.push_back(conv);
|
||||
}
|
||||
loop["children"] = children;
|
||||
for (int i = 0; i < (int)currLoop->children.size(); ++i)
|
||||
convertToString(currLoop->children[i], result);
|
||||
}
|
||||
return loop;
|
||||
}
|
||||
|
||||
json convertToJson(const map<string, vector<LoopGraph*>>& loopsByFileMap)
|
||||
{
|
||||
json loopsByFile = json::array();
|
||||
|
||||
for (auto& byFile : loopsByFileMap)
|
||||
{
|
||||
json loop;
|
||||
const string& file = byFile.first;
|
||||
|
||||
json loops_array = json::array();
|
||||
for (auto& loop : byFile.second)
|
||||
{
|
||||
auto conv = convertToJson(loop);
|
||||
if (!conv.empty())
|
||||
loops_array.push_back(conv);
|
||||
}
|
||||
|
||||
loop["file"] = file;
|
||||
loop["loops"] = loops_array;
|
||||
|
||||
loopsByFile.push_back(loop);
|
||||
}
|
||||
|
||||
json allLoops;
|
||||
allLoops["allLoops"] = loopsByFile;
|
||||
return allLoops;
|
||||
}
|
||||
|
||||
void createMapLoopGraph(const vector<LoopGraph*> &loops, map<int, LoopGraph*> &mapGraph)
|
||||
|
||||
@@ -497,6 +497,7 @@ void processLoopInformationForFunction(std::map<LoopGraph*, std::map<DIST::Array
|
||||
void addToDistributionGraph(const std::map<LoopGraph*, std::map<DIST::Array*, ArrayInfo*>>& loopInfo, const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls);
|
||||
void selectFreeLoopsForParallelization(const std::vector<LoopGraph*>& loops, const std::string& funcName, bool isDistribute, const std::vector<ParallelRegion*>& regions, std::vector<Messages>& messagesForFile);
|
||||
|
||||
void convertToString(const LoopGraph* currLoop, std::string& result);
|
||||
int printLoopGraph(const char* fileName, const std::map<std::string, std::vector<LoopGraph*>>& loopGraph, bool withRegs = false);
|
||||
void checkCountOfIter(std::map<std::string, std::vector<LoopGraph*>>& loopGraph, const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo, std::map<std::string, std::vector<Messages>>& SPF_messages);
|
||||
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "graph_loops.h"
|
||||
#include "../Distribution/DvmhDirective.h"
|
||||
#include "Utils/json.hpp"
|
||||
|
||||
struct SpfInterval;
|
||||
|
||||
@@ -19,6 +17,4 @@ bool checkRegionEntries(SgStatement *begin, SgStatement *end, const std::map<std
|
||||
bool recSymbolFind(SgExpression *ex, const std::string &symb, const int var);
|
||||
void completeFillOfArrayUsageBetweenProc(const std::map<std::string, std::vector<LoopGraph*>>& loopGraph, const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo);
|
||||
bool detectMpiCalls(SgProject* proj, std::map<std::string, std::vector<Messages>>& SPF_messages);
|
||||
int calculateLoopIters(SgExpression* start, SgExpression* end, SgExpression* step, std::tuple<int, int, int>& result);
|
||||
|
||||
nlohmann::json convertToJson(const std::map<std::string, std::vector<LoopGraph*>>& loopsByFile);
|
||||
int calculateLoopIters(SgExpression* start, SgExpression* end, SgExpression* step, std::tuple<int, int, int>& result);
|
||||
@@ -44,7 +44,7 @@ static bool isParentStmt(SgStatement* stmt, SgStatement* parent)
|
||||
}
|
||||
|
||||
/*returns head block and loop*/
|
||||
pair<SAPFOR::BasicBlock*, unordered_set<SAPFOR::BasicBlock*>> GetBasicBlocksForLoop(LoopGraph* loop, vector<SAPFOR::BasicBlock*> blocks)
|
||||
static pair<SAPFOR::BasicBlock*, unordered_set<SAPFOR::BasicBlock*>> GetBasicBlocksForLoop(LoopGraph* loop, vector<SAPFOR::BasicBlock*> blocks)
|
||||
{
|
||||
unordered_set<SAPFOR::BasicBlock*> block_loop;
|
||||
SAPFOR::BasicBlock* head_block = nullptr;
|
||||
@@ -397,7 +397,7 @@ static vector<vector<ArrayDimension>> ElementsDifference(const vector<ArrayDimen
|
||||
if(!dimDiff.empty())
|
||||
{
|
||||
vector<ArrayDimension> firstCopy = firstElement;
|
||||
for(const auto& range: dimDiff)
|
||||
for(const auto range: dimDiff)
|
||||
{
|
||||
firstCopy[i] = range;
|
||||
result.push_back(firstCopy);
|
||||
@@ -508,94 +508,27 @@ AccessingSet AccessingSet::Diff(const AccessingSet& secondSet) const
|
||||
|
||||
void Collapse(Region* region)
|
||||
{
|
||||
//Region* newBlock = new Region();
|
||||
for (auto& [arrayName, arrayRanges] : region->getHeader()->array_out)
|
||||
Region* newBlock = new Region();
|
||||
for (auto& [arrayName, arrayRanges] : region->GetHeader()->array_out)
|
||||
{
|
||||
for (Region* byBlock : region->getBasickBlocks())
|
||||
for (Region* byBlock : region->GetBasickBlocks())
|
||||
{
|
||||
AccessingSet intersection = byBlock->array_def[arrayName].Intersect(arrayRanges);
|
||||
region->array_def[arrayName].Union(intersection);
|
||||
newBlock->array_def[arrayName].Union(intersection);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& byBlock : region->getBasickBlocks()) {
|
||||
for (auto& byBlock : region->GetBasickBlocks()) {
|
||||
for (auto& [arrayName, arrayRanges] : byBlock->array_use)
|
||||
{
|
||||
AccessingSet diff = byBlock->array_use[arrayName].Diff(byBlock->array_in[arrayName]);
|
||||
region->array_use[arrayName].Union(diff);
|
||||
newBlock->array_use[arrayName].Union(diff);
|
||||
}
|
||||
}
|
||||
|
||||
for (Region* prevBlock : region->getHeader()->getPrevRegions())
|
||||
{
|
||||
prevBlock->replaceInNextRegions(region, region->getHeader());
|
||||
for (Region* prevRegion : region->getPrevRegions()) {
|
||||
prevRegion->setNextRegion(newBlock);
|
||||
}
|
||||
for (Region* nextBlock : region->getHeader()->getNextRegions())
|
||||
{
|
||||
nextBlock->replaceInPrevRegions(region, region->getHeader());
|
||||
}
|
||||
}
|
||||
|
||||
static void SetConnections(unordered_map<SAPFOR::BasicBlock*, Region*>& bbToRegion, const unordered_set<SAPFOR::BasicBlock*>& blockSet)
|
||||
{
|
||||
for (SAPFOR::BasicBlock* block : blockSet)
|
||||
{
|
||||
for (SAPFOR::BasicBlock* nextBlock : block->getNext())
|
||||
{
|
||||
if (bbToRegion.find(nextBlock) != bbToRegion.end())
|
||||
{
|
||||
bbToRegion[block]->addNextRegion(bbToRegion[nextBlock]);
|
||||
}
|
||||
}
|
||||
for (SAPFOR::BasicBlock* prevBlock : block->getPrev())
|
||||
{
|
||||
if (bbToRegion.find(prevBlock) != bbToRegion.end())
|
||||
{
|
||||
bbToRegion[block]->addPrevRegion(bbToRegion[prevBlock]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Region* CreateSubRegion(LoopGraph* loop, const vector<SAPFOR::BasicBlock*>& Blocks, const unordered_map<SAPFOR::BasicBlock*, Region*>& bbToRegion)
|
||||
{
|
||||
Region* region = new Region;
|
||||
auto [header, blockSet] = GetBasicBlocksForLoop(loop, Blocks);
|
||||
for (SAPFOR::BasicBlock* block : Blocks)
|
||||
{
|
||||
region->addBasickBlocks(bbToRegion.at(block));
|
||||
}
|
||||
for (LoopGraph* childLoop : loop->children)
|
||||
{
|
||||
region->addSubRegions(CreateSubRegion(childLoop, Blocks, bbToRegion));
|
||||
}
|
||||
return region;
|
||||
}
|
||||
|
||||
Region::Region(LoopGraph* loop, vector<SAPFOR::BasicBlock*>& Blocks)
|
||||
{
|
||||
auto [header, blockSet] = GetBasicBlocksForLoop(loop, Blocks);
|
||||
unordered_map<SAPFOR::BasicBlock*, Region*> bbToRegion;
|
||||
for (auto poiner : blockSet)
|
||||
{
|
||||
bbToRegion[poiner] = new Region(*poiner);
|
||||
}
|
||||
SetConnections(bbToRegion, blockSet);
|
||||
//create subRegions
|
||||
for (LoopGraph* childLoop : loop->children)
|
||||
{
|
||||
subRegions.insert(CreateSubRegion(childLoop, Blocks, bbToRegion));
|
||||
}
|
||||
}
|
||||
|
||||
void SolveDataFlow(Region* DFG)
|
||||
{
|
||||
//SolveDataFlowIteratively(DFG)
|
||||
for (Region* subRegion : DFG->getSubRegions())
|
||||
{
|
||||
SolveDataFlow(subRegion);
|
||||
}
|
||||
Collapse(DFG);
|
||||
region->getNextRegion()->setPrevRegion(newBlock);
|
||||
}
|
||||
|
||||
void FindPrivateArrays(map<string, vector<LoopGraph*>> &loopGraph, map<FuncInfo*, vector<SAPFOR::BasicBlock*>>& FullIR)
|
||||
|
||||
@@ -7,8 +7,6 @@ using std::vector;
|
||||
using std::map;
|
||||
using std::string;
|
||||
using std::set;
|
||||
using std::unordered_set;
|
||||
using std::pair;
|
||||
|
||||
struct ArrayDimension
|
||||
{
|
||||
@@ -38,85 +36,49 @@ class Region: public SAPFOR::BasicBlock {
|
||||
public:
|
||||
Region()
|
||||
{
|
||||
header = nullptr;
|
||||
header = nullptr;
|
||||
nextRegion = nullptr;
|
||||
}
|
||||
|
||||
Region(SAPFOR::BasicBlock block) : SAPFOR::BasicBlock::BasicBlock(block)
|
||||
{
|
||||
header = nullptr;
|
||||
}
|
||||
|
||||
Region(LoopGraph* loop, vector<SAPFOR::BasicBlock*>& Blocks);
|
||||
|
||||
Region* getHeader()
|
||||
nextRegion = nullptr;
|
||||
};
|
||||
//Region(LoopGraph* loop);
|
||||
Region* GetHeader()
|
||||
{
|
||||
return header;
|
||||
}
|
||||
|
||||
unordered_set<Region*>& getBasickBlocks()
|
||||
set<Region*> GetBasickBlocks()
|
||||
{
|
||||
return basickBlocks;
|
||||
}
|
||||
|
||||
void addBasickBlocks(Region* region)
|
||||
{
|
||||
basickBlocks.insert(region);
|
||||
}
|
||||
unordered_set<Region*> getPrevRegions()
|
||||
vector<Region*> getPrevRegions()
|
||||
{
|
||||
return prevRegions;
|
||||
}
|
||||
|
||||
unordered_set<Region*> getNextRegions()
|
||||
Region* getNextRegion()
|
||||
{
|
||||
return nextRegions;
|
||||
return nextRegion;
|
||||
}
|
||||
|
||||
void addPrevRegion(Region* region)
|
||||
void setPrevRegion(Region* region)
|
||||
{
|
||||
prevRegions.insert(region);
|
||||
prevRegions.push_back(region);
|
||||
}
|
||||
|
||||
void addNextRegion(Region* region)
|
||||
void setNextRegion(Region* region)
|
||||
{
|
||||
nextRegions.insert(region);
|
||||
nextRegion = region;
|
||||
}
|
||||
|
||||
void replaceInPrevRegions(Region* source, Region* destination)
|
||||
{
|
||||
prevRegions.erase(destination);
|
||||
prevRegions.insert(source);
|
||||
}
|
||||
|
||||
void replaceInNextRegions(Region* source, Region* destination)
|
||||
{
|
||||
nextRegions.erase(destination);
|
||||
nextRegions.insert(source);
|
||||
}
|
||||
|
||||
unordered_set<Region*> getSubRegions()
|
||||
{
|
||||
return subRegions;
|
||||
}
|
||||
|
||||
void addSubRegions(Region* region)
|
||||
{
|
||||
subRegions.insert(region);
|
||||
}
|
||||
|
||||
ArrayAccessingIndexes array_def, array_use, array_out, array_in;
|
||||
|
||||
|
||||
private:
|
||||
unordered_set<Region*> subRegions, basickBlocks;
|
||||
/*next Region which is BB for current BB Region*/
|
||||
unordered_set<Region*> nextRegions;
|
||||
/*prev Regions which is BBs for current BB Region*/
|
||||
unordered_set<Region*> prevRegions;
|
||||
Region* header;
|
||||
set<Region*> subRegions, basickBlocks;
|
||||
Region* header;
|
||||
Region* nextRegion;
|
||||
vector<Region*> prevRegions;
|
||||
};
|
||||
|
||||
|
||||
void Collapse(Region* region);
|
||||
void FindPrivateArrays(map<string, vector<LoopGraph*>>& loopGraph, map<FuncInfo*, vector<SAPFOR::BasicBlock*>>& FullIR);
|
||||
void GetDimensionInfo(LoopGraph* loop, map<DIST::Array*, vector<vector<ArrayDimension>>>& loopDimensionsInfo, int level);
|
||||
pair<SAPFOR::BasicBlock*, unordered_set<SAPFOR::BasicBlock*>> GetBasicBlocksForLoop(LoopGraph* loop, vector<SAPFOR::BasicBlock*> blocks);
|
||||
set<SAPFOR::BasicBlock> GetBasicBlocksForLoop(LoopGraph* loop, vector<SAPFOR::BasicBlock>);
|
||||
|
||||
@@ -1561,7 +1561,6 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
{
|
||||
if (keepFiles)
|
||||
printLoopGraph("_loopGraph.txt", loopGraph);
|
||||
//printf("%s\n", convertToJson(loopGraph).dump(2).c_str());
|
||||
}
|
||||
else if (curr_regime == FILL_COMMON_BLOCKS)
|
||||
{
|
||||
|
||||
22828
src/Utils/json.hpp
22828
src/Utils/json.hpp
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2404"
|
||||
#define VERSION_SPF "2401"
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../DirectiveProcessing/insert_directive.h"
|
||||
#include "../ProjectManipulation/PerfAnalyzer.h"
|
||||
#include "Utils/json.hpp"
|
||||
|
||||
#include "BuildGraph.h"
|
||||
|
||||
@@ -62,7 +61,6 @@ 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;
|
||||
@@ -512,7 +510,26 @@ int SPF_GetGraphLoops(void*& context, int winHandler, short *options, short *pro
|
||||
{
|
||||
runPassesForVisualizer(projName, { LOOP_GRAPH } );
|
||||
|
||||
string resVal = convertToJson(loopGraph).dump();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
copyStringToShort(result, resVal);
|
||||
retSize = (int)resVal.size() + 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user