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