LLVM  14.0.0git
MBFIWrapper.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/MBFIWrapper.h -------------------------------*- C++ -*-===//
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 
14 #ifndef LLVM_CODEGEN_MBFIWRAPPER_H
15 #define LLVM_CODEGEN_MBFIWRAPPER_H
16 
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/ADT/Optional.h"
20 
21 namespace llvm {
22 
23 class MachineBasicBlock;
24 class MachineBlockFrequencyInfo;
25 
26 class MBFIWrapper {
27  public:
29 
33 
35  const MachineBasicBlock *MBB) const;
37  const BlockFrequency Freq) const;
38  void view(const Twine &Name, bool isSimple = true);
39  uint64_t getEntryFreq() const;
40  const MachineBlockFrequencyInfo &getMBFI() { return MBFI; }
41 
42  private:
43  const MachineBlockFrequencyInfo &MBFI;
45 };
46 
47 } // end namespace llvm
48 
49 #endif // LLVM_CODEGEN_MBFIWRAPPER_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
Optional.h
llvm::MBFIWrapper::view
void view(const Twine &Name, bool isSimple=true)
Definition: MBFIWrapper.cpp:56
BlockFrequency.h
DenseMap.h
llvm::Optional< uint64_t >
llvm::MBFIWrapper::setBlockFreq
void setBlockFreq(const MachineBasicBlock *MBB, BlockFrequency F)
Definition: MBFIWrapper.cpp:29
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::MBFIWrapper::printBlockFreq
raw_ostream & printBlockFreq(raw_ostream &OS, const MachineBasicBlock *MBB) const
Definition: MBFIWrapper.cpp:46
llvm::MachineBlockFrequencyInfo
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
Definition: MachineBlockFrequencyInfo.h:33
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::MBFIWrapper::getEntryFreq
uint64_t getEntryFreq() const
Definition: MBFIWrapper.cpp:60
llvm::MBFIWrapper
Definition: MBFIWrapper.h:26
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::BlockFrequency
Definition: BlockFrequency.h:24
uint64_t
llvm::DenseMap
Definition: DenseMap.h:714
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::MBFIWrapper::getMBFI
const MachineBlockFrequencyInfo & getMBFI()
Definition: MBFIWrapper.h:40
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::MBFIWrapper::getBlockProfileCount
Optional< uint64_t > getBlockProfileCount(const MachineBasicBlock *MBB) const
Definition: MBFIWrapper.cpp:35
isSimple
static bool isSimple(Instruction *I)
Definition: SLPVectorizer.cpp:593
llvm::MBFIWrapper::MBFIWrapper
MBFIWrapper(const MachineBlockFrequencyInfo &I)
Definition: MBFIWrapper.h:28
llvm::MBFIWrapper::getBlockFreq
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
Definition: MBFIWrapper.cpp:20