expose edge information and switch j-t to use it.
[oota-llvm.git] / include / llvm / Analysis / LazyValueInfo.h
1 //===- LazyValueInfo.h - Value constraint analysis --------------*- 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 file defines the interface for lazy computation of value constraint
11 // information.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_ANALYSIS_LIVEVALUES_H
16 #define LLVM_ANALYSIS_LIVEVALUES_H
17
18 #include "llvm/Pass.h"
19
20 namespace llvm {
21   class Constant;
22   class TargetData;
23   class Value;
24   
25 /// LazyValueInfo - This pass computes, caches, and vends lazy value constraint
26 /// information.
27 class LazyValueInfo : public FunctionPass {
28   class TargetData *TD;
29   void *PImpl;
30 public:
31   static char ID;
32   LazyValueInfo() : FunctionPass(&ID), PImpl(0) {}
33
34   /// Tristate - This is used to return yes/no/dunno results.
35   enum Tristate {
36     Unknown = -1, No = 0, Yes = 1
37   };
38   
39   
40   // Public query interface.
41   
42   
43   /// isEqual - Determine whether the specified value is known to be equal or
44   /// not-equal to the specified constant at the end of the specified block.
45   Tristate isEqual(Value *V, Constant *C, BasicBlock *BB);
46
47   /// getConstant - Determine whether the specified value is known to be a
48   /// constant at the end of the specified block.  Return null if not.
49   Constant *getConstant(Value *V, BasicBlock *BB);
50
51   /// getConstantOnEdge - Determine whether the specified value is known to be a
52   /// constant on the specified edge.  Return null if not.
53   Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB);
54   
55   
56   // Implementation boilerplate.
57   
58   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
59     AU.setPreservesAll();
60   }
61   virtual void releaseMemory();
62   virtual bool runOnFunction(Function &F);
63 };
64
65 }  // end namespace llvm
66
67 #endif
68