1 Commits

Author SHA1 Message Date
ffba174810 REMOVE_DIST_ARRAYS_FROM_IO: fix type, add TODO 2026-01-18 14:08:40 +03:00
3 changed files with 8 additions and 42 deletions

View File

@@ -200,46 +200,20 @@ static void fillOutForFunc(const FuncInfo* func, const vector<SAPFOR::BasicBlock
outForFunc[func->funcName] = { defined, common_defined };
}
static bool isInstructionSpfParameter(SAPFOR::Instruction* instr)
{
SgStatement* st = instr->getOperator();
// check if this operator is SPF(ANALYSIS(PARAMETER( )))
if (st && st->variant() == ASSIGN_STAT)
{
if (st->lineNumber() < 0 && st->numberOfAttributes())
{
for (int i = 0; i < st->numberOfAttributes(); ++i)
{
SgAttribute* attr = st->getAttribute(i);
SgStatement* attributeStatement = (SgStatement*)(attr->getAttributeData());
int type = st->attributeType(i);
if (type == SPF_PARAMETER_OP)
return true;
}
}
}
return false;
}
static void getDefsFromBlock(SAPFOR::BasicBlock* block, set<SAPFOR::Argument*>& res,
const vector<pair<const Variable*, CommonBlock*>>& commonVars,
const FuncInfo* func)
{
vector<SAPFOR::Argument*> lastParamRef;
for (const auto &ir_block : block->getInstructions())
for (auto ir_block : block->getInstructions())
{
SAPFOR::Instruction* instr = ir_block->getInstruction();
if (isInstructionSpfParameter(instr))
continue;
SAPFOR::CFG_OP instr_operation = instr->getOperation();
if (instr_operation == SAPFOR::CFG_OP::PARAM)
{
SAPFOR::Argument* arg = instr->getArg1();
if (arg->getType() == SAPFOR::CFG_ARG_TYPE::VAR)
if(arg->getType() == SAPFOR::CFG_ARG_TYPE::VAR)
addPlaceWithDef(commonVars, func, arg, instr);
lastParamRef.push_back(arg);
@@ -262,19 +236,11 @@ static void getDefsFromBlock(SAPFOR::BasicBlock* block, set<SAPFOR::Argument*>&
int last_instr_num = block->getInstructions().back()->getNumber();
for (const auto& def : block->getRD_Out())
{
for (int place : def.second)
{
if (place >= first_instr_num && place <= last_instr_num && def.first->getType() == SAPFOR::CFG_ARG_TYPE::VAR)
{
SAPFOR::Instruction* instr = block->getInstructions()[place - first_instr_num]->getInstruction();
if (isInstructionSpfParameter(instr))
continue;
res.insert(def.first);
addPlaceWithDef(commonVars, func, def.first, instr);
}
}
addPlaceWithDef(commonVars, func, def.first, block->getInstructions()[place - first_instr_num]->getInstruction());
}
}
@@ -300,7 +266,7 @@ static set<SAPFOR::BasicBlock*> analyzeLoop(LoopGraph* loop, const set<SAPFOR::B
SAPFOR::BasicBlock* head_block = NULL;
int loop_start = loop->lineNum, loop_end = loop->lineNumAfterLoop;
for (const auto &bb : blocks)
for (auto bb : blocks)
{
if (!bb || (bb->getInstructions().size() == 0))
continue;
@@ -382,7 +348,7 @@ static set<SAPFOR::BasicBlock*> analyzeLoop(LoopGraph* loop, const set<SAPFOR::B
getDefsFromBlock(*loop_it, changeValueOnExit, commonVars, func);
for (const auto &bb : currentLoop)
for (auto bb : currentLoop)
{
//fill LiveWhenLoopEnds
bool has_next_outside_body = false;

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2453"
#define VERSION_SPF "2452"