[MemAccInst] Introduce the '->' operator and remove the simple wrapper functions...
authorHongbin Zheng <etherzhhb@gmail.com>
Fri, 26 Feb 2016 09:47:11 +0000 (09:47 +0000)
committerHongbin Zheng <etherzhhb@gmail.com>
Fri, 26 Feb 2016 09:47:11 +0000 (09:47 +0000)
llvm-svn: 261994

polly/include/polly/Support/ScopHelper.h
polly/lib/Analysis/ScopDetection.cpp
polly/lib/Analysis/ScopInfo.cpp

index 371fa41..aa1a662 100644 (file)
@@ -150,26 +150,16 @@ public:
     return *this;
   }
 
+  llvm::Instruction *get() const {
+    assert(I && "Unexpected nullptr!");
+    return I;
+  }
   operator llvm::Instruction *() const { return asInstruction(); }
+  llvm::Instruction *operator->() const { return get(); }
+
   explicit operator bool() const { return isInstruction(); }
   bool operator!() const { return isNull(); }
 
-  llvm::Value *getOperand(unsigned i) const { return I->getOperand(i); }
-  llvm::BasicBlock *getParent() const { return I->getParent(); }
-  llvm::LLVMContext &getContext() const { return I->getContext(); }
-  void getAAMetadata(llvm::AAMDNodes &N, bool Merge = false) const {
-    I->getAAMetadata(N, Merge);
-  }
-
-  /// @brief Get the debug location of this instruction.
-  ///
-  /// @returns The debug location of this instruction.
-  const llvm::DebugLoc &getDebugLoc() const {
-    if (I)
-      return I->getDebugLoc();
-    llvm_unreachable("Operation not supported on nullptr");
-  }
-
   llvm::Value *getValueOperand() const {
     if (isLoad())
       return asLoad();
index a8833f1..2046a90 100644 (file)
@@ -942,7 +942,7 @@ bool ScopDetection::isValidAccess(Instruction *Inst, const SCEV *AF,
 bool ScopDetection::isValidMemoryAccess(MemAccInst Inst,
                                         DetectionContext &Context) const {
   Value *Ptr = Inst.getPointerOperand();
-  Loop *L = LI->getLoopFor(Inst.getParent());
+  Loop *L = LI->getLoopFor(Inst->getParent());
   const SCEV *AccessFunction = SE->getSCEVAtScope(Ptr, L);
   const SCEVUnknown *BasePointer;
 
index eeed801..bb62f5c 100644 (file)
@@ -3926,7 +3926,7 @@ bool ScopInfo::buildAccessMultiDimParam(
         cast<SCEVConstant>(Sizes.back())->getAPInt().getSExtValue();
     Sizes.pop_back();
     if (ElementSize != DelinearizedSize)
-      scop->invalidate(DELINEARIZATION, Inst.getDebugLoc());
+      scop->invalidate(DELINEARIZATION, Inst->getDebugLoc());
 
     addArrayAccess(Inst, Type, BasePointer->getValue(), ElementType, true,
                    AccItr->second.DelinearizedSubscripts, Sizes, Val);
@@ -4218,7 +4218,7 @@ void ScopInfo::addArrayAccess(MemAccInst MemAccInst,
                               ArrayRef<const SCEV *> Sizes,
                               Value *AccessValue) {
   ArrayBasePointers.insert(BaseAddress);
-  addMemoryAccess(MemAccInst.getParent(), MemAccInst, AccType, BaseAddress,
+  addMemoryAccess(MemAccInst->getParent(), MemAccInst, AccType, BaseAddress,
                   ElementType, IsAffine, AccessValue, Subscripts, Sizes,
                   ScopArrayInfo::MK_Array);
 }