LLVM  3.7.0
MachineBlockFrequencyInfo.h
Go to the documentation of this file.
1 //===- MachineBlockFrequencyInfo.h - MBB 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_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H
15 #define LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H
16 
19 #include <climits>
20 
21 namespace llvm {
22 
23 class MachineBasicBlock;
24 class MachineBranchProbabilityInfo;
25 template <class BlockT> class BlockFrequencyInfoImpl;
26 
27 /// MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation
28 /// to estimate machine basic block frequencies.
31  std::unique_ptr<ImplType> MBFI;
32 
33 public:
34  static char ID;
35 
37 
38  ~MachineBlockFrequencyInfo() override;
39 
40  void getAnalysisUsage(AnalysisUsage &AU) const override;
41 
42  bool runOnMachineFunction(MachineFunction &F) override;
43 
44  void releaseMemory() override;
45 
46  /// getblockFreq - Return block frequency. Return 0 if we don't have the
47  /// information. Please note that initial frequency is equal to 1024. It means
48  /// that we should not rely on the value itself, but only on the comparison to
49  /// the other block frequencies. We do this to avoid using of floating points.
50  ///
52 
53  const MachineFunction *getFunction() const;
54  void view() const;
55 
56  // Print the block frequency Freq to OS using the current functions entry
57  // frequency to convert freq into a relative decimal form.
58  raw_ostream &printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const;
59 
60  // Convenience method that attempts to look up the frequency associated with
61  // BB and print it to OS.
63  const MachineBasicBlock *MBB) const;
64 
65  uint64_t getEntryFreq() const;
66 
67 };
68 
69 }
70 
71 #endif
void view() const
Pop up a ghostview window with the current block frequency propagation rendered using dot...
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
F(f)
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
getblockFreq - Return block frequency.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
raw_ostream & printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const
Represent the analysis usage information of a pass.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
bool runOnMachineFunction(MachineFunction &F) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
Shared implementation for block frequency analysis.
const MachineFunction * getFunction() const