LLVM  14.0.0git
LegacyPassManagers.h
Go to the documentation of this file.
1 //===- LegacyPassManagers.h - Legacy Pass Infrastructure --------*- 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 declares the LLVM Pass Manager infrastructure.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_IR_LEGACYPASSMANAGERS_H
14 #define LLVM_IR_LEGACYPASSMANAGERS_H
15 
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/FoldingSet.h"
18 #include "llvm/ADT/SmallPtrSet.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/Pass.h"
21 #include <vector>
22 
23 //===----------------------------------------------------------------------===//
24 // Overview:
25 // The Pass Manager Infrastructure manages passes. It's responsibilities are:
26 //
27 // o Manage optimization pass execution order
28 // o Make required Analysis information available before pass P is run
29 // o Release memory occupied by dead passes
30 // o If Analysis information is dirtied by a pass then regenerate Analysis
31 // information before it is consumed by another pass.
32 //
33 // Pass Manager Infrastructure uses multiple pass managers. They are
34 // PassManager, FunctionPassManager, MPPassManager, FPPassManager, BBPassManager.
35 // This class hierarchy uses multiple inheritance but pass managers do not
36 // derive from another pass manager.
37 //
38 // PassManager and FunctionPassManager are two top-level pass manager that
39 // represents the external interface of this entire pass manager infrastucture.
40 //
41 // Important classes :
42 //
43 // [o] class PMTopLevelManager;
44 //
45 // Two top level managers, PassManager and FunctionPassManager, derive from
46 // PMTopLevelManager. PMTopLevelManager manages information used by top level
47 // managers such as last user info.
48 //
49 // [o] class PMDataManager;
50 //
51 // PMDataManager manages information, e.g. list of available analysis info,
52 // used by a pass manager to manage execution order of passes. It also provides
53 // a place to implement common pass manager APIs. All pass managers derive from
54 // PMDataManager.
55 //
56 // [o] class FunctionPassManager;
57 //
58 // This is a external interface used to manage FunctionPasses. This
59 // interface relies on FunctionPassManagerImpl to do all the tasks.
60 //
61 // [o] class FunctionPassManagerImpl : public ModulePass, PMDataManager,
62 // public PMTopLevelManager;
63 //
64 // FunctionPassManagerImpl is a top level manager. It manages FPPassManagers
65 //
66 // [o] class FPPassManager : public ModulePass, public PMDataManager;
67 //
68 // FPPassManager manages FunctionPasses and BBPassManagers
69 //
70 // [o] class MPPassManager : public Pass, public PMDataManager;
71 //
72 // MPPassManager manages ModulePasses and FPPassManagers
73 //
74 // [o] class PassManager;
75 //
76 // This is a external interface used by various tools to manages passes. It
77 // relies on PassManagerImpl to do all the tasks.
78 //
79 // [o] class PassManagerImpl : public Pass, public PMDataManager,
80 // public PMTopLevelManager
81 //
82 // PassManagerImpl is a top level pass manager responsible for managing
83 // MPPassManagers.
84 //===----------------------------------------------------------------------===//
85 
87 
88 namespace llvm {
89 template <typename T> class ArrayRef;
90 class Module;
91 class StringRef;
92 class Value;
93 class Timer;
94 class PMDataManager;
95 
96 // enums for debugging strings
98  EXECUTION_MSG, // "Executing Pass '" + PassName
99  MODIFICATION_MSG, // "Made Modification '" + PassName
100  FREEING_MSG, // " Freeing Pass '" + PassName
101  ON_FUNCTION_MSG, // "' on Function '" + FunctionName + "'...\n"
102  ON_MODULE_MSG, // "' on Module '" + ModuleName + "'...\n"
103  ON_REGION_MSG, // "' on Region '" + Msg + "'...\n'"
104  ON_LOOP_MSG, // "' on Loop '" + Msg + "'...\n'"
105  ON_CG_MSG // "' on Call Graph Nodes '" + Msg + "'...\n'"
106 };
107 
108 /// PassManagerPrettyStackEntry - This is used to print informative information
109 /// about what pass is running when/if a stack trace is generated.
111  Pass *P;
112  Value *V;
113  Module *M;
114 
115 public:
117  : P(p), V(nullptr), M(nullptr) {} // When P is releaseMemory'd.
119  : P(p), V(&v), M(nullptr) {} // When P is run on V
121  : P(p), V(nullptr), M(&m) {} // When P is run on M
122 
123  /// print - Emit information about this stack frame to OS.
124  void print(raw_ostream &OS) const override;
125 };
126 
127 //===----------------------------------------------------------------------===//
128 // PMStack
129 //
130 /// PMStack - This class implements a stack data structure of PMDataManager
131 /// pointers.
132 ///
133 /// Top level pass managers (see PassManager.cpp) maintain active Pass Managers
134 /// using PMStack. Each Pass implements assignPassManager() to connect itself
135 /// with appropriate manager. assignPassManager() walks PMStack to find
136 /// suitable manager.
137 class PMStack {
138 public:
139  typedef std::vector<PMDataManager *>::const_reverse_iterator iterator;
140  iterator begin() const { return S.rbegin(); }
141  iterator end() const { return S.rend(); }
142 
143  void pop();
144  PMDataManager *top() const { return S.back(); }
145  void push(PMDataManager *PM);
146  bool empty() const { return S.empty(); }
147 
148  void dump() const;
149 
150 private:
151  std::vector<PMDataManager *> S;
152 };
153 
154 //===----------------------------------------------------------------------===//
155 // PMTopLevelManager
156 //
157 /// PMTopLevelManager manages LastUser info and collects common APIs used by
158 /// top level pass managers.
160 protected:
161  explicit PMTopLevelManager(PMDataManager *PMDM);
162 
163  unsigned getNumContainedManagers() const {
164  return (unsigned)PassManagers.size();
165  }
166 
168 
169 private:
170  virtual PMDataManager *getAsPMDataManager() = 0;
171  virtual PassManagerType getTopLevelPassManagerType() = 0;
172 
173 public:
174  /// Schedule pass P for execution. Make sure that passes required by
175  /// P are run before P is run. Update analysis info maintained by
176  /// the manager. Remove dead passes. This is a recursive function.
177  void schedulePass(Pass *P);
178 
179  /// Set pass P as the last user of the given analysis passes.
180  void setLastUser(ArrayRef<Pass*> AnalysisPasses, Pass *P);
181 
182  /// Collect passes whose last user is P
183  void collectLastUses(SmallVectorImpl<Pass *> &LastUses, Pass *P);
184 
185  /// Find the pass that implements Analysis AID. Search immutable
186  /// passes and all pass managers. If desired pass is not found
187  /// then return NULL.
189 
190  /// Retrieve the PassInfo for an analysis.
191  const PassInfo *findAnalysisPassInfo(AnalysisID AID) const;
192 
193  /// Find analysis usage information for the pass P.
195 
196  virtual ~PMTopLevelManager();
197 
198  /// Add immutable pass and initialize it.
200 
202  return ImmutablePasses;
203  }
204 
205  void addPassManager(PMDataManager *Manager) {
206  PassManagers.push_back(Manager);
207  }
208 
209  // Add Manager into the list of managers that are not directly
210  // maintained by this top level pass manager
211  inline void addIndirectPassManager(PMDataManager *Manager) {
212  IndirectPassManagers.push_back(Manager);
213  }
214 
215  // Print passes managed by this top level manager.
216  void dumpPasses() const;
217  void dumpArguments() const;
218 
219  // Active Pass Managers
221 
222 protected:
223  /// Collection of pass managers
225 
226 private:
227  /// Collection of pass managers that are not directly maintained
228  /// by this pass manager
229  SmallVector<PMDataManager *, 8> IndirectPassManagers;
230 
231  // Map to keep track of last user of the analysis pass.
232  // LastUser->second is the last user of Lastuser->first.
233  // This is kept in sync with InversedLastUser.
234  DenseMap<Pass *, Pass *> LastUser;
235 
236  // Map to keep track of passes that are last used by a pass.
237  // This is kept in sync with LastUser.
238  DenseMap<Pass *, SmallPtrSet<Pass *, 8> > InversedLastUser;
239 
240  /// Immutable passes are managed by top level manager.
241  SmallVector<ImmutablePass *, 16> ImmutablePasses;
242 
243  /// Map from ID to immutable passes.
245 
246 
247  /// A wrapper around AnalysisUsage for the purpose of uniqueing. The wrapper
248  /// is used to avoid needing to make AnalysisUsage itself a folding set node.
249  struct AUFoldingSetNode : public FoldingSetNode {
250  AnalysisUsage AU;
251  AUFoldingSetNode(const AnalysisUsage &AU) : AU(AU) {}
252  void Profile(FoldingSetNodeID &ID) const {
253  Profile(ID, AU);
254  }
255  static void Profile(FoldingSetNodeID &ID, const AnalysisUsage &AU) {
256  // TODO: We could consider sorting the dependency arrays within the
257  // AnalysisUsage (since they are conceptually unordered).
258  ID.AddBoolean(AU.getPreservesAll());
259  auto ProfileVec = [&](const SmallVectorImpl<AnalysisID>& Vec) {
260  ID.AddInteger(Vec.size());
261  for(AnalysisID AID : Vec)
262  ID.AddPointer(AID);
263  };
264  ProfileVec(AU.getRequiredSet());
265  ProfileVec(AU.getRequiredTransitiveSet());
266  ProfileVec(AU.getPreservedSet());
267  ProfileVec(AU.getUsedSet());
268  }
269  };
270 
271  // Contains all of the unique combinations of AnalysisUsage. This is helpful
272  // when we have multiple instances of the same pass since they'll usually
273  // have the same analysis usage and can share storage.
274  FoldingSet<AUFoldingSetNode> UniqueAnalysisUsages;
275 
276  // Allocator used for allocating UAFoldingSetNodes. This handles deletion of
277  // all allocated nodes in one fell swoop.
278  SpecificBumpPtrAllocator<AUFoldingSetNode> AUFoldingSetNodeAllocator;
279 
280  // Maps from a pass to it's associated entry in UniqueAnalysisUsages. Does
281  // not own the storage associated with either key or value..
283 
284  /// Collection of PassInfo objects found via analysis IDs and in this top
285  /// level manager. This is used to memoize queries to the pass registry.
286  /// FIXME: This is an egregious hack because querying the pass registry is
287  /// either slow or racy.
288  mutable DenseMap<AnalysisID, const PassInfo *> AnalysisPassInfos;
289 };
290 
291 //===----------------------------------------------------------------------===//
292 // PMDataManager
293 
294 /// PMDataManager provides the common place to manage the analysis data
295 /// used by pass managers.
297 public:
298  explicit PMDataManager() : TPM(nullptr), Depth(0) {
300  }
301 
302  virtual ~PMDataManager();
303 
304  virtual Pass *getAsPass() = 0;
305 
306  /// Augment AvailableAnalysis by adding analysis made available by pass P.
308 
309  /// verifyPreservedAnalysis -- Verify analysis presreved by pass P.
311 
312  /// Remove Analysis that is not preserved by the pass
314 
315  /// Remove dead passes used by P.
316  void removeDeadPasses(Pass *P, StringRef Msg,
317  enum PassDebuggingString);
318 
319  /// Remove P.
320  void freePass(Pass *P, StringRef Msg,
321  enum PassDebuggingString);
322 
323  /// Add pass P into the PassVector. Update
324  /// AvailableAnalysis appropriately if ProcessAnalysis is true.
325  void add(Pass *P, bool ProcessAnalysis = true);
326 
327  /// Add RequiredPass into list of lower level passes required by pass P.
328  /// RequiredPass is run on the fly by Pass Manager when P requests it
329  /// through getAnalysis interface.
330  virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass);
331 
332  virtual std::tuple<Pass *, bool> getOnTheFlyPass(Pass *P, AnalysisID PI,
333  Function &F);
334 
335  /// Initialize available analysis information.
337  AvailableAnalysis.clear();
338  for (auto &IA : InheritedAnalysis)
339  IA = nullptr;
340  }
341 
342  // Return true if P preserves high level analysis used by other
343  // passes that are managed by this manager.
345 
346  /// Populate UsedPasses with analysis pass that are used or required by pass
347  /// P and are available. Populate ReqPassNotAvailable with analysis pass that
348  /// are required by pass P but are not available.
350  SmallVectorImpl<Pass *> &UsedPasses,
351  SmallVectorImpl<AnalysisID> &ReqPassNotAvailable, Pass *P);
352 
353  /// All Required analyses should be available to the pass as it runs! Here
354  /// we fill in the AnalysisImpls member of the pass so that it can
355  /// successfully use the getAnalysis() method to retrieve the
356  /// implementations it needs.
358 
359  /// Find the pass that implements Analysis AID. If desired pass is not found
360  /// then return NULL.
362 
363  // Access toplevel manager
366 
367  unsigned getDepth() const { return Depth; }
368  void setDepth(unsigned newDepth) { Depth = newDepth; }
369 
370  // Print routines used by debug-pass
371  void dumpLastUses(Pass *P, unsigned Offset) const;
372  void dumpPassArguments() const;
373  void dumpPassInfo(Pass *P, enum PassDebuggingString S1,
374  enum PassDebuggingString S2, StringRef Msg);
375  void dumpRequiredSet(const Pass *P) const;
376  void dumpPreservedSet(const Pass *P) const;
377  void dumpUsedSet(const Pass *P) const;
378 
379  unsigned getNumContainedPasses() const {
380  return (unsigned)PassVector.size();
381  }
382 
384  assert ( 0 && "Invalid use of getPassManagerType");
385  return PMT_Unknown;
386  }
387 
389  return &AvailableAnalysis;
390  }
391 
392  // Collect AvailableAnalysis from all the active Pass Managers.
394  unsigned Index = 0;
395  for (PMDataManager *PMDM : PMS)
396  InheritedAnalysis[Index++] = PMDM->getAvailableAnalysis();
397  }
398 
399  /// Set the initial size of the module if the user has specified that they
400  /// want remarks for size.
401  /// Returns 0 if the remark was not requested.
402  unsigned initSizeRemarkInfo(
403  Module &M,
404  StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount);
405 
406  /// Emit a remark signifying that the number of IR instructions in the module
407  /// changed.
408  /// \p F is optionally passed by passes which run on Functions, and thus
409  /// always know whether or not a non-empty function is available.
410  ///
411  /// \p FunctionToInstrCount maps the name of a \p Function to a pair. The
412  /// first member of the pair is the IR count of the \p Function before running
413  /// \p P, and the second member is the IR count of the \p Function after
414  /// running \p P.
416  Pass *P, Module &M, int64_t Delta, unsigned CountBefore,
417  StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount,
418  Function *F = nullptr);
419 
420 protected:
421  // Top level manager.
423 
424  // Collection of pass that are managed by this manager
426 
427  // Collection of Analysis provided by Parent pass manager and
428  // used by current pass manager. At at time there can not be more
429  // then PMT_Last active pass mangers.
431 
432  /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions
433  /// or higher is specified.
434  bool isPassDebuggingExecutionsOrMore() const;
435 
436 private:
437  void dumpAnalysisUsage(StringRef Msg, const Pass *P,
438  const AnalysisUsage::VectorType &Set) const;
439 
440  // Set of available Analysis. This information is used while scheduling
441  // pass. If a pass requires an analysis which is not available then
442  // the required analysis pass is scheduled to run before the pass itself is
443  // scheduled to run.
444  DenseMap<AnalysisID, Pass*> AvailableAnalysis;
445 
446  // Collection of higher level analysis used by the pass managed by
447  // this manager.
448  SmallVector<Pass *, 16> HigherLevelAnalysis;
449 
450  unsigned Depth;
451 };
452 
453 //===----------------------------------------------------------------------===//
454 // FPPassManager
455 //
456 /// FPPassManager manages BBPassManagers and FunctionPasses.
457 /// It batches all function passes and basic block pass managers together and
458 /// sequence them to process one function at a time before processing next
459 /// function.
460 class FPPassManager : public ModulePass, public PMDataManager {
461 public:
462  static char ID;
463  explicit FPPassManager()
464  : ModulePass(ID), PMDataManager() { }
465 
466  /// run - Execute all of the passes scheduled for execution. Keep track of
467  /// whether any of the passes modifies the module, and if so, return true.
468  bool runOnFunction(Function &F);
469  bool runOnModule(Module &M) override;
470 
471  /// cleanup - After running all passes, clean up pass manager cache.
472  void cleanup();
473 
474  /// doInitialization - Overrides ModulePass doInitialization for global
475  /// initialization tasks
476  ///
478 
479  /// doInitialization - Run all of the initializers for the function passes.
480  ///
481  bool doInitialization(Module &M) override;
482 
483  /// doFinalization - Overrides ModulePass doFinalization for global
484  /// finalization tasks
485  ///
487 
488  /// doFinalization - Run all of the finalizers for the function passes.
489  ///
490  bool doFinalization(Module &M) override;
491 
492  PMDataManager *getAsPMDataManager() override { return this; }
493  Pass *getAsPass() override { return this; }
494 
495  /// Pass Manager itself does not invalidate any analysis info.
496  void getAnalysisUsage(AnalysisUsage &Info) const override {
497  Info.setPreservesAll();
498  }
499 
500  // Print passes managed by this manager
501  void dumpPassStructure(unsigned Offset) override;
502 
503  StringRef getPassName() const override { return "Function Pass Manager"; }
504 
506  assert ( N < PassVector.size() && "Pass number out of range!");
507  FunctionPass *FP = static_cast<FunctionPass *>(PassVector[N]);
508  return FP;
509  }
510 
513  }
514 };
515 
516 }
517 
518 #endif
llvm::PMTopLevelManager::addImmutablePass
void addImmutablePass(ImmutablePass *P)
Add immutable pass and initialize it.
Definition: LegacyPassManager.cpp:802
llvm::PMDataManager::recordAvailableAnalysis
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
Definition: LegacyPassManager.cpp:878
CmpMode::FP
@ FP
llvm::AnalysisUsage::getRequiredTransitiveSet
const VectorType & getRequiredTransitiveSet() const
Definition: PassAnalysisSupport.h:145
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::FPPassManager::runOnFunction
bool runOnFunction(Function &F)
run - Execute all of the passes scheduled for execution.
Definition: LegacyPassManager.cpp:1402
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
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:238
llvm::PassManagerPrettyStackEntry::print
void print(raw_ostream &OS) const override
print - Emit information about this stack frame to OS.
Definition: LegacyPassManager.cpp:213
llvm::PMTopLevelManager::findAnalysisUsage
AnalysisUsage * findAnalysisUsage(Pass *P)
Find analysis usage information for the pass P.
Definition: LegacyPassManager.cpp:628
llvm::ImmutablePass
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition: Pass.h:269
llvm::PMTopLevelManager::PassManagers
SmallVector< PMDataManager *, 8 > PassManagers
Collection of pass managers.
Definition: LegacyPassManagers.h:224
llvm::PassManagerPrettyStackEntry::PassManagerPrettyStackEntry
PassManagerPrettyStackEntry(Pass *p)
Definition: LegacyPassManagers.h:116
llvm::FPPassManager::getAsPass
Pass * getAsPass() override
Definition: LegacyPassManagers.h:493
llvm::Function
Definition: Function.h:62
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::PMTopLevelManager::schedulePass
void schedulePass(Pass *P)
Schedule pass P for execution.
Definition: LegacyPassManager.cpp:664
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::PMDataManager::dumpPassInfo
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
Definition: LegacyPassManager.cpp:1187
llvm::SmallDenseMap
Definition: DenseMap.h:880
llvm::AnalysisID
const void * AnalysisID
Definition: Pass.h:47
llvm::FPPassManager::getPassName
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: LegacyPassManagers.h:503
llvm::PMTopLevelManager::getNumContainedManagers
unsigned getNumContainedManagers() const
Definition: LegacyPassManagers.h:163
llvm::PassManagerType
PassManagerType
Different types of internal pass managers.
Definition: Pass.h:52
llvm::SpecificBumpPtrAllocator< AUFoldingSetNode >
DenseMap.h
llvm::PassInfo
PassInfo class - An instance of this class exists for every pass known by the system,...
Definition: PassInfo.h:30
llvm::PMT_Unknown
@ PMT_Unknown
Definition: Pass.h:53
llvm::PMTopLevelManager::findAnalysisPassInfo
const PassInfo * findAnalysisPassInfo(AnalysisID AID) const
Retrieve the PassInfo for an analysis.
Definition: LegacyPassManager.cpp:791
T
#define T
Definition: Mips16ISelLowering.cpp:341
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::PMStack::push
void push(PMDataManager *PM)
Definition: LegacyPassManager.cpp:1700
llvm::ON_REGION_MSG
@ ON_REGION_MSG
Definition: LegacyPassManagers.h:103
llvm::PMStack::end
iterator end() const
Definition: LegacyPassManagers.h:141
llvm::PassManagerPrettyStackEntry
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
Definition: LegacyPassManagers.h:110
llvm::PMDataManager::initSizeRemarkInfo
unsigned initSizeRemarkInfo(Module &M, StringMap< std::pair< unsigned, unsigned >> &FunctionToInstrCount)
Set the initial size of the module if the user has specified that they want remarks for size.
Definition: LegacyPassManager.cpp:70
p
the resulting code requires compare and branches when and if * p
Definition: README.txt:396
llvm::FPPassManager::doInitialization
bool doInitialization(Module &M) override
doInitialization - Run all of the initializers for the function passes.
Definition: LegacyPassManager.cpp:1490
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::PrettyStackTraceEntry
PrettyStackTraceEntry - This class is used to represent a frame of the "pretty" stack trace that is d...
Definition: PrettyStackTrace.h:52
llvm::PMDataManager
PMDataManager provides the common place to manage the analysis data used by pass managers.
Definition: LegacyPassManagers.h:296
llvm::PMDataManager::dumpLastUses
void dumpLastUses(Pass *P, unsigned Offset) const
Definition: LegacyPassManager.cpp:1157
llvm::AnalysisUsage::getPreservesAll
bool getPreservesAll() const
Determine whether a pass said it does not transform its input at all.
Definition: PassAnalysisSupport.h:133
llvm::PMTopLevelManager::dumpPasses
void dumpPasses() const
Definition: LegacyPassManager.cpp:821
llvm::PMDataManager::getNumContainedPasses
unsigned getNumContainedPasses() const
Definition: LegacyPassManagers.h:379
llvm::PMStack::iterator
std::vector< PMDataManager * >::const_reverse_iterator iterator
Definition: LegacyPassManagers.h:139
llvm::PMStack::begin
iterator begin() const
Definition: LegacyPassManagers.h:140
llvm::FPPassManager::getPassManagerType
PassManagerType getPassManagerType() const override
Definition: LegacyPassManagers.h:511
llvm::FPPassManager::getAsPMDataManager
PMDataManager * getAsPMDataManager() override
Definition: LegacyPassManagers.h:492
llvm::PMTopLevelManager::activeStack
PMStack activeStack
Definition: LegacyPassManagers.h:220
llvm::PMTopLevelManager::getImmutablePasses
SmallVectorImpl< ImmutablePass * > & getImmutablePasses()
Definition: LegacyPassManagers.h:201
llvm::PMTopLevelManager::collectLastUses
void collectLastUses(SmallVectorImpl< Pass * > &LastUses, Pass *P)
Collect passes whose last user is P.
Definition: LegacyPassManager.cpp:618
llvm::AnalysisUsage::getUsedSet
const VectorType & getUsedSet() const
Definition: PassAnalysisSupport.h:149
llvm::PMDataManager::dumpPreservedSet
void dumpPreservedSet(const Pass *P) const
Definition: LegacyPassManager.cpp:1237
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::PMDataManager::initializeAnalysisImpl
void initializeAnalysisImpl(Pass *P)
All Required analyses should be available to the pass as it runs! Here we fill in the AnalysisImpls m...
Definition: LegacyPassManager.cpp:1124
llvm::PMDataManager::setDepth
void setDepth(unsigned newDepth)
Definition: LegacyPassManagers.h:368
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::FPPassManager::cleanup
void cleanup()
cleanup - After running all passes, clean up pass manager cache.
Definition: LegacyPassManager.cpp:1375
llvm::MODIFICATION_MSG
@ MODIFICATION_MSG
Definition: LegacyPassManagers.h:99
llvm::PMTopLevelManager::dumpArguments
void dumpArguments() const
Definition: LegacyPassManager.cpp:839
llvm::PMDataManager::dumpPassArguments
void dumpPassArguments() const
Definition: LegacyPassManager.cpp:1175
SmallPtrSet.h
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::ON_CG_MSG
@ ON_CG_MSG
Definition: LegacyPassManagers.h:105
llvm::FPPassManager::getContainedPass
FunctionPass * getContainedPass(unsigned N)
Definition: LegacyPassManagers.h:505
llvm::PMStack::top
PMDataManager * top() const
Definition: LegacyPassManagers.h:144
llvm::FPPassManager::doFinalization
bool doFinalization(Module &M) override
doFinalization - Run all of the finalizers for the function passes.
Definition: LegacyPassManager.cpp:1499
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::AnalysisUsage::getRequiredSet
const VectorType & getRequiredSet() const
Definition: PassAnalysisSupport.h:144
llvm::PMStack::empty
bool empty() const
Definition: LegacyPassManagers.h:146
llvm::ON_MODULE_MSG
@ ON_MODULE_MSG
Definition: LegacyPassManagers.h:102
llvm::PassManagerPrettyStackEntry::PassManagerPrettyStackEntry
PassManagerPrettyStackEntry(Pass *p, Value &v)
Definition: LegacyPassManagers.h:118
llvm::ON_LOOP_MSG
@ ON_LOOP_MSG
Definition: LegacyPassManagers.h:104
llvm::FPPassManager::ID
static char ID
Definition: LegacyPassManagers.h:462
llvm::PMDataManager::initializeAnalysisInfo
void initializeAnalysisInfo()
Initialize available analysis information.
Definition: LegacyPassManagers.h:336
llvm::PMDataManager::getTopLevelManager
PMTopLevelManager * getTopLevelManager()
Definition: LegacyPassManagers.h:364
llvm::ON_FUNCTION_MSG
@ ON_FUNCTION_MSG
Definition: LegacyPassManagers.h:101
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::DenseMap
Definition: DenseMap.h:714
llvm::FPPassManager::FPPassManager
FPPassManager()
Definition: LegacyPassManagers.h:463
PrettyStackTrace.h
llvm::FPPassManager::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
Definition: LegacyPassManagers.h:496
llvm::PMTopLevelManager::addPassManager
void addPassManager(PMDataManager *Manager)
Definition: LegacyPassManagers.h:205
llvm::PassDebuggingString
PassDebuggingString
Definition: LegacyPassManagers.h:97
llvm::PMDataManager::removeDeadPasses
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
Definition: LegacyPassManager.cpp:976
llvm::PMDataManager::preserveHigherLevelAnalysis
bool preserveHigherLevelAnalysis(Pass *P)
Definition: LegacyPassManager.cpp:896
llvm::PMDataManager::InheritedAnalysis
DenseMap< AnalysisID, Pass * > * InheritedAnalysis[PMT_Last]
Definition: LegacyPassManagers.h:430
llvm::PMTopLevelManager::PMTopLevelManager
PMTopLevelManager(PMDataManager *PMDM)
Initialize top level manager. Create first pass manager.
Definition: LegacyPassManager.cpp:558
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::PMDataManager::dumpRequiredSet
void dumpRequiredSet(const Pass *P) const
Definition: LegacyPassManager.cpp:1228
llvm::PMDataManager::~PMDataManager
virtual ~PMDataManager()
Definition: LegacyPassManager.cpp:1307
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::FPPassManager::dumpPassStructure
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
Definition: LegacyPassManager.cpp:1390
llvm::PMDataManager::setTopLevelManager
void setTopLevelManager(PMTopLevelManager *T)
Definition: LegacyPassManagers.h:365
llvm::PMT_Last
@ PMT_Last
Definition: Pass.h:59
llvm::PMDataManager::dumpUsedSet
void dumpUsedSet(const Pass *P) const
Definition: LegacyPassManager.cpp:1246
llvm::Pass::doFinalization
virtual bool doFinalization(Module &)
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
Definition: Pass.h:120
llvm::FoldingSet< AUFoldingSetNode >
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::Pass::doInitialization
virtual bool doInitialization(Module &)
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
Definition: Pass.h:116
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::PMT_FunctionPassManager
@ PMT_FunctionPassManager
FPPassManager.
Definition: Pass.h:56
llvm::FoldingSetBase::Node
Node - This class is used to maintain the singly linked bucket list in a folding set.
Definition: FoldingSet.h:133
llvm::PassManagerPrettyStackEntry::PassManagerPrettyStackEntry
PassManagerPrettyStackEntry(Pass *p, Module &m)
Definition: LegacyPassManagers.h:120
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:313
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::EXECUTION_MSG
@ EXECUTION_MSG
Definition: LegacyPassManagers.h:98
Profile
Load MIR Sample Profile
Definition: MIRSampleProfile.cpp:62
llvm::PMDataManager::getPassManagerType
virtual PassManagerType getPassManagerType() const
Definition: LegacyPassManagers.h:383
llvm::PMDataManager::PMDataManager
PMDataManager()
Definition: LegacyPassManagers.h:298
llvm::PMStack::pop
void pop()
Definition: LegacyPassManager.cpp:1691
FoldingSet.h
llvm::PMDataManager::verifyPreservedAnalysis
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
Definition: LegacyPassManager.cpp:912
llvm::PMDataManager::removeNotPreservedAnalysis
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
Definition: LegacyPassManager.cpp:930
llvm::FPPassManager
FPPassManager manages BBPassManagers and FunctionPasses.
Definition: LegacyPassManagers.h:460
llvm::PMDataManager::getAsPass
virtual Pass * getAsPass()=0
llvm::PMDataManager::addLowerLevelRequiredPass
virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass)
Add RequiredPass into list of lower level passes required by pass P.
Definition: LegacyPassManager.cpp:1279
llvm::PMStack
PMStack - This class implements a stack data structure of PMDataManager pointers.
Definition: LegacyPassManagers.h:137
llvm::PMDataManager::add
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
Definition: LegacyPassManager.cpp:1028
llvm::PMDataManager::getOnTheFlyPass
virtual std::tuple< Pass *, bool > getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F)
Definition: LegacyPassManager.cpp:1301
llvm::PMDataManager::PassVector
SmallVector< Pass *, 16 > PassVector
Definition: LegacyPassManagers.h:425
Direction
Loop::LoopBounds::Direction Direction
Definition: LoopInfo.cpp:230
llvm::PMDataManager::getAvailableAnalysis
DenseMap< AnalysisID, Pass * > * getAvailableAnalysis()
Definition: LegacyPassManagers.h:388
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::PMDataManager::TPM
PMTopLevelManager * TPM
Definition: LegacyPassManagers.h:422
llvm::PMTopLevelManager::initializeAllAnalysisInfo
void initializeAllAnalysisInfo()
Definition: LegacyPassManager.cpp:856
llvm::PMTopLevelManager::addIndirectPassManager
void addIndirectPassManager(PMDataManager *Manager)
Definition: LegacyPassManagers.h:211
llvm::FPPassManager::runOnModule
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition: LegacyPassManager.cpp:1481
llvm::PMDataManager::getDepth
unsigned getDepth() const
Definition: LegacyPassManagers.h:367
llvm::PMTopLevelManager::setLastUser
void setLastUser(ArrayRef< Pass * > AnalysisPasses, Pass *P)
Set pass P as the last user of the given analysis passes.
Definition: LegacyPassManager.cpp:566
llvm::PMDataManager::collectRequiredAndUsedAnalyses
void collectRequiredAndUsedAnalyses(SmallVectorImpl< Pass * > &UsedPasses, SmallVectorImpl< AnalysisID > &ReqPassNotAvailable, Pass *P)
Populate UsedPasses with analysis pass that are used or required by pass P and are available.
Definition: LegacyPassManager.cpp:1103
llvm::Pass
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:91
llvm::PMDataManager::freePass
void freePass(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove P.
Definition: LegacyPassManager.cpp:997
SmallVector.h
N
#define N
P
#define P(N)
llvm::AnalysisUsage::getPreservedSet
const VectorType & getPreservedSet() const
Definition: PassAnalysisSupport.h:148
llvm::PMTopLevelManager::~PMTopLevelManager
virtual ~PMTopLevelManager()
Destructor.
Definition: LegacyPassManager.cpp:866
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::PMTopLevelManager
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers.
Definition: LegacyPassManagers.h:159
llvm::PMStack::dump
void dump() const
Definition: LegacyPassManager.cpp:1724
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
llvm::PMDataManager::emitInstrCountChangedRemark
void emitInstrCountChangedRemark(Pass *P, Module &M, int64_t Delta, unsigned CountBefore, StringMap< std::pair< unsigned, unsigned >> &FunctionToInstrCount, Function *F=nullptr)
Emit a remark signifying that the number of IR instructions in the module changed.
Definition: LegacyPassManager.cpp:92
llvm::PMTopLevelManager::findAnalysisPass
Pass * findAnalysisPass(AnalysisID AID)
Find the pass that implements Analysis AID.
Definition: LegacyPassManager.cpp:772
llvm::PMDataManager::isPassDebuggingExecutionsOrMore
bool isPassDebuggingExecutionsOrMore() const
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.
Definition: LegacyPassManager.cpp:66
llvm::PMDataManager::populateInheritedAnalysis
void populateInheritedAnalysis(PMStack &PMS)
Definition: LegacyPassManagers.h:393
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::FREEING_MSG
@ FREEING_MSG
Definition: LegacyPassManagers.h:100
llvm::PMDataManager::findAnalysisPass
Pass * findAnalysisPass(AnalysisID AID, bool Direction)
Find the pass that implements Analysis AID.
Definition: LegacyPassManager.cpp:1141
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37