LLVM  14.0.0git
LoopPass.cpp
Go to the documentation of this file.
1 //===- LoopPass.cpp - Loop Pass and Loop Pass Manager ---------------------===//
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 LoopPass and LPPassManager. All loop optimization
10 // and transformation passes are derived from LoopPass. LPPassManager is
11 // responsible for managing LoopPasses.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "llvm/Analysis/LoopPass.h"
17 #include "llvm/IR/Dominators.h"
18 #include "llvm/IR/LLVMContext.h"
19 #include "llvm/IR/OptBisect.h"
20 #include "llvm/IR/PassManager.h"
21 #include "llvm/IR/PassTimingInfo.h"
22 #include "llvm/IR/PrintPasses.h"
23 #include "llvm/IR/StructuralHash.h"
24 #include "llvm/InitializePasses.h"
25 #include "llvm/Support/Debug.h"
27 #include "llvm/Support/Timer.h"
29 using namespace llvm;
30 
31 #define DEBUG_TYPE "loop-pass-manager"
32 
33 namespace {
34 
35 /// PrintLoopPass - Print a Function corresponding to a Loop.
36 ///
37 class PrintLoopPassWrapper : public LoopPass {
38  raw_ostream &OS;
39  std::string Banner;
40 
41 public:
42  static char ID;
43  PrintLoopPassWrapper() : LoopPass(ID), OS(dbgs()) {}
44  PrintLoopPassWrapper(raw_ostream &OS, const std::string &Banner)
45  : LoopPass(ID), OS(OS), Banner(Banner) {}
46 
47  void getAnalysisUsage(AnalysisUsage &AU) const override {
48  AU.setPreservesAll();
49  }
50 
51  bool runOnLoop(Loop *L, LPPassManager &) override {
52  auto BBI = llvm::find_if(L->blocks(), [](BasicBlock *BB) { return BB; });
53  if (BBI != L->blocks().end() &&
54  isFunctionInPrintList((*BBI)->getParent()->getName())) {
55  printLoop(*L, OS, Banner);
56  }
57  return false;
58  }
59 
60  StringRef getPassName() const override { return "Print Loop IR"; }
61 };
62 
64 }
65 
66 //===----------------------------------------------------------------------===//
67 // LPPassManager
68 //
69 
70 char LPPassManager::ID = 0;
71 
73  LI = nullptr;
74  CurrentLoop = nullptr;
75 }
76 
77 // Insert loop into loop nest (LoopInfo) and loop queue (LQ).
79  if (L.isOutermost()) {
80  // This is the top level loop.
81  LQ.push_front(&L);
82  return;
83  }
84 
85  // Insert L into the loop queue after the parent loop.
86  for (auto I = LQ.begin(), E = LQ.end(); I != E; ++I) {
87  if (*I == L.getParentLoop()) {
88  // deque does not support insert after.
89  ++I;
90  LQ.insert(I, 1, &L);
91  return;
92  }
93  }
94 }
95 
96 // Recurse through all subloops and all loops into LQ.
97 static void addLoopIntoQueue(Loop *L, std::deque<Loop *> &LQ) {
98  LQ.push_back(L);
99  for (Loop *I : reverse(*L))
100  addLoopIntoQueue(I, LQ);
101 }
102 
103 /// Pass Manager itself does not invalidate any analysis info.
105  // LPPassManager needs LoopInfo. In the long term LoopInfo class will
106  // become part of LPPassManager.
107  Info.addRequired<LoopInfoWrapperPass>();
108  Info.addRequired<DominatorTreeWrapperPass>();
109  Info.setPreservesAll();
110 }
111 
113  assert((&L == CurrentLoop || CurrentLoop->contains(&L)) &&
114  "Must not delete loop outside the current loop tree!");
115  // If this loop appears elsewhere within the queue, we also need to remove it
116  // there. However, we have to be careful to not remove the back of the queue
117  // as that is assumed to match the current loop.
118  assert(LQ.back() == CurrentLoop && "Loop queue back isn't the current loop!");
119  llvm::erase_value(LQ, &L);
120 
121  if (&L == CurrentLoop) {
122  CurrentLoopDeleted = true;
123  // Add this loop back onto the back of the queue to preserve our invariants.
124  LQ.push_back(&L);
125  }
126 }
127 
128 /// run - Execute all of the passes scheduled for execution. Keep track of
129 /// whether any of the passes modifies the function, and if so, return true.
131  auto &LIWP = getAnalysis<LoopInfoWrapperPass>();
132  LI = &LIWP.getLoopInfo();
133  Module &M = *F.getParent();
134 #if 0
135  DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
136 #endif
137  bool Changed = false;
138 
139  // Collect inherited analysis from Module level pass manager.
141 
142  // Populate the loop queue in reverse program order. There is no clear need to
143  // process sibling loops in either forward or reverse order. There may be some
144  // advantage in deleting uses in a later loop before optimizing the
145  // definitions in an earlier loop. If we find a clear reason to process in
146  // forward order, then a forward variant of LoopPassManager should be created.
147  //
148  // Note that LoopInfo::iterator visits loops in reverse program
149  // order. Here, reverse_iterator gives us a forward order, and the LoopQueue
150  // reverses the order a third time by popping from the back.
151  for (Loop *L : reverse(*LI))
152  addLoopIntoQueue(L, LQ);
153 
154  if (LQ.empty()) // No loops, skip calling finalizers
155  return false;
156 
157  // Initialization
158  for (Loop *L : LQ) {
159  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
161  Changed |= P->doInitialization(L, *this);
162  }
163  }
164 
165  // Walk Loops
166  unsigned InstrCount, FunctionSize = 0;
167  StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
168  bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
169  // Collect the initial size of the module and the function we're looking at.
170  if (EmitICRemark) {
171  InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
172  FunctionSize = F.getInstructionCount();
173  }
174  while (!LQ.empty()) {
175  CurrentLoopDeleted = false;
176  CurrentLoop = LQ.back();
177 
178  // Run all passes on the current Loop.
179  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
181 
182  llvm::TimeTraceScope LoopPassScope("RunLoopPass", P->getPassName());
183 
185  CurrentLoop->getHeader()->getName());
187 
189 
190  bool LocalChanged = false;
191  {
192  PassManagerPrettyStackEntry X(P, *CurrentLoop->getHeader());
193  TimeRegion PassTimer(getPassTimer(P));
194 #ifdef EXPENSIVE_CHECKS
195  uint64_t RefHash = StructuralHash(F);
196 #endif
197  LocalChanged = P->runOnLoop(CurrentLoop, *this);
198 
199 #ifdef EXPENSIVE_CHECKS
200  if (!LocalChanged && (RefHash != StructuralHash(F))) {
201  llvm::errs() << "Pass modifies its input and doesn't report it: "
202  << P->getPassName() << "\n";
203  llvm_unreachable("Pass modifies its input and doesn't report it");
204  }
205 #endif
206 
207  Changed |= LocalChanged;
208  if (EmitICRemark) {
209  unsigned NewSize = F.getInstructionCount();
210  // Update the size of the function, emit a remark, and update the
211  // size of the module.
212  if (NewSize != FunctionSize) {
213  int64_t Delta = static_cast<int64_t>(NewSize) -
214  static_cast<int64_t>(FunctionSize);
216  FunctionToInstrCount, &F);
217  InstrCount = static_cast<int64_t>(InstrCount) + Delta;
218  FunctionSize = NewSize;
219  }
220  }
221  }
222 
223  if (LocalChanged)
225  CurrentLoopDeleted ? "<deleted loop>"
226  : CurrentLoop->getName());
228 
229  if (!CurrentLoopDeleted) {
230  // Manually check that this loop is still healthy. This is done
231  // instead of relying on LoopInfo::verifyLoop since LoopInfo
232  // is a function pass and it's really expensive to verify every
233  // loop in the function every time. That level of checking can be
234  // enabled with the -verify-loop-info option.
235  {
236  TimeRegion PassTimer(getPassTimer(&LIWP));
237  CurrentLoop->verifyLoop();
238  }
239  // Here we apply same reasoning as in the above case. Only difference
240  // is that LPPassManager might run passes which do not require LCSSA
241  // form (LoopPassPrinter for example). We should skip verification for
242  // such passes.
243  // FIXME: Loop-sink currently break LCSSA. Fix it and reenable the
244  // verification!
245 #if 0
247  assert(CurrentLoop->isRecursivelyLCSSAForm(*DT, *LI));
248 #endif
249 
250  // Then call the regular verifyAnalysis functions.
252 
253  F.getContext().yield();
254  }
255 
256  if (LocalChanged)
260  CurrentLoopDeleted ? "<deleted>"
261  : CurrentLoop->getHeader()->getName(),
262  ON_LOOP_MSG);
263 
264  if (CurrentLoopDeleted)
265  // Do not run other passes on this loop.
266  break;
267  }
268 
269  // If the loop was deleted, release all the loop passes. This frees up
270  // some memory, and avoids trouble with the pass manager trying to call
271  // verifyAnalysis on them.
272  if (CurrentLoopDeleted) {
273  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
275  freePass(P, "<deleted>", ON_LOOP_MSG);
276  }
277  }
278 
279  // Pop the loop from queue after running all passes.
280  LQ.pop_back();
281  }
282 
283  // Finalization
284  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
286  Changed |= P->doFinalization();
287  }
288 
289  return Changed;
290 }
291 
292 /// Print passes managed by this manager
294  errs().indent(Offset*2) << "Loop Pass Manager\n";
295  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
297  P->dumpPassStructure(Offset + 1);
298  dumpLastUses(P, Offset+1);
299  }
300 }
301 
302 
303 //===----------------------------------------------------------------------===//
304 // LoopPass
305 
307  const std::string &Banner) const {
308  return new PrintLoopPassWrapper(O, Banner);
309 }
310 
311 // Check if this pass is suitable for the current LPPassManager, if
312 // available. This pass P is not suitable for a LPPassManager if P
313 // is not preserving higher level analysis info used by other
314 // LPPassManager passes. In such case, pop LPPassManager from the
315 // stack. This will force assignPassManager() to create new
316 // LPPassManger as expected.
318 
319  // Find LPPassManager
320  while (!PMS.empty() &&
322  PMS.pop();
323 
324  // If this pass is destroying high level information that is used
325  // by other passes that are managed by LPM then do not insert
326  // this pass in current LPM. Use new LPPassManager.
327  if (PMS.top()->getPassManagerType() == PMT_LoopPassManager &&
328  !PMS.top()->preserveHigherLevelAnalysis(this))
329  PMS.pop();
330 }
331 
332 /// Assign pass manager to manage this pass.
334  PassManagerType PreferredType) {
335  // Find LPPassManager
336  while (!PMS.empty() &&
338  PMS.pop();
339 
340  LPPassManager *LPPM;
342  LPPM = (LPPassManager*)PMS.top();
343  else {
344  // Create new Loop Pass Manager if it does not exist.
345  assert (!PMS.empty() && "Unable to create Loop Pass Manager");
346  PMDataManager *PMD = PMS.top();
347 
348  // [1] Create new Loop Pass Manager
349  LPPM = new LPPassManager();
350  LPPM->populateInheritedAnalysis(PMS);
351 
352  // [2] Set up new manager's top level manager
354  TPM->addIndirectPassManager(LPPM);
355 
356  // [3] Assign manager to manage this new manager. This may create
357  // and push new managers into PMS
358  Pass *P = LPPM->getAsPass();
359  TPM->schedulePass(P);
360 
361  // [4] Push new manager into PMS
362  PMS.push(LPPM);
363  }
364 
365  LPPM->add(this);
366 }
367 
368 static std::string getDescription(const Loop &L) {
369  return "loop";
370 }
371 
372 bool LoopPass::skipLoop(const Loop *L) const {
373  const Function *F = L->getHeader()->getParent();
374  if (!F)
375  return false;
376  // Check the opt bisect limit.
377  OptPassGate &Gate = F->getContext().getOptPassGate();
378  if (Gate.isEnabled() && !Gate.shouldRunPass(this, getDescription(*L)))
379  return true;
380  // Check for the OptimizeNone attribute.
381  if (F->hasOptNone()) {
382  // FIXME: Report this to dbgs() only once per function.
383  LLVM_DEBUG(dbgs() << "Skipping pass '" << getPassName() << "' in function "
384  << F->getName() << "\n");
385  // FIXME: Delete loop from pass manager's queue?
386  return true;
387  }
388  return false;
389 }
390 
393 }
394 
396 INITIALIZE_PASS(LCSSAVerificationPass, "lcssa-verification", "LCSSA Verifier",
397  false, false)
llvm::PMDataManager::recordAvailableAnalysis
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
Definition: LegacyPassManager.cpp:876
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
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::LoopPass::createPrinterPass
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
getPrinterPass - Get a pass to print the function corresponding to a Loop.
Definition: LoopPass.cpp:306
llvm::BasicBlock::getParent
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:107
llvm::Function
Definition: Function.h:62
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:530
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::LoopBase::contains
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
Definition: LoopInfo.h:122
llvm::PMTopLevelManager::schedulePass
void schedulePass(Pass *P)
Schedule pass P for execution.
Definition: LegacyPassManager.cpp:662
llvm::PMDataManager::dumpPassInfo
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
Definition: LegacyPassManager.cpp:1183
llvm::OptPassGate::isEnabled
virtual bool isEnabled() const
isEnabled() should return true before calling shouldRunPass().
Definition: OptBisect.h:38
llvm::LPPassManager::LPPassManager
LPPassManager()
Definition: LoopPass.cpp:72
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:151
llvm::PassManagerType
PassManagerType
Different types of internal pass managers.
Definition: Pass.h:52
InstrCount
static unsigned InstrCount
Definition: DFAPacketizer.cpp:53
llvm::LPPassManager::getContainedPass
LoopPass * getContainedPass(unsigned N)
Definition: LoopPass.h:96
llvm::reverse
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
Definition: STLExtras.h:414
llvm::LoopInfoWrapperPass
The legacy pass manager's analysis pass to compute loop information.
Definition: LoopInfo.h:1271
OptBisect.h
llvm::LCSSAVerificationPass::LCSSAVerificationPass
LCSSAVerificationPass()
Definition: LoopPass.cpp:391
llvm::LCSSAVerificationPass::ID
static char ID
Definition: LoopPass.h:124
llvm::LPPassManager::ID
static char ID
Definition: LoopPass.h:77
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:80
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::PassManagerPrettyStackEntry
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
Definition: LegacyPassManagers.h:109
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
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
llvm::LPPassManager::addLoop
void addLoop(Loop &L)
Definition: LoopPass.cpp:78
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
LoopAnalysisManager.h
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
PassTimingInfo.h
llvm::PMDataManager
PMDataManager provides the common place to manage the analysis data used by pass managers.
Definition: LegacyPassManagers.h:295
llvm::PMDataManager::dumpLastUses
void dumpLastUses(Pass *P, unsigned Offset) const
Definition: LegacyPassManager.cpp:1153
llvm::LoopBase::getParentLoop
LoopT * getParentLoop() const
Return the parent loop if it exists or nullptr for top level loops.
Definition: LoopInfo.h:113
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
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::LPPassManager::dumpPassStructure
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
Definition: LoopPass.cpp:293
llvm::PMTopLevelManager::activeStack
PMStack activeStack
Definition: LegacyPassManagers.h:219
INITIALIZE_PASS
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:37
llvm::OptPassGate
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
Definition: OptBisect.h:27
addLoopIntoQueue
static void addLoopIntoQueue(Loop *L, std::deque< Loop * > &LQ)
Definition: LoopPass.cpp:97
llvm::LoopPass::skipLoop
bool skipLoop(const Loop *L) const
Optional passes call this function to check whether the pass should be skipped.
Definition: LoopPass.cpp:372
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::LoopBase::blocks
iterator_range< block_iterator > blocks() const
Definition: LoopInfo.h:178
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::printLoop
void printLoop(Loop &L, raw_ostream &OS, const std::string &Banner="")
Function to print a loop's contents as LLVM's text IR assembly.
Definition: LoopInfo.cpp:980
llvm::LoopBase::verifyLoop
void verifyLoop() const
Verify loop structure.
Definition: LoopInfoImpl.h:286
llvm::DominatorTreeWrapperPass
Legacy analysis pass which computes a DominatorTree.
Definition: Dominators.h:287
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::MODIFICATION_MSG
@ MODIFICATION_MSG
Definition: LegacyPassManagers.h:98
llvm::LPPassManager
Definition: LoopPass.h:75
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::LPPassManager::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
Definition: LoopPass.cpp:104
llvm::LoopPass::preparePassManager
void preparePassManager(PMStack &PMS) override
Check if available pass managers are suitable for this pass or not.
Definition: LoopPass.cpp:317
PrintPasses.h
llvm::Loop::getName
StringRef getName() const
Definition: LoopInfo.h:869
llvm::PMStack::top
PMDataManager * top() const
Definition: LegacyPassManagers.h:143
llvm::erase_value
void erase_value(Container &C, ValueType V)
Wrapper function to remove a value from a container:
Definition: STLExtras.h:1838
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::PMStack::empty
bool empty() const
Definition: LegacyPassManagers.h:145
StructuralHash.h
llvm::LPPassManager::getAsPass
Pass * getAsPass() override
Definition: LoopPass.h:91
Timer.h
llvm::ON_LOOP_MSG
@ ON_LOOP_MSG
Definition: LegacyPassManagers.h:103
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:206
llvm::PMDataManager::getTopLevelManager
PMTopLevelManager * getTopLevelManager()
Definition: LegacyPassManagers.h:363
Index
uint32_t Index
Definition: ELFObjHandler.cpp:83
uint64_t
llvm::LoopPass
Definition: LoopPass.h:27
llvm::LoopPass::assignPassManager
void assignPassManager(PMStack &PMS, PassManagerType PMT) override
Assign pass manager to manage this pass.
Definition: LoopPass.cpp:333
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::PMDataManager::removeDeadPasses
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
Definition: LegacyPassManager.cpp:973
llvm::LCSSAVerificationPass
Definition: LoopPass.h:123
llvm::isFunctionInPrintList
bool isFunctionInPrintList(StringRef FunctionName)
Definition: PrintPasses.cpp:83
llvm::PMDataManager::preserveHigherLevelAnalysis
bool preserveHigherLevelAnalysis(Pass *P)
Definition: LegacyPassManager.cpp:893
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::PMDataManager::dumpRequiredSet
void dumpRequiredSet(const Pass *P) const
Definition: LegacyPassManager.cpp:1224
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::initializeLCSSAVerificationPassPass
void initializeLCSSAVerificationPassPass(PassRegistry &)
llvm::Pass::mustPreserveAnalysisID
bool mustPreserveAnalysisID(char &AID) const
mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable,...
Definition: Pass.cpp:64
llvm::PMT_LoopPassManager
@ PMT_LoopPassManager
LPPassManager.
Definition: Pass.h:57
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::Pass::getPassName
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Definition: Pass.cpp:76
LoopPass.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::LoopBase::isOutermost
bool isOutermost() const
Return true if the loop does not have a parent (natural) loop.
Definition: LoopInfo.h:168
llvm::EXECUTION_MSG
@ EXECUTION_MSG
Definition: LegacyPassManagers.h:97
llvm::PMDataManager::getPassManagerType
virtual PassManagerType getPassManagerType() const
Definition: LegacyPassManagers.h:382
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
llvm::PMStack::pop
void pop()
Definition: LegacyPassManager.cpp:1687
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::PMDataManager::removeNotPreservedAnalysis
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
Definition: LegacyPassManager.cpp:927
llvm::PMStack
PMStack - This class implements a stack data structure of PMDataManager pointers.
Definition: LegacyPassManagers.h:136
llvm::AnalysisUsage::setPreservesAll
void setPreservesAll()
Set by analyses that do not transform their input at all.
Definition: PassAnalysisSupport.h:130
llvm::PMDataManager::add
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
Definition: LegacyPassManager.cpp:1024
llvm::LPPassManager::markLoopAsDeleted
void markLoopAsDeleted(Loop &L)
Definition: LoopPass.cpp:112
llvm::LoopBase::getHeader
BlockT * getHeader() const
Definition: LoopInfo.h:104
PassManager.h
llvm::PMDataManager::TPM
PMTopLevelManager * TPM
Definition: LegacyPassManagers.h:421
llvm::Loop::isRecursivelyLCSSAForm
bool isRecursivelyLCSSAForm(const DominatorTree &DT, const LoopInfo &LI) const
Return true if this Loop and all inner subloops are in LCSSA form.
Definition: LoopInfo.cpp:469
llvm::PMTopLevelManager::addIndirectPassManager
void addIndirectPassManager(PMDataManager *Manager)
Definition: LegacyPassManagers.h:210
llvm::LPPassManager::runOnFunction
bool runOnFunction(Function &F) override
run - Execute all of the passes scheduled for execution.
Definition: LoopPass.cpp:130
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
Dominators.h
getDescription
static std::string getDescription(const Loop &L)
Definition: LoopPass.cpp:368
llvm::PMTopLevelManager
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers.
Definition: LegacyPassManagers.h:158
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
raw_ostream.h
llvm::PMDataManager::populateInheritedAnalysis
void populateInheritedAnalysis(PMStack &PMS)
Definition: LegacyPassManagers.h:392
llvm::OptPassGate::shouldRunPass
virtual bool shouldRunPass(const Pass *P, StringRef IRDescription)
IRDescription is a textual description of the IR unit the pass is running over.
Definition: OptBisect.h:33
InitializePasses.h
TimeProfiler.h
Debug.h
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38