Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.7 KiB

  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. #ifndef LLVM_ANALYSIS_LAZYVALUEINFO_H
  15. #define LLVM_ANALYSIS_LAZYVALUEINFO_H
  16. #include "llvm/Pass.h"
  17. namespace llvm {
  18. class Constant;
  19. class DataLayout;
  20. class TargetLibraryInfo;
  21. class Value;
  22. /// LazyValueInfo - This pass computes, caches, and vends lazy value constraint
  23. /// information.
  24. class LazyValueInfo : public FunctionPass {
  25. class DataLayout *TD;
  26. class TargetLibraryInfo *TLI;
  27. void *PImpl;
  28. LazyValueInfo(const LazyValueInfo&) LLVM_DELETED_FUNCTION;
  29. void operator=(const LazyValueInfo&) LLVM_DELETED_FUNCTION;
  30. public:
  31. static char ID;
  32. LazyValueInfo() : FunctionPass(ID), PImpl(0) {
  33. initializeLazyValueInfoPass(*PassRegistry::getPassRegistry());
  34. }
  35. ~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); }
  36. /// Tristate - This is used to return true/false/dunno results.
  37. enum Tristate {
  38. Unknown = -1, False = 0, True = 1
  39. };
  40. // Public query interface.
  41. /// getPredicateOnEdge - Determine whether the specified value comparison
  42. /// with a constant is known to be true or false on the specified CFG edge.
  43. /// Pred is a CmpInst predicate.
  44. Tristate getPredicateOnEdge(unsigned Pred, Value *V, Constant *C,
  45. BasicBlock *FromBB, BasicBlock *ToBB);
  46. /// getConstant - Determine whether the specified value is known to be a
  47. /// constant at the end of the specified block. Return null if not.
  48. Constant *getConstant(Value *V, BasicBlock *BB);
  49. /// getConstantOnEdge - Determine whether the specified value is known to be a
  50. /// constant on the specified edge. Return null if not.
  51. Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB);
  52. /// threadEdge - Inform the analysis cache that we have threaded an edge from
  53. /// PredBB to OldSucc to be from PredBB to NewSucc instead.
  54. void threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc, BasicBlock *NewSucc);
  55. /// eraseBlock - Inform the analysis cache that we have erased a block.
  56. void eraseBlock(BasicBlock *BB);
  57. // Implementation boilerplate.
  58. virtual void getAnalysisUsage(AnalysisUsage &AU) const;
  59. virtual void releaseMemory();
  60. virtual bool runOnFunction(Function &F);
  61. };
  62. } // end namespace llvm
  63. #endif