LLVM  14.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/Function.h"
16 #include "llvm/IR/Module.h"
17 #include "llvm/IR/PassManager.h"
18 
19 namespace llvm {
20 
21 /// Public interface to the memory profiler pass for instrumenting code to
22 /// profile memory accesses.
23 ///
24 /// The profiler itself is a function pass that works by inserting various
25 /// calls to the MemProfiler runtime library functions. The runtime library
26 /// essentially replaces malloc() and free() with custom implementations that
27 /// record data about the allocations.
28 class MemProfilerPass : public PassInfoMixin<MemProfilerPass> {
29 public:
30  explicit MemProfilerPass();
32  static bool isRequired() { return true; }
33 };
34 
35 /// Public interface to the memory profiler module pass for instrumenting code
36 /// to profile memory allocations and accesses.
37 class ModuleMemProfilerPass : public PassInfoMixin<ModuleMemProfilerPass> {
38 public:
39  explicit ModuleMemProfilerPass();
41  static bool isRequired() { return true; }
42 };
43 
44 // Insert MemProfiler instrumentation
45 FunctionPass *createMemProfilerFunctionPass();
47 
48 } // namespace llvm
49 
50 #endif
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
llvm::Function
Definition: Function.h:62
Module.h
llvm::createMemProfilerFunctionPass
FunctionPass * createMemProfilerFunctionPass()
Definition: MemProfiler.cpp:286
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::ModuleMemProfilerPass::ModuleMemProfilerPass
ModuleMemProfilerPass()
Definition: MemProfiler.cpp:267
llvm::MemProfilerPass::MemProfilerPass
MemProfilerPass()
Definition: MemProfiler.cpp:256
llvm::MemProfilerPass
Public interface to the memory profiler pass for instrumenting code to profile memory accesses.
Definition: MemProfiler.h:28
llvm::ModuleMemProfilerPass
Public interface to the memory profiler module pass for instrumenting code to profile memory allocati...
Definition: MemProfiler.h:37
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::createModuleMemProfilerLegacyPassPass
ModulePass * createModuleMemProfilerLegacyPassPass()
llvm::MemProfilerPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: MemProfiler.cpp:258
Function.h
llvm::ModuleMemProfilerPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: MemProfiler.cpp:269
PassManager.h
llvm::ModuleMemProfilerPass::isRequired
static bool isRequired()
Definition: MemProfiler.h:41
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::MemProfilerPass::isRequired
static bool isRequired()
Definition: MemProfiler.h:32