add whole array assign
This commit is contained in:
@@ -105,6 +105,31 @@ static int GetDefUseArray(SAPFOR::BasicBlock* block, LoopGraph* loop, ArrayAcces
|
||||
|
||||
auto operation = instruction->getInstruction()->getOperation();
|
||||
auto type = instruction->getInstruction()->getArg1()->getType();
|
||||
if (operation == SAPFOR::CFG_OP::ASSIGN && instruction->getInstruction()->getResult()->getType() == SAPFOR::CFG_ARG_TYPE::ARRAY)
|
||||
{
|
||||
SgStatement* op = instruction->getInstruction()->getOperator();
|
||||
if (op && op->expr(0) && isArrayRef(op->expr(0)) && op->expr(0)->symbol() && op->expr(0)->type())
|
||||
{
|
||||
if (isSgArrayType(op->expr(0)->symbol()->type()))
|
||||
{
|
||||
SgArrayType* arrayType = (SgArrayType*)op->expr(0)->symbol()->type();
|
||||
int dimCount = ((SgArrayType*)op->expr(0)->symbol()->type())->dimension();
|
||||
vector<ArrayDimension> point;
|
||||
for (int i = 0; i < dimCount; i++)
|
||||
{
|
||||
string strDimLength = arrayType->sizeInDim(i)->unparse();
|
||||
if (arrayType->sizeInDim(i)->variant() == INT_VAL && strDimLength != "0")
|
||||
{
|
||||
point.push_back({ 1ULL, 1ULL, (uint64_t)stoi(strDimLength), (SgArrayRefExp*)op->expr(0) });
|
||||
}
|
||||
}
|
||||
if (point.size() == dimCount)
|
||||
{
|
||||
def[instruction->getInstruction()->getResult()->getValue()] = AccessingSet({point});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((operation == SAPFOR::CFG_OP::STORE || operation == SAPFOR::CFG_OP::LOAD) && type == SAPFOR::CFG_ARG_TYPE::ARRAY)
|
||||
{
|
||||
vector<SAPFOR::Argument*> index_vars;
|
||||
|
||||
Reference in New Issue
Block a user