4 Commits

Author SHA1 Message Date
e88706ae19 made functions static 2025-05-05 22:52:17 +03:00
ALEXks
a6c4dd1fab fixed gcov 2025-05-05 22:52:17 +03:00
ALEXks
4d51c0d588 added json for SPF_GetGCovInfo pass 2025-05-05 22:52:16 +03:00
ALEXks
9ea4e94a74 fixed getInterfaceBlock 2025-05-05 22:52:16 +03:00
5 changed files with 35 additions and 21 deletions

View File

@@ -834,19 +834,21 @@ static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
auto copy = duplicateProcedure(func, NULL, false, false, false, true); auto copy = duplicateProcedure(func, NULL, false, false, false, true);
const set<string> idents(pars.identificators.begin(), pars.identificators.end()); const set<string> idents(pars.identificators.begin(), pars.identificators.end());
bool need = (func->symbol()->identifier() == string("bl182"));
//remove all exec //remove all exec
SgStatement* st = copy->lexNext(); SgStatement* st = copy->lexNext();
SgStatement* last = copy->lastNodeOfStmt(); SgStatement* last = copy->lastNodeOfStmt();
vector<SgStatement*> toExtract; vector<SgStatement*> toExtract;
while (st != last) while (st != last)
{ {
if (isDVM_stat(st) || isSPF_stat(st)) if (isDVM_stat(st) || isSPF_stat(st))
{ {
if (st->variant() != ACC_ROUTINE_DIR) if (st->variant() != ACC_ROUTINE_DIR)
{ {
SgStatement* next = st->lexNext(); toExtract.push_back(st);
st->extractStmt(); st = st->lexNext();
st = next;
} }
else else
st = st->lexNext(); st = st->lexNext();
@@ -868,6 +870,7 @@ static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
while (st != last) while (st != last)
{ {
const int var = st->variant(); const int var = st->variant();
if (var == VAR_DECL if (var == VAR_DECL
|| var == VAR_DECL_90 || var == VAR_DECL_90
|| var == DIM_STAT || var == DIM_STAT
@@ -877,9 +880,8 @@ static string getInterfaceBlock(SgStatement* func, const FuncParam& pars)
bool empty = filterFromList(st, idents); bool empty = filterFromList(st, idents);
if (empty) if (empty)
{ {
SgStatement* next = st->lexNext();
toExtract.push_back(st); toExtract.push_back(st);
st = next; st = st->lexNext();
continue; continue;
} }
} }

View File

@@ -508,13 +508,13 @@ AccessingSet AccessingSet::Diff(const AccessingSet& secondSet) const
return uncovered; return uncovered;
} }
bool operator!=(const ArrayDimension& lhs, const ArrayDimension& rhs) static bool operator!=(const ArrayDimension& lhs, const ArrayDimension& rhs)
{ {
return !(lhs.start == rhs.start && lhs.step == rhs.step && lhs.tripCount == rhs.tripCount); return !(lhs.start == rhs.start && lhs.step == rhs.step && lhs.tripCount == rhs.tripCount);
} }
bool operator!=(const AccessingSet& lhs, const AccessingSet& rhs) static bool operator!=(const AccessingSet& lhs, const AccessingSet& rhs)
{ {
for (size_t i = 0; i < lhs.allElements.size(); i++) for (size_t i = 0; i < lhs.allElements.size(); i++)
{ {
@@ -529,7 +529,7 @@ bool operator!=(const AccessingSet& lhs, const AccessingSet& rhs)
return false; return false;
} }
bool operator!=(const ArrayAccessingIndexes& lhs, const ArrayAccessingIndexes& rhs) static bool operator!=(const ArrayAccessingIndexes& lhs, const ArrayAccessingIndexes& rhs)
{ {
if(lhs.size() != rhs.size()) if(lhs.size() != rhs.size())
{ {
@@ -628,7 +628,7 @@ Region::Region(LoopGraph* loop, vector<SAPFOR::BasicBlock*>& Blocks)
} }
} }
void SolveDataFlowIteratively(Region* DFG) static void SolveDataFlowIteratively(Region* DFG)
{ {
unordered_set<Region*> worklist(DFG->getBasickBlocks()); unordered_set<Region*> worklist(DFG->getBasickBlocks());
do do
@@ -661,7 +661,7 @@ void SolveDataFlowIteratively(Region* DFG)
while (!worklist.empty()); while (!worklist.empty());
} }
void SolveDataFlow(Region* DFG) static void SolveDataFlow(Region* DFG)
{ {
SolveDataFlowIteratively(DFG); SolveDataFlowIteratively(DFG);
for (Region* subRegion : DFG->getSubRegions()) for (Region* subRegion : DFG->getSubRegions())

View File

@@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION_SPF "2413" #define VERSION_SPF "2415"

View File

@@ -2253,18 +2253,30 @@ int SPF_GetGCovInfo(void*& context, int winHandler, short *options, short *projN
{ {
runPassesForVisualizer(projName, { GCOV_PARSER }); runPassesForVisualizer(projName, { GCOV_PARSER });
string resVal = ""; json gcov_array = json::array();
bool first = true; for (auto& byFile : gCovInfo)
for (auto &byFile : gCovInfo)
{ {
if (!first) json fileGCov;
resVal += "@"; fileGCov["file"] = byFile.first;
resVal += byFile.first + "@";
for (auto &elem : byFile.second) json info_array = json::array();
resVal += to_string(elem.first) + " " + to_string(elem.second.getExecutedCount()) + " "; for (auto& elem : byFile.second)
first = false; {
json item;
item["line"] = elem.first;
item["execution"] = elem.second.getExecutedCount();
info_array.push_back(item);
}
fileGCov["lines"] = info_array;
gcov_array.push_back(fileGCov);
} }
json allGCov;
allGCov["allGCov"] = gcov_array;
string resVal = allGCov.dump();
copyStringToShort(result, resVal); copyStringToShort(result, resVal);
retSize = (int)resVal.size(); retSize = (int)resVal.size();
} }