LLVM 18.0.0git
MemProfiler.h
Go to the documentation of this file.
1//===--------- Definition of the MemProfiler class --------------*- 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 MemProfiler class.
10//
11//===----------------------------------------------------------------------===//
12#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFILER_H
13#define LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFILER_H
14
16#include "llvm/IR/PassManager.h"
17
18namespace llvm {
19class Function;
20class FunctionPass;
21class Module;
22class ModulePass;
23
24namespace vfs {
25class FileSystem;
26} // namespace vfs
27
28/// Public interface to the memory profiler pass for instrumenting code to
29/// profile memory accesses.
30///
31/// The profiler itself is a function pass that works by inserting various
32/// calls to the MemProfiler runtime library functions. The runtime library
33/// essentially replaces malloc() and free() with custom implementations that
34/// record data about the allocations.
35class MemProfilerPass : public PassInfoMixin<MemProfilerPass> {
36public:
37 explicit MemProfilerPass();
39 static bool isRequired() { return true; }
40};
41
42/// Public interface to the memory profiler module pass for instrumenting code
43/// to profile memory allocations and accesses.
44class ModuleMemProfilerPass : public PassInfoMixin<ModuleMemProfilerPass> {
45public:
48 static bool isRequired() { return true; }
49};
50
51class MemProfUsePass : public PassInfoMixin<MemProfUsePass> {
52public:
53 explicit MemProfUsePass(std::string MemoryProfileFile,
56
57private:
58 std::string MemoryProfileFileName;
60};
61
62} // namespace llvm
63
64#endif
This file defines the RefCountedBase, ThreadSafeRefCountedBase, and IntrusiveRefCntPtr classes.
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
This header defines various interfaces for pass management in LLVM.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:620
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Public interface to the memory profiler pass for instrumenting code to profile memory accesses.
Definition: MemProfiler.h:35
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
static bool isRequired()
Definition: MemProfiler.h:39
Public interface to the memory profiler module pass for instrumenting code to profile memory allocati...
Definition: MemProfiler.h:44
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:371