LLVM  14.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 
19 #include "llvm/Pass.h"
21 
22 namespace llvm {
23 
24 class Pass;
25 class Module;
26 
27 namespace legacy {
28 
29 // Whether or not -debug-pass has been specified. For use to check if it's
30 // specified alongside the new PM.
31 bool debugPassSpecified();
32 
33 class PassManagerImpl;
34 class 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.
40 public:
41  virtual ~PassManagerBase();
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
52 class PassManager : public PassManagerBase {
53 public:
54 
55  PassManager();
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 
64 private:
65  /// PassManagerImpl_New is the actual class. PassManager is just the
66  /// wraper to publish simple pass manager interface
67  PassManagerImpl *PM;
68 };
69 
70 /// FunctionPassManager manages FunctionPasses.
72 public:
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 
94 private:
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
llvm
---------------------— PointerInfo ------------------------------------—
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
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1966
llvm::Function
Definition: Function.h:61
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
Pass.h
llvm::legacy::FunctionPassManager::FunctionPassManager
FunctionPassManager(Module *M)
FunctionPassManager ctor - This initializes the pass manager.
Definition: LegacyPassManager.cpp:1331
CBindingWrapping.h
llvm::legacy::FunctionPassManagerImpl
FunctionPassManagerImpl manages FPPassManagers.
Definition: LegacyPassManager.cpp:251
DEFINE_STDCXX_CONVERSION_FUNCTIONS
#define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref)
Definition: CBindingWrapping.h:36
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::legacy::PassManager::PassManager
PassManager()
Create new pass manager.
Definition: LegacyPassManager.cpp:1664
llvm::legacy::FunctionPassManager::doFinalization
bool doFinalization()
doFinalization - Run all of the finalizers for the function passes.
Definition: LegacyPassManager.cpp:1368
llvm::legacy::debugPassSpecified
bool debugPassSpecified()
Definition: LegacyPassManager.cpp:245
llvm::legacy::PassManager::~PassManager
~PassManager() override
Definition: LegacyPassManager.cpp:1670
llvm::legacy::PassManagerBase::~PassManagerBase
virtual ~PassManagerBase()
Definition: LegacyPassManager.cpp:1775
llvm::legacy::PassManagerBase::add
virtual void add(Pass *P)=0
Add a pass to the queue of passes to run.
llvm::legacy::FunctionPassManager::doInitialization
bool doInitialization()
doInitialization - Run all of the initializers for the function passes.
Definition: LegacyPassManager.cpp:1362
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::legacy::FunctionPassManager::add
void add(Pass *P) override
Add a pass to the queue of passes to run.
Definition: LegacyPassManager.cpp:1344
LLVMPassManagerRef
struct LLVMOpaquePassManager * LLVMPassManagerRef
Definition: Types.h:127
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::legacy::FunctionPassManager::run
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
Definition: LegacyPassManager.cpp:1352
llvm::legacy::PassManager
PassManager manages ModulePassManagers.
Definition: LegacyPassManager.h:52
llvm::legacy::PassManager::add
void add(Pass *P) override
Add a pass to the queue of passes to run.
Definition: LegacyPassManager.cpp:1674
llvm::legacy::FunctionPassManager::~FunctionPassManager
~FunctionPassManager() override
Definition: LegacyPassManager.cpp:1340
llvm::Pass
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:91
llvm::legacy::PassManagerImpl
PassManagerImpl manages MPPassManagers.
Definition: LegacyPassManager.cpp:474
llvm::legacy::FunctionPassManager
FunctionPassManager manages FunctionPasses.
Definition: LegacyPassManager.h:71
llvm::legacy::PassManagerBase
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Definition: LegacyPassManager.h:39
llvm::legacy::PassManager::run
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
Definition: LegacyPassManager.cpp:1680