LLVM 17.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
15#include "llvm/IR/PassManager.h"
16
17namespace llvm {
18class Function;
19class FunctionPass;
20class Module;
21class ModulePass;
22
23/// Public interface to the memory profiler pass for instrumenting code to
24/// profile memory accesses.
25///
26/// The profiler itself is a function pass that works by inserting various
27/// calls to the MemProfiler runtime library functions. The runtime library
28/// essentially replaces malloc() and free() with custom implementations that
29/// record data about the allocations.
30class MemProfilerPass : public PassInfoMixin<MemProfilerPass> {
31public:
32 explicit MemProfilerPass();
34 static bool isRequired() { return true; }
35};
36
37/// Public interface to the memory profiler module pass for instrumenting code
38/// to profile memory allocations and accesses.
39class ModuleMemProfilerPass : public PassInfoMixin<ModuleMemProfilerPass> {
40public:
43 static bool isRequired() { return true; }
44};
45
46// Insert MemProfiler instrumentation
49
50} // namespace llvm
51
52#endif
#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
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:308
Public interface to the memory profiler pass for instrumenting code to profile memory accesses.
Definition: MemProfiler.h:30
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
static bool isRequired()
Definition: MemProfiler.h:34
Public interface to the memory profiler module pass for instrumenting code to profile memory allocati...
Definition: MemProfiler.h:39
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:248
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
FunctionPass * createMemProfilerFunctionPass()
ModulePass * createModuleMemProfilerLegacyPassPass()
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:371