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.

55 lines
1.6 KiB

  1. //========-------- BlockFrequencyInfo.h - Block Frequency Analysis -------========//
  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. // Loops should be simplified before this analysis.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_ANALYSIS_BLOCKFREQUENCYINFO_H
  14. #define LLVM_ANALYSIS_BLOCKFREQUENCYINFO_H
  15. #include "llvm/Pass.h"
  16. #include "llvm/Support/BlockFrequency.h"
  17. #include <climits>
  18. namespace llvm {
  19. class BranchProbabilityInfo;
  20. template<class BlockT, class FunctionT, class BranchProbInfoT>
  21. class BlockFrequencyImpl;
  22. /// BlockFrequencyInfo pass uses BlockFrequencyImpl implementation to estimate
  23. /// IR basic block frequencies.
  24. class BlockFrequencyInfo : public FunctionPass {
  25. BlockFrequencyImpl<BasicBlock, Function, BranchProbabilityInfo> *BFI;
  26. public:
  27. static char ID;
  28. BlockFrequencyInfo();
  29. ~BlockFrequencyInfo();
  30. void getAnalysisUsage(AnalysisUsage &AU) const;
  31. bool runOnFunction(Function &F);
  32. void print(raw_ostream &O, const Module *M) const;
  33. /// getblockFreq - Return block frequency. Return 0 if we don't have the
  34. /// information. Please note that initial frequency is equal to 1024. It means
  35. /// that we should not rely on the value itself, but only on the comparison to
  36. /// the other block frequencies. We do this to avoid using of floating points.
  37. ///
  38. BlockFrequency getBlockFreq(const BasicBlock *BB) const;
  39. };
  40. }
  41. #endif