LLVM 24.0.0git
MIRSampleProfile.h
Go to the documentation of this file.
1//===----- MIRSampleProfile.h: SampleFDO Support in MIR ---*- 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 file contains the supoorting functions for machine level Sample FDO
10// loader. This is used in Flow Sensitive SampelFDO.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_MIRSAMPLEPROFILE_H
15#define LLVM_CODEGEN_MIRSAMPLEPROFILE_H
16
18#include "llvm/ADT/StringRef.h"
22#include <memory>
23#include <string>
24
25namespace llvm {
26class AnalysisUsage;
28class MachineFunction;
29class Module;
30
31using namespace sampleprof;
32
36 std::string ProfileFileName;
38 unsigned LowBit;
39 unsigned HighBit;
40
41public:
42 static char ID;
43 /// FS bits will only use the '1' bits in the Mask.
44 MIRProfileLoaderPass(std::string FileName = "",
45 std::string RemappingFileName = "",
46 FSDiscriminatorPass P = FSDiscriminatorPass::Pass1,
48
49 /// getMachineFunction - Return the last machine function computed.
50 const MachineFunction *getMachineFunction() const { return MF; }
51
52 StringRef getPassName() const override { return "SampleFDO loader in MIR"; }
53
54private:
55 void init(MachineFunction &MF);
56 bool runOnMachineFunction(MachineFunction &) override;
57 bool doInitialization(Module &M) override;
58 void getAnalysisUsage(AnalysisUsage &AU) const override;
59
60 std::unique_ptr<MIRProfileLoader> MIRSampleLoader;
61 /// Hold the information of the basic block frequency.
63};
64
65} // namespace llvm
66
67#endif // LLVM_CODEGEN_MIRSAMPLEPROFILE_H
#define LLVM_ABI
Definition Compiler.h:215
This file defines the RefCountedBase, ThreadSafeRefCountedBase, and IntrusiveRefCntPtr classes.
Contains the forward declaration for vfs::FileSystem, as well as the IntrusiveRefCntPtrInfo specializ...
Represent the analysis usage information of a pass.
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
const MachineFunction * getMachineFunction() const
getMachineFunction - Return the last machine function computed.
MIRProfileLoaderPass(std::string FileName="", std::string RemappingFileName="", FSDiscriminatorPass P=FSDiscriminatorPass::Pass1, IntrusiveRefCntPtr< vfs::FileSystem > FS=nullptr)
FS bits will only use the '1' bits in the Mask.
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This is an optimization pass for GlobalISel generic memory operations.