From 9e5ee78b80154f8c2548d63e68c5347aebe12d05 Mon Sep 17 00:00:00 2001 From: ALEXks Date: Mon, 10 Feb 2025 13:13:01 +0300 Subject: [PATCH] fixed module symbol analysis --- .../_src/DvmhRegions/DvmhRegionInserter.cpp | 51 ++++++++++++++++--- .../experts/Sapfor_2017/_src/Utils/version.h | 2 +- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp b/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp index 70549c4..5dad847 100644 --- a/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp +++ b/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp @@ -167,11 +167,11 @@ void DvmhRegionInserter::updateParallelFunctions(const map>> &modByUse, const string& varName, - const string& locName, vector &altNames) + const set& locNames, vector &altNames) { for (auto& elem : modByUse) { - if (elem.first == locName) + if (locNames.count(elem.first)) { for (auto& byUse : elem.second) { @@ -217,6 +217,8 @@ static string getNameByUse(SgStatement *place, const string &varName, const stri return varName; else { + map> graphUse; + set useMod; map>> modByUse; map>> modByUseOnly; @@ -241,12 +243,22 @@ static string getNameByUse(SgStatement *place, const string &varName, const stri if (useModDone.find(useM) == useModDone.end()) { auto modSt = findModWithName(modules, useM); - if (modSt == NULL && useM == "dvmh_template_mod") + if (modSt == NULL || useM == "dvmh_template_mod") continue; checkNull(modSt, convertFileName(__FILE__).c_str(), __LINE__); - fillInfo(modSt, newUseMod, modByUse, modByUseOnly); + + set tmpUse; + fillInfo(modSt, tmpUse, modByUse, modByUseOnly); useModDone.insert(useM); + + for (auto& use : tmpUse) + { + newUseMod.insert(use); + + if (use != "dvmh_template_mod") + graphUse[use].insert(useM); + } } } @@ -261,9 +273,36 @@ static string getNameByUse(SgStatement *place, const string &varName, const stri } vector altNames; - findByUse(modByUse, varName, locName, altNames); - findByUse(modByUseOnly, varName, locName, altNames); + findByUse(modByUse, varName, { locName }, altNames); + findByUse(modByUseOnly, varName, { locName }, altNames); + if (altNames.size() == 0) + { + set locations = { locName }; + bool changed = true; + while (changed) + { + changed = false; + for (auto& loc : locations) + { + if (graphUse.find(loc) != graphUse.end()) + { + for (auto& use : graphUse[loc]) + { + if (locations.find(use) == locations.end()) + { + locations.insert(use); + changed = true; + } + } + } + } + } + + findByUse(modByUse, varName, locations, altNames); + findByUse(modByUseOnly, varName, locations, altNames); + } + if (altNames.size() == 0) return varName; else if (altNames.size() >= 1) diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index d9a229a..bbc2467 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/version.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2387" +#define VERSION_SPF "2388"