55b058b98afae99f62c16c0376266bc10eca8d3d
[oota-llvm.git] / include / llvm / Analysis / BasicAliasAnalysis.h
1 //===- llvm/Analysis/BasicAliasAnalysis.h - Alias Analysis Impl -*- C++ -*-===//
2 //
3 // This file defines the default implementation of the Alias Analysis interface
4 // that simply implements a few identities (two different globals cannot alias,
5 // etc), but otherwise does no analysis.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_ANALYSIS_BASIC_ALIAS_ANALYSIS_H
10 #define LLVM_ANALYSIS_BASIC_ALIAS_ANALYSIS_H
11
12 #include "llvm/Analysis/AliasAnalysis.h"
13 #include "llvm/Pass.h"
14
15 struct BasicAliasAnalysis : public ImmutablePass, public AliasAnalysis {
16   
17   // Pass Implementation stuff.  This isn't much of a pass.
18   //
19   bool runOnFunction(Function &) { return false; }
20     
21   // getAnalysisUsage - Does not modify anything.
22   //
23   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
24     AU.setPreservesAll();
25   }
26   
27   // alias - This is the only method here that does anything interesting...
28   //
29   Result alias(const Value *V1, const Value *V2) const;
30     
31   /// canCallModify - We are not interprocedural, so we do nothing exciting.
32   ///
33   Result canCallModify(const CallInst &CI, const Value *Ptr) const {
34     return MayAlias;
35   }
36     
37   /// canInvokeModify - We are not interprocedural, so we do nothing exciting.
38   ///
39   Result canInvokeModify(const InvokeInst &I, const Value *Ptr) const {
40     return MayAlias;  // We are not interprocedural
41   }
42 };
43
44 #endif