1- // ===--------- Definition of the MemProfiler class ---------- ----*- C++ -*-===//
1+ // ===--------- MemProfUse.h - Memory profiler use pass ----*- C++ -*-===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44// See https://llvm.org/LICENSE.txt for license information.
55// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66//
77// ===----------------------------------------------------------------------===//
88//
9- // This file declares the MemProfiler class.
9+ // This file declares the MemProfUsePass class and related utilities .
1010//
1111// ===----------------------------------------------------------------------===//
12- #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFILER_H
13- #define LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFILER_H
12+ #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFUSE_H
13+ #define LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFUSE_H
1414
1515#include " llvm/ADT/IntrusiveRefCntPtr.h"
1616#include " llvm/IR/PassManager.h"
1919#include < unordered_map>
2020
2121namespace llvm {
22- class Function ;
2322class IndexedInstrProfReader ;
2423class Module ;
2524class TargetLibraryInfo ;
@@ -28,29 +27,6 @@ namespace vfs {
2827class FileSystem ;
2928} // namespace vfs
3029
31- // / Public interface to the memory profiler pass for instrumenting code to
32- // / profile memory accesses.
33- // /
34- // / The profiler itself is a function pass that works by inserting various
35- // / calls to the MemProfiler runtime library functions. The runtime library
36- // / essentially replaces malloc() and free() with custom implementations that
37- // / record data about the allocations.
38- class MemProfilerPass : public PassInfoMixin <MemProfilerPass> {
39- public:
40- explicit MemProfilerPass ();
41- PreservedAnalyses run (Function &F, FunctionAnalysisManager &AM);
42- static bool isRequired () { return true ; }
43- };
44-
45- // / Public interface to the memory profiler module pass for instrumenting code
46- // / to profile memory allocations and accesses.
47- class ModuleMemProfilerPass : public PassInfoMixin <ModuleMemProfilerPass> {
48- public:
49- explicit ModuleMemProfilerPass ();
50- PreservedAnalyses run (Module &M, ModuleAnalysisManager &AM);
51- static bool isRequired () { return true ; }
52- };
53-
5430class MemProfUsePass : public PassInfoMixin <MemProfUsePass> {
5531public:
5632 explicit MemProfUsePass (std::string MemoryProfileFile,
@@ -90,4 +66,4 @@ computeUndriftMap(Module &M, IndexedInstrProfReader *MemProfReader,
9066} // namespace memprof
9167} // namespace llvm
9268
93- #endif
69+ #endif
0 commit comments