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.

56 lines
1.7 KiB

  1. //====----- MachineBlockFrequencyInfo.h - MachineBlock 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_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H
  14. #define LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H
  15. #include "llvm/CodeGen/MachineFunctionPass.h"
  16. #include "llvm/Support/BlockFrequency.h"
  17. #include <climits>
  18. namespace llvm {
  19. class MachineBasicBlock;
  20. class MachineBranchProbabilityInfo;
  21. template<class BlockT, class FunctionT, class BranchProbInfoT>
  22. class BlockFrequencyImpl;
  23. /// MachineBlockFrequencyInfo pass uses BlockFrequencyImpl implementation to estimate
  24. /// machine basic block frequencies.
  25. class MachineBlockFrequencyInfo : public MachineFunctionPass {
  26. BlockFrequencyImpl<MachineBasicBlock, MachineFunction,
  27. MachineBranchProbabilityInfo> *MBFI;
  28. public:
  29. static char ID;
  30. MachineBlockFrequencyInfo();
  31. ~MachineBlockFrequencyInfo();
  32. void getAnalysisUsage(AnalysisUsage &AU) const;
  33. bool runOnMachineFunction(MachineFunction &F);
  34. /// getblockFreq - Return block frequency. Return 0 if we don't have the
  35. /// information. Please note that initial frequency is equal to 1024. It means
  36. /// that we should not rely on the value itself, but only on the comparison to
  37. /// the other block frequencies. We do this to avoid using of floating points.
  38. ///
  39. BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const;
  40. };
  41. }
  42. #endif