LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BlockFrequencyInfo.h
Go to the documentation of this file.
1 //===------- BlockFrequencyInfo.h - Block Frequency 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 // Loops should be simplified before this analysis.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_ANALYSIS_BLOCKFREQUENCYINFO_H
15 #define LLVM_ANALYSIS_BLOCKFREQUENCYINFO_H
16 
17 #include "llvm/Pass.h"
19 #include <climits>
20 
21 namespace llvm {
22 
23 class BranchProbabilityInfo;
24 template<class BlockT, class FunctionT, class BranchProbInfoT>
25 class BlockFrequencyImpl;
26 
27 /// BlockFrequencyInfo pass uses BlockFrequencyImpl implementation to estimate
28 /// IR basic block frequencies.
30 
32 
33 public:
34  static char ID;
35 
37 
39 
40  void getAnalysisUsage(AnalysisUsage &AU) const;
41 
42  bool runOnFunction(Function &F);
43  void print(raw_ostream &O, const Module *M) const;
44  const Function *getFunction() const;
45  void view() const;
46 
47  /// getblockFreq - Return block frequency. Return 0 if we don't have the
48  /// information. Please note that initial frequency is equal to ENTRY_FREQ. It
49  /// means that we should not rely on the value itself, but only on the
50  /// comparison to the other block frequencies. We do this to avoid using of
51  /// floating points.
52  BlockFrequency getBlockFreq(const BasicBlock *BB) const;
53 };
54 
55 }
56 
57 #endif
The main container class for the LLVM Intermediate Representation.
Definition: Module.h:112
F(f)
void getAnalysisUsage(AnalysisUsage &AU) const
LLVM Basic Block Representation.
Definition: BasicBlock.h:72
void print(raw_ostream &O, const Module *M) const
const Function * getFunction() const
BlockFrequency getBlockFreq(const BasicBlock *BB) const