LLVM  14.0.0git
LegacyPassManager.cpp
Go to the documentation of this file.
1 //===- LegacyPassManager.cpp - LLVM Pass Infrastructure Implementation ----===//
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 implements the legacy LLVM Pass Manager infrastructure.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/ADT/MapVector.h"
15 #include "llvm/ADT/Statistic.h"
16 #include "llvm/IR/DiagnosticInfo.h"
18 #include "llvm/IR/LLVMContext.h"
21 #include "llvm/IR/Module.h"
22 #include "llvm/IR/PassTimingInfo.h"
23 #include "llvm/IR/PrintPasses.h"
24 #include "llvm/IR/StructuralHash.h"
25 #include "llvm/Support/Chrono.h"
27 #include "llvm/Support/Debug.h"
28 #include "llvm/Support/Error.h"
31 #include "llvm/Support/Mutex.h"
33 #include "llvm/Support/Timer.h"
35 #include <algorithm>
36 #include <unordered_set>
37 using namespace llvm;
38 
39 // See PassManagers.h for Pass Manager infrastructure overview.
40 
41 //===----------------------------------------------------------------------===//
42 // Pass debugging information. Often it is useful to find out what pass is
43 // running when a crash occurs in a utility. When this library is compiled with
44 // debugging on, a command line option (--debug-pass) is enabled that causes the
45 // pass name to be printed before it executes.
46 //
47 
48 namespace {
49 // Different debug levels that can be enabled...
50 enum PassDebugLevel {
51  Disabled, Arguments, Structure, Executions, Details
52 };
53 } // namespace
54 
56  "debug-pass", cl::Hidden,
57  cl::desc("Print legacy PassManager debugging information"),
58  cl::values(clEnumVal(Disabled, "disable debug output"),
59  clEnumVal(Arguments, "print pass arguments to pass to 'opt'"),
60  clEnumVal(Structure, "print pass structure before run()"),
61  clEnumVal(Executions, "print pass name before it is executed"),
62  clEnumVal(Details, "print pass details when it is executed")));
63 
64 /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions
65 /// or higher is specified.
67  return PassDebugging >= Executions;
68 }
69 
71  Module &M, StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount) {
72  // Only calculate getInstructionCount if the size-info remark is requested.
73  unsigned InstrCount = 0;
74 
75  // Collect instruction counts for every function. We'll use this to emit
76  // per-function size remarks later.
77  for (Function &F : M) {
78  unsigned FCount = F.getInstructionCount();
79 
80  // Insert a record into FunctionToInstrCount keeping track of the current
81  // size of the function as the first member of a pair. Set the second
82  // member to 0; if the function is deleted by the pass, then when we get
83  // here, we'll be able to let the user know that F no longer contributes to
84  // the module.
85  FunctionToInstrCount[F.getName().str()] =
86  std::pair<unsigned, unsigned>(FCount, 0);
87  InstrCount += FCount;
88  }
89  return InstrCount;
90 }
91 
93  Pass *P, Module &M, int64_t Delta, unsigned CountBefore,
94  StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount,
95  Function *F) {
96  // If it's a pass manager, don't emit a remark. (This hinges on the assumption
97  // that the only passes that return non-null with getAsPMDataManager are pass
98  // managers.) The reason we have to do this is to avoid emitting remarks for
99  // CGSCC passes.
100  if (P->getAsPMDataManager())
101  return;
102 
103  // Set to true if this isn't a module pass or CGSCC pass.
104  bool CouldOnlyImpactOneFunction = (F != nullptr);
105 
106  // Helper lambda that updates the changes to the size of some function.
107  auto UpdateFunctionChanges =
108  [&FunctionToInstrCount](Function &MaybeChangedFn) {
109  // Update the total module count.
110  unsigned FnSize = MaybeChangedFn.getInstructionCount();
111  auto It = FunctionToInstrCount.find(MaybeChangedFn.getName());
112 
113  // If we created a new function, then we need to add it to the map and
114  // say that it changed from 0 instructions to FnSize.
115  if (It == FunctionToInstrCount.end()) {
116  FunctionToInstrCount[MaybeChangedFn.getName()] =
117  std::pair<unsigned, unsigned>(0, FnSize);
118  return;
119  }
120  // Insert the new function size into the second member of the pair. This
121  // tells us whether or not this function changed in size.
122  It->second.second = FnSize;
123  };
124 
125  // We need to initially update all of the function sizes.
126  // If no function was passed in, then we're either a module pass or an
127  // CGSCC pass.
128  if (!CouldOnlyImpactOneFunction)
129  std::for_each(M.begin(), M.end(), UpdateFunctionChanges);
130  else
131  UpdateFunctionChanges(*F);
132 
133  // Do we have a function we can use to emit a remark?
134  if (!CouldOnlyImpactOneFunction) {
135  // We need a function containing at least one basic block in order to output
136  // remarks. Since it's possible that the first function in the module
137  // doesn't actually contain a basic block, we have to go and find one that's
138  // suitable for emitting remarks.
139  auto It = llvm::find_if(M, [](const Function &Fn) { return !Fn.empty(); });
140 
141  // Didn't find a function. Quit.
142  if (It == M.end())
143  return;
144 
145  // We found a function containing at least one basic block.
146  F = &*It;
147  }
148  int64_t CountAfter = static_cast<int64_t>(CountBefore) + Delta;
149  BasicBlock &BB = *F->begin();
150  OptimizationRemarkAnalysis R("size-info", "IRSizeChange",
151  DiagnosticLocation(), &BB);
152  // FIXME: Move ore namespace to DiagnosticInfo so that we can use it. This
153  // would let us use NV instead of DiagnosticInfoOptimizationBase::Argument.
154  R << DiagnosticInfoOptimizationBase::Argument("Pass", P->getPassName())
155  << ": IR instruction count changed from "
156  << DiagnosticInfoOptimizationBase::Argument("IRInstrsBefore", CountBefore)
157  << " to "
158  << DiagnosticInfoOptimizationBase::Argument("IRInstrsAfter", CountAfter)
159  << "; Delta: "
160  << DiagnosticInfoOptimizationBase::Argument("DeltaInstrCount", Delta);
161  F->getContext().diagnose(R); // Not using ORE for layering reasons.
162 
163  // Emit per-function size change remarks separately.
164  std::string PassName = P->getPassName().str();
165 
166  // Helper lambda that emits a remark when the size of a function has changed.
167  auto EmitFunctionSizeChangedRemark = [&FunctionToInstrCount, &F, &BB,
168  &PassName](StringRef Fname) {
169  unsigned FnCountBefore, FnCountAfter;
170  std::pair<unsigned, unsigned> &Change = FunctionToInstrCount[Fname];
171  std::tie(FnCountBefore, FnCountAfter) = Change;
172  int64_t FnDelta = static_cast<int64_t>(FnCountAfter) -
173  static_cast<int64_t>(FnCountBefore);
174 
175  if (FnDelta == 0)
176  return;
177 
178  // FIXME: We shouldn't use BB for the location here. Unfortunately, because
179  // the function that we're looking at could have been deleted, we can't use
180  // it for the source location. We *want* remarks when a function is deleted
181  // though, so we're kind of stuck here as is. (This remark, along with the
182  // whole-module size change remarks really ought not to have source
183  // locations at all.)
184  OptimizationRemarkAnalysis FR("size-info", "FunctionIRSizeChange",
185  DiagnosticLocation(), &BB);
187  << ": Function: "
188  << DiagnosticInfoOptimizationBase::Argument("Function", Fname)
189  << ": IR instruction count changed from "
190  << DiagnosticInfoOptimizationBase::Argument("IRInstrsBefore",
191  FnCountBefore)
192  << " to "
193  << DiagnosticInfoOptimizationBase::Argument("IRInstrsAfter",
194  FnCountAfter)
195  << "; Delta: "
196  << DiagnosticInfoOptimizationBase::Argument("DeltaInstrCount", FnDelta);
197  F->getContext().diagnose(FR);
198 
199  // Update the function size.
200  Change.first = FnCountAfter;
201  };
202 
203  // Are we looking at more than one function? If so, emit remarks for all of
204  // the functions in the module. Otherwise, only emit one remark.
205  if (!CouldOnlyImpactOneFunction)
206  std::for_each(FunctionToInstrCount.keys().begin(),
207  FunctionToInstrCount.keys().end(),
208  EmitFunctionSizeChangedRemark);
209  else
210  EmitFunctionSizeChangedRemark(F->getName().str());
211 }
212 
214  if (!V && !M)
215  OS << "Releasing pass '";
216  else
217  OS << "Running pass '";
218 
219  OS << P->getPassName() << "'";
220 
221  if (M) {
222  OS << " on module '" << M->getModuleIdentifier() << "'.\n";
223  return;
224  }
225  if (!V) {
226  OS << '\n';
227  return;
228  }
229 
230  OS << " on ";
231  if (isa<Function>(V))
232  OS << "function";
233  else if (isa<BasicBlock>(V))
234  OS << "basic block";
235  else
236  OS << "value";
237 
238  OS << " '";
239  V->printAsOperand(OS, /*PrintType=*/false, M);
240  OS << "'\n";
241 }
242 
243 namespace llvm {
244 namespace legacy {
246 
247 //===----------------------------------------------------------------------===//
248 // FunctionPassManagerImpl
249 //
250 /// FunctionPassManagerImpl manages FPPassManagers
252  public PMDataManager,
253  public PMTopLevelManager {
254  virtual void anchor();
255 private:
256  bool wasRun;
257 public:
258  static char ID;
261  wasRun(false) {}
262 
263  /// \copydoc FunctionPassManager::add()
264  void add(Pass *P) {
265  schedulePass(P);
266  }
267 
268  /// createPrinterPass - Get a function printer pass.
270  const std::string &Banner) const override {
271  return createPrintFunctionPass(O, Banner);
272  }
273 
274  // Prepare for running an on the fly pass, freeing memory if needed
275  // from a previous run.
276  void releaseMemoryOnTheFly();
277 
278  /// run - Execute all of the passes scheduled for execution. Keep track of
279  /// whether any of the passes modifies the module, and if so, return true.
280  bool run(Function &F);
281 
282  /// doInitialization - Run all of the initializers for the function passes.
283  ///
284  bool doInitialization(Module &M) override;
285 
286  /// doFinalization - Run all of the finalizers for the function passes.
287  ///
288  bool doFinalization(Module &M) override;
289 
290 
291  PMDataManager *getAsPMDataManager() override { return this; }
292  Pass *getAsPass() override { return this; }
295  }
296 
297  /// Pass Manager itself does not invalidate any analysis info.
298  void getAnalysisUsage(AnalysisUsage &Info) const override {
299  Info.setPreservesAll();
300  }
301 
303  assert(N < PassManagers.size() && "Pass number out of range!");
304  FPPassManager *FP = static_cast<FPPassManager *>(PassManagers[N]);
305  return FP;
306  }
307 
308  void dumpPassStructure(unsigned Offset) override {
309  for (unsigned I = 0; I < getNumContainedManagers(); ++I)
311  }
312 };
313 
314 void FunctionPassManagerImpl::anchor() {}
315 
317 
318 //===----------------------------------------------------------------------===//
319 // FunctionPassManagerImpl implementation
320 //
322  bool Changed = false;
323 
324  dumpArguments();
325  dumpPasses();
326 
327  for (ImmutablePass *ImPass : getImmutablePasses())
328  Changed |= ImPass->doInitialization(M);
329 
330  for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index)
332 
333  return Changed;
334 }
335 
337  bool Changed = false;
338 
339  for (int Index = getNumContainedManagers() - 1; Index >= 0; --Index)
341 
342  for (ImmutablePass *ImPass : getImmutablePasses())
343  Changed |= ImPass->doFinalization(M);
344 
345  return Changed;
346 }
347 
349  if (!wasRun)
350  return;
351  for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) {
353  for (unsigned Index = 0; Index < FPPM->getNumContainedPasses(); ++Index) {
355  }
356  }
357  wasRun = false;
358 }
359 
360 // Execute all the passes managed by this top level manager.
361 // Return true if any function is modified by a pass.
363  bool Changed = false;
364 
366  for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) {
368  F.getContext().yield();
369  }
370 
371  for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index)
373 
374  wasRun = true;
375  return Changed;
376 }
377 } // namespace legacy
378 } // namespace llvm
379 
380 namespace {
381 //===----------------------------------------------------------------------===//
382 // MPPassManager
383 //
384 /// MPPassManager manages ModulePasses and function pass managers.
385 /// It batches all Module passes and function pass managers together and
386 /// sequences them to process one module.
387 class MPPassManager : public Pass, public PMDataManager {
388 public:
389  static char ID;
390  explicit MPPassManager() : Pass(PT_PassManager, ID) {}
391 
392  // Delete on the fly managers.
393  ~MPPassManager() override {
394  for (auto &OnTheFlyManager : OnTheFlyManagers) {
395  legacy::FunctionPassManagerImpl *FPP = OnTheFlyManager.second;
396  delete FPP;
397  }
398  }
399 
400  /// createPrinterPass - Get a module printer pass.
402  const std::string &Banner) const override {
403  return createPrintModulePass(O, Banner);
404  }
405 
406  /// run - Execute all of the passes scheduled for execution. Keep track of
407  /// whether any of the passes modifies the module, and if so, return true.
408  bool runOnModule(Module &M);
409 
412 
413  /// Pass Manager itself does not invalidate any analysis info.
414  void getAnalysisUsage(AnalysisUsage &Info) const override {
415  Info.setPreservesAll();
416  }
417 
418  /// Add RequiredPass into list of lower level passes required by pass P.
419  /// RequiredPass is run on the fly by Pass Manager when P requests it
420  /// through getAnalysis interface.
421  void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) override;
422 
423  /// Return function pass corresponding to PassInfo PI, that is
424  /// required by module pass MP. Instantiate analysis pass, by using
425  /// its runOnFunction() for function F.
426  std::tuple<Pass *, bool> getOnTheFlyPass(Pass *MP, AnalysisID PI,
427  Function &F) override;
428 
429  StringRef getPassName() const override { return "Module Pass Manager"; }
430 
431  PMDataManager *getAsPMDataManager() override { return this; }
432  Pass *getAsPass() override { return this; }
433 
434  // Print passes managed by this manager
435  void dumpPassStructure(unsigned Offset) override {
436  dbgs().indent(Offset*2) << "ModulePass Manager\n";
437  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
438  ModulePass *MP = getContainedPass(Index);
439  MP->dumpPassStructure(Offset + 1);
441  OnTheFlyManagers.find(MP);
442  if (I != OnTheFlyManagers.end())
443  I->second->dumpPassStructure(Offset + 2);
444  dumpLastUses(MP, Offset+1);
445  }
446  }
447 
448  ModulePass *getContainedPass(unsigned N) {
449  assert(N < PassVector.size() && "Pass number out of range!");
450  return static_cast<ModulePass *>(PassVector[N]);
451  }
452 
453  PassManagerType getPassManagerType() const override {
454  return PMT_ModulePassManager;
455  }
456 
457  private:
458  /// Collection of on the fly FPPassManagers. These managers manage
459  /// function passes that are required by module passes.
461 };
462 
463 char MPPassManager::ID = 0;
464 } // End anonymous namespace
465 
466 namespace llvm {
467 namespace legacy {
468 //===----------------------------------------------------------------------===//
469 // PassManagerImpl
470 //
471 
472 /// PassManagerImpl manages MPPassManagers
473 class PassManagerImpl : public Pass,
474  public PMDataManager,
475  public PMTopLevelManager {
476  virtual void anchor();
477 
478 public:
479  static char ID;
480  explicit PassManagerImpl()
481  : Pass(PT_PassManager, ID), PMTopLevelManager(new MPPassManager()) {}
482 
483  /// \copydoc PassManager::add()
484  void add(Pass *P) {
485  schedulePass(P);
486  }
487 
488  /// createPrinterPass - Get a module printer pass.
490  const std::string &Banner) const override {
491  return createPrintModulePass(O, Banner);
492  }
493 
494  /// run - Execute all of the passes scheduled for execution. Keep track of
495  /// whether any of the passes modifies the module, and if so, return true.
496  bool run(Module &M);
497 
500 
501  /// Pass Manager itself does not invalidate any analysis info.
502  void getAnalysisUsage(AnalysisUsage &Info) const override {
503  Info.setPreservesAll();
504  }
505 
506  PMDataManager *getAsPMDataManager() override { return this; }
507  Pass *getAsPass() override { return this; }
509  return PMT_ModulePassManager;
510  }
511 
512  MPPassManager *getContainedManager(unsigned N) {
513  assert(N < PassManagers.size() && "Pass number out of range!");
514  MPPassManager *MP = static_cast<MPPassManager *>(PassManagers[N]);
515  return MP;
516  }
517 };
518 
519 void PassManagerImpl::anchor() {}
520 
521 char PassManagerImpl::ID = 0;
522 
523 //===----------------------------------------------------------------------===//
524 // PassManagerImpl implementation
525 
526 //
527 /// run - Execute all of the passes scheduled for execution. Keep track of
528 /// whether any of the passes modifies the module, and if so, return true.
530  bool Changed = false;
531 
532  dumpArguments();
533  dumpPasses();
534 
535  for (ImmutablePass *ImPass : getImmutablePasses())
536  Changed |= ImPass->doInitialization(M);
537 
539  for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) {
540  Changed |= getContainedManager(Index)->runOnModule(M);
541  M.getContext().yield();
542  }
543 
544  for (ImmutablePass *ImPass : getImmutablePasses())
545  Changed |= ImPass->doFinalization(M);
546 
547  return Changed;
548 }
549 } // namespace legacy
550 } // namespace llvm
551 
552 //===----------------------------------------------------------------------===//
553 // PMTopLevelManager implementation
554 
555 /// Initialize top level manager. Create first pass manager.
556 PMTopLevelManager::PMTopLevelManager(PMDataManager *PMDM) {
557  PMDM->setTopLevelManager(this);
558  addPassManager(PMDM);
559  activeStack.push(PMDM);
560 }
561 
562 /// Set pass P as the last user of the given analysis passes.
563 void
565  unsigned PDepth = 0;
566  if (P->getResolver())
567  PDepth = P->getResolver()->getPMDataManager().getDepth();
568 
569  for (Pass *AP : AnalysisPasses) {
570  // Record P as the new last user of AP.
571  auto &LastUserOfAP = LastUser[AP];
572  if (LastUserOfAP)
573  InversedLastUser[LastUserOfAP].erase(AP);
574  LastUserOfAP = P;
575  InversedLastUser[P].insert(AP);
576 
577  if (P == AP)
578  continue;
579 
580  // Update the last users of passes that are required transitive by AP.
581  AnalysisUsage *AnUsage = findAnalysisUsage(AP);
582  const AnalysisUsage::VectorType &IDs = AnUsage->getRequiredTransitiveSet();
583  SmallVector<Pass *, 12> LastUses;
584  SmallVector<Pass *, 12> LastPMUses;
585  for (AnalysisID ID : IDs) {
586  Pass *AnalysisPass = findAnalysisPass(ID);
587  assert(AnalysisPass && "Expected analysis pass to exist.");
588  AnalysisResolver *AR = AnalysisPass->getResolver();
589  assert(AR && "Expected analysis resolver to exist.");
590  unsigned APDepth = AR->getPMDataManager().getDepth();
591 
592  if (PDepth == APDepth)
593  LastUses.push_back(AnalysisPass);
594  else if (PDepth > APDepth)
595  LastPMUses.push_back(AnalysisPass);
596  }
597 
598  setLastUser(LastUses, P);
599 
600  // If this pass has a corresponding pass manager, push higher level
601  // analysis to this pass manager.
602  if (P->getResolver())
603  setLastUser(LastPMUses, P->getResolver()->getPMDataManager().getAsPass());
604 
605  // If AP is the last user of other passes then make P last user of
606  // such passes.
607  auto &LastUsedByAP = InversedLastUser[AP];
608  for (Pass *L : LastUsedByAP)
609  LastUser[L] = P;
610  InversedLastUser[P].insert(LastUsedByAP.begin(), LastUsedByAP.end());
611  LastUsedByAP.clear();
612  }
613 }
614 
615 /// Collect passes whose last user is P
617  Pass *P) {
618  auto DMI = InversedLastUser.find(P);
619  if (DMI == InversedLastUser.end())
620  return;
621 
622  auto &LU = DMI->second;
623  LastUses.append(LU.begin(), LU.end());
624 }
625 
627  AnalysisUsage *AnUsage = nullptr;
628  auto DMI = AnUsageMap.find(P);
629  if (DMI != AnUsageMap.end())
630  AnUsage = DMI->second;
631  else {
632  // Look up the analysis usage from the pass instance (different instances
633  // of the same pass can produce different results), but unique the
634  // resulting object to reduce memory usage. This helps to greatly reduce
635  // memory usage when we have many instances of only a few pass types
636  // (e.g. instcombine, simplifycfg, etc...) which tend to share a fixed set
637  // of dependencies.
638  AnalysisUsage AU;
639  P->getAnalysisUsage(AU);
640 
641  AUFoldingSetNode* Node = nullptr;
644  void *IP = nullptr;
645  if (auto *N = UniqueAnalysisUsages.FindNodeOrInsertPos(ID, IP))
646  Node = N;
647  else {
648  Node = new (AUFoldingSetNodeAllocator.Allocate()) AUFoldingSetNode(AU);
649  UniqueAnalysisUsages.InsertNode(Node, IP);
650  }
651  assert(Node && "cached analysis usage must be non null");
652 
653  AnUsageMap[P] = &Node->AU;
654  AnUsage = &Node->AU;
655  }
656  return AnUsage;
657 }
658 
659 /// Schedule pass P for execution. Make sure that passes required by
660 /// P are run before P is run. Update analysis info maintained by
661 /// the manager. Remove dead passes. This is a recursive function.
663 
664  // TODO : Allocate function manager for this pass, other wise required set
665  // may be inserted into previous function manager
666 
667  // Give pass a chance to prepare the stage.
668  P->preparePassManager(activeStack);
669 
670  // If P is an analysis pass and it is available then do not
671  // generate the analysis again. Stale analysis info should not be
672  // available at this point.
673  const PassInfo *PI = findAnalysisPassInfo(P->getPassID());
674  if (PI && PI->isAnalysis() && findAnalysisPass(P->getPassID())) {
675  // Remove any cached AnalysisUsage information.
676  AnUsageMap.erase(P);
677  delete P;
678  return;
679  }
680 
681  AnalysisUsage *AnUsage = findAnalysisUsage(P);
682 
683  bool checkAnalysis = true;
684  while (checkAnalysis) {
685  checkAnalysis = false;
686 
687  const AnalysisUsage::VectorType &RequiredSet = AnUsage->getRequiredSet();
688  for (const AnalysisID ID : RequiredSet) {
689 
690  Pass *AnalysisPass = findAnalysisPass(ID);
691  if (!AnalysisPass) {
692  const PassInfo *PI = findAnalysisPassInfo(ID);
693 
694  if (!PI) {
695  // Pass P is not in the global PassRegistry
696  dbgs() << "Pass '" << P->getPassName() << "' is not initialized." << "\n";
697  dbgs() << "Verify if there is a pass dependency cycle." << "\n";
698  dbgs() << "Required Passes:" << "\n";
699  for (const AnalysisID ID2 : RequiredSet) {
700  if (ID == ID2)
701  break;
702  Pass *AnalysisPass2 = findAnalysisPass(ID2);
703  if (AnalysisPass2) {
704  dbgs() << "\t" << AnalysisPass2->getPassName() << "\n";
705  } else {
706  dbgs() << "\t" << "Error: Required pass not found! Possible causes:" << "\n";
707  dbgs() << "\t\t" << "- Pass misconfiguration (e.g.: missing macros)" << "\n";
708  dbgs() << "\t\t" << "- Corruption of the global PassRegistry" << "\n";
709  }
710  }
711  }
712 
713  assert(PI && "Expected required passes to be initialized");
714  AnalysisPass = PI->createPass();
715  if (P->getPotentialPassManagerType () ==
716  AnalysisPass->getPotentialPassManagerType())
717  // Schedule analysis pass that is managed by the same pass manager.
718  schedulePass(AnalysisPass);
719  else if (P->getPotentialPassManagerType () >
720  AnalysisPass->getPotentialPassManagerType()) {
721  // Schedule analysis pass that is managed by a new manager.
722  schedulePass(AnalysisPass);
723  // Recheck analysis passes to ensure that required analyses that
724  // are already checked are still available.
725  checkAnalysis = true;
726  } else
727  // Do not schedule this analysis. Lower level analysis
728  // passes are run on the fly.
729  delete AnalysisPass;
730  }
731  }
732  }
733 
734  // Now all required passes are available.
735  if (ImmutablePass *IP = P->getAsImmutablePass()) {
736  // P is a immutable pass and it will be managed by this
737  // top level manager. Set up analysis resolver to connect them.
738  PMDataManager *DM = getAsPMDataManager();
740  P->setResolver(AR);
741  DM->initializeAnalysisImpl(P);
743  DM->recordAvailableAnalysis(IP);
744  return;
745  }
746 
747  if (PI && !PI->isAnalysis() && shouldPrintBeforePass(PI->getPassArgument())) {
748  Pass *PP =
749  P->createPrinterPass(dbgs(), ("*** IR Dump Before " + P->getPassName() +
750  " (" + PI->getPassArgument() + ") ***")
751  .str());
752  PP->assignPassManager(activeStack, getTopLevelPassManagerType());
753  }
754 
755  // Add the requested pass to the best available pass manager.
756  P->assignPassManager(activeStack, getTopLevelPassManagerType());
757 
758  if (PI && !PI->isAnalysis() && shouldPrintAfterPass(PI->getPassArgument())) {
759  Pass *PP =
760  P->createPrinterPass(dbgs(), ("*** IR Dump After " + P->getPassName() +
761  " (" + PI->getPassArgument() + ") ***")
762  .str());
763  PP->assignPassManager(activeStack, getTopLevelPassManagerType());
764  }
765 }
766 
767 /// Find the pass that implements Analysis AID. Search immutable
768 /// passes and all pass managers. If desired pass is not found
769 /// then return NULL.
771  // For immutable passes we have a direct mapping from ID to pass, so check
772  // that first.
773  if (Pass *P = ImmutablePassMap.lookup(AID))
774  return P;
775 
776  // Check pass managers
778  if (Pass *P = PassManager->findAnalysisPass(AID, false))
779  return P;
780 
781  // Check other pass managers
782  for (PMDataManager *IndirectPassManager : IndirectPassManagers)
783  if (Pass *P = IndirectPassManager->findAnalysisPass(AID, false))
784  return P;
785 
786  return nullptr;
787 }
788 
790  const PassInfo *&PI = AnalysisPassInfos[AID];
791  if (!PI)
793  else
795  "The pass info pointer changed for an analysis ID!");
796 
797  return PI;
798 }
799 
801  P->initializePass();
802  ImmutablePasses.push_back(P);
803 
804  // Add this pass to the map from its analysis ID. We clobber any prior runs
805  // of the pass in the map so that the last one added is the one found when
806  // doing lookups.
807  AnalysisID AID = P->getPassID();
808  ImmutablePassMap[AID] = P;
809 
810  // Also add any interfaces implemented by the immutable pass to the map for
811  // fast lookup.
812  const PassInfo *PassInf = findAnalysisPassInfo(AID);
813  assert(PassInf && "Expected all immutable passes to be initialized");
814  for (const PassInfo *ImmPI : PassInf->getInterfacesImplemented())
815  ImmutablePassMap[ImmPI->getTypeInfo()] = P;
816 }
817 
818 // Print passes managed by this top level manager.
820 
821  if (PassDebugging < Structure)
822  return;
823 
824  // Print out the immutable passes
825  for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) {
826  ImmutablePasses[i]->dumpPassStructure(0);
827  }
828 
829  // Every class that derives from PMDataManager also derives from Pass
830  // (sometimes indirectly), but there's no inheritance relationship
831  // between PMDataManager and Pass, so we have to getAsPass to get
832  // from a PMDataManager* to a Pass*.
833  for (PMDataManager *Manager : PassManagers)
834  Manager->getAsPass()->dumpPassStructure(1);
835 }
836 
838 
839  if (PassDebugging < Arguments)
840  return;
841 
842  dbgs() << "Pass Arguments: ";
843  for (ImmutablePass *P : ImmutablePasses)
844  if (const PassInfo *PI = findAnalysisPassInfo(P->getPassID())) {
845  assert(PI && "Expected all immutable passes to be initialized");
846  if (!PI->isAnalysisGroup())
847  dbgs() << " -" << PI->getPassArgument();
848  }
849  for (PMDataManager *PM : PassManagers)
850  PM->dumpPassArguments();
851  dbgs() << "\n";
852 }
853 
855  for (PMDataManager *PM : PassManagers)
856  PM->initializeAnalysisInfo();
857 
858  // Initailize other pass managers
859  for (PMDataManager *IPM : IndirectPassManagers)
860  IPM->initializeAnalysisInfo();
861 }
862 
863 /// Destructor
865  for (PMDataManager *PM : PassManagers)
866  delete PM;
867 
868  for (ImmutablePass *P : ImmutablePasses)
869  delete P;
870 }
871 
872 //===----------------------------------------------------------------------===//
873 // PMDataManager implementation
874 
875 /// Augement AvailableAnalysis by adding analysis made available by pass P.
877  AnalysisID PI = P->getPassID();
878 
879  AvailableAnalysis[PI] = P;
880 
881  assert(!AvailableAnalysis.empty());
882 
883  // This pass is the current implementation of all of the interfaces it
884  // implements as well.
885  const PassInfo *PInf = TPM->findAnalysisPassInfo(PI);
886  if (!PInf) return;
887  for (const PassInfo *PI : PInf->getInterfacesImplemented())
888  AvailableAnalysis[PI->getTypeInfo()] = P;
889 }
890 
891 // Return true if P preserves high level analysis used by other
892 // passes managed by this manager
894  AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P);
895  if (AnUsage->getPreservesAll())
896  return true;
897 
898  const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet();
899  for (Pass *P1 : HigherLevelAnalysis) {
900  if (P1->getAsImmutablePass() == nullptr &&
901  !is_contained(PreservedSet, P1->getPassID()))
902  return false;
903  }
904 
905  return true;
906 }
907 
908 /// verifyPreservedAnalysis -- Verify analysis preserved by pass P.
910  // Don't do this unless assertions are enabled.
911 #ifdef NDEBUG
912  return;
913 #endif
914  AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P);
915  const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet();
916 
917  // Verify preserved analysis
918  for (AnalysisID AID : PreservedSet) {
919  if (Pass *AP = findAnalysisPass(AID, true)) {
920  TimeRegion PassTimer(getPassTimer(AP));
921  AP->verifyAnalysis();
922  }
923  }
924 }
925 
926 /// Remove Analysis not preserved by Pass P
928  AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P);
929  if (AnUsage->getPreservesAll())
930  return;
931 
932  const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet();
933  for (DenseMap<AnalysisID, Pass*>::iterator I = AvailableAnalysis.begin(),
934  E = AvailableAnalysis.end(); I != E; ) {
936  if (Info->second->getAsImmutablePass() == nullptr &&
937  !is_contained(PreservedSet, Info->first)) {
938  // Remove this analysis
939  if (PassDebugging >= Details) {
940  Pass *S = Info->second;
941  dbgs() << " -- '" << P->getPassName() << "' is not preserving '";
942  dbgs() << S->getPassName() << "'\n";
943  }
944  AvailableAnalysis.erase(Info);
945  }
946  }
947 
948  // Check inherited analysis also. If P is not preserving analysis
949  // provided by parent manager then remove it here.
951  if (!IA)
952  continue;
953 
954  for (DenseMap<AnalysisID, Pass *>::iterator I = IA->begin(),
955  E = IA->end();
956  I != E;) {
958  if (Info->second->getAsImmutablePass() == nullptr &&
959  !is_contained(PreservedSet, Info->first)) {
960  // Remove this analysis
961  if (PassDebugging >= Details) {
962  Pass *S = Info->second;
963  dbgs() << " -- '" << P->getPassName() << "' is not preserving '";
964  dbgs() << S->getPassName() << "'\n";
965  }
966  IA->erase(Info);
967  }
968  }
969  }
970 }
971 
972 /// Remove analysis passes that are not used any longer
974  enum PassDebuggingString DBG_STR) {
975 
976  SmallVector<Pass *, 12> DeadPasses;
977 
978  // If this is a on the fly manager then it does not have TPM.
979  if (!TPM)
980  return;
981 
982  TPM->collectLastUses(DeadPasses, P);
983 
984  if (PassDebugging >= Details && !DeadPasses.empty()) {
985  dbgs() << " -*- '" << P->getPassName();
986  dbgs() << "' is the last user of following pass instances.";
987  dbgs() << " Free these instances\n";
988  }
989 
990  for (Pass *P : DeadPasses)
991  freePass(P, Msg, DBG_STR);
992 }
993 
995  enum PassDebuggingString DBG_STR) {
996  dumpPassInfo(P, FREEING_MSG, DBG_STR, Msg);
997 
998  {
999  // If the pass crashes releasing memory, remember this.
1001  TimeRegion PassTimer(getPassTimer(P));
1002 
1003  P->releaseMemory();
1004  }
1005 
1006  AnalysisID PI = P->getPassID();
1007  if (const PassInfo *PInf = TPM->findAnalysisPassInfo(PI)) {
1008  // Remove the pass itself (if it is not already removed).
1009  AvailableAnalysis.erase(PI);
1010 
1011  // Remove all interfaces this pass implements, for which it is also
1012  // listed as the available implementation.
1013  for (const PassInfo *PI : PInf->getInterfacesImplemented()) {
1015  AvailableAnalysis.find(PI->getTypeInfo());
1016  if (Pos != AvailableAnalysis.end() && Pos->second == P)
1017  AvailableAnalysis.erase(Pos);
1018  }
1019  }
1020 }
1021 
1022 /// Add pass P into the PassVector. Update
1023 /// AvailableAnalysis appropriately if ProcessAnalysis is true.
1024 void PMDataManager::add(Pass *P, bool ProcessAnalysis) {
1025  // This manager is going to manage pass P. Set up analysis resolver
1026  // to connect them.
1027  AnalysisResolver *AR = new AnalysisResolver(*this);
1028  P->setResolver(AR);
1029 
1030  // If a FunctionPass F is the last user of ModulePass info M
1031  // then the F's manager, not F, records itself as a last user of M.
1032  SmallVector<Pass *, 12> TransferLastUses;
1033 
1034  if (!ProcessAnalysis) {
1035  // Add pass
1036  PassVector.push_back(P);
1037  return;
1038  }
1039 
1040  // At the moment, this pass is the last user of all required passes.
1041  SmallVector<Pass *, 12> LastUses;
1042  SmallVector<Pass *, 8> UsedPasses;
1043  SmallVector<AnalysisID, 8> ReqAnalysisNotAvailable;
1044 
1045  unsigned PDepth = this->getDepth();
1046 
1047  collectRequiredAndUsedAnalyses(UsedPasses, ReqAnalysisNotAvailable, P);
1048  for (Pass *PUsed : UsedPasses) {
1049  unsigned RDepth = 0;
1050 
1051  assert(PUsed->getResolver() && "Analysis Resolver is not set");
1052  PMDataManager &DM = PUsed->getResolver()->getPMDataManager();
1053  RDepth = DM.getDepth();
1054 
1055  if (PDepth == RDepth)
1056  LastUses.push_back(PUsed);
1057  else if (PDepth > RDepth) {
1058  // Let the parent claim responsibility of last use
1059  TransferLastUses.push_back(PUsed);
1060  // Keep track of higher level analysis used by this manager.
1061  HigherLevelAnalysis.push_back(PUsed);
1062  } else
1063  llvm_unreachable("Unable to accommodate Used Pass");
1064  }
1065 
1066  // Set P as P's last user until someone starts using P.
1067  // However, if P is a Pass Manager then it does not need
1068  // to record its last user.
1069  if (!P->getAsPMDataManager())
1070  LastUses.push_back(P);
1071  TPM->setLastUser(LastUses, P);
1072 
1073  if (!TransferLastUses.empty()) {
1074  Pass *My_PM = getAsPass();
1075  TPM->setLastUser(TransferLastUses, My_PM);
1076  TransferLastUses.clear();
1077  }
1078 
1079  // Now, take care of required analyses that are not available.
1080  for (AnalysisID ID : ReqAnalysisNotAvailable) {
1081  const PassInfo *PI = TPM->findAnalysisPassInfo(ID);
1082  Pass *AnalysisPass = PI->createPass();
1083  this->addLowerLevelRequiredPass(P, AnalysisPass);
1084  }
1085 
1086  // Take a note of analysis required and made available by this pass.
1087  // Remove the analysis not preserved by this pass
1090 
1091  // Add pass
1092  PassVector.push_back(P);
1093 }
1094 
1095 
1096 /// Populate UP with analysis pass that are used or required by
1097 /// pass P and are available. Populate RP_NotAvail with analysis
1098 /// pass that are required by pass P but are not available.
1101  Pass *P) {
1102  AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P);
1103 
1104  for (const auto &UsedID : AnUsage->getUsedSet())
1105  if (Pass *AnalysisPass = findAnalysisPass(UsedID, true))
1106  UP.push_back(AnalysisPass);
1107 
1108  for (const auto &RequiredID : AnUsage->getRequiredSet())
1109  if (Pass *AnalysisPass = findAnalysisPass(RequiredID, true))
1110  UP.push_back(AnalysisPass);
1111  else
1112  RP_NotAvail.push_back(RequiredID);
1113 }
1114 
1115 // All Required analyses should be available to the pass as it runs! Here
1116 // we fill in the AnalysisImpls member of the pass so that it can
1117 // successfully use the getAnalysis() method to retrieve the
1118 // implementations it needs.
1119 //
1121  AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P);
1122 
1123  for (const AnalysisID ID : AnUsage->getRequiredSet()) {
1124  Pass *Impl = findAnalysisPass(ID, true);
1125  if (!Impl)
1126  // This may be analysis pass that is initialized on the fly.
1127  // If that is not the case then it will raise an assert when it is used.
1128  continue;
1129  AnalysisResolver *AR = P->getResolver();
1130  assert(AR && "Analysis Resolver is not set");
1131  AR->addAnalysisImplsPair(ID, Impl);
1132  }
1133 }
1134 
1135 /// Find the pass that implements Analysis AID. If desired pass is not found
1136 /// then return NULL.
1138 
1139  // Check if AvailableAnalysis map has one entry.
1140  DenseMap<AnalysisID, Pass*>::const_iterator I = AvailableAnalysis.find(AID);
1141 
1142  if (I != AvailableAnalysis.end())
1143  return I->second;
1144 
1145  // Search Parents through TopLevelManager
1146  if (SearchParent)
1147  return TPM->findAnalysisPass(AID);
1148 
1149  return nullptr;
1150 }
1151 
1152 // Print list of passes that are last used by P.
1153 void PMDataManager::dumpLastUses(Pass *P, unsigned Offset) const{
1154  if (PassDebugging < Details)
1155  return;
1156 
1158 
1159  // If this is a on the fly manager then it does not have TPM.
1160  if (!TPM)
1161  return;
1162 
1163  TPM->collectLastUses(LUses, P);
1164 
1165  for (Pass *P : LUses) {
1166  dbgs() << "--" << std::string(Offset*2, ' ');
1167  P->dumpPassStructure(0);
1168  }
1169 }
1170 
1172  for (Pass *P : PassVector) {
1173  if (PMDataManager *PMD = P->getAsPMDataManager())
1174  PMD->dumpPassArguments();
1175  else
1176  if (const PassInfo *PI =
1177  TPM->findAnalysisPassInfo(P->getPassID()))
1178  if (!PI->isAnalysisGroup())
1179  dbgs() << " -" << PI->getPassArgument();
1180  }
1181 }
1182 
1184  enum PassDebuggingString S2,
1185  StringRef Msg) {
1186  if (PassDebugging < Executions)
1187  return;
1188  dbgs() << "[" << std::chrono::system_clock::now() << "] " << (void *)this
1189  << std::string(getDepth() * 2 + 1, ' ');
1190  switch (S1) {
1191  case EXECUTION_MSG:
1192  dbgs() << "Executing Pass '" << P->getPassName();
1193  break;
1194  case MODIFICATION_MSG:
1195  dbgs() << "Made Modification '" << P->getPassName();
1196  break;
1197  case FREEING_MSG:
1198  dbgs() << " Freeing Pass '" << P->getPassName();
1199  break;
1200  default:
1201  break;
1202  }
1203  switch (S2) {
1204  case ON_FUNCTION_MSG:
1205  dbgs() << "' on Function '" << Msg << "'...\n";
1206  break;
1207  case ON_MODULE_MSG:
1208  dbgs() << "' on Module '" << Msg << "'...\n";
1209  break;
1210  case ON_REGION_MSG:
1211  dbgs() << "' on Region '" << Msg << "'...\n";
1212  break;
1213  case ON_LOOP_MSG:
1214  dbgs() << "' on Loop '" << Msg << "'...\n";
1215  break;
1216  case ON_CG_MSG:
1217  dbgs() << "' on Call Graph Nodes '" << Msg << "'...\n";
1218  break;
1219  default:
1220  break;
1221  }
1222 }
1223 
1225  if (PassDebugging < Details)
1226  return;
1227 
1228  AnalysisUsage analysisUsage;
1229  P->getAnalysisUsage(analysisUsage);
1230  dumpAnalysisUsage("Required", P, analysisUsage.getRequiredSet());
1231 }
1232 
1234  if (PassDebugging < Details)
1235  return;
1236 
1237  AnalysisUsage analysisUsage;
1238  P->getAnalysisUsage(analysisUsage);
1239  dumpAnalysisUsage("Preserved", P, analysisUsage.getPreservedSet());
1240 }
1241 
1242 void PMDataManager::dumpUsedSet(const Pass *P) const {
1243  if (PassDebugging < Details)
1244  return;
1245 
1246  AnalysisUsage analysisUsage;
1247  P->getAnalysisUsage(analysisUsage);
1248  dumpAnalysisUsage("Used", P, analysisUsage.getUsedSet());
1249 }
1250 
1251 void PMDataManager::dumpAnalysisUsage(StringRef Msg, const Pass *P,
1252  const AnalysisUsage::VectorType &Set) const {
1253  assert(PassDebugging >= Details);
1254  if (Set.empty())
1255  return;
1256  dbgs() << (const void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:";
1257  for (unsigned i = 0; i != Set.size(); ++i) {
1258  if (i) dbgs() << ',';
1259  const PassInfo *PInf = TPM->findAnalysisPassInfo(Set[i]);
1260  if (!PInf) {
1261  // Some preserved passes, such as AliasAnalysis, may not be initialized by
1262  // all drivers.
1263  dbgs() << " Uninitialized Pass";
1264  continue;
1265  }
1266  dbgs() << ' ' << PInf->getPassName();
1267  }
1268  dbgs() << '\n';
1269 }
1270 
1271 /// Add RequiredPass into list of lower level passes required by pass P.
1272 /// RequiredPass is run on the fly by Pass Manager when P requests it
1273 /// through getAnalysis interface.
1274 /// This should be handled by specific pass manager.
1276  if (TPM) {
1277  TPM->dumpArguments();
1278  TPM->dumpPasses();
1279  }
1280 
1281  // Module Level pass may required Function Level analysis info
1282  // (e.g. dominator info). Pass manager uses on the fly function pass manager
1283  // to provide this on demand. In that case, in Pass manager terminology,
1284  // module level pass is requiring lower level analysis info managed by
1285  // lower level pass manager.
1286 
1287  // When Pass manager is not able to order required analysis info, Pass manager
1288  // checks whether any lower level manager will be able to provide this
1289  // analysis info on demand or not.
1290 #ifndef NDEBUG
1291  dbgs() << "Unable to schedule '" << RequiredPass->getPassName();
1292  dbgs() << "' required by '" << P->getPassName() << "'\n";
1293 #endif
1294  llvm_unreachable("Unable to schedule pass");
1295 }
1296 
1297 std::tuple<Pass *, bool> PMDataManager::getOnTheFlyPass(Pass *P, AnalysisID PI,
1298  Function &F) {
1299  llvm_unreachable("Unable to find on the fly pass");
1300 }
1301 
1302 // Destructor
1304  for (Pass *P : PassVector)
1305  delete P;
1306 }
1307 
1308 //===----------------------------------------------------------------------===//
1309 // NOTE: Is this the right place to define this method ?
1310 // getAnalysisIfAvailable - Return analysis result or null if it doesn't exist.
1312  return PM.findAnalysisPass(ID, true);
1313 }
1314 
1315 std::tuple<Pass *, bool>
1317  return PM.getOnTheFlyPass(P, AnalysisPI, F);
1318 }
1319 
1320 namespace llvm {
1321 namespace legacy {
1322 
1323 //===----------------------------------------------------------------------===//
1324 // FunctionPassManager implementation
1325 
1326 /// Create new Function pass manager
1328  FPM = new legacy::FunctionPassManagerImpl();
1329  // FPM is the top level manager.
1330  FPM->setTopLevelManager(FPM);
1331 
1332  AnalysisResolver *AR = new AnalysisResolver(*FPM);
1333  FPM->setResolver(AR);
1334 }
1335 
1337  delete FPM;
1338 }
1339 
1341  FPM->add(P);
1342 }
1343 
1344 /// run - Execute all of the passes scheduled for execution. Keep
1345 /// track of whether any of the passes modifies the function, and if
1346 /// so, return true.
1347 ///
1349  handleAllErrors(F.materialize(), [&](ErrorInfoBase &EIB) {
1350  report_fatal_error(Twine("Error reading bitcode file: ") + EIB.message());
1351  });
1352  return FPM->run(F);
1353 }
1354 
1355 
1356 /// doInitialization - Run all of the initializers for the function passes.
1357 ///
1359  return FPM->doInitialization(*M);
1360 }
1361 
1362 /// doFinalization - Run all of the finalizers for the function passes.
1363 ///
1365  return FPM->doFinalization(*M);
1366 }
1367 } // namespace legacy
1368 } // namespace llvm
1369 
1370 /// cleanup - After running all passes, clean up pass manager cache.
1372  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1374  AnalysisResolver *AR = FP->getResolver();
1375  assert(AR && "Analysis Resolver is not set");
1376  AR->clearAnalysisImpls();
1377  }
1378 }
1379 
1380 
1381 //===----------------------------------------------------------------------===//
1382 // FPPassManager implementation
1383 
1384 char FPPassManager::ID = 0;
1385 /// Print passes managed by this manager
1387  dbgs().indent(Offset*2) << "FunctionPass Manager\n";
1388  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1390  FP->dumpPassStructure(Offset + 1);
1391  dumpLastUses(FP, Offset+1);
1392  }
1393 }
1394 
1395 /// Execute all of the passes scheduled for execution by invoking
1396 /// runOnFunction method. Keep track of whether any of the passes modifies
1397 /// the function, and if so, return true.
1399  if (F.isDeclaration())
1400  return false;
1401 
1402  bool Changed = false;
1403  Module &M = *F.getParent();
1404  // Collect inherited analysis from Module level pass manager.
1406 
1407  unsigned InstrCount, FunctionSize = 0;
1408  StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
1409  bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
1410  // Collect the initial size of the module.
1411  if (EmitICRemark) {
1412  InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
1413  FunctionSize = F.getInstructionCount();
1414  }
1415 
1416  llvm::TimeTraceScope FunctionScope("OptFunction", F.getName());
1417 
1418  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1420  bool LocalChanged = false;
1421 
1422  llvm::TimeTraceScope PassScope("RunPass", FP->getPassName());
1423 
1426 
1428 
1429  {
1431  TimeRegion PassTimer(getPassTimer(FP));
1432 #ifdef EXPENSIVE_CHECKS
1433  uint64_t RefHash = StructuralHash(F);
1434 #endif
1435  LocalChanged |= FP->runOnFunction(F);
1436 
1437 #if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
1438  if (!LocalChanged && (RefHash != StructuralHash(F))) {
1439  llvm::errs() << "Pass modifies its input and doesn't report it: "
1440  << FP->getPassName() << "\n";
1441  llvm_unreachable("Pass modifies its input and doesn't report it");
1442  }
1443 #endif
1444 
1445  if (EmitICRemark) {
1446  unsigned NewSize = F.getInstructionCount();
1447 
1448  // Update the size of the function, emit a remark, and update the size
1449  // of the module.
1450  if (NewSize != FunctionSize) {
1451  int64_t Delta = static_cast<int64_t>(NewSize) -
1452  static_cast<int64_t>(FunctionSize);
1454  FunctionToInstrCount, &F);
1455  InstrCount = static_cast<int64_t>(InstrCount) + Delta;
1456  FunctionSize = NewSize;
1457  }
1458  }
1459  }
1460 
1461  Changed |= LocalChanged;
1462  if (LocalChanged)
1465  dumpUsedSet(FP);
1466 
1468  if (LocalChanged)
1471  removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
1472  }
1473 
1474  return Changed;
1475 }
1476 
1478  bool Changed = false;
1479 
1480  for (Function &F : M)
1481  Changed |= runOnFunction(F);
1482 
1483  return Changed;
1484 }
1485 
1487  bool Changed = false;
1488 
1489  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
1490  Changed |= getContainedPass(Index)->doInitialization(M);
1491 
1492  return Changed;
1493 }
1494 
1496  bool Changed = false;
1497 
1498  for (int Index = getNumContainedPasses() - 1; Index >= 0; --Index)
1499  Changed |= getContainedPass(Index)->doFinalization(M);
1500 
1501  return Changed;
1502 }
1503 
1504 //===----------------------------------------------------------------------===//
1505 // MPPassManager implementation
1506 
1507 /// Execute all of the passes scheduled for execution by invoking
1508 /// runOnModule method. Keep track of whether any of the passes modifies
1509 /// the module, and if so, return true.
1510 bool
1511 MPPassManager::runOnModule(Module &M) {
1512  llvm::TimeTraceScope TimeScope("OptModule", M.getName());
1513 
1514  bool Changed = false;
1515 
1516  // Initialize on-the-fly passes
1517  for (auto &OnTheFlyManager : OnTheFlyManagers) {
1518  legacy::FunctionPassManagerImpl *FPP = OnTheFlyManager.second;
1519  Changed |= FPP->doInitialization(M);
1520  }
1521 
1522  // Initialize module passes
1523  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
1524  Changed |= getContainedPass(Index)->doInitialization(M);
1525 
1526  unsigned InstrCount;
1527  StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
1528  bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
1529  // Collect the initial size of the module.
1530  if (EmitICRemark)
1531  InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
1532 
1533  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1534  ModulePass *MP = getContainedPass(Index);
1535  bool LocalChanged = false;
1536 
1537  dumpPassInfo(MP, EXECUTION_MSG, ON_MODULE_MSG, M.getModuleIdentifier());
1538  dumpRequiredSet(MP);
1539 
1540  initializeAnalysisImpl(MP);
1541 
1542  {
1544  TimeRegion PassTimer(getPassTimer(MP));
1545 
1546 #ifdef EXPENSIVE_CHECKS
1547  uint64_t RefHash = StructuralHash(M);
1548 #endif
1549 
1550  LocalChanged |= MP->runOnModule(M);
1551 
1552 #ifdef EXPENSIVE_CHECKS
1553  assert((LocalChanged || (RefHash == StructuralHash(M))) &&
1554  "Pass modifies its input and doesn't report it.");
1555 #endif
1556 
1557  if (EmitICRemark) {
1558  // Update the size of the module.
1559  unsigned ModuleCount = M.getInstructionCount();
1560  if (ModuleCount != InstrCount) {
1561  int64_t Delta = static_cast<int64_t>(ModuleCount) -
1562  static_cast<int64_t>(InstrCount);
1563  emitInstrCountChangedRemark(MP, M, Delta, InstrCount,
1564  FunctionToInstrCount);
1565  InstrCount = ModuleCount;
1566  }
1567  }
1568  }
1569 
1570  Changed |= LocalChanged;
1571  if (LocalChanged)
1572  dumpPassInfo(MP, MODIFICATION_MSG, ON_MODULE_MSG,
1573  M.getModuleIdentifier());
1574  dumpPreservedSet(MP);
1575  dumpUsedSet(MP);
1576 
1577  verifyPreservedAnalysis(MP);
1578  if (LocalChanged)
1579  removeNotPreservedAnalysis(MP);
1580  recordAvailableAnalysis(MP);
1581  removeDeadPasses(MP, M.getModuleIdentifier(), ON_MODULE_MSG);
1582  }
1583 
1584  // Finalize module passes
1585  for (int Index = getNumContainedPasses() - 1; Index >= 0; --Index)
1586  Changed |= getContainedPass(Index)->doFinalization(M);
1587 
1588  // Finalize on-the-fly passes
1589  for (auto &OnTheFlyManager : OnTheFlyManagers) {
1590  legacy::FunctionPassManagerImpl *FPP = OnTheFlyManager.second;
1591  // We don't know when is the last time an on-the-fly pass is run,
1592  // so we need to releaseMemory / finalize here
1593  FPP->releaseMemoryOnTheFly();
1594  Changed |= FPP->doFinalization(M);
1595  }
1596 
1597  return Changed;
1598 }
1599 
1600 /// Add RequiredPass into list of lower level passes required by pass P.
1601 /// RequiredPass is run on the fly by Pass Manager when P requests it
1602 /// through getAnalysis interface.
1603 void MPPassManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) {
1604  assert(RequiredPass && "No required pass?");
1605  assert(P->getPotentialPassManagerType() == PMT_ModulePassManager &&
1606  "Unable to handle Pass that requires lower level Analysis pass");
1607  assert((P->getPotentialPassManagerType() <
1608  RequiredPass->getPotentialPassManagerType()) &&
1609  "Unable to handle Pass that requires lower level Analysis pass");
1610 
1611  legacy::FunctionPassManagerImpl *FPP = OnTheFlyManagers[P];
1612  if (!FPP) {
1613  FPP = new legacy::FunctionPassManagerImpl();
1614  // FPP is the top level manager.
1615  FPP->setTopLevelManager(FPP);
1616 
1617  OnTheFlyManagers[P] = FPP;
1618  }
1619  const PassInfo *RequiredPassPI =
1620  TPM->findAnalysisPassInfo(RequiredPass->getPassID());
1621 
1622  Pass *FoundPass = nullptr;
1623  if (RequiredPassPI && RequiredPassPI->isAnalysis()) {
1624  FoundPass =
1625  ((PMTopLevelManager*)FPP)->findAnalysisPass(RequiredPass->getPassID());
1626  }
1627  if (!FoundPass) {
1628  FoundPass = RequiredPass;
1629  // This should be guaranteed to add RequiredPass to the passmanager given
1630  // that we checked for an available analysis above.
1631  FPP->add(RequiredPass);
1632  }
1633  // Register P as the last user of FoundPass or RequiredPass.
1635  LU.push_back(FoundPass);
1636  FPP->setLastUser(LU, P);
1637 }
1638 
1639 /// Return function pass corresponding to PassInfo PI, that is
1640 /// required by module pass MP. Instantiate analysis pass, by using
1641 /// its runOnFunction() for function F.
1642 std::tuple<Pass *, bool> MPPassManager::getOnTheFlyPass(Pass *MP, AnalysisID PI,
1643  Function &F) {
1644  legacy::FunctionPassManagerImpl *FPP = OnTheFlyManagers[MP];
1645  assert(FPP && "Unable to find on the fly pass");
1646 
1647  FPP->releaseMemoryOnTheFly();
1648  bool Changed = FPP->run(F);
1649  return std::make_tuple(((PMTopLevelManager *)FPP)->findAnalysisPass(PI),
1650  Changed);
1651 }
1652 
1653 namespace llvm {
1654 namespace legacy {
1655 
1656 //===----------------------------------------------------------------------===//
1657 // PassManager implementation
1658 
1659 /// Create new pass manager
1661  PM = new PassManagerImpl();
1662  // PM is the top level manager
1663  PM->setTopLevelManager(PM);
1664 }
1665 
1667  delete PM;
1668 }
1669 
1671  PM->add(P);
1672 }
1673 
1674 /// run - Execute all of the passes scheduled for execution. Keep track of
1675 /// whether any of the passes modifies the module, and if so, return true.
1677  return PM->run(M);
1678 }
1679 } // namespace legacy
1680 } // namespace llvm
1681 
1682 //===----------------------------------------------------------------------===//
1683 // PMStack implementation
1684 //
1685 
1686 // Pop Pass Manager from the stack and clear its analysis info.
1687 void PMStack::pop() {
1688 
1689  PMDataManager *Top = this->top();
1690  Top->initializeAnalysisInfo();
1691 
1692  S.pop_back();
1693 }
1694 
1695 // Push PM on the stack and set its top level manager.
1697  assert(PM && "Unable to push. Pass Manager expected");
1698  assert(PM->getDepth()==0 && "Pass Manager depth set too early");
1699 
1700  if (!this->empty()) {
1701  assert(PM->getPassManagerType() > this->top()->getPassManagerType()
1702  && "pushing bad pass manager to PMStack");
1703  PMTopLevelManager *TPM = this->top()->getTopLevelManager();
1704 
1705  assert(TPM && "Unable to find top level manager");
1706  TPM->addIndirectPassManager(PM);
1707  PM->setTopLevelManager(TPM);
1708  PM->setDepth(this->top()->getDepth()+1);
1709  } else {
1712  && "pushing bad pass manager to PMStack");
1713  PM->setDepth(1);
1714  }
1715 
1716  S.push_back(PM);
1717 }
1718 
1719 // Dump content of the pass manager stack.
1721  for (PMDataManager *Manager : S)
1722  dbgs() << Manager->getAsPass()->getPassName() << ' ';
1723 
1724  if (!S.empty())
1725  dbgs() << '\n';
1726 }
1727 
1728 /// Find appropriate Module Pass Manager in the PM Stack and
1729 /// add self into that manager.
1731  PassManagerType PreferredType) {
1732  // Find Module Pass Manager
1734  while ((T = PMS.top()->getPassManagerType()) > PMT_ModulePassManager &&
1735  T != PreferredType)
1736  PMS.pop();
1737  PMS.top()->add(this);
1738 }
1739 
1740 /// Find appropriate Function Pass Manager or Call Graph Pass Manager
1741 /// in the PM Stack and add self into that manager.
1743  PassManagerType /*PreferredType*/) {
1744  // Find Function Pass Manager
1745  PMDataManager *PM;
1746  while (PM = PMS.top(), PM->getPassManagerType() > PMT_FunctionPassManager)
1747  PMS.pop();
1748 
1749  // Create new Function Pass Manager if needed.
1751  // [1] Create new Function Pass Manager
1752  auto *FPP = new FPPassManager;
1753  FPP->populateInheritedAnalysis(PMS);
1754 
1755  // [2] Set up new manager's top level manager
1757 
1758  // [3] Assign manager to manage this new manager. This may create
1759  // and push new managers into PMS
1760  FPP->assignPassManager(PMS, PM->getPassManagerType());
1761 
1762  // [4] Push new manager into PMS
1763  PMS.push(FPP);
1764  PM = FPP;
1765  }
1766 
1767  // Assign FPP as the manager of this pass.
1768  PM->add(this);
1769 }
1770 
i
i
Definition: README.txt:29
llvm::PMTopLevelManager::addImmutablePass
void addImmutablePass(ImmutablePass *P)
Add immutable pass and initialize it.
Definition: LegacyPassManager.cpp:800
llvm::PMDataManager::recordAvailableAnalysis
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
Definition: LegacyPassManager.cpp:876
llvm::ModulePass::assignPassManager
void assignPassManager(PMStack &PMS, PassManagerType T) override
Find appropriate Module Pass Manager in the PM Stack and add self into that manager.
Definition: LegacyPassManager.cpp:1730
CmpMode::FP
@ FP
llvm::AnalysisUsage::getRequiredTransitiveSet
const VectorType & getRequiredTransitiveSet() const
Definition: PassAnalysisSupport.h:145
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:510
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::Pass::assignPassManager
virtual void assignPassManager(PMStack &, PassManagerType)
Each pass is responsible for assigning a pass manager to itself.
Definition: Pass.h:139
llvm::FPPassManager::runOnFunction
bool runOnFunction(Function &F)
run - Execute all of the passes scheduled for execution.
Definition: LegacyPassManager.cpp:1398
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::TailPredication::Disabled
@ Disabled
Definition: ARMTargetTransformInfo.h:43
llvm::legacy::FunctionPassManagerImpl::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
Definition: LegacyPassManager.cpp:298
llvm::TimeTraceScope
The TimeTraceScope is a helper class to call the begin and end functions of the time trace profiler.
Definition: TimeProfiler.h:65
llvm::legacy::PassManagerImpl::createPrinterPass
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
createPrinterPass - Get a module printer pass.
Definition: LegacyPassManager.cpp:489
llvm::legacy::FunctionPassManagerImpl::releaseMemoryOnTheFly
void releaseMemoryOnTheFly()
Definition: LegacyPassManager.cpp:348
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:626
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:223
llvm::Function::empty
bool empty() const
Definition: Function.h:729
T
llvm::Function
Definition: Function.h:62
llvm::Pass::getPassID
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
Definition: Pass.h:110
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
llvm::PMTopLevelManager::schedulePass
void schedulePass(Pass *P)
Schedule pass P for execution.
Definition: LegacyPassManager.cpp:662
DM
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
llvm::PT_PassManager
@ PT_PassManager
Definition: Pass.h:69
llvm::FoldingSetImpl::InsertNode
void InsertNode(T *N, void *InsertPos)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
Definition: FoldingSet.h:470
llvm::legacy::PassManagerImpl::getContainedManager
MPPassManager * getContainedManager(unsigned N)
Definition: LegacyPassManager.cpp:512
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1177
Statistic.h
ErrorHandling.h
llvm::PMDataManager::dumpPassInfo
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
Definition: LegacyPassManager.cpp:1183
llvm::legacy::FunctionPassManager::FunctionPassManager
FunctionPassManager(Module *M)
FunctionPassManager ctor - This initializes the pass manager.
Definition: LegacyPassManager.cpp:1327
ManagedStatic.h
MapVector.h
Error.h
llvm::AnalysisID
const void * AnalysisID
Definition: Pass.h:47
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
cleanup
static void cleanup(BlockFrequencyInfoImplBase &BFI)
Clear all memory not needed downstream.
Definition: BlockFrequencyInfoImpl.cpp:304
llvm::PMTopLevelManager::getNumContainedManagers
unsigned getNumContainedManagers() const
Definition: LegacyPassManagers.h:162
llvm::PassManagerType
PassManagerType
Different types of internal pass managers.
Definition: Pass.h:52
InstrCount
static unsigned InstrCount
Definition: DFAPacketizer.cpp:53
llvm::FoldingSetImpl::FindNodeOrInsertPos
T * FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos)
FindNodeOrInsertPos - Look up the node specified by ID.
Definition: FoldingSet.h:462
llvm::DenseMapIterator
Definition: DenseMap.h:56
PassDebugging
static cl::opt< enum PassDebugLevel > PassDebugging("debug-pass", cl::Hidden, cl::desc("Print legacy PassManager debugging information"), cl::values(clEnumVal(Disabled, "disable debug output"), clEnumVal(Arguments, "print pass arguments to pass to 'opt'"), clEnumVal(Structure, "print pass structure before run()"), clEnumVal(Executions, "print pass name before it is executed"), clEnumVal(Details, "print pass details when it is executed")))
Module.h
llvm::legacy::PassManagerImpl::ID
static char ID
Definition: LegacyPassManager.cpp:479
llvm::PassInfo
PassInfo class - An instance of this class exists for every pass known by the system,...
Definition: PassInfo.h:30
llvm::PMTopLevelManager::findAnalysisPassInfo
const PassInfo * findAnalysisPassInfo(AnalysisID AID) const
Retrieve the PassInfo for an analysis.
Definition: LegacyPassManager.cpp:789
LegacyPassNameParser.h
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:37
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:80
llvm::legacy::PassManagerImpl::getAsPMDataManager
PMDataManager * getAsPMDataManager() override
Definition: LegacyPassManager.cpp:506
getPassInfo
static const PassInfo * getPassInfo(StringRef PassName)
Definition: TargetPassConfig.cpp:407
llvm::PMStack::push
void push(PMDataManager *PM)
Definition: LegacyPassManager.cpp:1696
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:894
llvm::legacy::FunctionPassManagerImpl
FunctionPassManagerImpl manages FPPassManagers.
Definition: LegacyPassManager.cpp:251
llvm::ON_REGION_MSG
@ ON_REGION_MSG
Definition: LegacyPassManagers.h:102
llvm::PassManagerPrettyStackEntry
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
Definition: LegacyPassManagers.h:109
llvm::PassInfo::createPass
Pass * createPass() const
createPass() - Use this method to create an instance of this pass.
Definition: PassInfo.h:96
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
LegacyPassManager.h
clEnumVal
#define clEnumVal(ENUMVAL, DESC)
Definition: CommandLine.h:670
llvm::FPPassManager::doInitialization
bool doInitialization(Module &M) override
doInitialization - Run all of the initializers for the function passes.
Definition: LegacyPassManager.cpp:1486
new
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM ID Predecessors according to mbb< bb27, 0x8b0a7c0 > Note ADDri is not a two address instruction its result reg1037 is an operand of the PHI node in bb76 and its operand reg1039 is the result of the PHI node We should treat it as a two address code and make sure the ADDri is scheduled after any node that reads reg1039 Use info(i.e. register scavenger) to assign it a free register to allow reuse the collector could move the objects and invalidate the derived pointer This is bad enough in the first but safe points can crop up unpredictably **array_addr i32 n y store obj * new
Definition: README.txt:125
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::legacy::FunctionPassManagerImpl::FunctionPassManagerImpl
FunctionPassManagerImpl()
Definition: LegacyPassManager.cpp:259
Chrono.h
llvm::PMT_ModulePassManager
@ PMT_ModulePassManager
MPPassManager.
Definition: Pass.h:54
llvm::legacy::FunctionPassManagerImpl::doFinalization
bool doFinalization(Module &M) override
doFinalization - Run all of the finalizers for the function passes.
Definition: LegacyPassManager.cpp:336
llvm::legacy::PassManagerImpl::getAsPass
Pass * getAsPass() override
Definition: LegacyPassManager.cpp:507
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::MapVector::const_iterator
typename VectorType::const_iterator const_iterator
Definition: MapVector.h:51
PassTimingInfo.h
CommandLine.h
llvm::PMDataManager
PMDataManager provides the common place to manage the analysis data used by pass managers.
Definition: LegacyPassManagers.h:295
llvm::legacy::FunctionPassManagerImpl::ID
static char ID
Definition: LegacyPassManager.cpp:258
llvm::legacy::PassManager::PassManager
PassManager()
Create new pass manager.
Definition: LegacyPassManager.cpp:1660
llvm::PMDataManager::dumpLastUses
void dumpLastUses(Pass *P, unsigned Offset) const
Definition: LegacyPassManager.cpp:1153
llvm::legacy::FunctionPassManagerImpl::getAsPass
Pass * getAsPass() override
Definition: LegacyPassManager.cpp:292
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:819
llvm::PMDataManager::getNumContainedPasses
unsigned getNumContainedPasses() const
Definition: LegacyPassManagers.h:378
llvm::TimeRegion
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
Definition: Timer.h:146
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
llvm::legacy::FunctionPassManager::doFinalization
bool doFinalization()
doFinalization - Run all of the finalizers for the function passes.
Definition: LegacyPassManager.cpp:1364
llvm::PassInfo::getPassName
StringRef getPassName() const
getPassName - Return the friendly name for the pass, never returns null
Definition: PassInfo.h:62
llvm::PassInfo::getInterfacesImplemented
const std::vector< const PassInfo * > & getInterfacesImplemented() const
getInterfacesImplemented - Return a list of all of the analysis group interfaces implemented by this ...
Definition: PassInfo.h:113
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::SmallVectorImpl::append
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:657
llvm::legacy::debugPassSpecified
bool debugPassSpecified()
Definition: LegacyPassManager.cpp:245
llvm::PMTopLevelManager::activeStack
PMStack activeStack
Definition: LegacyPassManagers.h:219
llvm::FunctionPass::assignPassManager
void assignPassManager(PMStack &PMS, PassManagerType T) override
Find appropriate Function Pass Manager or Call Graph Pass Manager in the PM Stack and add self into t...
Definition: LegacyPassManager.cpp:1742
llvm::legacy::PassManagerImpl::PassManagerImpl
PassManagerImpl()
Definition: LegacyPassManager.cpp:480
llvm::PMTopLevelManager::getImmutablePasses
SmallVectorImpl< ImmutablePass * > & getImmutablePasses()
Definition: LegacyPassManagers.h:200
llvm::PMTopLevelManager::collectLastUses
void collectLastUses(SmallVectorImpl< Pass * > &LastUses, Pass *P)
Collect passes whose last user is P.
Definition: LegacyPassManager.cpp:616
llvm::AnalysisUsage::getUsedSet
const VectorType & getUsedSet() const
Definition: PassAnalysisSupport.h:149
LegacyPassManagers.h
llvm::PMDataManager::dumpPreservedSet
void dumpPreservedSet(const Pass *P) const
Definition: LegacyPassManager.cpp:1233
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::legacy::FunctionPassManagerImpl::createPrinterPass
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
createPrinterPass - Get a function printer pass.
Definition: LegacyPassManager.cpp:269
IP
Definition: NVPTXLowerArgs.cpp:166
false
Definition: StackSlotColoring.cpp:142
llvm::AnalysisResolver
AnalysisResolver - Simple interface used by Pass objects to pull all analysis information out of pass...
Definition: PassAnalysisSupport.h:157
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:1120
llvm::legacy::FunctionPassManagerImpl::getTopLevelPassManagerType
PassManagerType getTopLevelPassManagerType() override
Definition: LegacyPassManager.cpp:293
llvm::PMDataManager::setDepth
void setDepth(unsigned newDepth)
Definition: LegacyPassManagers.h:367
llvm::legacy::PassManagerImpl::add
void add(Pass *P)
Add a pass to the queue of passes to run.
Definition: LegacyPassManager.cpp:484
IRPrintingPasses.h
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:1371
llvm::MODIFICATION_MSG
@ MODIFICATION_MSG
Definition: LegacyPassManagers.h:98
llvm::PMTopLevelManager::dumpArguments
void dumpArguments() const
Definition: LegacyPassManager.cpp:837
llvm::PMDataManager::dumpPassArguments
void dumpPassArguments() const
Definition: LegacyPassManager.cpp:1171
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::ON_CG_MSG
@ ON_CG_MSG
Definition: LegacyPassManagers.h:104
llvm::FPPassManager::getContainedPass
FunctionPass * getContainedPass(unsigned N)
Definition: LegacyPassManagers.h:503
PrintPasses.h
llvm::AnalysisResolver::getAnalysisIfAvailable
Pass * getAnalysisIfAvailable(AnalysisID ID) const
Return analysis result or null if it doesn't exist.
Definition: LegacyPassManager.cpp:1311
llvm::PMStack::top
PMDataManager * top() const
Definition: LegacyPassManagers.h:143
now
static sys::TimePoint< std::chrono::seconds > now(bool Deterministic)
Definition: ArchiveWriter.cpp:261
llvm::ErrorInfoBase
Base class for error info classes.
Definition: Error.h:48
llvm::legacy::PassManager::~PassManager
~PassManager() override
Definition: LegacyPassManager.cpp:1666
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::FPPassManager::doFinalization
bool doFinalization(Module &M) override
doFinalization - Run all of the finalizers for the function passes.
Definition: LegacyPassManager.cpp:1495
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::legacy::PassManagerBase::~PassManagerBase
virtual ~PassManagerBase()
Definition: LegacyPassManager.cpp:1771
llvm::PMStack::empty
bool empty() const
Definition: LegacyPassManagers.h:145
llvm::AnalysisUsage::getRequiredSet
const VectorType & getRequiredSet() const
Definition: PassAnalysisSupport.h:144
StructuralHash.h
llvm::ON_MODULE_MSG
@ ON_MODULE_MSG
Definition: LegacyPassManagers.h:101
Timer.h
llvm::cl::opt
Definition: CommandLine.h:1432
llvm::ON_LOOP_MSG
@ ON_LOOP_MSG
Definition: LegacyPassManagers.h:103
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:206
llvm::FPPassManager::ID
static char ID
Definition: LegacyPassManagers.h:461
llvm::DiagnosticInfoOptimizationBase::Argument
Used in the streaming interface as the general argument type.
Definition: DiagnosticInfo.h:422
llvm::PMDataManager::initializeAnalysisInfo
void initializeAnalysisInfo()
Initialize available analysis information.
Definition: LegacyPassManagers.h:335
llvm::AnalysisResolver::clearAnalysisImpls
void clearAnalysisImpls()
Clear cache that is used to connect a pass to the analysis (PassInfo).
Definition: PassAnalysisSupport.h:187
llvm::cl::values
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Definition: CommandLine.h:697
llvm::PMDataManager::getTopLevelManager
PMTopLevelManager * getTopLevelManager()
Definition: LegacyPassManagers.h:363
llvm::ON_FUNCTION_MSG
@ ON_FUNCTION_MSG
Definition: LegacyPassManagers.h:100
Index
uint32_t Index
Definition: ELFObjHandler.cpp:83
uint64_t
llvm::for_each
UnaryFunction for_each(R &&Range, UnaryFunction F)
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1642
llvm::PassInfo::getPassArgument
StringRef getPassArgument() const
getPassArgument - Return the command line option that may be passed to 'opt' that will cause this pas...
Definition: PassInfo.h:67
llvm::Pass::getResolver
AnalysisResolver * getResolver() const
Definition: Pass.h:150
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::DenseMap
Definition: DenseMap.h:714
llvm::getPassTimer
Timer * getPassTimer(Pass *)
Request the timer for this legacy-pass-manager's pass instance.
Definition: PassTimingInfo.cpp:153
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::PMTopLevelManager::addPassManager
void addPassManager(PMDataManager *Manager)
Definition: LegacyPassManagers.h:204
llvm::PassDebuggingString
PassDebuggingString
Definition: LegacyPassManagers.h:96
llvm::PMDataManager::removeDeadPasses
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
Definition: LegacyPassManager.cpp:973
llvm::legacy::PassManagerImpl::run
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
Definition: LegacyPassManager.cpp:529
llvm::legacy::FunctionPassManager::doInitialization
bool doInitialization()
doInitialization - Run all of the initializers for the function passes.
Definition: LegacyPassManager.cpp:1358
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:1714
llvm::PMDataManager::preserveHigherLevelAnalysis
bool preserveHigherLevelAnalysis(Pass *P)
Definition: LegacyPassManager.cpp:893
llvm::AnalysisResolver::findImplPass
Pass * findImplPass(AnalysisID PI)
Find pass that is implementing PI.
Definition: PassAnalysisSupport.h:165
llvm::PMDataManager::InheritedAnalysis
DenseMap< AnalysisID, Pass * > * InheritedAnalysis[PMT_Last]
Definition: LegacyPassManagers.h:429
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::PassInfo::isAnalysis
bool isAnalysis() const
Definition: PassInfo.h:79
llvm::PMDataManager::dumpRequiredSet
void dumpRequiredSet(const Pass *P) const
Definition: LegacyPassManager.cpp:1224
llvm::legacy::FunctionPassManagerImpl::run
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
Definition: LegacyPassManager.cpp:362
llvm::ModulePass::runOnModule
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
llvm::PMDataManager::~PMDataManager
virtual ~PMDataManager()
Definition: LegacyPassManager.cpp:1303
llvm::Module::getModuleIdentifier
const std::string & getModuleIdentifier() const
Get the module identifier which is, essentially, the name of the module.
Definition: Module.h:225
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::legacy::FunctionPassManager::add
void add(Pass *P) override
Add a pass to the queue of passes to run.
Definition: LegacyPassManager.cpp:1340
llvm::FPPassManager::dumpPassStructure
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
Definition: LegacyPassManager.cpp:1386
llvm::Value::printAsOperand
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
Definition: AsmWriter.cpp:4654
llvm::PMDataManager::setTopLevelManager
void setTopLevelManager(PMTopLevelManager *T)
Definition: LegacyPassManagers.h:364
llvm::PMDataManager::dumpUsedSet
void dumpUsedSet(const Pass *P) const
Definition: LegacyPassManager.cpp:1242
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::Pass::releaseMemory
virtual void releaseMemory()
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Definition: Pass.cpp:97
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:57
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::Pass::getPassName
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Definition: Pass.cpp:76
llvm::PMT_FunctionPassManager
@ PMT_FunctionPassManager
FPPassManager.
Definition: Pass.h:56
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::DiagnosticLocation
Definition: DiagnosticInfo.h:349
llvm::legacy::PassManagerImpl::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
Definition: LegacyPassManager.cpp:502
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:313
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::EXECUTION_MSG
@ EXECUTION_MSG
Definition: LegacyPassManagers.h:97
Profile
Load MIR Sample Profile
Definition: MIRSampleProfile.cpp:62
llvm::PMDataManager::getPassManagerType
virtual PassManagerType getPassManagerType() const
Definition: LegacyPassManagers.h:382
llvm::OptimizationRemarkAnalysis
Diagnostic information for optimization analysis remarks.
Definition: DiagnosticInfo.h:776
Mutex.h
llvm::PMStack::pop
void pop()
Definition: LegacyPassManager.cpp:1687
llvm::Pass::getAsPMDataManager
virtual PMDataManager * getAsPMDataManager()
Definition: Pass.cpp:113
llvm::SpecificBumpPtrAllocator::Allocate
T * Allocate(size_t num=1)
Allocate space for an array of objects without constructing them.
Definition: Allocator.h:426
llvm::legacy::FunctionPassManagerImpl::doInitialization
bool doInitialization(Module &M) override
doInitialization - Run all of the initializers for the function passes.
Definition: LegacyPassManager.cpp:321
llvm::find_if
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1676
llvm::PMDataManager::verifyPreservedAnalysis
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
Definition: LegacyPassManager.cpp:909
llvm::PassManager
Manages a sequence of passes over a particular unit of IR.
Definition: PassManager.h:472
llvm::PMDataManager::removeNotPreservedAnalysis
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
Definition: LegacyPassManager.cpp:927
llvm::FPPassManager
FPPassManager manages BBPassManagers and FunctionPasses.
Definition: LegacyPassManagers.h:459
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:1275
llvm::PMStack
PMStack - This class implements a stack data structure of PMDataManager pointers.
Definition: LegacyPassManagers.h:136
llvm::Pass::dumpPassStructure
virtual void dumpPassStructure(unsigned Offset=0)
Definition: Pass.cpp:69
llvm::legacy::FunctionPassManager::run
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
Definition: LegacyPassManager.cpp:1348
llvm::PMDataManager::add
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
Definition: LegacyPassManager.cpp:1024
llvm::PMDataManager::getOnTheFlyPass
virtual std::tuple< Pass *, bool > getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F)
Definition: LegacyPassManager.cpp:1297
llvm::AnalysisResolver::addAnalysisImplsPair
void addAnalysisImplsPair(AnalysisID PI, Pass *P)
Definition: PassAnalysisSupport.h:179
llvm::PMDataManager::PassVector
SmallVector< Pass *, 16 > PassVector
Definition: LegacyPassManagers.h:424
DiagnosticInfo.h
Arguments
AMDGPU Lower Kernel Arguments
Definition: AMDGPULowerKernelArguments.cpp:243
llvm::PMDataManager::TPM
PMTopLevelManager * TPM
Definition: LegacyPassManagers.h:421
llvm::shouldPrintAfterPass
bool shouldPrintAfterPass(StringRef PassID)
Definition: PrintPasses.cpp:69
llvm::legacy::FunctionPassManagerImpl::getAsPMDataManager
PMDataManager * getAsPMDataManager() override
Definition: LegacyPassManager.cpp:291
llvm::PMTopLevelManager::initializeAllAnalysisInfo
void initializeAllAnalysisInfo()
Definition: LegacyPassManager.cpp:854
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:581
llvm::legacy::PassManager::add
void add(Pass *P) override
Add a pass to the queue of passes to run.
Definition: LegacyPassManager.cpp:1670
llvm::shouldPrintBeforePass
bool shouldPrintBeforePass(StringRef PassID)
Definition: PrintPasses.cpp:65
llvm::PMTopLevelManager::addIndirectPassManager
void addIndirectPassManager(PMDataManager *Manager)
Definition: LegacyPassManagers.h:210
llvm::FPPassManager::runOnModule
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition: LegacyPassManager.cpp:1477
llvm::PMDataManager::getDepth
unsigned getDepth() const
Definition: LegacyPassManagers.h:366
llvm::Pass::setResolver
void setResolver(AnalysisResolver *AR)
Definition: Pass.cpp:117
llvm::legacy::FunctionPassManager::~FunctionPassManager
~FunctionPassManager() override
Definition: LegacyPassManager.cpp:1336
llvm::Pass::getPotentialPassManagerType
virtual PassManagerType getPotentialPassManagerType() const
Return what kind of Pass Manager can manage this pass.
Definition: Pass.cpp:88
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:564
llvm::legacy::FunctionPassManagerImpl::getContainedManager
FPPassManager * getContainedManager(unsigned N)
Definition: LegacyPassManager.cpp:302
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:1099
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:994
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:497
llvm::AnalysisResolver::getPMDataManager
PMDataManager & getPMDataManager()
Definition: PassAnalysisSupport.h:162
llvm::legacy::PassManagerImpl
PassManagerImpl manages MPPassManagers.
Definition: LegacyPassManager.cpp:473
N
#define N
llvm::AnalysisUsage::getPreservedSet
const VectorType & getPreservedSet() const
Definition: PassAnalysisSupport.h:148
llvm::PMTopLevelManager::~PMTopLevelManager
virtual ~PMTopLevelManager()
Destructor.
Definition: LegacyPassManager.cpp:864
llvm::SmallVectorImpl< AnalysisID >
llvm::PMTopLevelManager
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers.
Definition: LegacyPassManagers.h:158
llvm::legacy::PassManager::run
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
Definition: LegacyPassManager.cpp:1676
llvm::PMStack::dump
void dump() const
Definition: LegacyPassManager.cpp:1720
llvm::Pass::getAnalysisUsage
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Pass.cpp:93
llvm::Pass::createPrinterPass
virtual Pass * createPrinterPass(raw_ostream &OS, const std::string &Banner) const =0
createPrinterPass - Get a Pass appropriate to print the IR this pass operates on (Module,...
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
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
LLVMContext.h
llvm::PMTopLevelManager::findAnalysisPass
Pass * findAnalysisPass(AnalysisID AID)
Find the pass that implements Analysis AID.
Definition: LegacyPassManager.cpp:770
llvm::legacy::PassManagerImpl::getTopLevelPassManagerType
PassManagerType getTopLevelPassManagerType() override
Definition: LegacyPassManager.cpp:508
llvm::cl::desc
Definition: CommandLine.h:412
llvm::PassRegistry::getPassInfo
const PassInfo * getPassInfo(const void *TI) const
getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass' type identifier (&MyPass::...
Definition: PassRegistry.cpp:41
llvm::PMDataManager::isPassDebuggingExecutionsOrMore
bool isPassDebuggingExecutionsOrMore() const
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.
Definition: LegacyPassManager.cpp:66
raw_ostream.h
llvm::PMDataManager::populateInheritedAnalysis
void populateInheritedAnalysis(PMStack &PMS)
Definition: LegacyPassManagers.h:392
llvm::legacy::FunctionPassManagerImpl::add
void add(Pass *P)
Add a pass to the queue of passes to run.
Definition: LegacyPassManager.cpp:264
llvm::handleAllErrors
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
Definition: Error.h:968
TimeProfiler.h
llvm::FREEING_MSG
@ FREEING_MSG
Definition: LegacyPassManagers.h:99
Debug.h
llvm::SystemZISD::IPM
@ IPM
Definition: SystemZISelLowering.h:146
PassName
static const char PassName[]
Definition: X86LowerAMXIntrinsics.cpp:670
llvm::legacy::FunctionPassManagerImpl::dumpPassStructure
void dumpPassStructure(unsigned Offset) override
Definition: LegacyPassManager.cpp:308
llvm::PMDataManager::findAnalysisPass
Pass * findAnalysisPass(AnalysisID AID, bool Direction)
Find the pass that implements Analysis AID.
Definition: LegacyPassManager.cpp:1137
llvm::createPrintFunctionPass
FunctionPass * createPrintFunctionPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that prints functions to the specified raw_ostream as they are processed.
Definition: IRPrintingPasses.cpp:130
llvm::createPrintModulePass
ModulePass * createPrintModulePass(raw_ostream &OS, const std::string &Banner="", bool ShouldPreserveUseListOrder=false)
Create and return a pass that writes the module to the specified raw_ostream.
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38