LLVM  12.0.0git
MBFIWrapper.cpp
Go to the documentation of this file.
1 //===- MBFIWrapper.cpp - MachineBlockFrequencyInfo wrapper ----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This class keeps track of branch frequencies of newly created blocks and
10 // tail-merged blocks. Used by the TailDuplication and MachineBlockPlacement.
11 //
12 //===----------------------------------------------------------------------===//
13 
16 
17 using namespace llvm;
18 
20  auto I = MergedBBFreq.find(MBB);
21 
22  if (I != MergedBBFreq.end())
23  return I->second;
24 
25  return MBFI.getBlockFreq(MBB);
26 }
27 
29  BlockFrequency F) {
30  MergedBBFreq[MBB] = F;
31 }
32 
34  const MachineBasicBlock *MBB) const {
35  return MBFI.printBlockFreq(OS, getBlockFreq(MBB));
36 }
37 
39  const BlockFrequency Freq) const {
40  return MBFI.printBlockFreq(OS, Freq);
41 }
42 
43 void MBFIWrapper::view(const Twine &Name, bool isSimple) {
44  MBFI.view(Name, isSimple);
45 }
46 
47 uint64_t MBFIWrapper::getEntryFreq() const {
48  return MBFI.getEntryFreq();
49 }
This class represents lattice values for constants.
Definition: AllocatorList.h:23
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
F(f)
void view(const Twine &Name, bool isSimple=true)
Definition: MBFIWrapper.cpp:43
MachineBasicBlock & MBB
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
void view(const Twine &Name, bool isSimple=true) const
Pop up a ghostview window with the current block frequency propagation rendered using dot...
static bool isSimple(Instruction *I)
void setBlockFreq(const MachineBasicBlock *MBB, BlockFrequency F)
Definition: MBFIWrapper.cpp:28
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
getblockFreq - Return block frequency.
raw_ostream & printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const
uint64_t getEntryFreq() const
Definition: MBFIWrapper.cpp:47
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
Definition: MBFIWrapper.cpp:19
raw_ostream & printBlockFreq(raw_ostream &OS, const MachineBasicBlock *MBB) const
Definition: MBFIWrapper.cpp:33
#define I(x, y, z)
Definition: MD5.cpp:59
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46