LLVM 24.0.0git
MemProfUse.h
Go to the documentation of this file.
1//===--------- MemProfUse.h - Memory profiler use pass ----*- 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 declares the MemProfUsePass class and related utilities.
10//
11//===----------------------------------------------------------------------===//
12#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFUSE_H
13#define LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFUSE_H
14
16#include "llvm/IR/PassManager.h"
21
22namespace llvm {
24class Module;
26
27class MemProfUsePass : public OptionalPassInfoMixin<MemProfUsePass> {
28public:
29 LLVM_ABI explicit MemProfUsePass(
30 std::string MemoryProfileFile,
33
34private:
35 // Annotate global variables' section prefix based on data access profile,
36 // return true if any global variable is annotated and false otherwise.
37 bool
38 annotateGlobalVariables(Module &M,
39 const memprof::DataAccessProfData *DataAccessProf);
40 std::string MemoryProfileFileName;
42};
43
44namespace memprof {
45
46// Extract all calls from the IR. Arrange them in a map from caller GUIDs to a
47// list of call sites, each of the form {LineLocation, CalleeGUID}.
49 Module &M, const TargetLibraryInfo &TLI,
50 function_ref<bool(uint64_t)> IsPresentInProfile = [](uint64_t) {
51 return true;
52 });
53
55
56// Compute an undrifting map. The result is a map from caller GUIDs to an inner
57// map that maps source locations in the profile to those in the current IR.
60 const TargetLibraryInfo &TLI);
61
62} // namespace memprof
63} // namespace llvm
64
65#endif
unsigned uint64_t
#define LLVM_ABI
Definition Compiler.h:215
This header defines various interfaces for pass management in LLVM.
This file defines the RefCountedBase, ThreadSafeRefCountedBase, and IntrusiveRefCntPtr classes.
Contains the forward declaration for vfs::FileSystem, as well as the IntrusiveRefCntPtrInfo specializ...
Reader for the indexed binary instrprof format.
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
LLVM_ABI MemProfUsePass(std::string MemoryProfileFile, IntrusiveRefCntPtr< vfs::FileSystem > FS=nullptr)
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
Provides information about what library functions are available for the current target.
An efficient, type-erasing, non-owning reference to a callable.
Encapsulates the data access profile data and the methods to operate on it.
LLVM_ABI DenseMap< uint64_t, LocToLocMap > computeUndriftMap(Module &M, IndexedInstrProfReader *MemProfReader, const TargetLibraryInfo &TLI)
DenseMap< LineLocation, LineLocation > LocToLocMap
Definition MemProfUse.h:54
LLVM_ABI DenseMap< uint64_t, SmallVector< CallEdgeTy, 0 > > extractCallsFromIR(Module &M, const TargetLibraryInfo &TLI, function_ref< bool(uint64_t)> IsPresentInProfile=[](uint64_t) { return true;})
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
A CRTP mix-in for passes that can be skipped.