Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:32

0001 //===- llvm/CodeGen/MBFIWrapper.h -------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This class keeps track of branch frequencies of newly created blocks and
0010 // tail-merged blocks. Used by the TailDuplication and MachineBlockPlacement.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CODEGEN_MBFIWRAPPER_H
0015 #define LLVM_CODEGEN_MBFIWRAPPER_H
0016 
0017 #include "llvm/ADT/DenseMap.h"
0018 #include "llvm/Support/BlockFrequency.h"
0019 #include <optional>
0020 
0021 namespace llvm {
0022 
0023 class MachineBasicBlock;
0024 class MachineBlockFrequencyInfo;
0025 
0026 class MBFIWrapper {
0027  public:
0028   MBFIWrapper(const MachineBlockFrequencyInfo &I) : MBFI(I) {}
0029 
0030   BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const;
0031   void setBlockFreq(const MachineBasicBlock *MBB, BlockFrequency F);
0032   std::optional<uint64_t>
0033   getBlockProfileCount(const MachineBasicBlock *MBB) const;
0034 
0035   void view(const Twine &Name, bool isSimple = true);
0036   BlockFrequency getEntryFreq() const;
0037   const MachineBlockFrequencyInfo &getMBFI() const { return MBFI; }
0038 
0039 private:
0040   const MachineBlockFrequencyInfo &MBFI;
0041   DenseMap<const MachineBasicBlock *, BlockFrequency> MergedBBFreq;
0042 };
0043 
0044 } // end namespace llvm
0045 
0046 #endif // LLVM_CODEGEN_MBFIWRAPPER_H