1 //===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Collect the sequence of machine instructions for a basic block.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H
15 #define LLVM_CODEGEN_MACHINEBASICBLOCK_H
17 #include "llvm/CodeGen/MachineInstr.h"
18 #include "llvm/ADT/GraphTraits.h"
19 #include "llvm/Support/DataTypes.h"
26 class MachineFunction;
31 class MachineBranchProbabilityInfo;
34 struct ilist_traits<MachineInstr> : public ilist_default_traits<MachineInstr> {
36 mutable ilist_half_node<MachineInstr> Sentinel;
38 // this is only set by the MachineBasicBlock owning the LiveList
39 friend class MachineBasicBlock;
40 MachineBasicBlock* Parent;
43 MachineInstr *createSentinel() const {
44 return static_cast<MachineInstr*>(&Sentinel);
46 void destroySentinel(MachineInstr *) const {}
48 MachineInstr *provideInitialHead() const { return createSentinel(); }
49 MachineInstr *ensureHead(MachineInstr*) const { return createSentinel(); }
50 static void noteHead(MachineInstr*, MachineInstr*) {}
52 void addNodeToList(MachineInstr* N);
53 void removeNodeFromList(MachineInstr* N);
54 void transferNodesFromList(ilist_traits &SrcTraits,
55 ilist_iterator<MachineInstr> first,
56 ilist_iterator<MachineInstr> last);
57 void deleteNode(MachineInstr *N);
59 void createNode(const MachineInstr &);
62 class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
63 typedef ilist<MachineInstr> Instructions;
67 MachineFunction *xParent;
69 /// Predecessors/Successors - Keep track of the predecessor / successor
71 std::vector<MachineBasicBlock *> Predecessors;
72 std::vector<MachineBasicBlock *> Successors;
75 /// Weights - Keep track of the weights to the successors. This vector
76 /// has the same order as Successors, or it is empty if we don't use it
77 /// (disable optimization).
78 std::vector<uint32_t> Weights;
79 typedef std::vector<uint32_t>::iterator weight_iterator;
81 /// LiveIns - Keep track of the physical registers that are livein of
83 std::vector<unsigned> LiveIns;
85 /// Alignment - Alignment of the basic block. Zero if the basic block does
86 /// not need to be aligned.
87 /// The alignment is specified as log2(bytes).
90 /// IsLandingPad - Indicate that this basic block is entered via an
91 /// exception handler.
94 /// AddressTaken - Indicate that this basic block is potentially the
95 /// target of an indirect branch.
98 // Intrusive list support
99 MachineBasicBlock() {}
101 explicit MachineBasicBlock(MachineFunction &mf, const BasicBlock *bb);
103 ~MachineBasicBlock();
105 // MachineBasicBlocks are allocated and owned by MachineFunction.
106 friend class MachineFunction;
109 /// getBasicBlock - Return the LLVM basic block that this instance
110 /// corresponded to originally. Note that this may be NULL if this instance
111 /// does not correspond directly to an LLVM basic block.
113 const BasicBlock *getBasicBlock() const { return BB; }
115 /// getName - Return the name of the corresponding LLVM basic block, or
117 StringRef getName() const;
119 /// hasAddressTaken - Test whether this block is potentially the target
120 /// of an indirect branch.
121 bool hasAddressTaken() const { return AddressTaken; }
123 /// setHasAddressTaken - Set this block to reflect that it potentially
124 /// is the target of an indirect branch.
125 void setHasAddressTaken() { AddressTaken = true; }
127 /// getParent - Return the MachineFunction containing this basic block.
129 const MachineFunction *getParent() const { return xParent; }
130 MachineFunction *getParent() { return xParent; }
133 /// bundle_iterator - MachineBasicBlock iterator that automatically skips over
134 /// MIs that are inside bundles (i.e. walk top level MIs only).
135 template<typename Ty, typename IterTy>
136 class bundle_iterator
137 : public std::iterator<std::bidirectional_iterator_tag, Ty, ptrdiff_t> {
141 bundle_iterator(IterTy mii) : MII(mii) {
142 assert(!MII->isInsideBundle() &&
143 "It's not legal to initialize bundle_iterator with a bundled MI");
146 bundle_iterator(Ty &mi) : MII(mi) {
147 assert(!mi.isInsideBundle() &&
148 "It's not legal to initialize bundle_iterator with a bundled MI");
150 bundle_iterator(Ty *mi) : MII(mi) {
151 assert((!mi || !mi->isInsideBundle()) &&
152 "It's not legal to initialize bundle_iterator with a bundled MI");
154 bundle_iterator(const bundle_iterator &I) : MII(I.MII) {}
155 bundle_iterator() : MII(0) {}
157 Ty &operator*() const { return *MII; }
158 Ty *operator->() const { return &operator*(); }
160 operator Ty*() const { return MII; }
162 bool operator==(const bundle_iterator &x) const {
165 bool operator!=(const bundle_iterator &x) const {
166 return !operator==(x);
169 // Increment and decrement operators...
170 bundle_iterator &operator--() { // predecrement - Back up
173 } while (MII->isInsideBundle());
176 bundle_iterator &operator++() { // preincrement - Advance
179 } while (MII->isInsideBundle());
182 bundle_iterator operator--(int) { // postdecrement operators...
183 bundle_iterator tmp = *this;
186 } while (MII->isInsideBundle());
189 bundle_iterator operator++(int) { // postincrement operators...
190 bundle_iterator tmp = *this;
193 } while (MII->isInsideBundle());
197 IterTy getInstrIterator() const {
202 typedef Instructions::iterator instr_iterator;
203 typedef Instructions::const_iterator const_instr_iterator;
204 typedef std::reverse_iterator<instr_iterator> reverse_instr_iterator;
206 std::reverse_iterator<const_instr_iterator> const_reverse_instr_iterator;
209 bundle_iterator<MachineInstr,instr_iterator> iterator;
211 bundle_iterator<const MachineInstr,const_instr_iterator> const_iterator;
212 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
213 typedef std::reverse_iterator<iterator> reverse_iterator;
216 unsigned size() const { return (unsigned)Insts.size(); }
217 bool empty() const { return Insts.empty(); }
219 MachineInstr& front() { return Insts.front(); }
220 MachineInstr& back() { return Insts.back(); }
221 const MachineInstr& front() const { return Insts.front(); }
222 const MachineInstr& back() const { return Insts.back(); }
224 instr_iterator instr_begin() { return Insts.begin(); }
225 const_instr_iterator instr_begin() const { return Insts.begin(); }
226 instr_iterator instr_end() { return Insts.end(); }
227 const_instr_iterator instr_end() const { return Insts.end(); }
228 reverse_instr_iterator instr_rbegin() { return Insts.rbegin(); }
229 const_reverse_instr_iterator instr_rbegin() const { return Insts.rbegin(); }
230 reverse_instr_iterator instr_rend () { return Insts.rend(); }
231 const_reverse_instr_iterator instr_rend () const { return Insts.rend(); }
233 iterator begin() { return Insts.begin(); }
234 const_iterator begin() const { return Insts.begin(); }
236 instr_iterator II = instr_end();
237 if (II != instr_begin()) {
238 while (II->isInsideBundle())
243 const_iterator end() const {
244 const_instr_iterator II = instr_end();
245 if (II != instr_begin()) {
246 while (II->isInsideBundle())
251 reverse_iterator rbegin() {
252 reverse_instr_iterator II = instr_rbegin();
253 if (II != instr_rend()) {
254 while (II->isInsideBundle())
259 const_reverse_iterator rbegin() const {
260 const_reverse_instr_iterator II = instr_rbegin();
261 if (II != instr_rend()) {
262 while (II->isInsideBundle())
267 reverse_iterator rend () { return Insts.rend(); }
268 const_reverse_iterator rend () const { return Insts.rend(); }
271 // Machine-CFG iterators
272 typedef std::vector<MachineBasicBlock *>::iterator pred_iterator;
273 typedef std::vector<MachineBasicBlock *>::const_iterator const_pred_iterator;
274 typedef std::vector<MachineBasicBlock *>::iterator succ_iterator;
275 typedef std::vector<MachineBasicBlock *>::const_iterator const_succ_iterator;
276 typedef std::vector<MachineBasicBlock *>::reverse_iterator
277 pred_reverse_iterator;
278 typedef std::vector<MachineBasicBlock *>::const_reverse_iterator
279 const_pred_reverse_iterator;
280 typedef std::vector<MachineBasicBlock *>::reverse_iterator
281 succ_reverse_iterator;
282 typedef std::vector<MachineBasicBlock *>::const_reverse_iterator
283 const_succ_reverse_iterator;
285 pred_iterator pred_begin() { return Predecessors.begin(); }
286 const_pred_iterator pred_begin() const { return Predecessors.begin(); }
287 pred_iterator pred_end() { return Predecessors.end(); }
288 const_pred_iterator pred_end() const { return Predecessors.end(); }
289 pred_reverse_iterator pred_rbegin()
290 { return Predecessors.rbegin();}
291 const_pred_reverse_iterator pred_rbegin() const
292 { return Predecessors.rbegin();}
293 pred_reverse_iterator pred_rend()
294 { return Predecessors.rend(); }
295 const_pred_reverse_iterator pred_rend() const
296 { return Predecessors.rend(); }
297 unsigned pred_size() const {
298 return (unsigned)Predecessors.size();
300 bool pred_empty() const { return Predecessors.empty(); }
301 succ_iterator succ_begin() { return Successors.begin(); }
302 const_succ_iterator succ_begin() const { return Successors.begin(); }
303 succ_iterator succ_end() { return Successors.end(); }
304 const_succ_iterator succ_end() const { return Successors.end(); }
305 succ_reverse_iterator succ_rbegin()
306 { return Successors.rbegin(); }
307 const_succ_reverse_iterator succ_rbegin() const
308 { return Successors.rbegin(); }
309 succ_reverse_iterator succ_rend()
310 { return Successors.rend(); }
311 const_succ_reverse_iterator succ_rend() const
312 { return Successors.rend(); }
313 unsigned succ_size() const {
314 return (unsigned)Successors.size();
316 bool succ_empty() const { return Successors.empty(); }
318 // LiveIn management methods.
320 /// addLiveIn - Add the specified register as a live in. Note that it
321 /// is an error to add the same register to the same set more than once.
322 void addLiveIn(unsigned Reg) { LiveIns.push_back(Reg); }
324 /// removeLiveIn - Remove the specified register from the live in set.
326 void removeLiveIn(unsigned Reg);
328 /// isLiveIn - Return true if the specified register is in the live in set.
330 bool isLiveIn(unsigned Reg) const;
332 // Iteration support for live in sets. These sets are kept in sorted
333 // order by their register number.
334 typedef std::vector<unsigned>::const_iterator livein_iterator;
335 livein_iterator livein_begin() const { return LiveIns.begin(); }
336 livein_iterator livein_end() const { return LiveIns.end(); }
337 bool livein_empty() const { return LiveIns.empty(); }
339 /// getAlignment - Return alignment of the basic block.
340 /// The alignment is specified as log2(bytes).
342 unsigned getAlignment() const { return Alignment; }
344 /// setAlignment - Set alignment of the basic block.
345 /// The alignment is specified as log2(bytes).
347 void setAlignment(unsigned Align) { Alignment = Align; }
349 /// isLandingPad - Returns true if the block is a landing pad. That is
350 /// this basic block is entered via an exception handler.
351 bool isLandingPad() const { return IsLandingPad; }
353 /// setIsLandingPad - Indicates the block is a landing pad. That is
354 /// this basic block is entered via an exception handler.
355 void setIsLandingPad(bool V = true) { IsLandingPad = V; }
357 /// getLandingPadSuccessor - If this block has a successor that is a landing
358 /// pad, return it. Otherwise return NULL.
359 const MachineBasicBlock *getLandingPadSuccessor() const;
361 // Code Layout methods.
363 /// moveBefore/moveAfter - move 'this' block before or after the specified
364 /// block. This only moves the block, it does not modify the CFG or adjust
365 /// potential fall-throughs at the end of the block.
366 void moveBefore(MachineBasicBlock *NewAfter);
367 void moveAfter(MachineBasicBlock *NewBefore);
369 /// updateTerminator - Update the terminator instructions in block to account
370 /// for changes to the layout. If the block previously used a fallthrough,
371 /// it may now need a branch, and if it previously used branching it may now
372 /// be able to use a fallthrough.
373 void updateTerminator();
375 // Machine-CFG mutators
377 /// addSuccessor - Add succ as a successor of this MachineBasicBlock.
378 /// The Predecessors list of succ is automatically updated. WEIGHT
379 /// parameter is stored in Weights list and it may be used by
380 /// MachineBranchProbabilityInfo analysis to calculate branch probability.
382 void addSuccessor(MachineBasicBlock *succ, uint32_t weight = 0);
384 /// removeSuccessor - Remove successor from the successors list of this
385 /// MachineBasicBlock. The Predecessors list of succ is automatically updated.
387 void removeSuccessor(MachineBasicBlock *succ);
389 /// removeSuccessor - Remove specified successor from the successors list of
390 /// this MachineBasicBlock. The Predecessors list of succ is automatically
391 /// updated. Return the iterator to the element after the one removed.
393 succ_iterator removeSuccessor(succ_iterator I);
395 /// replaceSuccessor - Replace successor OLD with NEW and update weight info.
397 void replaceSuccessor(MachineBasicBlock *Old, MachineBasicBlock *New);
400 /// transferSuccessors - Transfers all the successors from MBB to this
401 /// machine basic block (i.e., copies all the successors fromMBB and
402 /// remove all the successors from fromMBB).
403 void transferSuccessors(MachineBasicBlock *fromMBB);
405 /// transferSuccessorsAndUpdatePHIs - Transfers all the successors, as
406 /// in transferSuccessors, and update PHI operands in the successor blocks
407 /// which refer to fromMBB to refer to this.
408 void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *fromMBB);
410 /// isSuccessor - Return true if the specified MBB is a successor of this
412 bool isSuccessor(const MachineBasicBlock *MBB) const;
414 /// isLayoutSuccessor - Return true if the specified MBB will be emitted
415 /// immediately after this block, such that if this block exits by
416 /// falling through, control will transfer to the specified MBB. Note
417 /// that MBB need not be a successor at all, for example if this block
418 /// ends with an unconditional branch to some other block.
419 bool isLayoutSuccessor(const MachineBasicBlock *MBB) const;
421 /// canFallThrough - Return true if the block can implicitly transfer
422 /// control to the block after it by falling off the end of it. This should
423 /// return false if it can reach the block after it, but it uses an explicit
424 /// branch to do so (e.g., a table jump). True is a conservative answer.
425 bool canFallThrough();
427 /// Returns a pointer to the first instructon in this block that is not a
428 /// PHINode instruction. When adding instruction to the beginning of the
429 /// basic block, they should be added before the returned value, not before
430 /// the first instruction, which might be PHI.
431 /// Returns end() is there's no non-PHI instruction.
432 iterator getFirstNonPHI();
434 /// SkipPHIsAndLabels - Return the first instruction in MBB after I that is
435 /// not a PHI or a label. This is the correct point to insert copies at the
436 /// beginning of a basic block.
437 iterator SkipPHIsAndLabels(iterator I);
439 /// getFirstTerminator - returns an iterator to the first terminator
440 /// instruction of this basic block. If a terminator does not exist,
442 iterator getFirstTerminator();
443 const_iterator getFirstTerminator() const;
445 /// getFirstInstrTerminator - Same getFirstTerminator but it ignores bundles
446 /// and return an instr_iterator instead.
447 instr_iterator getFirstInstrTerminator();
449 /// getLastNonDebugInstr - returns an iterator to the last non-debug
450 /// instruction in the basic block, or end()
451 iterator getLastNonDebugInstr();
452 const_iterator getLastNonDebugInstr() const;
454 /// SplitCriticalEdge - Split the critical edge from this block to the
455 /// given successor block, and return the newly created block, or null
456 /// if splitting is not possible.
458 /// This function updates LiveVariables, MachineDominatorTree, and
459 /// MachineLoopInfo, as applicable.
460 MachineBasicBlock *SplitCriticalEdge(MachineBasicBlock *Succ, Pass *P);
462 void pop_front() { Insts.pop_front(); }
463 void pop_back() { Insts.pop_back(); }
464 void push_back(MachineInstr *MI) { Insts.push_back(MI); }
466 template<typename IT>
467 void insert(instr_iterator I, IT S, IT E) {
468 Insts.insert(I, S, E);
470 instr_iterator insert(instr_iterator I, MachineInstr *M) {
471 return Insts.insert(I, M);
473 instr_iterator insertAfter(instr_iterator I, MachineInstr *M) {
474 return Insts.insertAfter(I, M);
477 template<typename IT>
478 void insert(iterator I, IT S, IT E) {
479 Insts.insert(I.getInstrIterator(), S, E);
481 iterator insert(iterator I, MachineInstr *M) {
482 return Insts.insert(I.getInstrIterator(), M);
484 iterator insertAfter(iterator I, MachineInstr *M) {
485 return Insts.insertAfter(I.getInstrIterator(), M);
488 /// erase - Remove the specified element or range from the instruction list.
489 /// These functions delete any instructions removed.
491 instr_iterator erase(instr_iterator I) {
492 return Insts.erase(I);
494 instr_iterator erase(instr_iterator I, instr_iterator E) {
495 return Insts.erase(I, E);
497 instr_iterator erase_instr(MachineInstr *I) {
498 instr_iterator MII(I);
502 iterator erase(iterator I);
503 iterator erase(iterator I, iterator E) {
504 return Insts.erase(I.getInstrIterator(), E.getInstrIterator());
506 iterator erase(MachineInstr *I) {
511 /// remove - Remove the instruction from the instruction list. This function
512 /// does not delete the instruction. WARNING: Note, if the specified
513 /// instruction is a bundle this function will remove all the bundled
514 /// instructions as well. It is up to the caller to keep a list of the
515 /// bundled instructions and re-insert them if desired. This function is
516 /// *not recommended* for manipulating instructions with bundles. Use
518 MachineInstr *remove(MachineInstr *I);
523 /// splice - Take an instruction from MBB 'Other' at the position From,
524 /// and insert it into this MBB right before 'where'.
525 void splice(instr_iterator where, MachineBasicBlock *Other,
526 instr_iterator From) {
527 Insts.splice(where, Other->Insts, From);
529 void splice(iterator where, MachineBasicBlock *Other, iterator From);
531 /// splice - Take a block of instructions from MBB 'Other' in the range [From,
532 /// To), and insert them into this MBB right before 'where'.
533 void splice(instr_iterator where, MachineBasicBlock *Other, instr_iterator From,
535 Insts.splice(where, Other->Insts, From, To);
537 void splice(iterator where, MachineBasicBlock *Other, iterator From,
539 Insts.splice(where.getInstrIterator(), Other->Insts,
540 From.getInstrIterator(), To.getInstrIterator());
543 /// removeFromParent - This method unlinks 'this' from the containing
544 /// function, and returns it, but does not delete it.
545 MachineBasicBlock *removeFromParent();
547 /// eraseFromParent - This method unlinks 'this' from the containing
548 /// function and deletes it.
549 void eraseFromParent();
551 /// ReplaceUsesOfBlockWith - Given a machine basic block that branched to
552 /// 'Old', change the code and CFG so that it branches to 'New' instead.
553 void ReplaceUsesOfBlockWith(MachineBasicBlock *Old, MachineBasicBlock *New);
555 /// CorrectExtraCFGEdges - Various pieces of code can cause excess edges in
556 /// the CFG to be inserted. If we have proven that MBB can only branch to
557 /// DestA and DestB, remove any other MBB successors from the CFG. DestA and
558 /// DestB can be null. Besides DestA and DestB, retain other edges leading
559 /// to LandingPads (currently there can be only one; we don't check or require
560 /// that here). Note it is possible that DestA and/or DestB are LandingPads.
561 bool CorrectExtraCFGEdges(MachineBasicBlock *DestA,
562 MachineBasicBlock *DestB,
565 /// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping
566 /// any DBG_VALUE instructions. Return UnknownLoc if there is none.
567 DebugLoc findDebugLoc(instr_iterator MBBI);
568 DebugLoc findDebugLoc(iterator MBBI) {
569 return findDebugLoc(MBBI.getInstrIterator());
572 // Debugging methods.
574 void print(raw_ostream &OS, SlotIndexes* = 0) const;
576 /// getNumber - MachineBasicBlocks are uniquely numbered at the function
577 /// level, unless they're not in a MachineFunction yet, in which case this
580 int getNumber() const { return Number; }
581 void setNumber(int N) { Number = N; }
583 /// getSymbol - Return the MCSymbol for this basic block.
585 MCSymbol *getSymbol() const;
589 /// getWeightIterator - Return weight iterator corresponding to the I
590 /// successor iterator.
591 weight_iterator getWeightIterator(succ_iterator I);
593 friend class MachineBranchProbabilityInfo;
595 /// getSuccWeight - Return weight of the edge from this block to MBB. This
596 /// method should NOT be called directly, but by using getEdgeWeight method
597 /// from MachineBranchProbabilityInfo class.
598 uint32_t getSuccWeight(MachineBasicBlock *succ);
601 // Methods used to maintain doubly linked list of blocks...
602 friend struct ilist_traits<MachineBasicBlock>;
604 // Machine-CFG mutators
606 /// addPredecessor - Remove pred as a predecessor of this MachineBasicBlock.
607 /// Don't do this unless you know what you're doing, because it doesn't
608 /// update pred's successors list. Use pred->addSuccessor instead.
610 void addPredecessor(MachineBasicBlock *pred);
612 /// removePredecessor - Remove pred as a predecessor of this
613 /// MachineBasicBlock. Don't do this unless you know what you're
614 /// doing, because it doesn't update pred's successors list. Use
615 /// pred->removeSuccessor instead.
617 void removePredecessor(MachineBasicBlock *pred);
620 raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
622 void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t);
624 // This is useful when building IndexedMaps keyed on basic block pointers.
625 struct MBB2NumberFunctor :
626 public std::unary_function<const MachineBasicBlock*, unsigned> {
627 unsigned operator()(const MachineBasicBlock *MBB) const {
628 return MBB->getNumber();
632 //===--------------------------------------------------------------------===//
633 // GraphTraits specializations for machine basic block graphs (machine-CFGs)
634 //===--------------------------------------------------------------------===//
636 // Provide specializations of GraphTraits to be able to treat a
637 // MachineFunction as a graph of MachineBasicBlocks...
640 template <> struct GraphTraits<MachineBasicBlock *> {
641 typedef MachineBasicBlock NodeType;
642 typedef MachineBasicBlock::succ_iterator ChildIteratorType;
644 static NodeType *getEntryNode(MachineBasicBlock *BB) { return BB; }
645 static inline ChildIteratorType child_begin(NodeType *N) {
646 return N->succ_begin();
648 static inline ChildIteratorType child_end(NodeType *N) {
649 return N->succ_end();
653 template <> struct GraphTraits<const MachineBasicBlock *> {
654 typedef const MachineBasicBlock NodeType;
655 typedef MachineBasicBlock::const_succ_iterator ChildIteratorType;
657 static NodeType *getEntryNode(const MachineBasicBlock *BB) { return BB; }
658 static inline ChildIteratorType child_begin(NodeType *N) {
659 return N->succ_begin();
661 static inline ChildIteratorType child_end(NodeType *N) {
662 return N->succ_end();
666 // Provide specializations of GraphTraits to be able to treat a
667 // MachineFunction as a graph of MachineBasicBlocks... and to walk it
668 // in inverse order. Inverse order for a function is considered
669 // to be when traversing the predecessor edges of a MBB
670 // instead of the successor edges.
672 template <> struct GraphTraits<Inverse<MachineBasicBlock*> > {
673 typedef MachineBasicBlock NodeType;
674 typedef MachineBasicBlock::pred_iterator ChildIteratorType;
675 static NodeType *getEntryNode(Inverse<MachineBasicBlock *> G) {
678 static inline ChildIteratorType child_begin(NodeType *N) {
679 return N->pred_begin();
681 static inline ChildIteratorType child_end(NodeType *N) {
682 return N->pred_end();
686 template <> struct GraphTraits<Inverse<const MachineBasicBlock*> > {
687 typedef const MachineBasicBlock NodeType;
688 typedef MachineBasicBlock::const_pred_iterator ChildIteratorType;
689 static NodeType *getEntryNode(Inverse<const MachineBasicBlock*> G) {
692 static inline ChildIteratorType child_begin(NodeType *N) {
693 return N->pred_begin();
695 static inline ChildIteratorType child_end(NodeType *N) {
696 return N->pred_end();
700 } // End llvm namespace