LLVM 17.0.0git
MemProfContextDisambiguation.h
Go to the documentation of this file.
1//==- MemProfContextDisambiguation.h - Context Disambiguation ----*- 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// Implements support for context disambiguation of allocation calls for profile
10// guided heap optimization using memprof metadata. See implementation file for
11// details.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_TRANSFORMS_IPO_MEMPROF_CONTEXT_DISAMBIGUATION_H
16#define LLVM_TRANSFORMS_IPO_MEMPROF_CONTEXT_DISAMBIGUATION_H
17
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/StringSet.h"
20#include "llvm/IR/GlobalValue.h"
22#include "llvm/IR/PassManager.h"
23#include <functional>
24
25namespace llvm {
26class GlobalValueSummary;
27class Module;
28class OptimizationRemarkEmitter;
29
31 : public PassInfoMixin<MemProfContextDisambiguation> {
32 /// Run the context disambiguator on \p M, returns true if any changes made.
33 bool processModule(
34 Module &M,
36
37 /// In the ThinLTO backend, apply the cloning decisions in ImportSummary to
38 /// the IR.
39 bool applyImport(Module &M);
40
41 /// Import summary containing cloning decisions for the ThinLTO backend.
42 const ModuleSummaryIndex *ImportSummary;
43
44 // Owns the import summary specified by internal options for testing the
45 // ThinLTO backend via opt (to simulate distributed ThinLTO).
46 std::unique_ptr<ModuleSummaryIndex> ImportSummaryForTesting;
47
48public:
49 MemProfContextDisambiguation(const ModuleSummaryIndex *Summary = nullptr);
50
52
55 isPrevailing);
56};
57} // end namespace llvm
58
59#endif // LLVM_TRANSFORMS_IPO_MEMPROF_CONTEXT_DISAMBIGUATION_H
This file defines the DenseMap class.
Machine Check Debug Module
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
This header defines various interfaces for pass management in LLVM.
StringSet - A set-like wrapper for the StringMap.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:620
Function and variable summary information to aid decisions and implementation of importing.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Class to hold module path string table and global value map, and encapsulate methods for operating on...
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
The optimization diagnostic interface.
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
An efficient, type-erasing, non-owning reference to a callable.
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