Compare commits
1 Commits
39abbafb3a
...
egormayoro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7390d96b1f |
@@ -800,47 +800,20 @@ static void fillInOut(FuncInfo *currF, SgStatement *start, SgStatement *last, co
|
|||||||
|
|
||||||
static map<string, vector<int>> supportedKeyWordArg = { {"system_clock", { OUT_BIT, OUT_BIT, OUT_BIT } } };
|
static map<string, vector<int>> supportedKeyWordArg = { {"system_clock", { OUT_BIT, OUT_BIT, OUT_BIT } } };
|
||||||
|
|
||||||
map<string, int> parNamesMain;
|
map<string, int> parNames;
|
||||||
map<string, int> parNamesContains;
|
|
||||||
|
|
||||||
for (int i = 0; i < currF->funcParams.identificators.size(); ++i)
|
for (int i = 0; i < currF->funcParams.identificators.size(); ++i)
|
||||||
parNamesMain[currF->funcParams.identificators[i]] = i;
|
parNames[currF->funcParams.identificators[i]] = i;
|
||||||
|
|
||||||
map<string, int>& parNames = parNamesMain;
|
|
||||||
|
|
||||||
bool isContainsFunctions = false;
|
|
||||||
for (auto st = start; st != last; st = st->lexNext())
|
for (auto st = start; st != last; st = st->lexNext())
|
||||||
{
|
{
|
||||||
if (st->variant() == CONTAINS_STMT) {
|
if (st->variant() == CONTAINS_STMT)
|
||||||
isContainsFunctions = true;
|
break;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isContainsFunctions) {
|
|
||||||
if (st->variant() == PROC_HEDR || st->variant() == FUNC_HEDR) {
|
|
||||||
parNamesContains = parNamesMain;
|
|
||||||
|
|
||||||
SgProgHedrStmt* hedr = (SgProgHedrStmt*)st;
|
|
||||||
|
|
||||||
int numOfParams = hedr->numberOfParameters();
|
|
||||||
if (numOfParams > 0)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < numOfParams; ++i)
|
|
||||||
{
|
|
||||||
auto it = parNamesContains.find(hedr->parameter(i)->identifier());
|
|
||||||
if (it != parNamesContains.end())
|
|
||||||
parNamesContains.erase(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parNames = parNamesContains;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (st->variant() == ENTRY_STAT)
|
if (st->variant() == ENTRY_STAT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (isSgExecutableStatement(st) == NULL) {
|
if (isSgExecutableStatement(st) == NULL) {
|
||||||
if (!isContainsFunctions)
|
|
||||||
checkInTypeDescription(st->expr(0), currF, parNames);
|
checkInTypeDescription(st->expr(0), currF, parNames);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -848,10 +821,8 @@ static void fillInOut(FuncInfo *currF, SgStatement *start, SgStatement *last, co
|
|||||||
if (st->lineNumber() <= 0)
|
if (st->lineNumber() <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//XXX: use parameters removing in block ... isContainsFunctions ...
|
if (activeOps.size() && activeOps.find(st) == activeOps.end())
|
||||||
//TODO need to use IR for parameters checking
|
continue;
|
||||||
/*if (activeOps.size() && activeOps.find(st) == activeOps.end())
|
|
||||||
continue; */
|
|
||||||
|
|
||||||
if (st->variant() == ASSIGN_STAT)
|
if (st->variant() == ASSIGN_STAT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -470,6 +470,8 @@ static bool reorderOperatorsInBasicBlockUsingDeps(SAPFOR::BasicBlock* bb, const
|
|||||||
// as close as possible after its last dependency (if any).
|
// as close as possible after its last dependency (if any).
|
||||||
const auto depsMap = analyzeBasicBlockIntraDependencies(bb);
|
const auto depsMap = analyzeBasicBlockIntraDependencies(bb);
|
||||||
vector<SgStatement*> order = ops;
|
vector<SgStatement*> order = ops;
|
||||||
|
const vector<SgStatement*> originalOrder = ops;
|
||||||
|
const int nOrig = (int)originalOrder.size();
|
||||||
|
|
||||||
auto indexIn = [](const vector<SgStatement*>& v, SgStatement* s) -> int
|
auto indexIn = [](const vector<SgStatement*>& v, SgStatement* s) -> int
|
||||||
{
|
{
|
||||||
@@ -479,37 +481,59 @@ static bool reorderOperatorsInBasicBlockUsingDeps(SAPFOR::BasicBlock* bb, const
|
|||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto indexInOriginal = [&](SgStatement* s) -> int
|
||||||
|
{
|
||||||
|
return indexIn(originalOrder, s);
|
||||||
|
};
|
||||||
|
|
||||||
for (SgStatement* s : ops)
|
for (SgStatement* s : ops)
|
||||||
{
|
{
|
||||||
auto itDeps = depsMap.find(s);
|
auto itDeps = depsMap.find(s);
|
||||||
if (itDeps == depsMap.end() || itDeps->second.empty())
|
if (itDeps == depsMap.end() || itDeps->second.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
int lastDepOrigIdx = -1;
|
||||||
|
for (SgStatement* dep : itDeps->second)
|
||||||
|
{
|
||||||
|
const int j = indexInOriginal(dep);
|
||||||
|
if (j >= 0)
|
||||||
|
lastDepOrigIdx = max(lastDepOrigIdx, j);
|
||||||
|
}
|
||||||
|
if (lastDepOrigIdx < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
SgStatement* successor = nullptr;
|
||||||
|
if (lastDepOrigIdx + 1 < nOrig)
|
||||||
|
successor = originalOrder[lastDepOrigIdx + 1];
|
||||||
|
|
||||||
int posS = indexIn(order, s);
|
int posS = indexIn(order, s);
|
||||||
if (posS < 0)
|
if (posS < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int lastDepIdx = -1;
|
if (successor == nullptr)
|
||||||
for (SgStatement* dep : itDeps->second)
|
|
||||||
{
|
{
|
||||||
const int j = indexIn(order, dep);
|
if (posS == (int)order.size() - 1)
|
||||||
if (j >= 0)
|
continue;
|
||||||
lastDepIdx = max(lastDepIdx, j);
|
order.erase(order.begin() + posS);
|
||||||
|
order.push_back(s);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (lastDepIdx < 0)
|
|
||||||
|
if (successor == s)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (posS == lastDepIdx + 1)
|
const int posSucc = indexIn(order, successor);
|
||||||
|
if (posSucc < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (posS + 1 == posSucc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
order.erase(order.begin() + posS);
|
order.erase(order.begin() + posS);
|
||||||
|
const int posSucc2 = indexIn(order, successor);
|
||||||
int lp = lastDepIdx;
|
if (posSucc2 < 0)
|
||||||
if (posS < lastDepIdx)
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
lp = lastDepIdx - 1;
|
order.insert(order.begin() + posSucc2, s);
|
||||||
|
|
||||||
const int insertAt = lp + 1;
|
|
||||||
order.insert(order.begin() + insertAt, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2473"
|
#define VERSION_SPF "2472"
|
||||||
|
|||||||
Reference in New Issue
Block a user