67da2e7fbc1b1d3a9dbafba12125897f7de6945c
[oota-llvm.git] / include / llvm / Analysis / LoopDependenceAnalysis.h
1 //===- llvm/Analysis/LoopDependenceAnalysis.h --------------- -*- C++ -*---===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // LoopDependenceAnalysis is an LLVM pass that analyses dependences in memory
11 // accesses in loops.
12 //
13 // Please note that this is work in progress and the interface is subject to
14 // change.
15 //
16 // TODO: adapt as interface progresses
17 //
18 //===----------------------------------------------------------------------===//
19
20 #ifndef LLVM_ANALYSIS_LOOP_DEPENDENCE_ANALYSIS_H
21 #define LLVM_ANALYSIS_LOOP_DEPENDENCE_ANALYSIS_H
22
23 #include "llvm/Analysis/LoopPass.h"
24 #include "llvm/Support/raw_ostream.h"
25 #include <iosfwd>
26
27 namespace llvm {
28
29   class AliasAnalysis;
30   class AnalysisUsage;
31   class ScalarEvolution;
32   class Value;
33
34   class LoopDependenceAnalysis : public LoopPass {
35     Loop *L;
36     AliasAnalysis *AA;
37     ScalarEvolution *SE;
38
39   public:
40     static char ID; // Class identification, replacement for typeinfo
41     LoopDependenceAnalysis() : LoopPass(&ID) {}
42
43     /// TODO: docs
44     bool isDependencePair(const Value*, const Value*) const;
45     bool depends(Value*, Value*);
46
47     bool runOnLoop(Loop*, LPPassManager&);
48
49     virtual void getAnalysisUsage(AnalysisUsage&) const;
50
51     void print(raw_ostream&, const Module* = 0) const;
52     virtual void print(std::ostream&, const Module* = 0) const;
53   }; // class LoopDependenceAnalysis
54
55
56   // createLoopDependenceAnalysisPass - This creates an instance of the
57   // LoopDependenceAnalysis pass.
58   //
59   LoopPass *createLoopDependenceAnalysisPass();
60
61 } // namespace llvm
62
63 #endif /* LLVM_ANALYSIS_LOOP_DEPENDENCE_ANALYSIS_H */