[LoopAccesses] Add -analyze support
[oota-llvm.git] / include / llvm / Analysis / LoopAccessAnalysis.h
index a2f938ca67c07812b59c07077527ca1ccb3e78f3..b54279aa1b6fedba3ac962b449b61dc7a44bfb3d 100644 (file)
@@ -122,10 +122,16 @@ public:
     void insert(ScalarEvolution *SE, Loop *Lp, Value *Ptr, bool WritePtr,
                 unsigned DepSetId, unsigned ASId, ValueToValueMap &Strides);
 
+    /// \brief No run-time memory checking is necessary.
+    bool empty() const { return Pointers.empty(); }
+
     /// \brief Decide whether we need to issue a run-time check for pointer at
     /// index \p I and \p J to prove their independence.
     bool needsChecking(unsigned I, unsigned J) const;
 
+    /// \brief Print the list run-time memory checks necessary.
+    void print(raw_ostream &OS, unsigned Depth = 0) const;
+
     /// This flag indicates if we need to add the runtime check.
     bool Need;
     /// Holds the pointers that we need to check.
@@ -176,6 +182,9 @@ public:
   /// couldn't analyze the loop.
   Optional<LoopAccessReport> &getReport() { return Report; }
 
+  /// \brief Print the information about the memory accesses in the loop.
+  void print(raw_ostream &OS, unsigned Depth = 0) const;
+
   /// \brief Used to ensure that if the analysis was run with speculating the
   /// value of symbolic strides, the client queries it with the same assumption.
   /// Only used in DEBUG build but we don't want NDEBUG-depedent ABI.
@@ -258,6 +267,9 @@ public:
     LoopAccessInfoMap.clear();
   }
 
+  /// \brief Print the result of the analysis when invoked with -analyze.
+  void print(raw_ostream &OS, const Module *M = nullptr) const override;
+
 private:
   /// \brief The cache.
   DenseMap<Loop *, std::unique_ptr<LoopAccessInfo>> LoopAccessInfoMap;