add directives

This commit is contained in:
2025-12-04 08:54:09 +03:00
parent a0cea2df91
commit 40cfd83de5
4 changed files with 77 additions and 13 deletions

View File

@@ -139,17 +139,16 @@ static int GetDefUseArray(SAPFOR::BasicBlock* block, LoopGraph* loop, ArrayAcces
}
if(coefsForDims.empty())
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
int fillCount = 0;
while (!index_vars.empty())
while (!index_vars.empty() && !refPos.empty() && !coefsForDims.empty())
{
auto var = index_vars.back();
int currentVarPos = refPos.back();
pair<int, int> currentCoefs = coefsForDims.back();
ArrayDimension current_dim;
if (var->getType() == SAPFOR::CFG_ARG_TYPE::CONST)
current_dim = { stoul(var->getValue()), 1, 1 };
current_dim = { stoul(var->getValue()), 1, 1, ref};
else
{
string name, full_name = var->getValue();
@@ -177,19 +176,23 @@ static int GetDefUseArray(SAPFOR::BasicBlock* block, LoopGraph* loop, ArrayAcces
uint64_t start = currentLoop->startVal * currentCoefs.first + currentCoefs.second;
uint64_t step = currentCoefs.first;
current_dim = { start, step, (uint64_t)currentLoop->calculatedCountOfIters };
current_dim = { start, step, (uint64_t)currentLoop->calculatedCountOfIters, ref };
}
accessPoint[n - index_vars.size()] = current_dim;
fillCount++;
index_vars.pop_back();
refPos.pop_back();
coefsForDims.pop_back();
}
if (operation == SAPFOR::CFG_OP::STORE)
def[array_name].Insert(accessPoint);
else
use[array_name].Insert(accessPoint);
if (fillCount == accessPoint.size())
{
if (operation == SAPFOR::CFG_OP::STORE)
def[array_name].Insert(accessPoint);
else
use[array_name].Insert(accessPoint);
}
}
}
return 0;