//===- MachineBlockFrequencyInfo.h - MBB Frequency Analysis -----*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Loops should be simplified before this analysis. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H #define LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachinePassManager.h" #include "llvm/Support/BlockFrequency.h" #include <cstdint> #include <memory> #include <optional> namespace llvm { template <class BlockT> class BlockFrequencyInfoImpl; class MachineBasicBlock; class MachineBranchProbabilityInfo; class MachineFunction; class MachineLoopInfo; class raw_ostream; /// MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation /// to estimate machine basic block frequencies. class MachineBlockFrequencyInfo { … }; /// Print the block frequency @p Freq relative to the current functions entry /// frequency. Returns a Printable object that can be piped via `<<` to a /// `raw_ostream`. Printable printBlockFreq(const MachineBlockFrequencyInfo &MBFI, BlockFrequency Freq); /// Convenience function equivalent to calling /// `printBlockFreq(MBFI, MBFI.getBlockFreq(&MBB))`. Printable printBlockFreq(const MachineBlockFrequencyInfo &MBFI, const MachineBasicBlock &MBB); class MachineBlockFrequencyAnalysis : public AnalysisInfoMixin<MachineBlockFrequencyAnalysis> { … }; /// Printer pass for the \c MachineBlockFrequencyInfo results. class MachineBlockFrequencyPrinterPass : public PassInfoMixin<MachineBlockFrequencyPrinterPass> { … }; class MachineBlockFrequencyInfoWrapperPass : public MachineFunctionPass { … }; } // end namespace llvm #endif // LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H