172a2be6bcf7cee14a6774673430e3371a035919
[oota-llvm.git] / lib / Analysis / LoopDependenceAnalysis.cpp
1 //===- LoopDependenceAnalysis.cpp - LDA Implementation ----------*- 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 // This is the (beginning) of an implementation of a loop dependence analysis
11 // framework, which is used to detect dependences in memory 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 implementation progresses.
17 //
18 //===----------------------------------------------------------------------===//
19
20 #define DEBUG_TYPE "lda"
21 #include "llvm/Analysis/LoopDependenceAnalysis.h"
22 #include "llvm/Analysis/LoopPass.h"
23 #include "llvm/Analysis/ScalarEvolution.h"
24 using namespace llvm;
25
26 LoopPass *llvm::createLoopDependenceAnalysisPass() {
27   return new LoopDependenceAnalysis();
28 }
29
30 static RegisterPass<LoopDependenceAnalysis>
31 R("lda", "Loop Dependence Analysis", false, true);
32 char LoopDependenceAnalysis::ID = 0;
33
34 //===----------------------------------------------------------------------===//
35 //                   LoopDependenceAnalysis Implementation
36 //===----------------------------------------------------------------------===//
37
38 bool LoopDependenceAnalysis::runOnLoop(Loop *L, LPPassManager &) {
39   this->L = L;
40   SE = &getAnalysis<ScalarEvolution>();
41   return false;
42 }
43
44 void LoopDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
45   AU.setPreservesAll();
46   AU.addRequired<ScalarEvolution>();
47 }