Merge branch 'master' into par_reg_merging
This commit is contained in:
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 };
|
||||
}
|
||||
|
||||
static void getDefsFromBlock(SAPFOR::BasicBlock* block, set<SAPFOR::Argument*>& res,
|
||||
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 (auto ir_block : block->getInstructions())
|
||||
for (const 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);
|
||||
@@ -236,12 +262,20 @@ 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, block->getInstructions()[place - first_instr_num]->getInstruction());
|
||||
addPlaceWithDef(commonVars, func, def.first, instr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// recursively analyze FOR loops
|
||||
@@ -266,7 +300,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 (auto bb : blocks)
|
||||
for (const auto &bb : blocks)
|
||||
{
|
||||
if (!bb || (bb->getInstructions().size() == 0))
|
||||
continue;
|
||||
@@ -348,7 +382,7 @@ static set<SAPFOR::BasicBlock*> analyzeLoop(LoopGraph* loop, const set<SAPFOR::B
|
||||
getDefsFromBlock(*loop_it, changeValueOnExit, commonVars, func);
|
||||
|
||||
|
||||
for (auto bb : currentLoop)
|
||||
for (const auto &bb : currentLoop)
|
||||
{
|
||||
//fill LiveWhenLoopEnds
|
||||
bool has_next_outside_body = false;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2452"
|
||||
#define VERSION_SPF "2453"
|
||||
|
||||
Reference in New Issue
Block a user