1 //===- LazyValueInfo.h - Value constraint analysis --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the interface for lazy computation of value constraint
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_ANALYSIS_LIVEVALUES_H
16 #define LLVM_ANALYSIS_LIVEVALUES_H
18 #include "llvm/Pass.h"
25 /// LazyValueInfo - This pass computes, caches, and vends lazy value constraint
27 class LazyValueInfo : public FunctionPass {
30 LazyValueInfo(const LazyValueInfo&); // DO NOT IMPLEMENT.
31 void operator=(const LazyValueInfo&); // DO NOT IMPLEMENT.
34 LazyValueInfo() : FunctionPass(&ID), PImpl(0) {}
35 ~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); }
37 /// Tristate - This is used to return true/false/dunno results.
39 Unknown = -1, False = 0, True = 1
43 // Public query interface.
45 /// getPredicateOnEdge - Determine whether the specified value comparison
46 /// with a constant is known to be true or false on the specified CFG edge.
47 /// Pred is a CmpInst predicate.
48 Tristate getPredicateOnEdge(unsigned Pred, Value *V, Constant *C,
49 BasicBlock *FromBB, BasicBlock *ToBB);
52 /// getConstant - Determine whether the specified value is known to be a
53 /// constant at the end of the specified block. Return null if not.
54 Constant *getConstant(Value *V, BasicBlock *BB);
56 /// getConstantOnEdge - Determine whether the specified value is known to be a
57 /// constant on the specified edge. Return null if not.
58 Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB);
61 // Implementation boilerplate.
63 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
66 virtual void releaseMemory();
67 virtual bool runOnFunction(Function &F);
70 } // end namespace llvm