LLVM 17.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"
21#include <memory>
22#include <string>
23
24namespace llvm {
25class AnalysisUsage;
26class MachineBlockFrequencyInfo;
27class MachineFunction;
28class Module;
29
30namespace vfs {
31class FileSystem;
32} // namespace vfs
33
34using namespace sampleprof;
35
39 std::string ProfileFileName;
41 unsigned LowBit;
42 unsigned HighBit;
43
44public:
45 static char ID;
46 /// FS bits will only use the '1' bits in the Mask.
47 MIRProfileLoaderPass(std::string FileName = "",
48 std::string RemappingFileName = "",
49 FSDiscriminatorPass P = FSDiscriminatorPass::Pass1,
51
52 /// getMachineFunction - Return the last machine function computed.
53 const MachineFunction *getMachineFunction() const { return MF; }
54
55 StringRef getPassName() const override { return "SampleFDO loader in MIR"; }
56
57private:
58 void init(MachineFunction &MF);
59 bool runOnMachineFunction(MachineFunction &) override;
60 bool doInitialization(Module &M) override;
61 void getAnalysisUsage(AnalysisUsage &AU) const override;
62
63 std::unique_ptr<MIRProfileLoader> MIRSampleLoader;
64 /// Hold the information of the basic block frequency.
66};
67
68} // namespace llvm
69
70#endif // LLVM_CODEGEN_MIRSAMPLEPROFILE_H
This file defines the RefCountedBase, ThreadSafeRefCountedBase, and IntrusiveRefCntPtr classes.
Machine Check Debug Module
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.
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
The virtual file system interface.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18