LLVM 18.0.0git
MachineBasicBlock.h
Go to the documentation of this file.
1//===- llvm/CodeGen/MachineBasicBlock.h -------------------------*- 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// Collect the sequence of machine instructions for a basic block.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H
14#define LLVM_CODEGEN_MACHINEBASICBLOCK_H
15
18#include "llvm/ADT/ilist.h"
22#include "llvm/IR/DebugLoc.h"
23#include "llvm/MC/LaneBitmask.h"
25#include <cassert>
26#include <cstdint>
27#include <iterator>
28#include <string>
29#include <vector>
30
31namespace llvm {
32
33class BasicBlock;
34class MachineFunction;
35class MCSymbol;
36class ModuleSlotTracker;
37class Pass;
38class Printable;
39class SlotIndexes;
40class StringRef;
41class raw_ostream;
42class LiveIntervals;
43class TargetRegisterClass;
44class TargetRegisterInfo;
45
46// This structure uniquely identifies a basic block section.
47// Possible values are
48// {Type: Default, Number: (unsigned)} (These are regular section IDs)
49// {Type: Exception, Number: 0} (ExceptionSectionID)
50// {Type: Cold, Number: 0} (ColdSectionID)
53 Default = 0, // Regular section (these sections are distinguished by the
54 // Number field).
55 Exception, // Special section type for exception handling blocks
56 Cold, // Special section type for cold blocks
58 unsigned Number;
59
60 MBBSectionID(unsigned N) : Type(Default), Number(N) {}
61
62 // Special unique sections for cold and exception blocks.
65
66 bool operator==(const MBBSectionID &Other) const {
67 return Type == Other.Type && Number == Other.Number;
68 }
69
70 bool operator!=(const MBBSectionID &Other) const { return !(*this == Other); }
71
72private:
73 // This is only used to construct the special cold and exception sections.
75};
76
77template <> struct ilist_traits<MachineInstr> {
78private:
79 friend class MachineBasicBlock; // Set by the owning MachineBasicBlock.
80
81 MachineBasicBlock *Parent;
82
83 using instr_iterator =
85
86public:
92};
93
95 : public ilist_node_with_parent<MachineBasicBlock, MachineFunction> {
96public:
97 /// Pair of physical register and lane mask.
98 /// This is not simply a std::pair typedef because the members should be named
99 /// clearly as they both have an integer type.
101 public:
104
107 };
108
109private:
111
112 const BasicBlock *BB;
113 int Number;
114
115 /// The call frame size on entry to this basic block due to call frame setup
116 /// instructions in a predecessor. This is usually zero, unless basic blocks
117 /// are split in the middle of a call sequence.
118 ///
119 /// This information is only maintained until PrologEpilogInserter eliminates
120 /// call frame pseudos.
121 unsigned CallFrameSize = 0;
122
123 MachineFunction *xParent;
124 Instructions Insts;
125
126 /// Keep track of the predecessor / successor basic blocks.
127 std::vector<MachineBasicBlock *> Predecessors;
128 std::vector<MachineBasicBlock *> Successors;
129
130 /// Keep track of the probabilities to the successors. This vector has the
131 /// same order as Successors, or it is empty if we don't use it (disable
132 /// optimization).
133 std::vector<BranchProbability> Probs;
134 using probability_iterator = std::vector<BranchProbability>::iterator;
135 using const_probability_iterator =
136 std::vector<BranchProbability>::const_iterator;
137
138 std::optional<uint64_t> IrrLoopHeaderWeight;
139
140 /// Keep track of the physical registers that are livein of the basicblock.
141 using LiveInVector = std::vector<RegisterMaskPair>;
142 LiveInVector LiveIns;
143
144 /// Alignment of the basic block. One if the basic block does not need to be
145 /// aligned.
146 Align Alignment;
147 /// Maximum amount of bytes that can be added to align the basic block. If the
148 /// alignment cannot be reached in this many bytes, no bytes are emitted.
149 /// Zero to represent no maximum.
150 unsigned MaxBytesForAlignment = 0;
151
152 /// Indicate that this basic block is entered via an exception handler.
153 bool IsEHPad = false;
154
155 /// Indicate that this MachineBasicBlock is referenced somewhere other than
156 /// as predecessor/successor, a terminator MachineInstr, or a jump table.
157 bool MachineBlockAddressTaken = false;
158
159 /// If this MachineBasicBlock corresponds to an IR-level "blockaddress"
160 /// constant, this contains a pointer to that block.
161 BasicBlock *AddressTakenIRBlock = nullptr;
162
163 /// Indicate that this basic block needs its symbol be emitted regardless of
164 /// whether the flow just falls-through to it.
165 bool LabelMustBeEmitted = false;
166
167 /// Indicate that this basic block is the entry block of an EH scope, i.e.,
168 /// the block that used to have a catchpad or cleanuppad instruction in the
169 /// LLVM IR.
170 bool IsEHScopeEntry = false;
171
172 /// Indicates if this is a target block of a catchret.
173 bool IsEHCatchretTarget = false;
174
175 /// Indicate that this basic block is the entry block of an EH funclet.
176 bool IsEHFuncletEntry = false;
177
178 /// Indicate that this basic block is the entry block of a cleanup funclet.
179 bool IsCleanupFuncletEntry = false;
180
181 /// Fixed unique ID assigned to this basic block upon creation. Used with
182 /// basic block sections and basic block labels.
183 std::optional<unsigned> BBID;
184
185 /// With basic block sections, this stores the Section ID of the basic block.
186 MBBSectionID SectionID{0};
187
188 // Indicate that this basic block begins a section.
189 bool IsBeginSection = false;
190
191 // Indicate that this basic block ends a section.
192 bool IsEndSection = false;
193
194 /// Indicate that this basic block is the indirect dest of an INLINEASM_BR.
195 bool IsInlineAsmBrIndirectTarget = false;
196
197 /// since getSymbol is a relatively heavy-weight operation, the symbol
198 /// is only computed once and is cached.
199 mutable MCSymbol *CachedMCSymbol = nullptr;
200
201 /// Cached MCSymbol for this block (used if IsEHCatchRetTarget).
202 mutable MCSymbol *CachedEHCatchretMCSymbol = nullptr;
203
204 /// Marks the end of the basic block. Used during basic block sections to
205 /// calculate the size of the basic block, or the BB section ending with it.
206 mutable MCSymbol *CachedEndMCSymbol = nullptr;
207
208 // Intrusive list support
209 MachineBasicBlock() = default;
210
211 explicit MachineBasicBlock(MachineFunction &MF, const BasicBlock *BB);
212
213 ~MachineBasicBlock();
214
215 // MachineBasicBlocks are allocated and owned by MachineFunction.
216 friend class MachineFunction;
217
218public:
219 /// Return the LLVM basic block that this instance corresponded to originally.
220 /// Note that this may be NULL if this instance does not correspond directly
221 /// to an LLVM basic block.
222 const BasicBlock *getBasicBlock() const { return BB; }
223
224 /// Remove the reference to the underlying IR BasicBlock. This is for
225 /// reduction tools and should generally not be used.
227 BB = nullptr;
228 }
229
230 /// Return the name of the corresponding LLVM basic block, or an empty string.
231 StringRef getName() const;
232
233 /// Return a formatted string to identify this block and its parent function.
234 std::string getFullName() const;
235
236 /// Test whether this block is used as something other than the target
237 /// of a terminator, exception-handling target, or jump table. This is
238 /// either the result of an IR-level "blockaddress", or some form
239 /// of target-specific branch lowering.
240 bool hasAddressTaken() const {
241 return MachineBlockAddressTaken || AddressTakenIRBlock;
242 }
243
244 /// Test whether this block is used as something other than the target of a
245 /// terminator, exception-handling target, jump table, or IR blockaddress.
246 /// For example, its address might be loaded into a register, or
247 /// stored in some branch table that isn't part of MachineJumpTableInfo.
248 bool isMachineBlockAddressTaken() const { return MachineBlockAddressTaken; }
249
250 /// Test whether this block is the target of an IR BlockAddress. (There can
251 /// more than one MBB associated with an IR BB where the address is taken.)
252 bool isIRBlockAddressTaken() const { return AddressTakenIRBlock; }
253
254 /// Retrieves the BasicBlock which corresponds to this MachineBasicBlock.
255 BasicBlock *getAddressTakenIRBlock() const { return AddressTakenIRBlock; }
256
257 /// Set this block to indicate that its address is used as something other
258 /// than the target of a terminator, exception-handling target, jump table,
259 /// or IR-level "blockaddress".
260 void setMachineBlockAddressTaken() { MachineBlockAddressTaken = true; }
261
262 /// Set this block to reflect that it corresponds to an IR-level basic block
263 /// with a BlockAddress.
264 void setAddressTakenIRBlock(BasicBlock *BB) { AddressTakenIRBlock = BB; }
265
266 /// Test whether this block must have its label emitted.
267 bool hasLabelMustBeEmitted() const { return LabelMustBeEmitted; }
268
269 /// Set this block to reflect that, regardless how we flow to it, we need
270 /// its label be emitted.
271 void setLabelMustBeEmitted() { LabelMustBeEmitted = true; }
272
273 /// Return the MachineFunction containing this basic block.
274 const MachineFunction *getParent() const { return xParent; }
275 MachineFunction *getParent() { return xParent; }
276
281
287
288 unsigned size() const { return (unsigned)Insts.size(); }
289 bool sizeWithoutDebugLargerThan(unsigned Limit) const;
290 bool empty() const { return Insts.empty(); }
291
292 MachineInstr &instr_front() { return Insts.front(); }
293 MachineInstr &instr_back() { return Insts.back(); }
294 const MachineInstr &instr_front() const { return Insts.front(); }
295 const MachineInstr &instr_back() const { return Insts.back(); }
296
297 MachineInstr &front() { return Insts.front(); }
298 MachineInstr &back() { return *--end(); }
299 const MachineInstr &front() const { return Insts.front(); }
300 const MachineInstr &back() const { return *--end(); }
301
302 instr_iterator instr_begin() { return Insts.begin(); }
303 const_instr_iterator instr_begin() const { return Insts.begin(); }
304 instr_iterator instr_end() { return Insts.end(); }
305 const_instr_iterator instr_end() const { return Insts.end(); }
306 reverse_instr_iterator instr_rbegin() { return Insts.rbegin(); }
307 const_reverse_instr_iterator instr_rbegin() const { return Insts.rbegin(); }
308 reverse_instr_iterator instr_rend () { return Insts.rend(); }
309 const_reverse_instr_iterator instr_rend () const { return Insts.rend(); }
310
316 }
317
318 iterator begin() { return instr_begin(); }
319 const_iterator begin() const { return instr_begin(); }
320 iterator end () { return instr_end(); }
321 const_iterator end () const { return instr_end(); }
324 }
327 }
331 }
332
333 /// Support for MachineInstr::getNextNode().
335 return &MachineBasicBlock::Insts;
336 }
337
339 return make_range(getFirstTerminator(), end());
340 }
342 return make_range(getFirstTerminator(), end());
343 }
344
345 /// Returns a range that iterates over the phis in the basic block.
347 return make_range(begin(), getFirstNonPHI());
348 }
350 return const_cast<MachineBasicBlock *>(this)->phis();
351 }
352
353 // Machine-CFG iterators
354 using pred_iterator = std::vector<MachineBasicBlock *>::iterator;
355 using const_pred_iterator = std::vector<MachineBasicBlock *>::const_iterator;
356 using succ_iterator = std::vector<MachineBasicBlock *>::iterator;
357 using const_succ_iterator = std::vector<MachineBasicBlock *>::const_iterator;
359 std::vector<MachineBasicBlock *>::reverse_iterator;
361 std::vector<MachineBasicBlock *>::const_reverse_iterator;
363 std::vector<MachineBasicBlock *>::reverse_iterator;
365 std::vector<MachineBasicBlock *>::const_reverse_iterator;
366 pred_iterator pred_begin() { return Predecessors.begin(); }
367 const_pred_iterator pred_begin() const { return Predecessors.begin(); }
368 pred_iterator pred_end() { return Predecessors.end(); }
369 const_pred_iterator pred_end() const { return Predecessors.end(); }
371 { return Predecessors.rbegin();}
373 { return Predecessors.rbegin();}
375 { return Predecessors.rend(); }
377 { return Predecessors.rend(); }
378 unsigned pred_size() const {
379 return (unsigned)Predecessors.size();
380 }
381 bool pred_empty() const { return Predecessors.empty(); }
382 succ_iterator succ_begin() { return Successors.begin(); }
383 const_succ_iterator succ_begin() const { return Successors.begin(); }
384 succ_iterator succ_end() { return Successors.end(); }
385 const_succ_iterator succ_end() const { return Successors.end(); }
387 { return Successors.rbegin(); }
389 { return Successors.rbegin(); }
391 { return Successors.rend(); }
393 { return Successors.rend(); }
394 unsigned succ_size() const {
395 return (unsigned)Successors.size();
396 }
397 bool succ_empty() const { return Successors.empty(); }
398
400 return make_range(pred_begin(), pred_end());
401 }
403 return make_range(pred_begin(), pred_end());
404 }
406 return make_range(succ_begin(), succ_end());
407 }
409 return make_range(succ_begin(), succ_end());
410 }
411
412 // LiveIn management methods.
413
414 /// Adds the specified register as a live in. Note that it is an error to add
415 /// the same register to the same set more than once unless the intention is
416 /// to call sortUniqueLiveIns after all registers are added.
417 void addLiveIn(MCRegister PhysReg,
418 LaneBitmask LaneMask = LaneBitmask::getAll()) {
419 LiveIns.push_back(RegisterMaskPair(PhysReg, LaneMask));
420 }
421 void addLiveIn(const RegisterMaskPair &RegMaskPair) {
422 LiveIns.push_back(RegMaskPair);
423 }
424
425 /// Sorts and uniques the LiveIns vector. It can be significantly faster to do
426 /// this than repeatedly calling isLiveIn before calling addLiveIn for every
427 /// LiveIn insertion.
428 void sortUniqueLiveIns();
429
430 /// Clear live in list.
431 void clearLiveIns();
432
433 /// Add PhysReg as live in to this block, and ensure that there is a copy of
434 /// PhysReg to a virtual register of class RC. Return the virtual register
435 /// that is a copy of the live in PhysReg.
437
438 /// Remove the specified register from the live in set.
440 LaneBitmask LaneMask = LaneBitmask::getAll());
441
442 /// Return true if the specified register is in the live in set.
444 LaneBitmask LaneMask = LaneBitmask::getAll()) const;
445
446 // Iteration support for live in sets. These sets are kept in sorted
447 // order by their register number.
448 using livein_iterator = LiveInVector::const_iterator;
449
450 /// Unlike livein_begin, this method does not check that the liveness
451 /// information is accurate. Still for debug purposes it may be useful
452 /// to have iterators that won't assert if the liveness information
453 /// is not current.
454 livein_iterator livein_begin_dbg() const { return LiveIns.begin(); }
457 }
458
460 livein_iterator livein_end() const { return LiveIns.end(); }
461 bool livein_empty() const { return LiveIns.empty(); }
464 }
465
466 /// Remove entry from the livein set and return iterator to the next.
468
470 public:
471 using iterator_category = std::input_iterator_tag;
472 using difference_type = std::ptrdiff_t;
474 using pointer = const RegisterMaskPair *;
476
478 MCPhysReg ExceptionSelector, bool End)
479 : ExceptionPointer(ExceptionPointer),
480 ExceptionSelector(ExceptionSelector), BlockI(MBB.succ_begin()),
481 BlockEnd(MBB.succ_end()) {
482 if (End)
483 BlockI = BlockEnd;
484 else if (BlockI != BlockEnd) {
485 LiveRegI = (*BlockI)->livein_begin();
486 if (!advanceToValidPosition())
487 return;
488 if (LiveRegI->PhysReg == ExceptionPointer ||
489 LiveRegI->PhysReg == ExceptionSelector)
490 ++(*this);
491 }
492 }
493
495 do {
496 ++LiveRegI;
497 if (!advanceToValidPosition())
498 return *this;
499 } while ((*BlockI)->isEHPad() &&
500 (LiveRegI->PhysReg == ExceptionPointer ||
501 LiveRegI->PhysReg == ExceptionSelector));
502 return *this;
503 }
504
506 liveout_iterator Tmp = *this;
507 ++(*this);
508 return Tmp;
509 }
510
512 return *LiveRegI;
513 }
514
516 return &*LiveRegI;
517 }
518
519 bool operator==(const liveout_iterator &RHS) const {
520 if (BlockI != BlockEnd)
521 return BlockI == RHS.BlockI && LiveRegI == RHS.LiveRegI;
522 return RHS.BlockI == BlockEnd;
523 }
524
525 bool operator!=(const liveout_iterator &RHS) const {
526 return !(*this == RHS);
527 }
528 private:
529 bool advanceToValidPosition() {
530 if (LiveRegI != (*BlockI)->livein_end())
531 return true;
532
533 do {
534 ++BlockI;
535 } while (BlockI != BlockEnd && (*BlockI)->livein_empty());
536 if (BlockI == BlockEnd)
537 return false;
538
539 LiveRegI = (*BlockI)->livein_begin();
540 return true;
541 }
542
543 MCPhysReg ExceptionPointer, ExceptionSelector;
544 const_succ_iterator BlockI;
545 const_succ_iterator BlockEnd;
546 livein_iterator LiveRegI;
547 };
548
549 /// Iterator scanning successor basic blocks' liveins to determine the
550 /// registers potentially live at the end of this block. There may be
551 /// duplicates or overlapping registers in the list returned.
552 liveout_iterator liveout_begin() const;
554 return liveout_iterator(*this, 0, 0, true);
555 }
558 }
559
560 /// Get the clobber mask for the start of this basic block. Funclets use this
561 /// to prevent register allocation across funclet transitions.
563
564 /// Get the clobber mask for the end of the basic block.
565 /// \see getBeginClobberMask()
567
568 /// Return alignment of the basic block.
569 Align getAlignment() const { return Alignment; }
570
571 /// Set alignment of the basic block.
572 void setAlignment(Align A) { Alignment = A; }
573
574 void setAlignment(Align A, unsigned MaxBytes) {
576 setMaxBytesForAlignment(MaxBytes);
577 }
578
579 /// Return the maximum amount of padding allowed for aligning the basic block.
580 unsigned getMaxBytesForAlignment() const { return MaxBytesForAlignment; }
581
582 /// Set the maximum amount of padding allowed for aligning the basic block
583 void setMaxBytesForAlignment(unsigned MaxBytes) {
584 MaxBytesForAlignment = MaxBytes;
585 }
586
587 /// Returns true if the block is a landing pad. That is this basic block is
588 /// entered via an exception handler.
589 bool isEHPad() const { return IsEHPad; }
590
591 /// Indicates the block is a landing pad. That is this basic block is entered
592 /// via an exception handler.
593 void setIsEHPad(bool V = true) { IsEHPad = V; }
594
595 bool hasEHPadSuccessor() const;
596
597 /// Returns true if this is the entry block of the function.
598 bool isEntryBlock() const;
599
600 /// Returns true if this is the entry block of an EH scope, i.e., the block
601 /// that used to have a catchpad or cleanuppad instruction in the LLVM IR.
602 bool isEHScopeEntry() const { return IsEHScopeEntry; }
603
604 /// Indicates if this is the entry block of an EH scope, i.e., the block that
605 /// that used to have a catchpad or cleanuppad instruction in the LLVM IR.
606 void setIsEHScopeEntry(bool V = true) { IsEHScopeEntry = V; }
607
608 /// Returns true if this is a target block of a catchret.
609 bool isEHCatchretTarget() const { return IsEHCatchretTarget; }
610
611 /// Indicates if this is a target block of a catchret.
612 void setIsEHCatchretTarget(bool V = true) { IsEHCatchretTarget = V; }
613
614 /// Returns true if this is the entry block of an EH funclet.
615 bool isEHFuncletEntry() const { return IsEHFuncletEntry; }
616
617 /// Indicates if this is the entry block of an EH funclet.
618 void setIsEHFuncletEntry(bool V = true) { IsEHFuncletEntry = V; }
619
620 /// Returns true if this is the entry block of a cleanup funclet.
621 bool isCleanupFuncletEntry() const { return IsCleanupFuncletEntry; }
622
623 /// Indicates if this is the entry block of a cleanup funclet.
624 void setIsCleanupFuncletEntry(bool V = true) { IsCleanupFuncletEntry = V; }
625
626 /// Returns true if this block begins any section.
627 bool isBeginSection() const { return IsBeginSection; }
628
629 /// Returns true if this block ends any section.
630 bool isEndSection() const { return IsEndSection; }
631
632 void setIsBeginSection(bool V = true) { IsBeginSection = V; }
633
634 void setIsEndSection(bool V = true) { IsEndSection = V; }
635
636 std::optional<unsigned> getBBID() const { return BBID; }
637
638 /// Returns the section ID of this basic block.
639 MBBSectionID getSectionID() const { return SectionID; }
640
641 /// Returns the unique section ID number of this basic block.
642 unsigned getSectionIDNum() const {
643 return ((unsigned)MBBSectionID::SectionType::Cold) -
644 ((unsigned)SectionID.Type) + SectionID.Number;
645 }
646
647 /// Sets the fixed BBID of this basic block.
648 void setBBID(unsigned V) {
649 assert(!BBID.has_value() && "Cannot change BBID.");
650 BBID = V;
651 }
652
653 /// Sets the section ID for this basic block.
654 void setSectionID(MBBSectionID V) { SectionID = V; }
655
656 /// Returns the MCSymbol marking the end of this basic block.
657 MCSymbol *getEndSymbol() const;
658
659 /// Returns true if this block may have an INLINEASM_BR (overestimate, by
660 /// checking if any of the successors are indirect targets of any inlineasm_br
661 /// in the function).
662 bool mayHaveInlineAsmBr() const;
663
664 /// Returns true if this is the indirect dest of an INLINEASM_BR.
666 return IsInlineAsmBrIndirectTarget;
667 }
668
669 /// Indicates if this is the indirect dest of an INLINEASM_BR.
670 void setIsInlineAsmBrIndirectTarget(bool V = true) {
671 IsInlineAsmBrIndirectTarget = V;
672 }
673
674 /// Returns true if it is legal to hoist instructions into this block.
675 bool isLegalToHoistInto() const;
676
677 // Code Layout methods.
678
679 /// Move 'this' block before or after the specified block. This only moves
680 /// the block, it does not modify the CFG or adjust potential fall-throughs at
681 /// the end of the block.
682 void moveBefore(MachineBasicBlock *NewAfter);
683 void moveAfter(MachineBasicBlock *NewBefore);
684
685 /// Returns true if this and MBB belong to the same section.
686 bool sameSection(const MachineBasicBlock *MBB) const {
687 return getSectionID() == MBB->getSectionID();
688 }
689
690 /// Update the terminator instructions in block to account for changes to
691 /// block layout which may have been made. PreviousLayoutSuccessor should be
692 /// set to the block which may have been used as fallthrough before the block
693 /// layout was modified. If the block previously fell through to that block,
694 /// it may now need a branch. If it previously branched to another block, it
695 /// may now be able to fallthrough to the current layout successor.
696 void updateTerminator(MachineBasicBlock *PreviousLayoutSuccessor);
697
698 // Machine-CFG mutators
699
700 /// Add Succ as a successor of this MachineBasicBlock. The Predecessors list
701 /// of Succ is automatically updated. PROB parameter is stored in
702 /// Probabilities list. The default probability is set as unknown. Mixing
703 /// known and unknown probabilities in successor list is not allowed. When all
704 /// successors have unknown probabilities, 1 / N is returned as the
705 /// probability for each successor, where N is the number of successors.
706 ///
707 /// Note that duplicate Machine CFG edges are not allowed.
710
711 /// Add Succ as a successor of this MachineBasicBlock. The Predecessors list
712 /// of Succ is automatically updated. The probability is not provided because
713 /// BPI is not available (e.g. -O0 is used), in which case edge probabilities
714 /// won't be used. Using this interface can save some space.
716
717 /// Set successor probability of a given iterator.
719
720 /// Normalize probabilities of all successors so that the sum of them becomes
721 /// one. This is usually done when the current update on this MBB is done, and
722 /// the sum of its successors' probabilities is not guaranteed to be one. The
723 /// user is responsible for the correct use of this function.
724 /// MBB::removeSuccessor() has an option to do this automatically.
726 BranchProbability::normalizeProbabilities(Probs.begin(), Probs.end());
727 }
728
729 /// Validate successors' probabilities and check if the sum of them is
730 /// approximate one. This only works in DEBUG mode.
731 void validateSuccProbs() const;
732
733 /// Remove successor from the successors list of this MachineBasicBlock. The
734 /// Predecessors list of Succ is automatically updated.
735 /// If NormalizeSuccProbs is true, then normalize successors' probabilities
736 /// after the successor is removed.
738 bool NormalizeSuccProbs = false);
739
740 /// Remove specified successor from the successors list of this
741 /// MachineBasicBlock. The Predecessors list of Succ is automatically updated.
742 /// If NormalizeSuccProbs is true, then normalize successors' probabilities
743 /// after the successor is removed.
744 /// Return the iterator to the element after the one removed.
746 bool NormalizeSuccProbs = false);
747
748 /// Replace successor OLD with NEW and update probability info.
750
751 /// Copy a successor (and any probability info) from original block to this
752 /// block's. Uses an iterator into the original blocks successors.
753 ///
754 /// This is useful when doing a partial clone of successors. Afterward, the
755 /// probabilities may need to be normalized.
757
758 /// Split the old successor into old plus new and updates the probability
759 /// info.
761 bool NormalizeSuccProbs = false);
762
763 /// Transfers all the successors from MBB to this machine basic block (i.e.,
764 /// copies all the successors FromMBB and remove all the successors from
765 /// FromMBB).
767
768 /// Transfers all the successors, as in transferSuccessors, and update PHI
769 /// operands in the successor blocks which refer to FromMBB to refer to this.
771
772 /// Return true if any of the successors have probabilities attached to them.
773 bool hasSuccessorProbabilities() const { return !Probs.empty(); }
774
775 /// Return true if the specified MBB is a predecessor of this block.
776 bool isPredecessor(const MachineBasicBlock *MBB) const;
777
778 /// Return true if the specified MBB is a successor of this block.
779 bool isSuccessor(const MachineBasicBlock *MBB) const;
780
781 /// Return true if the specified MBB will be emitted immediately after this
782 /// block, such that if this block exits by falling through, control will
783 /// transfer to the specified MBB. Note that MBB need not be a successor at
784 /// all, for example if this block ends with an unconditional branch to some
785 /// other block.
786 bool isLayoutSuccessor(const MachineBasicBlock *MBB) const;
787
788 /// Return the successor of this block if it has a single successor.
789 /// Otherwise return a null pointer.
790 ///
793 return const_cast<MachineBasicBlock *>(
794 static_cast<const MachineBasicBlock *>(this)->getSingleSuccessor());
795 }
796
797 /// Return the fallthrough block if the block can implicitly
798 /// transfer control to the block after it by falling off the end of
799 /// it. If an explicit branch to the fallthrough block is not allowed,
800 /// set JumpToFallThrough to be false. Non-null return is a conservative
801 /// answer.
802 MachineBasicBlock *getFallThrough(bool JumpToFallThrough = true);
803
804 /// Return the fallthrough block if the block can implicitly
805 /// transfer control to it's successor, whether by a branch or
806 /// a fallthrough. Non-null return is a conservative answer.
808
809 /// Return true if the block can implicitly transfer control to the
810 /// block after it by falling off the end of it. This should return
811 /// false if it can reach the block after it, but it uses an
812 /// explicit branch to do so (e.g., a table jump). True is a
813 /// conservative answer.
814 bool canFallThrough();
815
816 /// Returns a pointer to the first instruction in this block that is not a
817 /// PHINode instruction. When adding instructions to the beginning of the
818 /// basic block, they should be added before the returned value, not before
819 /// the first instruction, which might be PHI.
820 /// Returns end() is there's no non-PHI instruction.
823 return const_cast<MachineBasicBlock *>(this)->getFirstNonPHI();
824 }
825
826 /// Return the first instruction in MBB after I that is not a PHI or a label.
827 /// This is the correct point to insert lowered copies at the beginning of a
828 /// basic block that must be before any debugging information.
830
831 /// Return the first instruction in MBB after I that is not a PHI, label or
832 /// debug. This is the correct point to insert copies at the beginning of a
833 /// basic block.
834 iterator SkipPHIsLabelsAndDebug(iterator I, bool SkipPseudoOp = true);
835
836 /// Returns an iterator to the first terminator instruction of this basic
837 /// block. If a terminator does not exist, it returns end().
840 return const_cast<MachineBasicBlock *>(this)->getFirstTerminator();
841 }
842
843 /// Same getFirstTerminator but it ignores bundles and return an
844 /// instr_iterator instead.
846
847 /// Finds the first terminator in a block by scanning forward. This can handle
848 /// cases in GlobalISel where there may be non-terminator instructions between
849 /// terminators, for which getFirstTerminator() will not work correctly.
851
852 /// Returns an iterator to the first non-debug instruction in the basic block,
853 /// or end(). Skip any pseudo probe operation if \c SkipPseudoOp is true.
854 /// Pseudo probes are like debug instructions which do not turn into real
855 /// machine code. We try to use the function to skip both debug instructions
856 /// and pseudo probe operations to avoid API proliferation. This should work
857 /// most of the time when considering optimizing the rest of code in the
858 /// block, except for certain cases where pseudo probes are designed to block
859 /// the optimizations. For example, code merge like optimizations are supposed
860 /// to be blocked by pseudo probes for better AutoFDO profile quality.
861 /// Therefore, they should be considered as a valid instruction when this
862 /// function is called in a context of such optimizations. On the other hand,
863 /// \c SkipPseudoOp should be true when it's used in optimizations that
864 /// unlikely hurt profile quality, e.g., without block merging. The default
865 /// value of \c SkipPseudoOp is set to true to maximize code quality in
866 /// general, with an explict false value passed in in a few places like branch
867 /// folding and if-conversion to favor profile quality.
868 iterator getFirstNonDebugInstr(bool SkipPseudoOp = true);
869 const_iterator getFirstNonDebugInstr(bool SkipPseudoOp = true) const {
870 return const_cast<MachineBasicBlock *>(this)->getFirstNonDebugInstr(
871 SkipPseudoOp);
872 }
873
874 /// Returns an iterator to the last non-debug instruction in the basic block,
875 /// or end(). Skip any pseudo operation if \c SkipPseudoOp is true.
876 /// Pseudo probes are like debug instructions which do not turn into real
877 /// machine code. We try to use the function to skip both debug instructions
878 /// and pseudo probe operations to avoid API proliferation. This should work
879 /// most of the time when considering optimizing the rest of code in the
880 /// block, except for certain cases where pseudo probes are designed to block
881 /// the optimizations. For example, code merge like optimizations are supposed
882 /// to be blocked by pseudo probes for better AutoFDO profile quality.
883 /// Therefore, they should be considered as a valid instruction when this
884 /// function is called in a context of such optimizations. On the other hand,
885 /// \c SkipPseudoOp should be true when it's used in optimizations that
886 /// unlikely hurt profile quality, e.g., without block merging. The default
887 /// value of \c SkipPseudoOp is set to true to maximize code quality in
888 /// general, with an explict false value passed in in a few places like branch
889 /// folding and if-conversion to favor profile quality.
890 iterator getLastNonDebugInstr(bool SkipPseudoOp = true);
891 const_iterator getLastNonDebugInstr(bool SkipPseudoOp = true) const {
892 return const_cast<MachineBasicBlock *>(this)->getLastNonDebugInstr(
893 SkipPseudoOp);
894 }
895
896 /// Convenience function that returns true if the block ends in a return
897 /// instruction.
898 bool isReturnBlock() const {
899 return !empty() && back().isReturn();
900 }
901
902 /// Convenience function that returns true if the bock ends in a EH scope
903 /// return instruction.
904 bool isEHScopeReturnBlock() const {
905 return !empty() && back().isEHScopeReturn();
906 }
907
908 /// Split a basic block into 2 pieces at \p SplitPoint. A new block will be
909 /// inserted after this block, and all instructions after \p SplitInst moved
910 /// to it (\p SplitInst will be in the original block). If \p LIS is provided,
911 /// LiveIntervals will be appropriately updated. \return the newly inserted
912 /// block.
913 ///
914 /// If \p UpdateLiveIns is true, this will ensure the live ins list is
915 /// accurate, including for physreg uses/defs in the original block.
916 MachineBasicBlock *splitAt(MachineInstr &SplitInst, bool UpdateLiveIns = true,
917 LiveIntervals *LIS = nullptr);
918
919 /// Split the critical edge from this block to the given successor block, and
920 /// return the newly created block, or null if splitting is not possible.
921 ///
922 /// This function updates LiveVariables, MachineDominatorTree, and
923 /// MachineLoopInfo, as applicable.
926 std::vector<SparseBitVector<>> *LiveInSets = nullptr);
927
928 /// Check if the edge between this block and the given successor \p
929 /// Succ, can be split. If this returns true a subsequent call to
930 /// SplitCriticalEdge is guaranteed to return a valid basic block if
931 /// no changes occurred in the meantime.
932 bool canSplitCriticalEdge(const MachineBasicBlock *Succ) const;
933
934 void pop_front() { Insts.pop_front(); }
935 void pop_back() { Insts.pop_back(); }
936 void push_back(MachineInstr *MI) { Insts.push_back(MI); }
937
938 /// Insert MI into the instruction list before I, possibly inside a bundle.
939 ///
940 /// If the insertion point is inside a bundle, MI will be added to the bundle,
941 /// otherwise MI will not be added to any bundle. That means this function
942 /// alone can't be used to prepend or append instructions to bundles. See
943 /// MIBundleBuilder::insert() for a more reliable way of doing that.
945
946 /// Insert a range of instructions into the instruction list before I.
947 template<typename IT>
948 void insert(iterator I, IT S, IT E) {
949 assert((I == end() || I->getParent() == this) &&
950 "iterator points outside of basic block");
951 Insts.insert(I.getInstrIterator(), S, E);
952 }
953
954 /// Insert MI into the instruction list before I.
956 assert((I == end() || I->getParent() == this) &&
957 "iterator points outside of basic block");
958 assert(!MI->isBundledWithPred() && !MI->isBundledWithSucc() &&
959 "Cannot insert instruction with bundle flags");
960 return Insts.insert(I.getInstrIterator(), MI);
961 }
962
963 /// Insert MI into the instruction list after I.
965 assert((I == end() || I->getParent() == this) &&
966 "iterator points outside of basic block");
967 assert(!MI->isBundledWithPred() && !MI->isBundledWithSucc() &&
968 "Cannot insert instruction with bundle flags");
969 return Insts.insertAfter(I.getInstrIterator(), MI);
970 }
971
972 /// If I is bundled then insert MI into the instruction list after the end of
973 /// the bundle, otherwise insert MI immediately after I.
975 assert((I == instr_end() || I->getParent() == this) &&
976 "iterator points outside of basic block");
977 assert(!MI->isBundledWithPred() && !MI->isBundledWithSucc() &&
978 "Cannot insert instruction with bundle flags");
979 while (I->isBundledWithSucc())
980 ++I;
981 return Insts.insertAfter(I, MI);
982 }
983
984 /// Remove an instruction from the instruction list and delete it.
985 ///
986 /// If the instruction is part of a bundle, the other instructions in the
987 /// bundle will still be bundled after removing the single instruction.
989
990 /// Remove an instruction from the instruction list and delete it.
991 ///
992 /// If the instruction is part of a bundle, the other instructions in the
993 /// bundle will still be bundled after removing the single instruction.
995 return erase(instr_iterator(I));
996 }
997
998 /// Remove a range of instructions from the instruction list and delete them.
1000 return Insts.erase(I.getInstrIterator(), E.getInstrIterator());
1001 }
1002
1003 /// Remove an instruction or bundle from the instruction list and delete it.
1004 ///
1005 /// If I points to a bundle of instructions, they are all erased.
1007 return erase(I, std::next(I));
1008 }
1009
1010 /// Remove an instruction from the instruction list and delete it.
1011 ///
1012 /// If I is the head of a bundle of instructions, the whole bundle will be
1013 /// erased.
1015 return erase(iterator(I));
1016 }
1017
1018 /// Remove the unbundled instruction from the instruction list without
1019 /// deleting it.
1020 ///
1021 /// This function can not be used to remove bundled instructions, use
1022 /// remove_instr to remove individual instructions from a bundle.
1024 assert(!I->isBundled() && "Cannot remove bundled instructions");
1025 return Insts.remove(instr_iterator(I));
1026 }
1027
1028 /// Remove the possibly bundled instruction from the instruction list
1029 /// without deleting it.
1030 ///
1031 /// If the instruction is part of a bundle, the other instructions in the
1032 /// bundle will still be bundled after removing the single instruction.
1034
1035 void clear() {
1036 Insts.clear();
1037 }
1038
1039 /// Take an instruction from MBB 'Other' at the position From, and insert it
1040 /// into this MBB right before 'Where'.
1041 ///
1042 /// If From points to a bundle of instructions, the whole bundle is moved.
1044 // The range splice() doesn't allow noop moves, but this one does.
1045 if (Where != From)
1046 splice(Where, Other, From, std::next(From));
1047 }
1048
1049 /// Take a block of instructions from MBB 'Other' in the range [From, To),
1050 /// and insert them into this MBB right before 'Where'.
1051 ///
1052 /// The instruction at 'Where' must not be included in the range of
1053 /// instructions to move.
1055 iterator From, iterator To) {
1056 Insts.splice(Where.getInstrIterator(), Other->Insts,
1057 From.getInstrIterator(), To.getInstrIterator());
1058 }
1059
1060 /// This method unlinks 'this' from the containing function, and returns it,
1061 /// but does not delete it.
1063
1064 /// This method unlinks 'this' from the containing function and deletes it.
1065 void eraseFromParent();
1066
1067 /// Given a machine basic block that branched to 'Old', change the code and
1068 /// CFG so that it branches to 'New' instead.
1070
1071 /// Update all phi nodes in this basic block to refer to basic block \p New
1072 /// instead of basic block \p Old.
1074
1075 /// Find the next valid DebugLoc starting at MBBI, skipping any debug
1076 /// instructions. Return UnknownLoc if there is none.
1079 return findDebugLoc(MBBI.getInstrIterator());
1080 }
1081
1082 /// Has exact same behavior as @ref findDebugLoc (it also searches towards the
1083 /// end of this MBB) except that this function takes a reverse iterator to
1084 /// identify the starting MI.
1087 return rfindDebugLoc(MBBI.getInstrIterator());
1088 }
1089
1090 /// Find the previous valid DebugLoc preceding MBBI, skipping any debug
1091 /// instructions. It is possible to find the last DebugLoc in the MBB using
1092 /// findPrevDebugLoc(instr_end()). Return UnknownLoc if there is none.
1095 return findPrevDebugLoc(MBBI.getInstrIterator());
1096 }
1097
1098 /// Has exact same behavior as @ref findPrevDebugLoc (it also searches towards
1099 /// the beginning of this MBB) except that this function takes reverse
1100 /// iterator to identify the starting MI. A minor difference compared to
1101 /// findPrevDebugLoc is that we can't start scanning at "instr_end".
1104 return rfindPrevDebugLoc(MBBI.getInstrIterator());
1105 }
1106
1107 /// Find and return the merged DebugLoc of the branch instructions of the
1108 /// block. Return UnknownLoc if there is none.
1110
1111 /// Possible outcome of a register liveness query to computeRegisterLiveness()
1113 LQR_Live, ///< Register is known to be (at least partially) live.
1114 LQR_Dead, ///< Register is known to be fully dead.
1115 LQR_Unknown ///< Register liveness not decidable from local neighborhood.
1117
1118 /// Return whether (physical) register \p Reg has been defined and not
1119 /// killed as of just before \p Before.
1120 ///
1121 /// Search is localised to a neighborhood of \p Neighborhood instructions
1122 /// before (searching for defs or kills) and \p Neighborhood instructions
1123 /// after (searching just for defs) \p Before.
1124 ///
1125 /// \p Reg must be a physical register.
1129 unsigned Neighborhood = 10) const;
1130
1131 // Debugging methods.
1132 void dump() const;
1133 void print(raw_ostream &OS, const SlotIndexes * = nullptr,
1134 bool IsStandalone = true) const;
1136 const SlotIndexes * = nullptr, bool IsStandalone = true) const;
1137
1139 PrintNameIr = (1 << 0), ///< Add IR name where available
1140 PrintNameAttributes = (1 << 1), ///< Print attributes
1141 };
1142
1143 void printName(raw_ostream &os, unsigned printNameFlags = PrintNameIr,
1144 ModuleSlotTracker *moduleSlotTracker = nullptr) const;
1145
1146 // Printing method used by LoopInfo.
1147 void printAsOperand(raw_ostream &OS, bool PrintType = true) const;
1148
1149 /// MachineBasicBlocks are uniquely numbered at the function level, unless
1150 /// they're not in a MachineFunction yet, in which case this will return -1.
1151 int getNumber() const { return Number; }
1152 void setNumber(int N) { Number = N; }
1153
1154 /// Return the call frame size on entry to this basic block.
1155 unsigned getCallFrameSize() const { return CallFrameSize; }
1156 /// Set the call frame size on entry to this basic block.
1157 void setCallFrameSize(unsigned N) { CallFrameSize = N; }
1158
1159 /// Return the MCSymbol for this basic block.
1160 MCSymbol *getSymbol() const;
1161
1162 /// Return the EHCatchret Symbol for this basic block.
1164
1165 std::optional<uint64_t> getIrrLoopHeaderWeight() const {
1166 return IrrLoopHeaderWeight;
1167 }
1168
1170 IrrLoopHeaderWeight = Weight;
1171 }
1172
1173 /// Return probability of the edge from this block to MBB. This method should
1174 /// NOT be called directly, but by using getEdgeProbability method from
1175 /// MachineBranchProbabilityInfo class.
1177
1178private:
1179 /// Return probability iterator corresponding to the I successor iterator.
1180 probability_iterator getProbabilityIterator(succ_iterator I);
1181 const_probability_iterator
1182 getProbabilityIterator(const_succ_iterator I) const;
1183
1185 friend class MIPrinter;
1186
1187 // Methods used to maintain doubly linked list of blocks...
1189
1190 // Machine-CFG mutators
1191
1192 /// Add Pred as a predecessor of this MachineBasicBlock. Don't do this
1193 /// unless you know what you're doing, because it doesn't update Pred's
1194 /// successors list. Use Pred->addSuccessor instead.
1195 void addPredecessor(MachineBasicBlock *Pred);
1196
1197 /// Remove Pred as a predecessor of this MachineBasicBlock. Don't do this
1198 /// unless you know what you're doing, because it doesn't update Pred's
1199 /// successors list. Use Pred->removeSuccessor instead.
1200 void removePredecessor(MachineBasicBlock *Pred);
1201};
1202
1204
1205/// Prints a machine basic block reference.
1206///
1207/// The format is:
1208/// %bb.5 - a machine basic block with MBB.getNumber() == 5.
1209///
1210/// Usage: OS << printMBBReference(MBB) << '\n';
1212
1213// This is useful when building IndexedMaps keyed on basic block pointers.
1216 unsigned operator()(const MachineBasicBlock *MBB) const {
1217 return MBB->getNumber();
1218 }
1219};
1220
1221//===--------------------------------------------------------------------===//
1222// GraphTraits specializations for machine basic block graphs (machine-CFGs)
1223//===--------------------------------------------------------------------===//
1224
1225// Provide specializations of GraphTraits to be able to treat a
1226// MachineFunction as a graph of MachineBasicBlocks.
1227//
1228
1229template <> struct GraphTraits<MachineBasicBlock *> {
1232
1233 static NodeRef getEntryNode(MachineBasicBlock *BB) { return BB; }
1234 static ChildIteratorType child_begin(NodeRef N) { return N->succ_begin(); }
1235 static ChildIteratorType child_end(NodeRef N) { return N->succ_end(); }
1236};
1237
1238template <> struct GraphTraits<const MachineBasicBlock *> {
1241
1242 static NodeRef getEntryNode(const MachineBasicBlock *BB) { return BB; }
1243 static ChildIteratorType child_begin(NodeRef N) { return N->succ_begin(); }
1244 static ChildIteratorType child_end(NodeRef N) { return N->succ_end(); }
1245};
1246
1247// Provide specializations of GraphTraits to be able to treat a
1248// MachineFunction as a graph of MachineBasicBlocks and to walk it
1249// in inverse order. Inverse order for a function is considered
1250// to be when traversing the predecessor edges of a MBB
1251// instead of the successor edges.
1252//
1256
1258 return G.Graph;
1259 }
1260
1261 static ChildIteratorType child_begin(NodeRef N) { return N->pred_begin(); }
1262 static ChildIteratorType child_end(NodeRef N) { return N->pred_end(); }
1263};
1264
1268
1270 return G.Graph;
1271 }
1272
1273 static ChildIteratorType child_begin(NodeRef N) { return N->pred_begin(); }
1274 static ChildIteratorType child_end(NodeRef N) { return N->pred_end(); }
1275};
1276
1277// These accessors are handy for sharing templated code between IR and MIR.
1278inline auto successors(const MachineBasicBlock *BB) { return BB->successors(); }
1279inline auto predecessors(const MachineBasicBlock *BB) {
1280 return BB->predecessors();
1281}
1282
1283/// MachineInstrSpan provides an interface to get an iteration range
1284/// containing the instruction it was initialized with, along with all
1285/// those instructions inserted prior to or following that instruction
1286/// at some point after the MachineInstrSpan is constructed.
1288 MachineBasicBlock &MBB;
1290
1291public:
1293 : MBB(*BB), I(I), B(I == MBB.begin() ? MBB.end() : std::prev(I)),
1294 E(std::next(I)) {
1295 assert(I == BB->end() || I->getParent() == BB);
1296 }
1297
1299 return B == MBB.end() ? MBB.begin() : std::next(B);
1300 }
1302 bool empty() { return begin() == end(); }
1303
1305};
1306
1307/// Increment \p It until it points to a non-debug instruction or to \p End
1308/// and return the resulting iterator. This function should only be used
1309/// MachineBasicBlock::{iterator, const_iterator, instr_iterator,
1310/// const_instr_iterator} and the respective reverse iterators.
1311template <typename IterT>
1312inline IterT skipDebugInstructionsForward(IterT It, IterT End,
1313 bool SkipPseudoOp = true) {
1314 while (It != End &&
1315 (It->isDebugInstr() || (SkipPseudoOp && It->isPseudoProbe())))
1316 ++It;
1317 return It;
1318}
1319
1320/// Decrement \p It until it points to a non-debug instruction or to \p Begin
1321/// and return the resulting iterator. This function should only be used
1322/// MachineBasicBlock::{iterator, const_iterator, instr_iterator,
1323/// const_instr_iterator} and the respective reverse iterators.
1324template <class IterT>
1325inline IterT skipDebugInstructionsBackward(IterT It, IterT Begin,
1326 bool SkipPseudoOp = true) {
1327 while (It != Begin &&
1328 (It->isDebugInstr() || (SkipPseudoOp && It->isPseudoProbe())))
1329 --It;
1330 return It;
1331}
1332
1333/// Increment \p It, then continue incrementing it while it points to a debug
1334/// instruction. A replacement for std::next.
1335template <typename IterT>
1336inline IterT next_nodbg(IterT It, IterT End, bool SkipPseudoOp = true) {
1337 return skipDebugInstructionsForward(std::next(It), End, SkipPseudoOp);
1338}
1339
1340/// Decrement \p It, then continue decrementing it while it points to a debug
1341/// instruction. A replacement for std::prev.
1342template <typename IterT>
1343inline IterT prev_nodbg(IterT It, IterT Begin, bool SkipPseudoOp = true) {
1344 return skipDebugInstructionsBackward(std::prev(It), Begin, SkipPseudoOp);
1345}
1346
1347/// Construct a range iterator which begins at \p It and moves forwards until
1348/// \p End is reached, skipping any debug instructions.
1349template <typename IterT>
1350inline auto instructionsWithoutDebug(IterT It, IterT End,
1351 bool SkipPseudoOp = true) {
1352 return make_filter_range(make_range(It, End), [=](const MachineInstr &MI) {
1353 return !MI.isDebugInstr() && !(SkipPseudoOp && MI.isPseudoProbe());
1354 });
1355}
1356
1357} // end namespace llvm
1358
1359#endif // LLVM_CODEGEN_MACHINEBASICBLOCK_H
aarch64 promote const
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator MBBI
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::values(clEnumValN(DefaultIT, "arm-default-it", "Generate any type of IT block"), clEnumValN(RestrictedIT, "arm-restrict-it", "Disallow complex IT blocks")))
BlockVerifier::State From
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
bool End
Definition: ELF_riscv.cpp:469
This file defines the little GraphTraits<X> template class that should be specialized by classes that...
IRTranslator LLVM IR MI
A common definition of LaneBitmask for use in TableGen and CodeGen.
print lazy value Lazy Value Info Printer Pass
#define I(x, y, z)
Definition: MD5.cpp:58
#define G(x, y, z)
Definition: MD5.cpp:56
unsigned const TargetRegisterInfo * TRI
unsigned Reg
#define P(N)
uint32_t Number
Definition: Profile.cpp:47
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
This file defines the SparseBitVector class.
Value * RHS
LLVM Basic Block Representation.
Definition: BasicBlock.h:56
static BranchProbability getUnknown()
static void normalizeProbabilities(ProbabilityIter Begin, ProbabilityIter End)
A debug info location.
Definition: DebugLoc.h:33
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
This class prints out the machine instructions using the MIR serialization format.
Definition: MIRPrinter.cpp:138
liveout_iterator(const MachineBasicBlock &MBB, MCPhysReg ExceptionPointer, MCPhysReg ExceptionSelector, bool End)
bool operator==(const liveout_iterator &RHS) const
bool operator!=(const liveout_iterator &RHS) const
const MachineInstr & instr_front() const
bool isInlineAsmBrIndirectTarget() const
Returns true if this is the indirect dest of an INLINEASM_BR.
DebugLoc rfindPrevDebugLoc(reverse_instr_iterator MBBI)
Has exact same behavior as findPrevDebugLoc (it also searches towards the beginning of this MBB) exce...
std::vector< MachineBasicBlock * >::const_reverse_iterator const_pred_reverse_iterator
unsigned pred_size() const
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
std::vector< MachineBasicBlock * >::reverse_iterator succ_reverse_iterator
iterator SkipPHIsLabelsAndDebug(iterator I, bool SkipPseudoOp=true)
Return the first instruction in MBB after I that is not a PHI, label or debug.
iterator erase(MachineInstr *I)
Remove an instruction from the instruction list and delete it.
void normalizeSuccProbs()
Normalize probabilities of all successors so that the sum of them becomes one.
void setAddressTakenIRBlock(BasicBlock *BB)
Set this block to reflect that it corresponds to an IR-level basic block with a BlockAddress.
livein_iterator livein_end() const
iterator getFirstTerminatorForward()
Finds the first terminator in a block by scanning forward.
bool isEHPad() const
Returns true if the block is a landing pad.
iterator_range< liveout_iterator > liveouts() const
const MachineInstr & back() const
void replacePhiUsesWith(MachineBasicBlock *Old, MachineBasicBlock *New)
Update all phi nodes in this basic block to refer to basic block New instead of basic block Old.
void setIsEHCatchretTarget(bool V=true)
Indicates if this is a target block of a catchret.
MachineInstr * remove_instr(MachineInstr *I)
Remove the possibly bundled instruction from the instruction list without deleting it.
instr_iterator instr_begin()
void setIsEndSection(bool V=true)
void setIrrLoopHeaderWeight(uint64_t Weight)
MachineBasicBlock * getLogicalFallThrough()
Return the fallthrough block if the block can implicitly transfer control to it's successor,...
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
void setIsCleanupFuncletEntry(bool V=true)
Indicates if this is the entry block of a cleanup funclet.
std::vector< MachineBasicBlock * >::reverse_iterator pred_reverse_iterator
DebugLoc rfindPrevDebugLoc(reverse_iterator MBBI)
MCSymbol * getEHCatchretSymbol() const
Return the EHCatchret Symbol for this basic block.
const_pred_iterator pred_end() const
void moveBefore(MachineBasicBlock *NewAfter)
Move 'this' block before or after the specified block.
void setLabelMustBeEmitted()
Set this block to reflect that, regardless how we flow to it, we need its label be emitted.
reverse_iterator rend()
void replaceSuccessor(MachineBasicBlock *Old, MachineBasicBlock *New)
Replace successor OLD with NEW and update probability info.
const_pred_reverse_iterator pred_rend() const
MachineBasicBlock * getFallThrough(bool JumpToFallThrough=true)
Return the fallthrough block if the block can implicitly transfer control to the block after it by fa...
void transferSuccessors(MachineBasicBlock *FromMBB)
Transfers all the successors from MBB to this machine basic block (i.e., copies all the successors Fr...
bool hasLabelMustBeEmitted() const
Test whether this block must have its label emitted.
const_iterator getFirstNonDebugInstr(bool SkipPseudoOp=true) const
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
BranchProbability getSuccProbability(const_succ_iterator Succ) const
Return probability of the edge from this block to MBB.
const_reverse_instr_iterator instr_rend() const
iterator_range< livein_iterator > liveins() const
void setAlignment(Align A, unsigned MaxBytes)
iterator_range< iterator > phis()
Returns a range that iterates over the phis in the basic block.
reverse_instr_iterator instr_rbegin()
MachineInstrBundleIterator< const MachineInstr, true > const_reverse_iterator
instr_iterator erase_instr(MachineInstr *I)
Remove an instruction from the instruction list and delete it.
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
void push_back(MachineInstr *MI)
iterator SkipPHIsAndLabels(iterator I)
Return the first instruction in MBB after I that is not a PHI or a label.
pred_reverse_iterator pred_rbegin()
std::vector< MachineBasicBlock * >::const_iterator const_succ_iterator
void addSuccessorWithoutProb(MachineBasicBlock *Succ)
Add Succ as a successor of this MachineBasicBlock.
void setCallFrameSize(unsigned N)
Set the call frame size on entry to this basic block.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
void splitSuccessor(MachineBasicBlock *Old, MachineBasicBlock *New, bool NormalizeSuccProbs=false)
Split the old successor into old plus new and updates the probability info.
liveout_iterator liveout_end() const
const_instr_iterator instr_begin() const
const_succ_iterator succ_begin() const
const_succ_reverse_iterator succ_rbegin() const
pred_reverse_iterator pred_rend()
@ PrintNameIr
Add IR name where available.
@ PrintNameAttributes
Print attributes.
void updateTerminator(MachineBasicBlock *PreviousLayoutSuccessor)
Update the terminator instructions in block to account for changes to block layout which may have bee...
std::vector< MachineBasicBlock * >::const_iterator const_pred_iterator
std::vector< MachineBasicBlock * >::const_reverse_iterator const_succ_reverse_iterator
bool isLiveIn(MCPhysReg Reg, LaneBitmask LaneMask=LaneBitmask::getAll()) const
Return true if the specified register is in the live in set.
bool canFallThrough()
Return true if the block can implicitly transfer control to the block after it by falling off the end...
void setSuccProbability(succ_iterator I, BranchProbability Prob)
Set successor probability of a given iterator.
iterator getFirstNonDebugInstr(bool SkipPseudoOp=true)
Returns an iterator to the first non-debug instruction in the basic block, or end().
DebugLoc rfindDebugLoc(reverse_iterator MBBI)
std::optional< unsigned > getBBID() const
iterator erase(iterator I, iterator E)
Remove a range of instructions from the instruction list and delete them.
const MachineInstr & front() const
void printAsOperand(raw_ostream &OS, bool PrintType=true) const
MachineInstr * remove(MachineInstr *I)
Remove the unbundled instruction from the instruction list without deleting it.
const_instr_range instrs() const
const_reverse_iterator rbegin() const
void clearBasicBlock()
Remove the reference to the underlying IR BasicBlock.
unsigned getMaxBytesForAlignment() const
Return the maximum amount of padding allowed for aligning the basic block.
void setMaxBytesForAlignment(unsigned MaxBytes)
Set the maximum amount of padding allowed for aligning the basic block.
void validateSuccProbs() const
Validate successors' probabilities and check if the sum of them is approximate one.
iterator_range< const_pred_iterator > predecessors() const
const MachineInstr & instr_back() const
bool isIRBlockAddressTaken() const
Test whether this block is the target of an IR BlockAddress.
LiveInVector::const_iterator livein_iterator
MCSymbol * getEndSymbol() const
Returns the MCSymbol marking the end of this basic block.
void splice(iterator Where, MachineBasicBlock *Other, iterator From, iterator To)
Take a block of instructions from MBB 'Other' in the range [From, To), and insert them into this MBB ...
void clearLiveIns()
Clear live in list.
bool isEHFuncletEntry() const
Returns true if this is the entry block of an EH funclet.
const_iterator getLastNonDebugInstr(bool SkipPseudoOp=true) const
LivenessQueryResult computeRegisterLiveness(const TargetRegisterInfo *TRI, MCRegister Reg, const_iterator Before, unsigned Neighborhood=10) const
Return whether (physical) register Reg has been defined and not killed as of just before Before.
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
bool sameSection(const MachineBasicBlock *MBB) const
Returns true if this and MBB belong to the same section.
iterator insert(iterator I, MachineInstr *MI)
Insert MI into the instruction list before I.
livein_iterator livein_begin() const
unsigned succ_size() const
bool isReturnBlock() const
Convenience function that returns true if the block ends in a return instruction.
iterator_range< livein_iterator > liveins_dbg() const
const uint32_t * getBeginClobberMask(const TargetRegisterInfo *TRI) const
Get the clobber mask for the start of this basic block.
bool hasAddressTaken() const
Test whether this block is used as something other than the target of a terminator,...
MBBSectionID getSectionID() const
Returns the section ID of this basic block.
void setAlignment(Align A)
Set alignment of the basic block.
bool isEHScopeEntry() const
Returns true if this is the entry block of an EH scope, i.e., the block that used to have a catchpad ...
std::vector< MachineBasicBlock * >::iterator succ_iterator
MachineInstr & instr_back()
bool isEntryBlock() const
Returns true if this is the entry block of the function.
iterator_range< const_instr_iterator > const_instr_range
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
const_pred_reverse_iterator pred_rbegin() const
void addLiveIn(const RegisterMaskPair &RegMaskPair)
MachineBasicBlock * getSingleSuccessor()
BasicBlock * getAddressTakenIRBlock() const
Retrieves the BasicBlock which corresponds to this MachineBasicBlock.
unsigned getSectionIDNum() const
Returns the unique section ID number of this basic block.
bool isEHCatchretTarget() const
Returns true if this is a target block of a catchret.
const_iterator getFirstNonPHI() const
void sortUniqueLiveIns()
Sorts and uniques the LiveIns vector.
const MachineBasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
iterator_range< const_iterator > phis() const
const_instr_iterator instr_end() const
liveout_iterator liveout_begin() const
Iterator scanning successor basic blocks' liveins to determine the registers potentially live at the ...
DebugLoc findDebugLoc(iterator MBBI)
void removeSuccessor(MachineBasicBlock *Succ, bool NormalizeSuccProbs=false)
Remove successor from the successors list of this MachineBasicBlock.
const_succ_iterator succ_end() const
iterator getFirstNonPHI()
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
const_iterator begin() const
bool isPredecessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a predecessor of this block.
bool hasSuccessorProbabilities() const
Return true if any of the successors have probabilities attached to them.
void setSectionID(MBBSectionID V)
Sets the section ID for this basic block.
iterator_range< const_iterator > terminators() const
livein_iterator livein_begin_dbg() const
Unlike livein_begin, this method does not check that the liveness information is accurate.
DebugLoc rfindDebugLoc(reverse_instr_iterator MBBI)
Has exact same behavior as findDebugLoc (it also searches towards the end of this MBB) except that th...
const_pred_iterator pred_begin() const
void print(raw_ostream &OS, const SlotIndexes *=nullptr, bool IsStandalone=true) const
reverse_instr_iterator instr_rend()
const_reverse_iterator rend() const
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any debug instructions.
Instructions::iterator instr_iterator
iterator getLastNonDebugInstr(bool SkipPseudoOp=true)
Returns an iterator to the last non-debug instruction in the basic block, or end().
void ReplaceUsesOfBlockWith(MachineBasicBlock *Old, MachineBasicBlock *New)
Given a machine basic block that branched to 'Old', change the code and CFG so that it branches to 'N...
MachineInstrBundleIterator< MachineInstr, true > reverse_iterator
MachineBasicBlock * SplitCriticalEdge(MachineBasicBlock *Succ, Pass &P, std::vector< SparseBitVector<> > *LiveInSets=nullptr)
Split the critical edge from this block to the given successor block, and return the newly created bl...
succ_reverse_iterator succ_rbegin()
bool isLayoutSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB will be emitted immediately after this block, such that if this bloc...
static Instructions MachineBasicBlock::* getSublistAccess(MachineInstr *)
Support for MachineInstr::getNextNode().
DebugLoc findPrevDebugLoc(instr_iterator MBBI)
Find the previous valid DebugLoc preceding MBBI, skipping any debug instructions.
MachineBasicBlock * splitAt(MachineInstr &SplitInst, bool UpdateLiveIns=true, LiveIntervals *LIS=nullptr)
Split a basic block into 2 pieces at SplitPoint.
MachineFunction * getParent()
void eraseFromParent()
This method unlinks 'this' from the containing function and deletes it.
void setIsInlineAsmBrIndirectTarget(bool V=true)
Indicates if this is the indirect dest of an INLINEASM_BR.
instr_iterator instr_end()
Instructions::const_iterator const_instr_iterator
iterator_range< const_succ_iterator > successors() const
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
const_iterator getFirstTerminator() const
const_succ_reverse_iterator succ_rend() const
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
std::string getFullName() const
Return a formatted string to identify this block and its parent function.
bool isBeginSection() const
Returns true if this block begins any section.
DebugLoc findPrevDebugLoc(iterator MBBI)
iterator_range< iterator > terminators()
unsigned getCallFrameSize() const
Return the call frame size on entry to this basic block.
void setIsEHFuncletEntry(bool V=true)
Indicates if this is the entry block of an EH funclet.
void setBBID(unsigned V)
Sets the fixed BBID of this basic block.
DebugLoc findBranchDebugLoc()
Find and return the merged DebugLoc of the branch instructions of the block.
iterator_range< succ_iterator > successors()
instr_iterator getFirstInstrTerminator()
Same getFirstTerminator but it ignores bundles and return an instr_iterator instead.
reverse_iterator rbegin()
bool isMachineBlockAddressTaken() const
Test whether this block is used as something other than the target of a terminator,...
void printName(raw_ostream &os, unsigned printNameFlags=PrintNameIr, ModuleSlotTracker *moduleSlotTracker=nullptr) const
Print the basic block's name as:
iterator insertAfter(iterator I, MachineInstr *MI)
Insert MI into the instruction list after I.
bool isSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a successor of this block.
iterator_range< pred_iterator > predecessors()
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
bool isEHScopeReturnBlock() const
Convenience function that returns true if the bock ends in a EH scope return instruction.
bool isEndSection() const
Returns true if this block ends any section.
Align getAlignment() const
Return alignment of the basic block.
bool canSplitCriticalEdge(const MachineBasicBlock *Succ) const
Check if the edge between this block and the given successor Succ, can be split.
MachineInstrBundleIterator< MachineInstr > iterator
bool isLegalToHoistInto() const
Returns true if it is legal to hoist instructions into this block.
MachineInstr & instr_front()
const_reverse_instr_iterator instr_rbegin() const
iterator erase(iterator I)
Remove an instruction or bundle from the instruction list and delete it.
instr_iterator insertAfterBundle(instr_iterator I, MachineInstr *MI)
If I is bundled then insert MI into the instruction list after the end of the bundle,...
const_iterator end() const
StringRef getName() const
Return the name of the corresponding LLVM basic block, or an empty string.
void copySuccessor(MachineBasicBlock *Orig, succ_iterator I)
Copy a successor (and any probability info) from original block to this block's.
bool mayHaveInlineAsmBr() const
Returns true if this block may have an INLINEASM_BR (overestimate, by checking if any of the successo...
void removeLiveIn(MCPhysReg Reg, LaneBitmask LaneMask=LaneBitmask::getAll())
Remove the specified register from the live in set.
LivenessQueryResult
Possible outcome of a register liveness query to computeRegisterLiveness()
@ LQR_Dead
Register is known to be fully dead.
@ LQR_Live
Register is known to be (at least partially) live.
@ LQR_Unknown
Register liveness not decidable from local neighborhood.
void setIsEHScopeEntry(bool V=true)
Indicates if this is the entry block of an EH scope, i.e., the block that that used to have a catchpa...
void moveAfter(MachineBasicBlock *NewBefore)
succ_reverse_iterator succ_rend()
void setMachineBlockAddressTaken()
Set this block to indicate that its address is used as something other than the target of a terminato...
std::optional< uint64_t > getIrrLoopHeaderWeight() const
std::vector< MachineBasicBlock * >::iterator pred_iterator
const uint32_t * getEndClobberMask(const TargetRegisterInfo *TRI) const
Get the clobber mask for the end of the basic block.
void setIsBeginSection(bool V=true)
bool sizeWithoutDebugLargerThan(unsigned Limit) const
iterator_range< instr_iterator > instr_range
MachineBasicBlock * removeFromParent()
This method unlinks 'this' from the containing function, and returns it, but does not delete it.
void insert(iterator I, IT S, IT E)
Insert a range of instructions into the instruction list before I.
void setIsEHPad(bool V=true)
Indicates the block is a landing pad.
Instructions::reverse_iterator reverse_instr_iterator
bool isCleanupFuncletEntry() const
Returns true if this is the entry block of a cleanup funclet.
static MachineInstrBundleIterator getAtBundleBegin(instr_iterator MI)
Get the bundle iterator for the given instruction's bundle.
MachineInstrSpan provides an interface to get an iteration range containing the instruction it was in...
MachineBasicBlock::iterator getInitial()
MachineInstrSpan(MachineBasicBlock::iterator I, MachineBasicBlock *BB)
MachineBasicBlock::iterator begin()
MachineBasicBlock::iterator end()
Representation of each machine instruction.
Definition: MachineInstr.h:68
bool isReturn(QueryType Type=AnyInBundle) const
Definition: MachineInstr.h:905
bool isEHScopeReturn(QueryType Type=AnyInBundle) const
Return true if this is an instruction that marks the end of an EH scope, i.e., a catchpad or a cleanu...
Definition: MachineInstr.h:911
Manage lifetime of a slot tracker for printing IR.
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:94
Simple wrapper around std::function<void(raw_ostream&)>.
Definition: Printable.h:38
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
SlotIndexes pass.
Definition: SlotIndexes.h:301
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
Iterator for intrusive lists based on ilist_node.
An ilist node that can access its parent list.
Definition: ilist_node.h:257
base_list_type::const_reverse_iterator const_reverse_iterator
Definition: ilist.h:125
An intrusive list with ownership and callbacks specified/controlled by ilist_traits,...
Definition: ilist.h:328
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
A simple intrusive list implementation.
Definition: simple_ilist.h:81
This file defines classes to implement an intrusive doubly linked list class (i.e.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
IterT next_nodbg(IterT It, IterT End, bool SkipPseudoOp=true)
Increment It, then continue incrementing it while it points to a debug instruction.
auto successors(const MachineBasicBlock *BB)
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition: MCRegister.h:21
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
IterT skipDebugInstructionsForward(IterT It, IterT End, bool SkipPseudoOp=true)
Increment It until it points to a non-debug instruction or to End and return the resulting iterator.
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
Definition: STLExtras.h:582
auto instructionsWithoutDebug(IterT It, IterT End, bool SkipPseudoOp=true)
Construct a range iterator which begins at It and moves forwards until End is reached,...
IterT skipDebugInstructionsBackward(IterT It, IterT Begin, bool SkipPseudoOp=true)
Decrement It until it points to a non-debug instruction or to Begin and return the resulting iterator...
@ Other
Any other memory.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:292
auto predecessors(const MachineBasicBlock *BB)
IterT prev_nodbg(IterT It, IterT Begin, bool SkipPseudoOp=true)
Decrement It, then continue decrementing it while it points to a debug instruction.
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
#define N
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
static NodeRef getEntryNode(Inverse< MachineBasicBlock * > G)
static ChildIteratorType child_begin(NodeRef N)
static NodeRef getEntryNode(Inverse< const MachineBasicBlock * > G)
MachineBasicBlock::const_pred_iterator ChildIteratorType
MachineBasicBlock::succ_iterator ChildIteratorType
static NodeRef getEntryNode(MachineBasicBlock *BB)
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
MachineBasicBlock::const_succ_iterator ChildIteratorType
static ChildIteratorType child_begin(NodeRef N)
static NodeRef getEntryNode(const MachineBasicBlock *BB)
static ChildIteratorType child_end(NodeRef N)
static constexpr LaneBitmask getAll()
Definition: LaneBitmask.h:82
unsigned operator()(const MachineBasicBlock *MBB) const
bool operator!=(const MBBSectionID &Other) const
static const MBBSectionID ExceptionSectionID
static const MBBSectionID ColdSectionID
MBBSectionID(unsigned N)
enum llvm::MBBSectionID::SectionType Type
bool operator==(const MBBSectionID &Other) const
Pair of physical register and lane mask.
RegisterMaskPair(MCPhysReg PhysReg, LaneBitmask LaneMask)
Callbacks do nothing by default in iplist and ilist.
Definition: ilist.h:65
void transferNodesFromList(ilist_traits &FromList, instr_iterator First, instr_iterator Last)
void addNodeToList(MachineInstr *N)
void removeNodeFromList(MachineInstr *N)
void deleteNode(MachineInstr *MI)
Template traits for intrusive list.
Definition: ilist.h:90