LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LazyValueInfo.h
Go to the documentation of this file.
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_LAZYVALUEINFO_H
16 #define LLVM_ANALYSIS_LAZYVALUEINFO_H
17 
18 #include "llvm/Pass.h"
19 
20 namespace llvm {
21  class Constant;
22  class DataLayout;
23  class TargetLibraryInfo;
24  class Value;
25 
26 /// LazyValueInfo - This pass computes, caches, and vends lazy value constraint
27 /// information.
28 class LazyValueInfo : public FunctionPass {
29  class DataLayout *TD;
30  class TargetLibraryInfo *TLI;
31  void *PImpl;
33  void operator=(const LazyValueInfo&) LLVM_DELETED_FUNCTION;
34 public:
35  static char ID;
36  LazyValueInfo() : FunctionPass(ID), PImpl(0) {
38  }
39  ~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); }
40 
41  /// Tristate - This is used to return true/false/dunno results.
42  enum Tristate {
43  Unknown = -1, False = 0, True = 1
44  };
45 
46 
47  // Public query interface.
48 
49  /// getPredicateOnEdge - Determine whether the specified value comparison
50  /// with a constant is known to be true or false on the specified CFG edge.
51  /// Pred is a CmpInst predicate.
52  Tristate getPredicateOnEdge(unsigned Pred, Value *V, Constant *C,
53  BasicBlock *FromBB, BasicBlock *ToBB);
54 
55 
56  /// getConstant - Determine whether the specified value is known to be a
57  /// constant at the end of the specified block. Return null if not.
59 
60  /// getConstantOnEdge - Determine whether the specified value is known to be a
61  /// constant on the specified edge. Return null if not.
63 
64  /// threadEdge - Inform the analysis cache that we have threaded an edge from
65  /// PredBB to OldSucc to be from PredBB to NewSucc instead.
66  void threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc, BasicBlock *NewSucc);
67 
68  /// eraseBlock - Inform the analysis cache that we have erased a block.
69  void eraseBlock(BasicBlock *BB);
70 
71  // Implementation boilerplate.
72 
73  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
74  virtual void releaseMemory();
75  virtual bool runOnFunction(Function &F);
76 };
77 
78 } // end namespace llvm
79 
80 #endif
81 
static PassRegistry * getPassRegistry()
Constant * getConstant(Value *V, BasicBlock *BB)
F(f)
Tristate getPredicateOnEdge(unsigned Pred, Value *V, Constant *C, BasicBlock *FromBB, BasicBlock *ToBB)
virtual void getAnalysisUsage(AnalysisUsage &AU) const
virtual void releaseMemory()
Constant * getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB)
LLVM Basic Block Representation.
Definition: BasicBlock.h:72
LLVM Constant Representation.
Definition: Constant.h:41
Tristate
Tristate - This is used to return true/false/dunno results.
Definition: LazyValueInfo.h:42
virtual bool runOnFunction(Function &F)
#define LLVM_DELETED_FUNCTION
Definition: Compiler.h:137
void threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc, BasicBlock *NewSucc)
void eraseBlock(BasicBlock *BB)
eraseBlock - Inform the analysis cache that we have erased a block.
LLVM Value Representation.
Definition: Value.h:66
void initializeLazyValueInfoPass(PassRegistry &)
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD