Compare commits
4 Commits
aec4ddab67
...
738f2c5d12
| Author | SHA1 | Date | |
|---|---|---|---|
| 738f2c5d12 | |||
|
|
29a8c30370 | ||
|
|
99f5febd58 | ||
|
|
0a4b795900 |
@@ -9,6 +9,7 @@
|
||||
#include "DvmhDirectiveBase.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/json.hpp"
|
||||
|
||||
class Symbol;
|
||||
class Expression;
|
||||
@@ -20,6 +21,7 @@ struct FuncInfo;
|
||||
#define MAP std::map
|
||||
#define SET std::set
|
||||
#define TO_STR std::to_string
|
||||
#define JSON nlohmann::json
|
||||
|
||||
#if __SPF
|
||||
extern int sharedMemoryParallelization;
|
||||
@@ -424,6 +426,7 @@ namespace Distribution
|
||||
|
||||
void ClearShadowSpecs() { allShadowSpecs.clear(); }
|
||||
|
||||
//TODO: to remove
|
||||
STRING toString()
|
||||
{
|
||||
STRING retVal = "";
|
||||
@@ -466,6 +469,63 @@ namespace Distribution
|
||||
return retVal;
|
||||
}
|
||||
|
||||
JSON toJson()
|
||||
{
|
||||
JSON retVal;
|
||||
|
||||
retVal["id"] = (int64_t)id;
|
||||
retVal["name"] = name;
|
||||
retVal["shortName"] = shortName;
|
||||
|
||||
retVal["dimSize"] = dimSize;
|
||||
retVal["typeSize"] = typeSize;
|
||||
retVal["state"] = (int)isNonDistribute;
|
||||
retVal["location"] = (int)locationPos.first;
|
||||
retVal["locName"] = locationPos.second;
|
||||
|
||||
retVal["isTemplFlag"] = (int)isTemplFlag;
|
||||
retVal["isLoopArrayFlag"] = (int)isLoopArrayFlag;
|
||||
|
||||
JSON deprToDist = nlohmann::json::array();
|
||||
for (int i = 0; i < depracateToDistribute.size(); ++i)
|
||||
deprToDist.push_back((int)depracateToDistribute[i]);
|
||||
retVal["depracateToDist"] = deprToDist;
|
||||
|
||||
JSON mappedDimsJ = nlohmann::json::array();
|
||||
for (int i = 0; i < mappedDims.size(); ++i)
|
||||
mappedDimsJ.push_back((int)mappedDims[i]);
|
||||
retVal["mappedDims"] = mappedDimsJ;
|
||||
|
||||
JSON sizesJ = nlohmann::json::array();
|
||||
for (int i = 0; i < sizes.size(); ++i)
|
||||
{
|
||||
JSON pair;
|
||||
pair["key"] = sizes[i].first;
|
||||
pair["value"] = sizes[i].second;
|
||||
sizesJ.push_back(pair);
|
||||
}
|
||||
retVal["sizes"] = sizesJ;
|
||||
|
||||
JSON regions = nlohmann::json::array();
|
||||
for (auto& reg : containsInRegions)
|
||||
regions.push_back(reg);
|
||||
retVal["regions"] = regions;
|
||||
|
||||
|
||||
JSON declPlacesJ = nlohmann::json::array();
|
||||
for (auto& place : declPlaces)
|
||||
{
|
||||
JSON elem;
|
||||
elem["file"] = place.first;
|
||||
elem["line"] = place.second;
|
||||
|
||||
declPlacesJ.push_back(elem);
|
||||
}
|
||||
retVal["declPlaces"] = declPlacesJ;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
Array* GetTemplateArray(const uint64_t regionId, bool withCheck = true)
|
||||
{
|
||||
TemplateLink *currLink = getTemlateInfo(regionId, withCheck);
|
||||
|
||||
@@ -309,9 +309,18 @@ static void getModuleSymbols(SgStatement* func, set<SgSymbol*>& symbs)
|
||||
|
||||
SgSymbol* s = func->symbol()->next();
|
||||
while (s)
|
||||
{
|
||||
if (func->variant() == MODULE_STMT)
|
||||
{
|
||||
if (s->scope() && s->scope()->symbol() && s->scope()->symbol()->identifier())
|
||||
if (s->scope()->symbol()->identifier() == currScope)
|
||||
symbs.insert(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IS_BY_USE(s) && s->scope() && s->scope()->symbol()->identifier() == currScope)
|
||||
symbs.insert(s);
|
||||
}
|
||||
s = s->next();
|
||||
}
|
||||
}
|
||||
@@ -325,9 +334,9 @@ const set<SgSymbol*>& getModuleSymbols(SgStatement *func)
|
||||
set<SgSymbol*> symbs;
|
||||
getModuleSymbols(func, symbs);
|
||||
|
||||
//if function in contains
|
||||
//if function or module in contains
|
||||
auto cp = func->controlParent();
|
||||
if (isSgProgHedrStmt(cp))
|
||||
if (isSgProgHedrStmt(cp) || cp->variant() == MODULE_STMT)
|
||||
getModuleSymbols(cp, symbs);
|
||||
|
||||
symbolsForFunc[func->symbol()->identifier()] = symbs;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2415"
|
||||
#define VERSION_SPF "2417"
|
||||
|
||||
@@ -1416,14 +1416,17 @@ int SPF_GetAllDeclaratedArrays(void*& context, int winHandler, short *options, s
|
||||
{
|
||||
runPassesForVisualizer(projName, { GET_ALL_ARRAY_DECL });
|
||||
|
||||
string resVal = "";
|
||||
for (auto f = declaredArrays.begin(); f != declaredArrays.end(); ++f)
|
||||
json arrays = json::array();
|
||||
for (const auto& [_, array] : declaredArrays)
|
||||
{
|
||||
if (f != declaredArrays.begin())
|
||||
resVal += "@";
|
||||
resVal += f->second.first->toString();
|
||||
json jArray = array.first->toJson();
|
||||
arrays.push_back(jArray);
|
||||
}
|
||||
|
||||
json allArrays;
|
||||
allArrays["allArrays"] = arrays;
|
||||
string resVal = allArrays.dump();
|
||||
|
||||
copyStringToShort(result, resVal);
|
||||
retSize = (int)resVal.size() + 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user