Compare commits
4 Commits
79af1ede79
...
8cae169131
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cae169131 | ||
|
|
0bec2c6527 | ||
| aa56778be1 | |||
|
|
0a484e77de |
Submodule projects/dvm updated: 13d113d343...4d4041a081
Submodule projects/libpredictor updated: d08cb25cc6...d0772cdb57
@@ -17,7 +17,7 @@ using std::fstream;
|
||||
static long int getNextTag()
|
||||
{
|
||||
static long int INTERVAL_TAG = 0;
|
||||
return INTERVAL_TAG++;
|
||||
return -(INTERVAL_TAG++);
|
||||
}
|
||||
|
||||
//Debug funcs
|
||||
@@ -413,7 +413,7 @@ static void findIntervals(SpfInterval *interval, map<int, int> &labelsRef, map<i
|
||||
inter->lineFile = std::make_pair(currentSt->lineNumber(), currentSt->fileName());
|
||||
inter->parent = interval;
|
||||
inter->exit_levels.push_back(0);
|
||||
inter->tag = getNextTag();
|
||||
inter->tag = currentSt->lineNumber();//getNextTag();
|
||||
interval->nested.push_back(inter);
|
||||
|
||||
findIntervals(inter, labelsRef, gotoStmts, currentSt);
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Provided by Sage runtime (declared in libSage++.h)
|
||||
extern SgFile *current_file;
|
||||
|
||||
|
||||
set<int> loop_tags = {FOR_NODE};
|
||||
set<int> control_tags = {IF_NODE, ELSEIF_NODE, DO_WHILE_NODE, WHILE_NODE, LOGIF_NODE};
|
||||
@@ -551,21 +554,35 @@ static bool reorderOperatorsInBasicBlockUsingDeps(SAPFOR::BasicBlock* bb)
|
||||
void moveOperators(SgFile *file, map<string, vector<LoopGraph*>>& loopGraph,
|
||||
const map<FuncInfo*, vector<SAPFOR::BasicBlock*>>& FullIR,
|
||||
int& countOfTransform) {
|
||||
if (!file)
|
||||
return;
|
||||
// Correct usage pattern in this project:
|
||||
// save current file -> switch -> work on current_file -> restore.
|
||||
const string oldFileName = (current_file ? current_file->filename() : "");
|
||||
|
||||
const int funcNum = file->numberOfFunctions();
|
||||
for (const auto& [fileName, _] : loopGraph)
|
||||
{
|
||||
if (SgFile::switchToFile(fileName.c_str()) == -1)
|
||||
continue;
|
||||
|
||||
for (int i = 0; i < funcNum; ++i) {
|
||||
SgStatement* st = file->functions(i);
|
||||
SgFile* curFile = current_file;
|
||||
if (!curFile)
|
||||
continue;
|
||||
|
||||
const auto loopBlocks = findBlocksInLoopsByFullIR(st, FullIR);
|
||||
for (auto* bb : loopBlocks)
|
||||
const int funcNum = curFile->numberOfFunctions();
|
||||
for (int i = 0; i < funcNum; ++i)
|
||||
{
|
||||
if (!bb)
|
||||
continue;
|
||||
if (reorderOperatorsInBasicBlockUsingDeps(bb))
|
||||
countOfTransform += 1;
|
||||
SgStatement* st = curFile->functions(i);
|
||||
|
||||
const auto loopBlocks = findBlocksInLoopsByFullIR(st, FullIR);
|
||||
for (auto* bb : loopBlocks)
|
||||
{
|
||||
if (!bb)
|
||||
continue;
|
||||
if (reorderOperatorsInBasicBlockUsingDeps(bb))
|
||||
countOfTransform += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!oldFileName.empty())
|
||||
SgFile::switchToFile(oldFileName.c_str());
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2468"
|
||||
#define VERSION_SPF "2470"
|
||||
|
||||
Reference in New Issue
Block a user