MemoryDependenceAnalysis.h revision 25f4b2b7a3f1f2bbaf954257e7834ba29a6ede7c
178e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//===- llvm/Analysis/MemoryDependenceAnalysis.h - Memory Deps  --*- C++ -*-===//
278e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//
378e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//                     The LLVM Compiler Infrastructure
478e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//
57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source
67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details.
778e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//
878e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//===----------------------------------------------------------------------===//
978e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//
10e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner// This file defines the MemoryDependenceAnalysis analysis pass.
1178e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//
1278e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson//===----------------------------------------------------------------------===//
1378e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
1478e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson#ifndef LLVM_ANALYSIS_MEMORY_DEPENDENCE_H
1578e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson#define LLVM_ANALYSIS_MEMORY_DEPENDENCE_H
1678e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
175391a1d8046396fb4dd005b1910973789f5427f4Chris Lattner#include "llvm/BasicBlock.h"
1878e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson#include "llvm/Pass.h"
1978e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson#include "llvm/ADT/DenseMap.h"
204beedbd0063a8ba6f97db02c3c94707d8ab45b50Owen Anderson#include "llvm/ADT/SmallPtrSet.h"
2139f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner#include "llvm/ADT/PointerIntPair.h"
2278e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
2378e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Andersonnamespace llvm {
24e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner  class Function;
25e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner  class FunctionPass;
26e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner  class Instruction;
27b390b1728e6c36f1f28d75d6f8f27cb91f8a8c56Chris Lattner  class CallSite;
284c724006256032e827177afeae04ea62436796e7Chris Lattner
294c724006256032e827177afeae04ea62436796e7Chris Lattner  /// MemDepResult - A memory dependence query can return one of three different
304c724006256032e827177afeae04ea62436796e7Chris Lattner  /// answers:
314c724006256032e827177afeae04ea62436796e7Chris Lattner  ///   Normal  : The query is dependent on a specific instruction.
324c724006256032e827177afeae04ea62436796e7Chris Lattner  ///   NonLocal: The query does not depend on anything inside this block, but
334c724006256032e827177afeae04ea62436796e7Chris Lattner  ///             we haven't scanned beyond the block to find out what.
344c724006256032e827177afeae04ea62436796e7Chris Lattner  ///   None    : The query does not depend on anything: we found the entry
354c724006256032e827177afeae04ea62436796e7Chris Lattner  ///             block or the allocation site of the memory.
364c724006256032e827177afeae04ea62436796e7Chris Lattner  class MemDepResult {
374c724006256032e827177afeae04ea62436796e7Chris Lattner    enum DepType {
384c724006256032e827177afeae04ea62436796e7Chris Lattner      Invalid = 0, Normal, NonLocal, None
394c724006256032e827177afeae04ea62436796e7Chris Lattner    };
404c724006256032e827177afeae04ea62436796e7Chris Lattner    typedef PointerIntPair<Instruction*, 2, DepType> PairTy;
414c724006256032e827177afeae04ea62436796e7Chris Lattner    PairTy Value;
424c724006256032e827177afeae04ea62436796e7Chris Lattner    explicit MemDepResult(PairTy V) : Value(V) {}
434c724006256032e827177afeae04ea62436796e7Chris Lattner  public:
444c724006256032e827177afeae04ea62436796e7Chris Lattner    MemDepResult() : Value(0, Invalid) {}
454c724006256032e827177afeae04ea62436796e7Chris Lattner
464c724006256032e827177afeae04ea62436796e7Chris Lattner    /// get methods: These are static ctor methods for creating various
474c724006256032e827177afeae04ea62436796e7Chris Lattner    /// MemDepResult kinds.
484c724006256032e827177afeae04ea62436796e7Chris Lattner    static MemDepResult get(Instruction *Inst) {
494c724006256032e827177afeae04ea62436796e7Chris Lattner      return MemDepResult(PairTy(Inst, Normal));
504c724006256032e827177afeae04ea62436796e7Chris Lattner    }
514c724006256032e827177afeae04ea62436796e7Chris Lattner    static MemDepResult getNonLocal() {
524c724006256032e827177afeae04ea62436796e7Chris Lattner      return MemDepResult(PairTy(0, NonLocal));
534c724006256032e827177afeae04ea62436796e7Chris Lattner    }
544c724006256032e827177afeae04ea62436796e7Chris Lattner    static MemDepResult getNone() {
554c724006256032e827177afeae04ea62436796e7Chris Lattner      return MemDepResult(PairTy(0, None));
564c724006256032e827177afeae04ea62436796e7Chris Lattner    }
574c724006256032e827177afeae04ea62436796e7Chris Lattner
584c724006256032e827177afeae04ea62436796e7Chris Lattner    /// isNormal - Return true if this MemDepResult represents a query that is
594c724006256032e827177afeae04ea62436796e7Chris Lattner    /// a normal instruction dependency.
6086b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    bool isNormal() const { return Value.getInt() == Normal; }
614c724006256032e827177afeae04ea62436796e7Chris Lattner
624c724006256032e827177afeae04ea62436796e7Chris Lattner    /// isNonLocal - Return true if this MemDepResult represents an query that
634c724006256032e827177afeae04ea62436796e7Chris Lattner    /// is transparent to the start of the block, but where a non-local hasn't
644c724006256032e827177afeae04ea62436796e7Chris Lattner    /// been done.
6586b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    bool isNonLocal() const { return Value.getInt() == NonLocal; }
664c724006256032e827177afeae04ea62436796e7Chris Lattner
674c724006256032e827177afeae04ea62436796e7Chris Lattner    /// isNone - Return true if this MemDepResult represents a query that
684c724006256032e827177afeae04ea62436796e7Chris Lattner    /// doesn't depend on any instruction.
6986b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    bool isNone() const { return Value.getInt() == None; }
704c724006256032e827177afeae04ea62436796e7Chris Lattner
714c724006256032e827177afeae04ea62436796e7Chris Lattner    /// getInst() - If this is a normal dependency, return the instruction that
724c724006256032e827177afeae04ea62436796e7Chris Lattner    /// is depended on.  Otherwise, return null.
734c724006256032e827177afeae04ea62436796e7Chris Lattner    Instruction *getInst() const { return isNormal() ? Value.getPointer() : 0; }
744c724006256032e827177afeae04ea62436796e7Chris Lattner
754c724006256032e827177afeae04ea62436796e7Chris Lattner    bool operator==(const MemDepResult &M) { return M.Value == Value; }
764c724006256032e827177afeae04ea62436796e7Chris Lattner    bool operator!=(const MemDepResult &M) { return M.Value != Value; }
774c724006256032e827177afeae04ea62436796e7Chris Lattner  };
7878e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
79e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner  /// MemoryDependenceAnalysis - This is an analysis that determines, for a
80e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner  /// given memory operation, what preceding memory operations it depends on.
81e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner  /// It builds on alias analysis information, and tries to provide a lazy,
82e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner  /// caching interface to a common kind of alias information query.
830e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  ///
840e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// The dependency information returned is somewhat unusual, but is pragmatic.
850e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// If queried about a store or call that might modify memory, the analysis
860e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// will return the instruction[s] that may either load from that memory or
870e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// store to it.  If queried with a load or call that can never modify memory,
880e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// the analysis will return calls and stores that might modify the pointer,
890e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// but generally does not return loads unless a) they are volatile, or
900e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// b) they load from *must-aliased* pointers.  Returning a dependence on
910e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// must-alias'd pointers instead of all pointers interacts well with the
920e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  /// internal caching mechanism.
930e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner  ///
94e85866313a551fa3d4e2f118c3bf34e96af36763Chris Lattner  class MemoryDependenceAnalysis : public FunctionPass {
9539f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner    /// DepType - This enum is used to indicate what flavor of dependence this
9639f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner    /// is.  If the type is Normal, there is an associated instruction pointer.
9739f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner    enum DepType {
980ec48ddef20deaa061152d86645972122beef605Chris Lattner      /// Dirty - Entries with this marker occur in a LocalDeps map or
990ec48ddef20deaa061152d86645972122beef605Chris Lattner      /// NonLocalDeps map when the instruction they previously referenced was
1000ec48ddef20deaa061152d86645972122beef605Chris Lattner      /// removed from MemDep.  In either case, the entry may include an
1010ec48ddef20deaa061152d86645972122beef605Chris Lattner      /// instruction pointer.  If so, the pointer is an instruction in the
1020ec48ddef20deaa061152d86645972122beef605Chris Lattner      /// block where scanning can start from, saving some work.
1037f52422a3c821c1deb7171808ffcf83386970791Chris Lattner      ///
1047f52422a3c821c1deb7171808ffcf83386970791Chris Lattner      /// In a default-constructed DepResultTy object, the type will be Dirty
1057f52422a3c821c1deb7171808ffcf83386970791Chris Lattner      /// and the instruction pointer will be null.
1067f52422a3c821c1deb7171808ffcf83386970791Chris Lattner      ///
1077f52422a3c821c1deb7171808ffcf83386970791Chris Lattner      Dirty = 0,
1087f52422a3c821c1deb7171808ffcf83386970791Chris Lattner
10939f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner      /// Normal - This is a normal instruction dependence.  The pointer member
11039f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner      /// of the DepResultTy pair holds the instruction.
1117f52422a3c821c1deb7171808ffcf83386970791Chris Lattner      Normal,
11239f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner
11339f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner      /// None - This dependence type indicates that the query does not depend
114f68f310386c8e1772a3e6eba01f09590678a8f96Chris Lattner      /// on any instructions, either because it is not a memory instruction or
115f68f310386c8e1772a3e6eba01f09590678a8f96Chris Lattner      /// because it scanned to the definition of the memory (alloca/malloc)
116f68f310386c8e1772a3e6eba01f09590678a8f96Chris Lattner      /// being accessed.
11739f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner      None,
11839f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner
11939f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner      /// NonLocal - This marker indicates that the query has no dependency in
12039f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner      /// the specified block.  To find out more, the client should query other
12139f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner      /// predecessor blocks.
1227f52422a3c821c1deb7171808ffcf83386970791Chris Lattner      NonLocal
12339f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner    };
12439f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner    typedef PointerIntPair<Instruction*, 2, DepType> DepResultTy;
1254c724006256032e827177afeae04ea62436796e7Chris Lattner
1267f52422a3c821c1deb7171808ffcf83386970791Chris Lattner    // A map from instructions to their dependency.
1277f52422a3c821c1deb7171808ffcf83386970791Chris Lattner    typedef DenseMap<Instruction*, DepResultTy> LocalDepMapType;
12839f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner    LocalDepMapType LocalDeps;
129df464195fe049d5ea921e2e37f4f833c2ea4e3ecDavid Greene
13025f4b2b7a3f1f2bbaf954257e7834ba29a6ede7cChris Lattner    typedef DenseMap<BasicBlock*, DepResultTy> NonLocalDepInfo;
13125f4b2b7a3f1f2bbaf954257e7834ba29a6ede7cChris Lattner
13225f4b2b7a3f1f2bbaf954257e7834ba29a6ede7cChris Lattner
1334d13de4e3bfc5121207efd01e1b31caa6bb4e40bOwen Anderson    // A map from instructions to their non-local dependencies.
134956033a4f5de491fcc07bc3ef0700ad22fd836a0Chris Lattner    typedef DenseMap<Instruction*,
135f68f310386c8e1772a3e6eba01f09590678a8f96Chris Lattner                     // This is an owning pointer.
13625f4b2b7a3f1f2bbaf954257e7834ba29a6ede7cChris Lattner                     NonLocalDepInfo*> NonLocalDepMapType;
1378c4652790e04515f34cf920b0783d6ec4161a313Chris Lattner    NonLocalDepMapType NonLocalDeps;
1384d13de4e3bfc5121207efd01e1b31caa6bb4e40bOwen Anderson
139956033a4f5de491fcc07bc3ef0700ad22fd836a0Chris Lattner    // A reverse mapping from dependencies to the dependees.  This is
140179463c0d4c20bfb2c6b1e697eed6f16305a201eOwen Anderson    // used when removing instructions to keep the cache coherent.
1417f52422a3c821c1deb7171808ffcf83386970791Chris Lattner    typedef DenseMap<Instruction*,
1428c4652790e04515f34cf920b0783d6ec4161a313Chris Lattner                     SmallPtrSet<Instruction*, 4> > ReverseDepMapType;
1438c4652790e04515f34cf920b0783d6ec4161a313Chris Lattner    ReverseDepMapType ReverseLocalDeps;
14478e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
1454d13de4e3bfc5121207efd01e1b31caa6bb4e40bOwen Anderson    // A reverse mapping form dependencies to the non-local dependees.
1468c4652790e04515f34cf920b0783d6ec4161a313Chris Lattner    ReverseDepMapType ReverseNonLocalDeps;
1474d13de4e3bfc5121207efd01e1b31caa6bb4e40bOwen Anderson
148179463c0d4c20bfb2c6b1e697eed6f16305a201eOwen Anderson  public:
149ae73dc1448d25b02cabc7c64c86c64371453dda8Dan Gohman    MemoryDependenceAnalysis() : FunctionPass(&ID) {}
15039f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner    static char ID;
1511cee94f04111cfd7114979d6dfddce2669c9380dDevang Patel
15278e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    /// Pass Implementation stuff.  This doesn't do any analysis.
15378e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    ///
1546b278fc7860c1e0e5cf72340e43f78a87159be4cOwen Anderson    bool runOnFunction(Function &) {return false; }
1556b278fc7860c1e0e5cf72340e43f78a87159be4cOwen Anderson
1566b278fc7860c1e0e5cf72340e43f78a87159be4cOwen Anderson    /// Clean up memory in between runs
1576b278fc7860c1e0e5cf72340e43f78a87159be4cOwen Anderson    void releaseMemory() {
15839f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner      LocalDeps.clear();
159f68f310386c8e1772a3e6eba01f09590678a8f96Chris Lattner      for (NonLocalDepMapType::iterator I = NonLocalDeps.begin(),
160f68f310386c8e1772a3e6eba01f09590678a8f96Chris Lattner           E = NonLocalDeps.end(); I != E; ++I)
161f68f310386c8e1772a3e6eba01f09590678a8f96Chris Lattner        delete I->second;
1628c4652790e04515f34cf920b0783d6ec4161a313Chris Lattner      NonLocalDeps.clear();
1638c4652790e04515f34cf920b0783d6ec4161a313Chris Lattner      ReverseLocalDeps.clear();
1648c4652790e04515f34cf920b0783d6ec4161a313Chris Lattner      ReverseNonLocalDeps.clear();
16578e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    }
16678e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
16778e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    /// getAnalysisUsage - Does not modify anything.  It uses Value Numbering
16878e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    /// and Alias Analysis.
16978e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    ///
17078e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    virtual void getAnalysisUsage(AnalysisUsage &AU) const;
17178e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
17278e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    /// getDependency - Return the instruction on which a memory operation
1730e0a5b690ca772a9002d8e8d21edac5f011bc7e8Chris Lattner    /// depends.  See the class comment for more details.
1745391a1d8046396fb4dd005b1910973789f5427f4Chris Lattner    MemDepResult getDependency(Instruction *QueryInst);
1755391a1d8046396fb4dd005b1910973789f5427f4Chris Lattner
1765391a1d8046396fb4dd005b1910973789f5427f4Chris Lattner    /// getDependencyFrom - Return the instruction on which the memory operation
1775391a1d8046396fb4dd005b1910973789f5427f4Chris Lattner    /// 'QueryInst' depends.  This starts scanning from the instruction before
1785391a1d8046396fb4dd005b1910973789f5427f4Chris Lattner    /// the position indicated by ScanIt.
17973ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    ///
18073ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    /// Note that this method does no caching at all.  You should use
18173ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    /// getDependency where possible.
1825391a1d8046396fb4dd005b1910973789f5427f4Chris Lattner    MemDepResult getDependencyFrom(Instruction *QueryInst,
18373ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner                                   BasicBlock::iterator ScanIt, BasicBlock *BB){
18473ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner      return ConvToResult(getDependencyFromInternal(QueryInst, ScanIt, BB));
18573ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    }
1865391a1d8046396fb4dd005b1910973789f5427f4Chris Lattner
1874beedbd0063a8ba6f97db02c3c94707d8ab45b50Owen Anderson
18886b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    /// getNonLocalDependency - Perform a full dependency query for the
18986b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    /// specified instruction, returning the set of blocks that the value is
19086b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    /// potentially live across.  The returned set of results will include a
19186b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    /// "NonLocal" result for all blocks where the value is live across.
19286b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    ///
19386b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    /// This method assumes the instruction returns a "nonlocal" dependency
19486b29ef64a36c8779ef7855b3c4b95744eb2f08bChris Lattner    /// within its own block.
195233336ebc588e77dde51ebbc3ce88c2d4304f168Chris Lattner    void getNonLocalDependency(Instruction *QueryInst,
196396a4a55e535728e2023aa331401c1a2b782cb9aChris Lattner                               SmallVectorImpl<std::pair<BasicBlock*,
197396a4a55e535728e2023aa331401c1a2b782cb9aChris Lattner                                                       MemDepResult> > &Result);
19878e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
19978e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    /// removeInstruction - Remove an instruction from the dependence analysis,
20078e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson    /// updating the dependence of instructions that previously depended on it.
20139f372e23e49cecb8db2eb7120eb331173e50c74Chris Lattner    void removeInstruction(Instruction *InstToRemove);
202179463c0d4c20bfb2c6b1e697eed6f16305a201eOwen Anderson
203179463c0d4c20bfb2c6b1e697eed6f16305a201eOwen Anderson  private:
2044c724006256032e827177afeae04ea62436796e7Chris Lattner    MemDepResult ConvToResult(DepResultTy R) {
2054c724006256032e827177afeae04ea62436796e7Chris Lattner      if (R.getInt() == Normal)
2064c724006256032e827177afeae04ea62436796e7Chris Lattner        return MemDepResult::get(R.getPointer());
2074c724006256032e827177afeae04ea62436796e7Chris Lattner      if (R.getInt() == NonLocal)
2084c724006256032e827177afeae04ea62436796e7Chris Lattner        return MemDepResult::getNonLocal();
2094c724006256032e827177afeae04ea62436796e7Chris Lattner      assert(R.getInt() == None && "Unknown MemDepResult!");
2104c724006256032e827177afeae04ea62436796e7Chris Lattner      return MemDepResult::getNone();
2114c724006256032e827177afeae04ea62436796e7Chris Lattner    }
2124c724006256032e827177afeae04ea62436796e7Chris Lattner
2138b589fa135d873e683b29ed0918638a79272f5d2Chris Lattner    /// verifyRemoved - Verify that the specified instruction does not occur
2148b589fa135d873e683b29ed0918638a79272f5d2Chris Lattner    /// in our internal data structures.
2158b589fa135d873e683b29ed0918638a79272f5d2Chris Lattner    void verifyRemoved(Instruction *Inst) const;
2168b589fa135d873e683b29ed0918638a79272f5d2Chris Lattner
21773ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    /// getDependencyFromInternal - Return the instruction on which the memory
21873ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    /// operation 'QueryInst' depends.  This starts scanning from the
21973ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    /// instruction before the position indicated by ScanIt.
22073ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    DepResultTy getDependencyFromInternal(Instruction *QueryInst,
22173ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner                                   BasicBlock::iterator ScanIt, BasicBlock *BB);
22273ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner    DepResultTy getCallSiteDependency(CallSite C, BasicBlock::iterator ScanIt,
22373ec3cdd7140aee6d2b9ac32bc2298254ff48c97Chris Lattner                                      BasicBlock *BB);
22478e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson  };
22578e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
22678e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson} // End llvm namespace
22778e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson
22878e02f78ce68274163e1e63be59abd17aaaf6cbfOwen Anderson#endif
229