Compare commits
3 Commits
ffba174810
...
fix_array_
| Author | SHA1 | Date | |
|---|---|---|---|
| 998fbc3036 | |||
|
|
331d4f9d99 | ||
|
|
904292f109 |
Submodule projects/libpredictor updated: 5cf49ecbff...d08cb25cc6
@@ -200,20 +200,46 @@ static void fillOutForFunc(const FuncInfo* func, const vector<SAPFOR::BasicBlock
|
|||||||
outForFunc[func->funcName] = { defined, common_defined };
|
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,
|
static void getDefsFromBlock(SAPFOR::BasicBlock* block, set<SAPFOR::Argument*>& res,
|
||||||
const vector<pair<const Variable*, CommonBlock*>>& commonVars,
|
const vector<pair<const Variable*, CommonBlock*>>& commonVars,
|
||||||
const FuncInfo* func)
|
const FuncInfo* func)
|
||||||
{
|
{
|
||||||
vector<SAPFOR::Argument*> lastParamRef;
|
vector<SAPFOR::Argument*> lastParamRef;
|
||||||
|
|
||||||
for (auto ir_block : block->getInstructions())
|
for (const auto &ir_block : block->getInstructions())
|
||||||
{
|
{
|
||||||
SAPFOR::Instruction* instr = ir_block->getInstruction();
|
SAPFOR::Instruction* instr = ir_block->getInstruction();
|
||||||
|
if (isInstructionSpfParameter(instr))
|
||||||
|
continue;
|
||||||
|
|
||||||
SAPFOR::CFG_OP instr_operation = instr->getOperation();
|
SAPFOR::CFG_OP instr_operation = instr->getOperation();
|
||||||
if (instr_operation == SAPFOR::CFG_OP::PARAM)
|
if (instr_operation == SAPFOR::CFG_OP::PARAM)
|
||||||
{
|
{
|
||||||
SAPFOR::Argument* arg = instr->getArg1();
|
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);
|
addPlaceWithDef(commonVars, func, arg, instr);
|
||||||
|
|
||||||
lastParamRef.push_back(arg);
|
lastParamRef.push_back(arg);
|
||||||
@@ -236,11 +262,19 @@ static void getDefsFromBlock(SAPFOR::BasicBlock* block, set<SAPFOR::Argument*>&
|
|||||||
int last_instr_num = block->getInstructions().back()->getNumber();
|
int last_instr_num = block->getInstructions().back()->getNumber();
|
||||||
|
|
||||||
for (const auto& def : block->getRD_Out())
|
for (const auto& def : block->getRD_Out())
|
||||||
|
{
|
||||||
for (int place : def.second)
|
for (int place : def.second)
|
||||||
|
{
|
||||||
if (place >= first_instr_num && place <= last_instr_num && def.first->getType() == SAPFOR::CFG_ARG_TYPE::VAR)
|
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);
|
res.insert(def.first);
|
||||||
addPlaceWithDef(commonVars, func, def.first, block->getInstructions()[place - first_instr_num]->getInstruction());
|
addPlaceWithDef(commonVars, func, def.first, instr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +300,7 @@ static set<SAPFOR::BasicBlock*> analyzeLoop(LoopGraph* loop, const set<SAPFOR::B
|
|||||||
SAPFOR::BasicBlock* head_block = NULL;
|
SAPFOR::BasicBlock* head_block = NULL;
|
||||||
|
|
||||||
int loop_start = loop->lineNum, loop_end = loop->lineNumAfterLoop;
|
int loop_start = loop->lineNum, loop_end = loop->lineNumAfterLoop;
|
||||||
for (auto bb : blocks)
|
for (const auto &bb : blocks)
|
||||||
{
|
{
|
||||||
if (!bb || (bb->getInstructions().size() == 0))
|
if (!bb || (bb->getInstructions().size() == 0))
|
||||||
continue;
|
continue;
|
||||||
@@ -348,7 +382,7 @@ static set<SAPFOR::BasicBlock*> analyzeLoop(LoopGraph* loop, const set<SAPFOR::B
|
|||||||
getDefsFromBlock(*loop_it, changeValueOnExit, commonVars, func);
|
getDefsFromBlock(*loop_it, changeValueOnExit, commonVars, func);
|
||||||
|
|
||||||
|
|
||||||
for (auto bb : currentLoop)
|
for (const auto &bb : currentLoop)
|
||||||
{
|
{
|
||||||
//fill LiveWhenLoopEnds
|
//fill LiveWhenLoopEnds
|
||||||
bool has_next_outside_body = false;
|
bool has_next_outside_body = false;
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ static void replaceArrayInFragment(SgSymbol* replace_symb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ioRegionBorder(SgStatement* stat, SgStatement* last_io_bound)
|
static bool ioReginBorder(SgStatement* stat, SgStatement* last_io_bound)
|
||||||
{
|
{
|
||||||
auto var = stat->variant();
|
auto var = stat->variant();
|
||||||
|
|
||||||
@@ -535,6 +535,8 @@ static bool ioRegionBorder(SgStatement* stat, SgStatement* last_io_bound)
|
|||||||
if (last_io_bound && last_io_bound->lastNodeOfStmt() && last_io_bound->lastNodeOfStmt() == stat)
|
if (last_io_bound && last_io_bound->lastNodeOfStmt() && last_io_bound->lastNodeOfStmt() == stat)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
int parent_var;
|
||||||
|
|
||||||
if (var == CONTROL_END && border_stats.find(stat->controlParent()->variant()) != border_stats.end())
|
if (var == CONTROL_END && border_stats.find(stat->controlParent()->variant()) != border_stats.end())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -600,7 +602,6 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
|
|||||||
|
|
||||||
auto var = curr_stmt->variant();
|
auto var = curr_stmt->variant();
|
||||||
|
|
||||||
// TODO: does not work with user regions
|
|
||||||
if (var == PROC_HEDR || var == PROG_HEDR || var == FUNC_HEDR)
|
if (var == PROC_HEDR || var == PROG_HEDR || var == FUNC_HEDR)
|
||||||
{
|
{
|
||||||
current_func_info = NULL;
|
current_func_info = NULL;
|
||||||
@@ -627,7 +628,7 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioRegionBorder(curr_stmt, last_io_bound))
|
if (ioReginBorder(curr_stmt, last_io_bound))
|
||||||
{
|
{
|
||||||
for (const auto& by_array_to_copy : need_replace)
|
for (const auto& by_array_to_copy : need_replace)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1314,7 +1314,7 @@ tuple<int, string, string> getUniqName(const map<string, vector<SgExpression*>>
|
|||||||
|
|
||||||
tuple<int, string, string> retVal;
|
tuple<int, string, string> retVal;
|
||||||
if (inCommon)
|
if (inCommon)
|
||||||
retVal = make_tuple(commonPos, string("common_") + getCommonName(foundCommon), string(symb->identifier()));
|
retVal = make_tuple(commonPos, string("common_") + getCommonName(foundCommon), "");
|
||||||
else
|
else
|
||||||
retVal = make_tuple(decl->lineNumber(), string(decl->fileName()), string(symb->identifier()));
|
retVal = make_tuple(decl->lineNumber(), string(decl->fileName()), string(symb->identifier()));
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2452"
|
#define VERSION_SPF "2453"
|
||||||
|
|||||||
Reference in New Issue
Block a user