diff --git a/src/PrivateAnalyzer/region.cpp b/src/PrivateAnalyzer/region.cpp index 29fa27c..ea966d9 100644 --- a/src/PrivateAnalyzer/region.cpp +++ b/src/PrivateAnalyzer/region.cpp @@ -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 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 index_vars;