LLVM 19.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 Module;
21
22namespace vfs {
23class FileSystem;
24} // namespace vfs
25
26/// Public interface to the memory profiler pass for instrumenting code to
27/// profile memory accesses.
28///
29/// The profiler itself is a function pass that works by inserting various
30/// calls to the MemProfiler runtime library functions. The runtime library
31/// essentially replaces malloc() and free() with custom implementations that
32/// record data about the allocations.
33class MemProfilerPass : public PassInfoMixin<MemProfilerPass> {
34public:
35 explicit MemProfilerPass();
37 static bool isRequired() { return true; }
38};
39
40/// Public interface to the memory profiler module pass for instrumenting code
41/// to profile memory allocations and accesses.
42class ModuleMemProfilerPass : public PassInfoMixin<ModuleMemProfilerPass> {
43public:
46 static bool isRequired() { return true; }
47};
48
49class MemProfUsePass : public PassInfoMixin<MemProfUsePass> {
50public:
51 explicit MemProfUsePass(std::string MemoryProfileFile,
54
55private:
56 std::string MemoryProfileFileName;
58};
59
60} // namespace llvm
61
62#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:321
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:33
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
static bool isRequired()
Definition: MemProfiler.h:37
Public interface to the memory profiler module pass for instrumenting code to profile memory allocati...
Definition: MemProfiler.h:42
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: Analysis.h:109
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:74