LLVM 22.0.0git
AllocToken.h
Go to the documentation of this file.
1//===- AllocToken.h - Allocation token instrumentation --------------------===//
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 AllocTokenPass, an instrumentation pass that
10// replaces allocation calls with ones including an allocation token.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_ALLOCTOKEN_H
15#define LLVM_TRANSFORMS_INSTRUMENTATION_ALLOCTOKEN_H
16
17#include "llvm/IR/Analysis.h"
18#include "llvm/IR/PassManager.h"
19#include <optional>
20
21namespace llvm {
22
23class Module;
24
26 std::optional<uint64_t> MaxTokens;
27 bool FastABI = false;
28 bool Extended = false;
29 AllocTokenOptions() = default;
30};
31
32/// A module pass that rewrites heap allocations to use token-enabled
33/// allocation functions based on various source-level properties.
34class AllocTokenPass : public PassInfoMixin<AllocTokenPass> {
35public:
36 LLVM_ABI explicit AllocTokenPass(AllocTokenOptions Opts = {});
38 static bool isRequired() { return true; }
39
40private:
42};
43
44} // namespace llvm
45
46#endif // LLVM_TRANSFORMS_INSTRUMENTATION_ALLOCTOKEN_H
#define LLVM_ABI
Definition Compiler.h:213
This header defines various interfaces for pass management in LLVM.
static LVOptions Options
Definition LVOptions.cpp:25
ModuleAnalysisManager MAM
LLVM_ABI AllocTokenPass(AllocTokenOptions Opts={})
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
static bool isRequired()
Definition AllocToken.h:38
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
Pass manager infrastructure for declaring and invalidating analyses.
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
std::optional< uint64_t > MaxTokens
Definition AllocToken.h:26
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition PassManager.h:70