/// through the loop.
typedef std::map<const Loop *, const SCEV *> LoopBoundMapType;
-typedef std::deque<MemoryAccess> AccFuncSetType;
-typedef std::map<const BasicBlock *, AccFuncSetType> AccFuncMapType;
+typedef std::vector<std::unique_ptr<MemoryAccess>> AccFuncVector;
/// @brief A class to store information about arrays in the SCoP.
///
/// The underlying Region.
Region &R;
- // Access function of statements (currently BasicBlocks) .
+ // Access functions of the SCoP.
//
// This owns all the MemoryAccess objects of the Scop created in this pass.
- AccFuncMapType AccFuncMap;
+ AccFuncVector AccessFunctions;
/// Flag to indicate that the scheduler actually optimized the SCoP.
bool IsOptimized;
Scop(Region &R, ScalarEvolution &SE, LoopInfo &LI,
ScopDetection::DetectionContext &DC);
- /// @brief Get or create the access function set in a BasicBlock
- AccFuncSetType &getOrCreateAccessFunctions(const BasicBlock *BB) {
- return AccFuncMap[BB];
+ /// @brief Add the access function to all MemoryAccess objects of the Scop
+ /// created in this pass.
+ void addAccessFunction(MemoryAccess *Access) {
+ AccessFunctions.emplace_back(Access);
}
//@}
public:
~Scop();
- /// @brief Get all access functions in a BasicBlock
- ///
- /// @param BB The BasicBlock that containing the access functions.
- ///
- /// @return All access functions in BB
- ///
- AccFuncSetType *getAccessFunctions(const BasicBlock *BB) {
- AccFuncMapType::iterator at = AccFuncMap.find(BB);
- return at != AccFuncMap.end() ? &(at->second) : 0;
- }
-
ScalarEvolution *getSE() const;
/// @brief Get the count of parameters used in this Scop.
if (!Stmt)
return nullptr;
- AccFuncSetType &AccList = scop->getOrCreateAccessFunctions(BB);
Value *BaseAddr = BaseAddress;
std::string BaseName = getIslCompatibleName("MemRef_", BaseAddr, "");
if (!isKnownMustAccess && AccType == MemoryAccess::MUST_WRITE)
AccType = MemoryAccess::MAY_WRITE;
- AccList.emplace_back(Stmt, Inst, AccType, BaseAddress, ElementType, Affine,
+ auto *Access =
+ new MemoryAccess(Stmt, Inst, AccType, BaseAddress, ElementType, Affine,
Subscripts, Sizes, AccessValue, Kind, BaseName);
- Stmt->addAccess(&AccList.back());
- return &AccList.back();
+
+ scop->addAccessFunction(Access);
+ Stmt->addAccess(Access);
+ return Access;
}
void ScopBuilder::addArrayAccess(