LLVM 20.0.0git
LegacyPassManager.h
Go to the documentation of this file.
1//===- LegacyPassManager.h - Legacy Container for Passes --------*- 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 defines the legacy PassManager class. This class is used to hold,
10// maintain, and optimize execution of Passes. The PassManager class ensures
11// that analysis results are available before a pass runs, and that Pass's are
12// destroyed when the PassManager is destroyed.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_IR_LEGACYPASSMANAGER_H
17#define LLVM_IR_LEGACYPASSMANAGER_H
18
20
21namespace llvm {
22
23class Function;
24class Pass;
25class Module;
26
27namespace legacy {
28
29// Whether or not -debug-pass has been specified. For use to check if it's
30// specified alongside the new PM.
32
33class PassManagerImpl;
34class FunctionPassManagerImpl;
35
36/// PassManagerBase - An abstract interface to allow code to add passes to
37/// a pass manager without having to hard-code what kind of pass manager
38/// it is.
40public:
42
43 /// Add a pass to the queue of passes to run. This passes ownership of
44 /// the Pass to the PassManager. When the PassManager is destroyed, the pass
45 /// will be destroyed as well, so there is no need to delete the pass. This
46 /// may even destroy the pass right away if it is found to be redundant. This
47 /// implies that all passes MUST be allocated with 'new'.
48 virtual void add(Pass *P) = 0;
49};
50
51/// PassManager manages ModulePassManagers
53public:
54
56 ~PassManager() override;
57
58 void add(Pass *P) override;
59
60 /// run - Execute all of the passes scheduled for execution. Keep track of
61 /// whether any of the passes modifies the module, and if so, return true.
62 bool run(Module &M);
63
64private:
65 /// PassManagerImpl_New is the actual class. PassManager is just the
66 /// wraper to publish simple pass manager interface
68};
69
70/// FunctionPassManager manages FunctionPasses.
72public:
73 /// FunctionPassManager ctor - This initializes the pass manager. It needs,
74 /// but does not take ownership of, the specified Module.
75 explicit FunctionPassManager(Module *M);
76 ~FunctionPassManager() override;
77
78 void add(Pass *P) override;
79
80 /// run - Execute all of the passes scheduled for execution. Keep
81 /// track of whether any of the passes modifies the function, and if
82 /// so, return true.
83 ///
84 bool run(Function &F);
85
86 /// doInitialization - Run all of the initializers for the function passes.
87 ///
88 bool doInitialization();
89
90 /// doFinalization - Run all of the finalizers for the function passes.
91 ///
92 bool doFinalization();
93
94private:
96 Module *M;
97};
98
99} // End legacy namespace
100
101// Create wrappers for C Binding types (see CBindingWrapping.h).
103
104} // End llvm namespace
105
106#endif
aarch64 AArch64 CCMP Pass
#define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref)
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
#define P(N)
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:94
FunctionPassManagerImpl manages FPPassManagers.
FunctionPassManager manages FunctionPasses.
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
void add(Pass *P) override
Add a pass to the queue of passes to run.
bool doInitialization()
doInitialization - Run all of the initializers for the function passes.
bool doFinalization()
doFinalization - Run all of the finalizers for the function passes.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
virtual void add(Pass *P)=0
Add a pass to the queue of passes to run.
PassManagerImpl manages MPPassManagers.
PassManager manages ModulePassManagers.
void add(Pass *P) override
Add a pass to the queue of passes to run.
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
PassManager()
Create new pass manager.
struct LLVMOpaquePassManager * LLVMPassManagerRef
Definition: Types.h:127
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18