Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
GenericLoopInfo.h
Go to the documentation of this file.
1//===- GenericLoopInfo - Generic Loop Info for graphs -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the LoopInfoBase class that is used to identify natural
10// loops and determine the loop depth of various nodes in a generic graph of
11// blocks. A natural loop has exactly one entry-point, which is called the
12// header. Note that natural loops may actually be several loops that share the
13// same header node.
14//
15// This analysis calculates the nesting structure of loops in a function. For
16// each natural loop identified, this analysis identifies natural loops
17// contained entirely within the loop and the basic blocks that make up the
18// loop.
19//
20// It can calculate on the fly various bits of information, for example:
21//
22// * whether there is a preheader for the loop
23// * the number of back edges to the header
24// * whether or not a particular block branches out of the loop
25// * the successor blocks of the loop
26// * the loop depth
27// * etc...
28//
29// Note that this analysis specifically identifies *Loops* not cycles or SCCs
30// in the graph. There can be strongly connected components in the graph which
31// this analysis will not recognize and that will not be represented by a Loop
32// instance. In particular, a Loop might be inside such a non-loop SCC, or a
33// non-loop SCC might contain a sub-SCC which is a Loop.
34//
35// For an overview of terminology used in this API (and thus all of our loop
36// analyses or transforms), see docs/LoopTerminology.rst.
37//
38//===----------------------------------------------------------------------===//
39
40#ifndef LLVM_SUPPORT_GENERICLOOPINFO_H
41#define LLVM_SUPPORT_GENERICLOOPINFO_H
42
43#include "llvm/ADT/DenseSet.h"
44#include "llvm/ADT/PostOrderIterator.h"
45#include "llvm/ADT/STLExtras.h"
46#include "llvm/ADT/SetOperations.h"
47#include "llvm/Support/Allocator.h"
48#include "llvm/Support/GenericDomTree.h"
49
50namespacellvm {
51
52template <class N,class M>classLoopInfoBase;
53template <class N,class M>classLoopBase;
54
55//===----------------------------------------------------------------------===//
56/// Instances of this class are used to represent loops that are detected in the
57/// flow graph.
58///
59template <class BlockT,class LoopT>classLoopBase {
60 LoopT *ParentLoop;
61// Loops contained entirely within this one.
62 std::vector<LoopT *> SubLoops;
63
64// The list of blocks in this loop. First entry is the header node.
65 std::vector<BlockT *> Blocks;
66
67SmallPtrSet<const BlockT *, 8> DenseBlockSet;
68
69#if LLVM_ENABLE_ABI_BREAKING_CHECKS
70 /// Indicator that this loop is no longer a valid loop.
71bool IsInvalid =false;
72#endif
73
74LoopBase(constLoopBase<BlockT, LoopT> &) =delete;
75constLoopBase<BlockT, LoopT> &
76 operator=(constLoopBase<BlockT, LoopT> &) =delete;
77
78public:
79 /// Return the nesting level of this loop. An outer-most loop has depth 1,
80 /// for consistency with loop depth values used for basic blocks, where depth
81 /// 0 is used for blocks not inside any loops.
82unsignedgetLoopDepth() const{
83assert(!isInvalid() &&"Loop not in a valid state!");
84unsignedD = 1;
85for (const LoopT *CurLoop = ParentLoop; CurLoop;
86 CurLoop = CurLoop->ParentLoop)
87 ++D;
88returnD;
89 }
90 BlockT *getHeader() const{returngetBlocks().front(); }
91 /// Return the parent loop if it exists or nullptr for top
92 /// level loops.
93
94 /// A loop is either top-level in a function (that is, it is not
95 /// contained in any other loop) or it is entirely enclosed in
96 /// some other loop.
97 /// If a loop is top-level, it has no parent, otherwise its
98 /// parent is the innermost loop in which it is enclosed.
99 LoopT *getParentLoop() const{return ParentLoop; }
100
101 /// Get the outermost loop in which this loop is contained.
102 /// This may be the loop itself, if it already is the outermost loop.
103const LoopT *getOutermostLoop() const{
104const LoopT *L =static_cast<constLoopT *>(this);
105while (L->ParentLoop)
106 L = L->ParentLoop;
107return L;
108 }
109
110 LoopT *getOutermostLoop() {
111 LoopT *L =static_cast<LoopT *>(this);
112while (L->ParentLoop)
113 L = L->ParentLoop;
114return L;
115 }
116
117 /// This is a raw interface for bypassing addChildLoop.
118voidsetParentLoop(LoopT *L) {
119assert(!isInvalid() &&"Loop not in a valid state!");
120 ParentLoop = L;
121 }
122
123 /// Return true if the specified loop is contained within in this loop.
124boolcontains(const LoopT *L) const{
125assert(!isInvalid() &&"Loop not in a valid state!");
126if (L ==this)
127returntrue;
128if (!L)
129returnfalse;
130returncontains(L->getParentLoop());
131 }
132
133 /// Return true if the specified basic block is in this loop.
134boolcontains(const BlockT *BB) const{
135assert(!isInvalid() &&"Loop not in a valid state!");
136return DenseBlockSet.count(BB);
137 }
138
139 /// Return true if the specified instruction is in this loop.
140template <class InstT>boolcontains(const InstT *Inst) const{
141returncontains(Inst->getParent());
142 }
143
144 /// Return the loops contained entirely within this loop.
145const std::vector<LoopT *> &getSubLoops() const{
146assert(!isInvalid() &&"Loop not in a valid state!");
147return SubLoops;
148 }
149 std::vector<LoopT *> &getSubLoopsVector() {
150assert(!isInvalid() &&"Loop not in a valid state!");
151return SubLoops;
152 }
153typedeftypename std::vector<LoopT *>::const_iteratoriterator;
154typedef
155typename std::vector<LoopT *>::const_reverse_iteratorreverse_iterator;
156iteratorbegin() const{returngetSubLoops().begin(); }
157iteratorend() const{returngetSubLoops().end(); }
158reverse_iteratorrbegin() const{returngetSubLoops().rbegin(); }
159reverse_iteratorrend() const{returngetSubLoops().rend(); }
160
161// LoopInfo does not detect irreducible control flow, just natural
162// loops. That is, it is possible that there is cyclic control
163// flow within the "innermost loop" or around the "outermost
164// loop".
165
166 /// Return true if the loop does not contain any (natural) loops.
167boolisInnermost() const{returngetSubLoops().empty(); }
168 /// Return true if the loop does not have a parent (natural) loop
169// (i.e. it is outermost, which is the same as top-level).
170boolisOutermost() const{returngetParentLoop() ==nullptr; }
171
172 /// Get a list of the basic blocks which make up this loop.
173ArrayRef<BlockT *>getBlocks() const{
174assert(!isInvalid() &&"Loop not in a valid state!");
175returnBlocks;
176 }
177typedeftypenameArrayRef<BlockT *>::const_iteratorblock_iterator;
178block_iteratorblock_begin() const{returngetBlocks().begin(); }
179block_iteratorblock_end() const{returngetBlocks().end(); }
180inlineiterator_range<block_iterator>blocks() const{
181assert(!isInvalid() &&"Loop not in a valid state!");
182returnmake_range(block_begin(),block_end());
183 }
184
185 /// Get the number of blocks in this loop in constant time.
186 /// Invalidate the loop, indicating that it is no longer a loop.
187unsignedgetNumBlocks() const{
188assert(!isInvalid() &&"Loop not in a valid state!");
189returnBlocks.size();
190 }
191
192 /// Return a direct, mutable handle to the blocks vector so that we can
193 /// mutate it efficiently with techniques like `std::remove`.
194 std::vector<BlockT *> &getBlocksVector() {
195assert(!isInvalid() &&"Loop not in a valid state!");
196returnBlocks;
197 }
198 /// Return a direct, mutable handle to the blocks set so that we can
199 /// mutate it efficiently.
200SmallPtrSetImpl<const BlockT *> &getBlocksSet() {
201assert(!isInvalid() &&"Loop not in a valid state!");
202return DenseBlockSet;
203 }
204
205 /// Return a direct, immutable handle to the blocks set.
206constSmallPtrSetImpl<const BlockT *> &getBlocksSet() const{
207assert(!isInvalid() &&"Loop not in a valid state!");
208return DenseBlockSet;
209 }
210
211 /// Return true if this loop is no longer valid. The only valid use of this
212 /// helper is "assert(L.isInvalid())" or equivalent, since IsInvalid is set to
213 /// true by the destructor. In other words, if this accessor returns true,
214 /// the caller has already triggered UB by calling this accessor; and so it
215 /// can only be called in a context where a return value of true indicates a
216 /// programmer error.
217boolisInvalid() const{
218#if LLVM_ENABLE_ABI_BREAKING_CHECKS
219return IsInvalid;
220#else
221returnfalse;
222#endif
223 }
224
225 /// True if terminator in the block can branch to another block that is
226 /// outside of the current loop. \p BB must be inside the loop.
227boolisLoopExiting(const BlockT *BB) const{
228assert(!isInvalid() &&"Loop not in a valid state!");
229assert(contains(BB) &&"Exiting block must be part of the loop");
230for (constauto *Succ : children<const BlockT *>(BB)) {
231if (!contains(Succ))
232returntrue;
233 }
234returnfalse;
235 }
236
237 /// Returns true if \p BB is a loop-latch.
238 /// A latch block is a block that contains a branch back to the header.
239 /// This function is useful when there are multiple latches in a loop
240 /// because \fn getLoopLatch will return nullptr in that case.
241boolisLoopLatch(const BlockT *BB) const{
242assert(!isInvalid() &&"Loop not in a valid state!");
243assert(contains(BB) &&"block does not belong to the loop");
244returnllvm::is_contained(inverse_children<BlockT *>(getHeader()), BB);
245 }
246
247 /// Calculate the number of back edges to the loop header.
248unsignedgetNumBackEdges() const{
249assert(!isInvalid() &&"Loop not in a valid state!");
250returnllvm::count_if(inverse_children<BlockT *>(getHeader()),
251 [&](BlockT *Pred) {returncontains(Pred); });
252 }
253
254//===--------------------------------------------------------------------===//
255// APIs for simple analysis of the loop.
256//
257// Note that all of these methods can fail on general loops (ie, there may not
258// be a preheader, etc). For best success, the loop simplification and
259// induction variable canonicalization pass should be used to normalize loops
260// for easy analysis. These methods assume canonical loops.
261
262 /// Return all blocks inside the loop that have successors outside of the
263 /// loop. These are the blocks _inside of the current loop_ which branch out.
264 /// The returned list is always unique.
265voidgetExitingBlocks(SmallVectorImpl<BlockT *> &ExitingBlocks)const;
266
267 /// If getExitingBlocks would return exactly one block, return that block.
268 /// Otherwise return null.
269 BlockT *getExitingBlock()const;
270
271 /// Return all of the successor blocks of this loop. These are the blocks
272 /// _outside of the current loop_ which are branched to.
273voidgetExitBlocks(SmallVectorImpl<BlockT *> &ExitBlocks)const;
274
275 /// If getExitBlocks would return exactly one block, return that block.
276 /// Otherwise return null.
277 BlockT *getExitBlock()const;
278
279 /// Return true if no exit block for the loop has a predecessor that is
280 /// outside the loop.
281boolhasDedicatedExits()const;
282
283 /// Return all unique successor blocks of this loop.
284 /// These are the blocks _outside of the current loop_ which are branched to.
285voidgetUniqueExitBlocks(SmallVectorImpl<BlockT *> &ExitBlocks)const;
286
287 /// Return all unique successor blocks of this loop except successors from
288 /// Latch block are not considered. If the exit comes from Latch has also
289 /// non Latch predecessor in a loop it will be added to ExitBlocks.
290 /// These are the blocks _outside of the current loop_ which are branched to.
291voidgetUniqueNonLatchExitBlocks(SmallVectorImpl<BlockT *> &ExitBlocks)const;
292
293 /// If getUniqueExitBlocks would return exactly one block, return that block.
294 /// Otherwise return null.
295 BlockT *getUniqueExitBlock()const;
296
297 /// Return the unique exit block for the latch, or null if there are multiple
298 /// different exit blocks or the latch is not exiting.
299 BlockT *getUniqueLatchExitBlock()const;
300
301 /// Return true if this loop does not have any exit blocks.
302boolhasNoExitBlocks()const;
303
304 /// Edge type.
305typedef std::pair<BlockT *, BlockT *>Edge;
306
307 /// Return all pairs of (_inside_block_,_outside_block_).
308voidgetExitEdges(SmallVectorImpl<Edge> &ExitEdges)const;
309
310 /// If there is a preheader for this loop, return it. A loop has a preheader
311 /// if there is only one edge to the header of the loop from outside of the
312 /// loop. If this is the case, the block branching to the header of the loop
313 /// is the preheader node.
314 ///
315 /// This method returns null if there is no preheader for the loop.
316 BlockT *getLoopPreheader()const;
317
318 /// If the given loop's header has exactly one unique predecessor outside the
319 /// loop, return it. Otherwise return null.
320 /// This is less strict that the loop "preheader" concept, which requires
321 /// the predecessor to have exactly one successor.
322 BlockT *getLoopPredecessor()const;
323
324 /// If there is a single latch block for this loop, return it.
325 /// A latch block is a block that contains a branch back to the header.
326 BlockT *getLoopLatch()const;
327
328 /// Return all loop latch blocks of this loop. A latch block is a block that
329 /// contains a branch back to the header.
330voidgetLoopLatches(SmallVectorImpl<BlockT *> &LoopLatches) const{
331assert(!isInvalid() &&"Loop not in a valid state!");
332 BlockT *H =getHeader();
333for (constauto Pred : inverse_children<BlockT *>(H))
334if (contains(Pred))
335 LoopLatches.push_back(Pred);
336 }
337
338 /// Return all inner loops in the loop nest rooted by the loop in preorder,
339 /// with siblings in forward program order.
340template <class Type>
341staticvoidgetInnerLoopsInPreorder(const LoopT &L,
342SmallVectorImpl<Type> &PreOrderLoops) {
343SmallVector<LoopT *, 4> PreOrderWorklist;
344 PreOrderWorklist.append(L.rbegin(), L.rend());
345
346while (!PreOrderWorklist.empty()) {
347 LoopT *L = PreOrderWorklist.pop_back_val();
348// Sub-loops are stored in forward program order, but will process the
349// worklist backwards so append them in reverse order.
350 PreOrderWorklist.append(L->rbegin(), L->rend());
351 PreOrderLoops.push_back(L);
352 }
353 }
354
355 /// Return all loops in the loop nest rooted by the loop in preorder, with
356 /// siblings in forward program order.
357SmallVector<const LoopT *, 4>getLoopsInPreorder() const{
358SmallVector<const LoopT *, 4> PreOrderLoops;
359const LoopT *CurLoop =static_cast<constLoopT *>(this);
360 PreOrderLoops.push_back(CurLoop);
361getInnerLoopsInPreorder(*CurLoop, PreOrderLoops);
362return PreOrderLoops;
363 }
364SmallVector<LoopT *, 4>getLoopsInPreorder() {
365SmallVector<LoopT *, 4> PreOrderLoops;
366 LoopT *CurLoop =static_cast<LoopT *>(this);
367 PreOrderLoops.push_back(CurLoop);
368getInnerLoopsInPreorder(*CurLoop, PreOrderLoops);
369return PreOrderLoops;
370 }
371
372//===--------------------------------------------------------------------===//
373// APIs for updating loop information after changing the CFG
374//
375
376 /// This method is used by other analyses to update loop information.
377 /// NewBB is set to be a new member of the current loop.
378 /// Because of this, it is added as a member of all parent loops, and is added
379 /// to the specified LoopInfo object as being in the current basic block. It
380 /// is not valid to replace the loop header with this method.
381voidaddBasicBlockToLoop(BlockT *NewBB,LoopInfoBase<BlockT, LoopT> &LI);
382
383 /// This is used when splitting loops up. It replaces the OldChild entry in
384 /// our children list with NewChild, and updates the parent pointer of
385 /// OldChild to be null and the NewChild to be this loop.
386 /// This updates the loop depth of the new child.
387voidreplaceChildLoopWith(LoopT *OldChild, LoopT *NewChild);
388
389 /// Add the specified loop to be a child of this loop.
390 /// This updates the loop depth of the new child.
391voidaddChildLoop(LoopT *NewChild) {
392assert(!isInvalid() &&"Loop not in a valid state!");
393assert(!NewChild->ParentLoop &&"NewChild already has a parent!");
394 NewChild->ParentLoop =static_cast<LoopT *>(this);
395 SubLoops.push_back(NewChild);
396 }
397
398 /// This removes the specified child from being a subloop of this loop. The
399 /// loop is not deleted, as it will presumably be inserted into another loop.
400 LoopT *removeChildLoop(iteratorI) {
401assert(!isInvalid() &&"Loop not in a valid state!");
402assert(I != SubLoops.end() &&"Cannot remove end iterator!");
403 LoopT *Child = *I;
404assert(Child->ParentLoop ==this &&"Child is not a child of this loop!");
405 SubLoops.erase(SubLoops.begin() + (I -begin()));
406 Child->ParentLoop =nullptr;
407return Child;
408 }
409
410 /// This removes the specified child from being a subloop of this loop. The
411 /// loop is not deleted, as it will presumably be inserted into another loop.
412 LoopT *removeChildLoop(LoopT *Child) {
413returnremoveChildLoop(llvm::find(*this, Child));
414 }
415
416 /// This adds a basic block directly to the basic block list.
417 /// This should only be used by transformations that create new loops. Other
418 /// transformations should use addBasicBlockToLoop.
419voidaddBlockEntry(BlockT *BB) {
420assert(!isInvalid() &&"Loop not in a valid state!");
421Blocks.push_back(BB);
422 DenseBlockSet.insert(BB);
423 }
424
425 /// interface to reverse Blocks[from, end of loop] in this loop
426voidreverseBlock(unsigned from) {
427assert(!isInvalid() &&"Loop not in a valid state!");
428 std::reverse(Blocks.begin() + from,Blocks.end());
429 }
430
431 /// interface to do reserve() for Blocks
432voidreserveBlocks(unsigned size) {
433assert(!isInvalid() &&"Loop not in a valid state!");
434Blocks.reserve(size);
435 }
436
437 /// This method is used to move BB (which must be part of this loop) to be the
438 /// loop header of the loop (the block that dominates all others).
439voidmoveToHeader(BlockT *BB) {
440assert(!isInvalid() &&"Loop not in a valid state!");
441if (Blocks[0] == BB)
442return;
443for (unsigned i = 0;; ++i) {
444assert(i !=Blocks.size() &&"Loop does not contain BB!");
445if (Blocks[i] == BB) {
446Blocks[i] =Blocks[0];
447Blocks[0] = BB;
448return;
449 }
450 }
451 }
452
453 /// This removes the specified basic block from the current loop, updating the
454 /// Blocks as appropriate. This does not update the mapping in the LoopInfo
455 /// class.
456voidremoveBlockFromLoop(BlockT *BB) {
457assert(!isInvalid() &&"Loop not in a valid state!");
458autoI =find(Blocks, BB);
459assert(I !=Blocks.end() &&"N is not in this list!");
460Blocks.erase(I);
461
462 DenseBlockSet.erase(BB);
463 }
464
465 /// Verify loop structure
466voidverifyLoop()const;
467
468 /// Verify loop structure of this loop and all nested loops.
469voidverifyLoopNest(DenseSet<const LoopT *> *Loops)const;
470
471 /// Returns true if the loop is annotated parallel.
472 ///
473 /// Derived classes can override this method using static template
474 /// polymorphism.
475boolisAnnotatedParallel() const{returnfalse; }
476
477 /// Print loop with all the BBs inside it.
478voidprint(raw_ostream &OS,boolVerbose =false,bool PrintNested =true,
479unsignedDepth = 0)const;
480
481protected:
482friendclassLoopInfoBase<BlockT, LoopT>;
483
484 /// This creates an empty loop.
485LoopBase() : ParentLoop(nullptr) {}
486
487explicitLoopBase(BlockT *BB) : ParentLoop(nullptr) {
488Blocks.push_back(BB);
489 DenseBlockSet.insert(BB);
490 }
491
492// Since loop passes like SCEV are allowed to key analysis results off of
493// `Loop` pointers, we cannot re-use pointers within a loop pass manager.
494// This means loop passes should not be `delete` ing `Loop` objects directly
495// (and risk a later `Loop` allocation re-using the address of a previous one)
496// but should be using LoopInfo::markAsRemoved, which keeps around the `Loop`
497// pointer till the end of the lifetime of the `LoopInfo` object.
498//
499// To make it easier to follow this rule, we mark the destructor as
500// non-public.
501~LoopBase() {
502for (auto *SubLoop : SubLoops)
503 SubLoop->~LoopT();
504
505#if LLVM_ENABLE_ABI_BREAKING_CHECKS
506 IsInvalid =true;
507#endif
508 SubLoops.clear();
509Blocks.clear();
510 DenseBlockSet.clear();
511 ParentLoop =nullptr;
512 }
513};
514
515template <class BlockT,class LoopT>
516raw_ostream &operator<<(raw_ostream &OS,constLoopBase<BlockT, LoopT> &Loop) {
517Loop.print(OS);
518returnOS;
519}
520
521//===----------------------------------------------------------------------===//
522/// This class builds and contains all of the top-level loop
523/// structures in the specified function.
524///
525
526template <class BlockT,class LoopT>classLoopInfoBase {
527// BBMap - Mapping of basic blocks to the inner most loop they occur in
528DenseMap<const BlockT *, LoopT *> BBMap;
529 std::vector<LoopT *> TopLevelLoops;
530BumpPtrAllocator LoopAllocator;
531
532friendclassLoopBase<BlockT, LoopT>;
533friendclassLoopInfo;
534
535void operator=(constLoopInfoBase &) =delete;
536LoopInfoBase(constLoopInfoBase &) =delete;
537
538public:
539LoopInfoBase() =default;
540~LoopInfoBase() {releaseMemory(); }
541
542LoopInfoBase(LoopInfoBase &&Arg)
543 : BBMap(std::move(Arg.BBMap)),
544 TopLevelLoops(std::move(Arg.TopLevelLoops)),
545 LoopAllocator(std::move(Arg.LoopAllocator)) {
546// We have to clear the arguments top level loops as we've taken ownership.
547 Arg.TopLevelLoops.clear();
548 }
549LoopInfoBase &operator=(LoopInfoBase &&RHS) {
550 BBMap = std::move(RHS.BBMap);
551
552for (auto *L : TopLevelLoops)
553 L->~LoopT();
554
555 TopLevelLoops = std::move(RHS.TopLevelLoops);
556 LoopAllocator = std::move(RHS.LoopAllocator);
557RHS.TopLevelLoops.clear();
558return *this;
559 }
560
561voidreleaseMemory() {
562 BBMap.clear();
563
564for (auto *L : TopLevelLoops)
565 L->~LoopT();
566 TopLevelLoops.clear();
567 LoopAllocator.Reset();
568 }
569
570template <typename... ArgsTy> LoopT *AllocateLoop(ArgsTy &&...Args) {
571 LoopT *Storage = LoopAllocator.Allocate<LoopT>();
572returnnew (Storage) LoopT(std::forward<ArgsTy>(Args)...);
573 }
574
575 /// iterator/begin/end - The interface to the top-level loops in the current
576 /// function.
577 ///
578typedeftypename std::vector<LoopT *>::const_iteratoriterator;
579typedef
580typename std::vector<LoopT *>::const_reverse_iteratorreverse_iterator;
581iteratorbegin() const{return TopLevelLoops.begin(); }
582iteratorend() const{return TopLevelLoops.end(); }
583reverse_iteratorrbegin() const{return TopLevelLoops.rbegin(); }
584reverse_iteratorrend() const{return TopLevelLoops.rend(); }
585boolempty() const{return TopLevelLoops.empty(); }
586
587 /// Return all of the loops in the function in preorder across the loop
588 /// nests, with siblings in forward program order.
589 ///
590 /// Note that because loops form a forest of trees, preorder is equivalent to
591 /// reverse postorder.
592SmallVector<LoopT *, 4>getLoopsInPreorder()const;
593
594 /// Return all of the loops in the function in preorder across the loop
595 /// nests, with siblings in *reverse* program order.
596 ///
597 /// Note that because loops form a forest of trees, preorder is equivalent to
598 /// reverse postorder.
599 ///
600 /// Also note that this is *not* a reverse preorder. Only the siblings are in
601 /// reverse program order.
602SmallVector<LoopT *, 4>getLoopsInReverseSiblingPreorder()const;
603
604 /// Return the inner most loop that BB lives in. If a basic block is in no
605 /// loop (for example the entry node), null is returned.
606 LoopT *getLoopFor(const BlockT *BB) const{return BBMap.lookup(BB); }
607
608 /// Same as getLoopFor.
609const LoopT *operator[](const BlockT *BB) const{returngetLoopFor(BB); }
610
611 /// Return the loop nesting level of the specified block. A depth of 0 means
612 /// the block is not inside any loop.
613unsignedgetLoopDepth(const BlockT *BB) const{
614const LoopT *L =getLoopFor(BB);
615return L ? L->getLoopDepth() : 0;
616 }
617
618// True if the block is a loop header node
619boolisLoopHeader(const BlockT *BB) const{
620const LoopT *L =getLoopFor(BB);
621return L && L->getHeader() == BB;
622 }
623
624 /// Return the top-level loops.
625const std::vector<LoopT *> &getTopLevelLoops() const{return TopLevelLoops; }
626
627 /// Return the top-level loops.
628 std::vector<LoopT *> &getTopLevelLoopsVector() {return TopLevelLoops; }
629
630 /// This removes the specified top-level loop from this loop info object.
631 /// The loop is not deleted, as it will presumably be inserted into
632 /// another loop.
633 LoopT *removeLoop(iteratorI) {
634assert(I !=end() &&"Cannot remove end iterator!");
635 LoopT *L = *I;
636assert(L->isOutermost() &&"Not a top-level loop!");
637 TopLevelLoops.erase(TopLevelLoops.begin() + (I -begin()));
638return L;
639 }
640
641 /// Change the top-level loop that contains BB to the specified loop.
642 /// This should be used by transformations that restructure the loop hierarchy
643 /// tree.
644voidchangeLoopFor(BlockT *BB, LoopT *L) {
645if (!L) {
646 BBMap.erase(BB);
647return;
648 }
649 BBMap[BB] = L;
650 }
651
652 /// Replace the specified loop in the top-level loops list with the indicated
653 /// loop.
654voidchangeTopLevelLoop(LoopT *OldLoop, LoopT *NewLoop) {
655autoI =find(TopLevelLoops, OldLoop);
656assert(I != TopLevelLoops.end() &&"Old loop not at top level!");
657 *I = NewLoop;
658assert(!NewLoop->ParentLoop && !OldLoop->ParentLoop &&
659"Loops already embedded into a subloop!");
660 }
661
662 /// This adds the specified loop to the collection of top-level loops.
663voidaddTopLevelLoop(LoopT *New) {
664assert(New->isOutermost() &&"Loop already in subloop!");
665 TopLevelLoops.push_back(New);
666 }
667
668 /// This method completely removes BB from all data structures,
669 /// including all of the Loop objects it is nested in and our mapping from
670 /// BasicBlocks to loops.
671voidremoveBlock(BlockT *BB) {
672autoI = BBMap.find(BB);
673if (I != BBMap.end()) {
674for (LoopT *L =I->second; L; L = L->getParentLoop())
675 L->removeBlockFromLoop(BB);
676
677 BBMap.erase(I);
678 }
679 }
680
681// Internals
682
683staticboolisNotAlreadyContainedIn(const LoopT *SubLoop,
684const LoopT *ParentLoop) {
685if (!SubLoop)
686returntrue;
687if (SubLoop == ParentLoop)
688returnfalse;
689returnisNotAlreadyContainedIn(SubLoop->getParentLoop(), ParentLoop);
690 }
691
692 /// Create the loop forest using a stable algorithm.
693voidanalyze(constDominatorTreeBase<BlockT, false> &DomTree);
694
695// Debugging
696voidprint(raw_ostream &OS)const;
697
698voidverify(constDominatorTreeBase<BlockT, false> &DomTree)const;
699
700 /// Destroy a loop that has been removed from the `LoopInfo` nest.
701 ///
702 /// This runs the destructor of the loop object making it invalid to
703 /// reference afterward. The memory is retained so that the *pointer* to the
704 /// loop remains valid.
705 ///
706 /// The caller is responsible for removing this loop from the loop nest and
707 /// otherwise disconnecting it from the broader `LoopInfo` data structures.
708 /// Callers that don't naturally handle this themselves should probably call
709 /// `erase' instead.
710voiddestroy(LoopT *L) {
711 L->~LoopT();
712
713// Since LoopAllocator is a BumpPtrAllocator, this Deallocate only poisons
714// \c L, but the pointer remains valid for non-dereferencing uses.
715 LoopAllocator.Deallocate(L);
716 }
717};
718
719}// namespace llvm
720
721#endif// LLVM_SUPPORT_GENERICLOOPINFO_H
Allocator.h
This file defines the BumpPtrAllocator interface.
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
DenseSet.h
This file defines the DenseSet and SmallDenseSet classes.
Blocks
DenseMap< Block *, BlockRelaxAux > Blocks
Definition:ELF_riscv.cpp:507
GenericDomTree.h
This file defines a set of templates that efficiently compute a dominator tree over a generic graph.
Loops
Hexagon Hardware Loops
Definition:HexagonHardwareLoops.cpp:373
I
#define I(x, y, z)
Definition:MD5.cpp:58
H
#define H(x, y, z)
Definition:MD5.cpp:57
verify
ppc ctr loops verify
Definition:PPCCTRLoopsVerify.cpp:72
PostOrderIterator.h
This file builds on the ADT/GraphTraits.h file to build a generic graph post order iterator.
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
STLExtras.h
This file contains some templates that are useful if you are working with the STL at all.
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
SetOperations.h
This file defines generic set operations that may be used on set's of different types,...
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
T
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition:Allocator.h:66
llvm::BumpPtrAllocatorImpl::Allocate
LLVM_ATTRIBUTE_RETURNS_NONNULL void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
Definition:Allocator.h:148
llvm::BumpPtrAllocatorImpl::Reset
void Reset()
Deallocate all but the current slab and reset the current pointer to the beginning of it,...
Definition:Allocator.h:123
llvm::BumpPtrAllocatorImpl::Deallocate
void Deallocate(const void *Ptr, size_t Size, size_t)
Definition:Allocator.h:225
llvm::DenseMapBase::lookup
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition:DenseMap.h:194
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition:DenseMap.h:156
llvm::DenseMapBase::erase
bool erase(const KeyT &Val)
Definition:DenseMap.h:321
llvm::DenseMapBase::end
iterator end()
Definition:DenseMap.h:84
llvm::DenseMapBase::clear
void clear()
Definition:DenseMap.h:110
llvm::DenseMap
Definition:DenseMap.h:727
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition:DenseSet.h:278
llvm::DominatorTreeBase
Core dominator tree base class.
Definition:GenericDomTree.h:237
llvm::LoopBase
Instances of this class are used to represent loops that are detected in the flow graph.
Definition:GenericLoopInfo.h:59
llvm::LoopBase::isAnnotatedParallel
bool isAnnotatedParallel() const
Returns true if the loop is annotated parallel.
Definition:GenericLoopInfo.h:475
llvm::LoopBase::contains
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
Definition:GenericLoopInfo.h:124
llvm::LoopBase::getBlocksSet
SmallPtrSetImpl< const BlockT * > & getBlocksSet()
Return a direct, mutable handle to the blocks set so that we can mutate it efficiently.
Definition:GenericLoopInfo.h:200
llvm::LoopBase::getInnerLoopsInPreorder
static void getInnerLoopsInPreorder(const LoopT &L, SmallVectorImpl< Type > &PreOrderLoops)
Return all inner loops in the loop nest rooted by the loop in preorder, with siblings in forward prog...
Definition:GenericLoopInfo.h:341
llvm::LoopBase::isOutermost
bool isOutermost() const
Return true if the loop does not have a parent (natural) loop.
Definition:GenericLoopInfo.h:170
llvm::LoopBase::getLoopLatch
BlockT * getLoopLatch() const
If there is a single latch block for this loop, return it.
Definition:GenericLoopInfoImpl.h:256
llvm::LoopBase::isInnermost
bool isInnermost() const
Return true if the loop does not contain any (natural) loops.
Definition:GenericLoopInfo.h:167
llvm::LoopBase::removeBlockFromLoop
void removeBlockFromLoop(BlockT *BB)
This removes the specified basic block from the current loop, updating the Blocks as appropriate.
Definition:GenericLoopInfo.h:456
llvm::LoopBase::getExitBlocks
void getExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all of the successor blocks of this loop.
Definition:GenericLoopInfoImpl.h:64
llvm::LoopBase::contains
bool contains(const InstT *Inst) const
Return true if the specified instruction is in this loop.
Definition:GenericLoopInfo.h:140
llvm::LoopBase::getNumBlocks
unsigned getNumBlocks() const
Get the number of blocks in this loop in constant time.
Definition:GenericLoopInfo.h:187
llvm::LoopBase::verifyLoop
void verifyLoop() const
Verify loop structure.
Definition:GenericLoopInfoImpl.h:326
llvm::LoopBase::verifyLoopNest
void verifyLoopNest(DenseSet< const LoopT * > *Loops) const
Verify loop structure of this loop and all nested loops.
Definition:GenericLoopInfoImpl.h:402
llvm::LoopBase::getLoopsInPreorder
SmallVector< LoopT *, 4 > getLoopsInPreorder()
Definition:GenericLoopInfo.h:364
llvm::LoopBase::getNumBackEdges
unsigned getNumBackEdges() const
Calculate the number of back edges to the loop header.
Definition:GenericLoopInfo.h:248
llvm::LoopBase::reverseBlock
void reverseBlock(unsigned from)
interface to reverse Blocks[from, end of loop] in this loop
Definition:GenericLoopInfo.h:426
llvm::LoopBase::getLoopsInPreorder
SmallVector< const LoopT *, 4 > getLoopsInPreorder() const
Return all loops in the loop nest rooted by the loop in preorder, with siblings in forward program or...
Definition:GenericLoopInfo.h:357
llvm::LoopBase::getUniqueLatchExitBlock
BlockT * getUniqueLatchExitBlock() const
Return the unique exit block for the latch, or null if there are multiple different exit blocks or th...
Definition:GenericLoopInfoImpl.h:163
llvm::LoopBase::getExitingBlocks
void getExitingBlocks(SmallVectorImpl< BlockT * > &ExitingBlocks) const
Return all blocks inside the loop that have successors outside of the loop.
Definition:GenericLoopInfoImpl.h:33
llvm::LoopBase::LoopBase
LoopBase(BlockT *BB)
Definition:GenericLoopInfo.h:487
llvm::LoopBase::getSubLoops
const std::vector< LoopT * > & getSubLoops() const
Return the loops contained entirely within this loop.
Definition:GenericLoopInfo.h:145
llvm::LoopBase::getHeader
BlockT * getHeader() const
Definition:GenericLoopInfo.h:90
llvm::LoopBase::getOutermostLoop
const LoopT * getOutermostLoop() const
Get the outermost loop in which this loop is contained.
Definition:GenericLoopInfo.h:103
llvm::LoopBase::~LoopBase
~LoopBase()
Definition:GenericLoopInfo.h:501
llvm::LoopBase::getLoopLatches
void getLoopLatches(SmallVectorImpl< BlockT * > &LoopLatches) const
Return all loop latch blocks of this loop.
Definition:GenericLoopInfo.h:330
llvm::LoopBase::getLoopDepth
unsigned getLoopDepth() const
Return the nesting level of this loop.
Definition:GenericLoopInfo.h:82
llvm::LoopBase::LoopBase
LoopBase()
This creates an empty loop.
Definition:GenericLoopInfo.h:485
llvm::LoopBase::print
void print(raw_ostream &OS, bool Verbose=false, bool PrintNested=true, unsigned Depth=0) const
Print loop with all the BBs inside it.
Definition:GenericLoopInfoImpl.h:414
llvm::LoopBase::addBasicBlockToLoop
void addBasicBlockToLoop(BlockT *NewBB, LoopInfoBase< BlockT, LoopT > &LI)
This method is used by other analyses to update loop information.
Definition:GenericLoopInfoImpl.h:282
llvm::LoopBase::getBlocksVector
std::vector< BlockT * > & getBlocksVector()
Return a direct, mutable handle to the blocks vector so that we can mutate it efficiently with techni...
Definition:GenericLoopInfo.h:194
llvm::LoopBase::reverse_iterator
std::vector< LoopT * >::const_reverse_iterator reverse_iterator
Definition:GenericLoopInfo.h:155
llvm::LoopBase::removeChildLoop
LoopT * removeChildLoop(LoopT *Child)
This removes the specified child from being a subloop of this loop.
Definition:GenericLoopInfo.h:412
llvm::LoopBase::iterator
std::vector< LoopT * >::const_iterator iterator
Definition:GenericLoopInfo.h:153
llvm::LoopBase::reserveBlocks
void reserveBlocks(unsigned size)
interface to do reserve() for Blocks
Definition:GenericLoopInfo.h:432
llvm::LoopBase::blocks
iterator_range< block_iterator > blocks() const
Definition:GenericLoopInfo.h:180
llvm::LoopBase::block_end
block_iterator block_end() const
Definition:GenericLoopInfo.h:179
llvm::LoopBase::Edge
std::pair< BlockT *, BlockT * > Edge
Edge type.
Definition:GenericLoopInfo.h:305
llvm::LoopBase::isInvalid
bool isInvalid() const
Return true if this loop is no longer valid.
Definition:GenericLoopInfo.h:217
llvm::LoopBase::getLoopPredecessor
BlockT * getLoopPredecessor() const
If the given loop's header has exactly one unique predecessor outside the loop, return it.
Definition:GenericLoopInfoImpl.h:235
llvm::LoopBase::contains
bool contains(const BlockT *BB) const
Return true if the specified basic block is in this loop.
Definition:GenericLoopInfo.h:134
llvm::LoopBase::isLoopLatch
bool isLoopLatch(const BlockT *BB) const
Definition:GenericLoopInfo.h:241
llvm::LoopBase::end
iterator end() const
Definition:GenericLoopInfo.h:157
llvm::LoopBase::addChildLoop
void addChildLoop(LoopT *NewChild)
Add the specified loop to be a child of this loop.
Definition:GenericLoopInfo.h:391
llvm::LoopBase::getExitEdges
void getExitEdges(SmallVectorImpl< Edge > &ExitEdges) const
Return all pairs of (inside_block,outside_block).
Definition:GenericLoopInfoImpl.h:175
llvm::LoopBase::addBlockEntry
void addBlockEntry(BlockT *BB)
This adds a basic block directly to the basic block list.
Definition:GenericLoopInfo.h:419
llvm::LoopBase::block_iterator
ArrayRef< BlockT * >::const_iterator block_iterator
Definition:GenericLoopInfo.h:177
llvm::LoopBase::getSubLoopsVector
std::vector< LoopT * > & getSubLoopsVector()
Definition:GenericLoopInfo.h:149
llvm::LoopBase::rbegin
reverse_iterator rbegin() const
Definition:GenericLoopInfo.h:158
llvm::LoopBase::getExitBlock
BlockT * getExitBlock() const
If getExitBlocks would return exactly one block, return that block.
Definition:GenericLoopInfoImpl.h:107
llvm::LoopBase::hasNoExitBlocks
bool hasNoExitBlocks() const
Return true if this loop does not have any exit blocks.
Definition:GenericLoopInfoImpl.h:95
llvm::LoopBase::replaceChildLoopWith
void replaceChildLoopWith(LoopT *OldChild, LoopT *NewChild)
This is used when splitting loops up.
Definition:GenericLoopInfoImpl.h:312
llvm::LoopBase::getLoopPreheader
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
Definition:GenericLoopInfoImpl.h:210
llvm::LoopBase::getBlocks
ArrayRef< BlockT * > getBlocks() const
Get a list of the basic blocks which make up this loop.
Definition:GenericLoopInfo.h:173
llvm::LoopBase::rend
reverse_iterator rend() const
Definition:GenericLoopInfo.h:159
llvm::LoopBase::getExitingBlock
BlockT * getExitingBlock() const
If getExitingBlocks would return exactly one block, return that block.
Definition:GenericLoopInfoImpl.h:48
llvm::LoopBase::getOutermostLoop
LoopT * getOutermostLoop()
Definition:GenericLoopInfo.h:110
llvm::LoopBase::getUniqueExitBlocks
void getUniqueExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all unique successor blocks of this loop.
Definition:GenericLoopInfoImpl.h:142
llvm::LoopBase::setParentLoop
void setParentLoop(LoopT *L)
This is a raw interface for bypassing addChildLoop.
Definition:GenericLoopInfo.h:118
llvm::LoopBase::getParentLoop
LoopT * getParentLoop() const
Return the parent loop if it exists or nullptr for top level loops.
Definition:GenericLoopInfo.h:99
llvm::LoopBase::hasDedicatedExits
bool hasDedicatedExits() const
Return true if no exit block for the loop has a predecessor that is outside the loop.
Definition:GenericLoopInfoImpl.h:112
llvm::LoopBase::getUniqueNonLatchExitBlocks
void getUniqueNonLatchExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all unique successor blocks of this loop except successors from Latch block are not considered...
Definition:GenericLoopInfoImpl.h:149
llvm::LoopBase::begin
iterator begin() const
Definition:GenericLoopInfo.h:156
llvm::LoopBase::getBlocksSet
const SmallPtrSetImpl< const BlockT * > & getBlocksSet() const
Return a direct, immutable handle to the blocks set.
Definition:GenericLoopInfo.h:206
llvm::LoopBase::isLoopExiting
bool isLoopExiting(const BlockT *BB) const
True if terminator in the block can branch to another block that is outside of the current loop.
Definition:GenericLoopInfo.h:227
llvm::LoopBase::block_begin
block_iterator block_begin() const
Definition:GenericLoopInfo.h:178
llvm::LoopBase::moveToHeader
void moveToHeader(BlockT *BB)
This method is used to move BB (which must be part of this loop) to be the loop header of the loop (t...
Definition:GenericLoopInfo.h:439
llvm::LoopBase::getUniqueExitBlock
BlockT * getUniqueExitBlock() const
If getUniqueExitBlocks would return exactly one block, return that block.
Definition:GenericLoopInfoImpl.h:158
llvm::LoopBase::removeChildLoop
LoopT * removeChildLoop(iterator I)
This removes the specified child from being a subloop of this loop.
Definition:GenericLoopInfo.h:400
llvm::LoopInfoBase
This class builds and contains all of the top-level loop structures in the specified function.
Definition:GenericLoopInfo.h:526
llvm::LoopInfoBase::~LoopInfoBase
~LoopInfoBase()
Definition:GenericLoopInfo.h:540
llvm::LoopInfoBase::getTopLevelLoops
const std::vector< LoopT * > & getTopLevelLoops() const
Return the top-level loops.
Definition:GenericLoopInfo.h:625
llvm::LoopInfoBase::addTopLevelLoop
void addTopLevelLoop(LoopT *New)
This adds the specified loop to the collection of top-level loops.
Definition:GenericLoopInfo.h:663
llvm::LoopInfoBase::analyze
void analyze(const DominatorTreeBase< BlockT, false > &DomTree)
Create the loop forest using a stable algorithm.
Definition:GenericLoopInfoImpl.h:577
llvm::LoopInfoBase::getLoopsInReverseSiblingPreorder
SmallVector< LoopT *, 4 > getLoopsInReverseSiblingPreorder() const
Return all of the loops in the function in preorder across the loop nests, with siblings in reverse p...
Definition:GenericLoopInfoImpl.h:624
llvm::LoopInfoBase::print
void print(raw_ostream &OS) const
Definition:GenericLoopInfoImpl.h:649
llvm::LoopInfoBase::rend
reverse_iterator rend() const
Definition:GenericLoopInfo.h:584
llvm::LoopInfoBase::changeTopLevelLoop
void changeTopLevelLoop(LoopT *OldLoop, LoopT *NewLoop)
Replace the specified loop in the top-level loops list with the indicated loop.
Definition:GenericLoopInfo.h:654
llvm::LoopInfoBase::end
iterator end() const
Definition:GenericLoopInfo.h:582
llvm::LoopInfoBase::removeBlock
void removeBlock(BlockT *BB)
This method completely removes BB from all data structures, including all of the Loop objects it is n...
Definition:GenericLoopInfo.h:671
llvm::LoopInfoBase::LoopInfoBase
LoopInfoBase(LoopInfoBase &&Arg)
Definition:GenericLoopInfo.h:542
llvm::LoopInfoBase::AllocateLoop
LoopT * AllocateLoop(ArgsTy &&...Args)
Definition:GenericLoopInfo.h:570
llvm::LoopInfoBase::operator[]
const LoopT * operator[](const BlockT *BB) const
Same as getLoopFor.
Definition:GenericLoopInfo.h:609
llvm::LoopInfoBase::isLoopHeader
bool isLoopHeader(const BlockT *BB) const
Definition:GenericLoopInfo.h:619
llvm::LoopInfoBase::removeLoop
LoopT * removeLoop(iterator I)
This removes the specified top-level loop from this loop info object.
Definition:GenericLoopInfo.h:633
llvm::LoopInfoBase::empty
bool empty() const
Definition:GenericLoopInfo.h:585
llvm::LoopInfoBase::LoopInfoBase
LoopInfoBase()=default
llvm::LoopInfoBase::getLoopsInPreorder
SmallVector< LoopT *, 4 > getLoopsInPreorder() const
Return all of the loops in the function in preorder across the loop nests, with siblings in forward p...
Definition:GenericLoopInfoImpl.h:606
llvm::LoopInfoBase::changeLoopFor
void changeLoopFor(BlockT *BB, LoopT *L)
Change the top-level loop that contains BB to the specified loop.
Definition:GenericLoopInfo.h:644
llvm::LoopInfoBase::getLoopDepth
unsigned getLoopDepth(const BlockT *BB) const
Return the loop nesting level of the specified block.
Definition:GenericLoopInfo.h:613
llvm::LoopInfoBase::getTopLevelLoopsVector
std::vector< LoopT * > & getTopLevelLoopsVector()
Return the top-level loops.
Definition:GenericLoopInfo.h:628
llvm::LoopInfoBase::begin
iterator begin() const
Definition:GenericLoopInfo.h:581
llvm::LoopInfoBase::isNotAlreadyContainedIn
static bool isNotAlreadyContainedIn(const LoopT *SubLoop, const LoopT *ParentLoop)
Definition:GenericLoopInfo.h:683
llvm::LoopInfoBase::reverse_iterator
std::vector< LoopT * >::const_reverse_iterator reverse_iterator
Definition:GenericLoopInfo.h:580
llvm::LoopInfoBase::rbegin
reverse_iterator rbegin() const
Definition:GenericLoopInfo.h:583
llvm::LoopInfoBase::getLoopFor
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
Definition:GenericLoopInfo.h:606
llvm::LoopInfoBase::operator=
LoopInfoBase & operator=(LoopInfoBase &&RHS)
Definition:GenericLoopInfo.h:549
llvm::LoopInfoBase::destroy
void destroy(LoopT *L)
Destroy a loop that has been removed from the LoopInfo nest.
Definition:GenericLoopInfo.h:710
llvm::LoopInfoBase::releaseMemory
void releaseMemory()
Definition:GenericLoopInfo.h:561
llvm::LoopInfoBase::iterator
std::vector< LoopT * >::const_iterator iterator
iterator/begin/end - The interface to the top-level loops in the current function.
Definition:GenericLoopInfo.h:578
llvm::LoopInfo
Definition:LoopInfo.h:407
llvm::Loop
Represents a single loop in the control flow graph.
Definition:LoopInfo.h:39
llvm::SmallPtrSetImplBase::clear
void clear()
Definition:SmallPtrSet.h:97
llvm::SmallPtrSetImpl
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition:SmallPtrSet.h:363
llvm::SmallPtrSetImpl::erase
bool erase(PtrType Ptr)
Remove pointer from the set.
Definition:SmallPtrSet.h:401
llvm::SmallPtrSetImpl::count
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Definition:SmallPtrSet.h:452
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition:SmallPtrSet.h:384
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition:SmallPtrSet.h:519
llvm::SmallVectorBase::empty
bool empty() const
Definition:SmallVector.h:81
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVectorImpl::pop_back_val
T pop_back_val()
Definition:SmallVector.h:673
llvm::SmallVectorImpl::append
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition:SmallVector.h:683
llvm::SmallVectorTemplateBase::push_back
void push_back(const T &Elt)
Definition:SmallVector.h:413
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition:iterator_range.h:42
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
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::find
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1759
llvm::size
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition:STLExtras.h:1697
llvm::Depth
@ Depth
Definition:SIMachineScheduler.h:36
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition:iterator_range.h:77
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition:APFixedPoint.h:303
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1873
llvm::count_if
auto count_if(R &&Range, UnaryPredicate P)
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
Definition:STLExtras.h:1945
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition:STLExtras.h:1903
llvm::InlinerFunctionImportStatsOpts::Verbose
@ Verbose
std
Implement std::hash so that hash_code can be used in STL containers.
Definition:BitVector.h:858

Generated on Thu Jul 17 2025 10:16:50 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp