Support APPLY_FRAGMENT(WEIGHT(double)) clause: add weights to fragments of parallel regions (and use it in at loopAnalyzer)

This commit is contained in:
2025-05-10 15:27:03 +03:00
parent 29a8c30370
commit 738f2c5d12
5 changed files with 246 additions and 44 deletions

View File

@@ -1405,6 +1405,37 @@ ParallelRegion* getRegionByLine(const vector<ParallelRegion*>& regions, const st
return NULL;
}
std::pair<ParallelRegion*, const ParallelRegionLines*> getRegionAndLinesByLine(const vector<ParallelRegion*>& regions, const string& file, const int line)
{
if (regions.size() == 1 && regions[0]->GetName() == "DEFAULT") // only default
return {regions[0], NULL};
else if (regions.size() > 0)
{
map<ParallelRegion*, const ParallelRegionLines*> regFound;
const ParallelRegionLines* foundLines = nullptr;
for (int i = 0; i < regions.size(); ++i)
if (regions[i]->HasThisLine(line, file, &foundLines))
regFound[regions[i]] = foundLines;
if (regFound.size() == 0)
return {NULL, NULL};
else if (regFound.size() == 1)
return *regFound.begin();
else
{
__spf_print(1, "WARN: this lines included in more than one region!!\n");
return {NULL, NULL};
}
}
else
return {NULL, NULL};
return {NULL, NULL};
}
set<ParallelRegion*> getAllRegionsByLine(const vector<ParallelRegion*>& regions, const string& file, const int line)
{
set<ParallelRegion*> regFound;