LLVM 22.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::MachineBasicBlock Class Reference

#include "llvm/CodeGen/MachineBasicBlock.h"

Inheritance diagram for llvm::MachineBasicBlock:
[legend]

Classes

class  liveout_iterator
 
struct  RegisterMaskPair
 Pair of physical register and lane mask. More...
 
struct  SplitCriticalEdgeAnalyses
 Split the critical edge from this block to the given successor block, and return the newly created block, or null if splitting is not possible. More...
 

Public Types

enum  LivenessQueryResult { LQR_Live , LQR_Dead , LQR_Unknown }
 Possible outcome of a register liveness query to computeRegisterLiveness() More...
 
enum  PrintNameFlag { PrintNameIr = (1 << 0) , PrintNameAttributes = (1 << 1) }
 
using instr_iterator = Instructions::iterator
 
using const_instr_iterator = Instructions::const_iterator
 
using reverse_instr_iterator = Instructions::reverse_iterator
 
using const_reverse_instr_iterator = Instructions::const_reverse_iterator
 
using iterator = MachineInstrBundleIterator< MachineInstr >
 
using const_iterator = MachineInstrBundleIterator< const MachineInstr >
 
using reverse_iterator = MachineInstrBundleIterator< MachineInstr, true >
 
using const_reverse_iterator = MachineInstrBundleIterator< const MachineInstr, true >
 
using instr_range = iterator_range< instr_iterator >
 
using const_instr_range = iterator_range< const_instr_iterator >
 
using pred_iterator = SmallVectorImpl< MachineBasicBlock * >::iterator
 
using const_pred_iterator = SmallVectorImpl< MachineBasicBlock * >::const_iterator
 
using succ_iterator = SmallVectorImpl< MachineBasicBlock * >::iterator
 
using const_succ_iterator = SmallVectorImpl< MachineBasicBlock * >::const_iterator
 
using pred_reverse_iterator = SmallVectorImpl< MachineBasicBlock * >::reverse_iterator
 
using const_pred_reverse_iterator = SmallVectorImpl< MachineBasicBlock * >::const_reverse_iterator
 
using succ_reverse_iterator = SmallVectorImpl< MachineBasicBlock * >::reverse_iterator
 
using const_succ_reverse_iterator = SmallVectorImpl< MachineBasicBlock * >::const_reverse_iterator
 
using livein_iterator = LiveInVector::const_iterator
 

Public Member Functions

const BasicBlockgetBasicBlock () const
 Return the LLVM basic block that this instance corresponded to originally.
 
void clearBasicBlock ()
 Remove the reference to the underlying IR BasicBlock.
 
LLVM_ABI bool hasName () const
 Check if there is a name of corresponding LLVM basic block.
 
LLVM_ABI StringRef getName () const
 Return the name of the corresponding LLVM basic block, or an empty string.
 
LLVM_ABI std::string getFullName () const
 Return a formatted string to identify this block and its parent function.
 
bool hasAddressTaken () const
 Test whether this block is used as something other than the target of a terminator, exception-handling target, or jump table.
 
bool isMachineBlockAddressTaken () const
 Test whether this block is used as something other than the target of a terminator, exception-handling target, jump table, or IR blockaddress.
 
bool isIRBlockAddressTaken () const
 Test whether this block is the target of an IR BlockAddress.
 
BasicBlockgetAddressTakenIRBlock () const
 Retrieves the BasicBlock which corresponds to this MachineBasicBlock.
 
void setMachineBlockAddressTaken ()
 Set this block to indicate that its address is used as something other than the target of a terminator, exception-handling target, jump table, or IR-level "blockaddress".
 
void setAddressTakenIRBlock (BasicBlock *BB)
 Set this block to reflect that it corresponds to an IR-level basic block with a BlockAddress.
 
bool hasLabelMustBeEmitted () const
 Test whether this block must have its label emitted.
 
void setLabelMustBeEmitted ()
 Set this block to reflect that, regardless how we flow to it, we need its label be emitted.
 
const MachineFunctiongetParent () const
 Return the MachineFunction containing this basic block.
 
MachineFunctiongetParent ()
 
bool terminatorIsComputedGotoWithSuccessors () const
 Returns true if the original IR terminator is an indirectbr with successor blocks.
 
unsigned size () const
 
LLVM_ABI bool sizeWithoutDebugLargerThan (unsigned Limit) const
 
bool empty () const
 
MachineInstrinstr_front ()
 
MachineInstrinstr_back ()
 
const MachineInstrinstr_front () const
 
const MachineInstrinstr_back () const
 
MachineInstrfront ()
 
MachineInstrback ()
 
const MachineInstrfront () const
 
const MachineInstrback () const
 
instr_iterator instr_begin ()
 
const_instr_iterator instr_begin () const
 
instr_iterator instr_end ()
 
const_instr_iterator instr_end () const
 
reverse_instr_iterator instr_rbegin ()
 
const_reverse_instr_iterator instr_rbegin () const
 
reverse_instr_iterator instr_rend ()
 
const_reverse_instr_iterator instr_rend () const
 
instr_range instrs ()
 
const_instr_range instrs () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
iterator_range< iteratorterminators ()
 
iterator_range< const_iteratorterminators () const
 
iterator_range< iteratorphis ()
 Returns a range that iterates over the phis in the basic block.
 
iterator_range< const_iteratorphis () const
 
pred_iterator pred_begin ()
 
const_pred_iterator pred_begin () const
 
pred_iterator pred_end ()
 
const_pred_iterator pred_end () const
 
pred_reverse_iterator pred_rbegin ()
 
const_pred_reverse_iterator pred_rbegin () const
 
pred_reverse_iterator pred_rend ()
 
const_pred_reverse_iterator pred_rend () const
 
unsigned pred_size () const
 
bool pred_empty () const
 
succ_iterator succ_begin ()
 
const_succ_iterator succ_begin () const
 
succ_iterator succ_end ()
 
const_succ_iterator succ_end () const
 
succ_reverse_iterator succ_rbegin ()
 
const_succ_reverse_iterator succ_rbegin () const
 
succ_reverse_iterator succ_rend ()
 
const_succ_reverse_iterator succ_rend () const
 
unsigned succ_size () const
 
bool succ_empty () const
 
iterator_range< pred_iteratorpredecessors ()
 
iterator_range< const_pred_iteratorpredecessors () const
 
iterator_range< succ_iteratorsuccessors ()
 
iterator_range< const_succ_iteratorsuccessors () const
 
void addLiveIn (MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
 Adds the specified register as a live in.
 
void addLiveIn (const RegisterMaskPair &RegMaskPair)
 
LLVM_ABI void sortUniqueLiveIns ()
 Sorts and uniques the LiveIns vector.
 
LLVM_ABI void clearLiveIns ()
 Clear live in list.
 
LLVM_ABI void clearLiveIns (std::vector< RegisterMaskPair > &OldLiveIns)
 Clear the live in list, and return the removed live in's in OldLiveIns.
 
LLVM_ABI Register addLiveIn (MCRegister PhysReg, const TargetRegisterClass *RC)
 Add PhysReg as live in to this block, and ensure that there is a copy of PhysReg to a virtual register of class RC.
 
LLVM_ABI void removeLiveIn (MCRegister Reg, LaneBitmask LaneMask=LaneBitmask::getAll())
 Remove the specified register from the live in set.
 
LLVM_ABI bool isLiveIn (MCRegister Reg, LaneBitmask LaneMask=LaneBitmask::getAll()) const
 Return true if the specified register is in the live in set.
 
livein_iterator livein_begin_dbg () const
 Unlike livein_begin, this method does not check that the liveness information is accurate.
 
iterator_range< livein_iteratorliveins_dbg () const
 
LLVM_ABI livein_iterator livein_begin () const
 
livein_iterator livein_end () const
 
bool livein_empty () const
 
iterator_range< livein_iteratorliveins () const
 
LLVM_ABI livein_iterator removeLiveIn (livein_iterator I)
 Remove entry from the livein set and return iterator to the next.
 
const std::vector< RegisterMaskPair > & getLiveIns () const
 
LLVM_ABI liveout_iterator liveout_begin () const
 Iterator scanning successor basic blocks' liveins to determine the registers potentially live at the end of this block.
 
liveout_iterator liveout_end () const
 
iterator_range< liveout_iteratorliveouts () const
 
LLVM_ABI const uint32_tgetBeginClobberMask (const TargetRegisterInfo *TRI) const
 Get the clobber mask for the start of this basic block.
 
LLVM_ABI const uint32_tgetEndClobberMask (const TargetRegisterInfo *TRI) const
 Get the clobber mask for the end of the basic block.
 
Align getAlignment () const
 Return alignment of the basic block.
 
void setAlignment (Align A)
 Set alignment of the basic block.
 
void setAlignment (Align A, unsigned MaxBytes)
 
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.
 
bool isEHPad () const
 Returns true if the block is a landing pad.
 
void setIsEHPad (bool V=true)
 Indicates the block is a landing pad.
 
LLVM_ABI bool hasEHPadSuccessor () const
 
LLVM_ABI bool isEntryBlock () const
 Returns true if this is the entry block of the function.
 
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 or cleanuppad instruction in the LLVM IR.
 
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 catchpad or cleanuppad instruction in the LLVM IR.
 
bool isEHContTarget () const
 Returns true if this is a target of Windows EH Continuation Guard.
 
void setIsEHContTarget (bool V=true)
 Indicates if this is a target of Windows EH Continuation Guard.
 
bool isEHFuncletEntry () const
 Returns true if this is the entry block of an EH funclet.
 
void setIsEHFuncletEntry (bool V=true)
 Indicates if this is the entry block of an EH funclet.
 
bool isCleanupFuncletEntry () const
 Returns true if this is the entry block of a cleanup funclet.
 
void setIsCleanupFuncletEntry (bool V=true)
 Indicates if this is the entry block of a cleanup funclet.
 
bool isBeginSection () const
 Returns true if this block begins any section.
 
bool isEndSection () const
 Returns true if this block ends any section.
 
void setIsBeginSection (bool V=true)
 
void setIsEndSection (bool V=true)
 
std::optional< UniqueBBIDgetBBID () const
 
MBBSectionID getSectionID () const
 Returns the section ID of this basic block.
 
void setBBID (const UniqueBBID &V)
 Sets the fixed BBID of this basic block.
 
void setSectionID (MBBSectionID V)
 Sets the section ID for this basic block.
 
LLVM_ABI MCSymbolgetEndSymbol () const
 Returns the MCSymbol marking the end of this basic block.
 
LLVM_ABI bool mayHaveInlineAsmBr () const
 Returns true if this block may have an INLINEASM_BR (overestimate, by checking if any of the successors are indirect targets of any inlineasm_br in the function).
 
bool isInlineAsmBrIndirectTarget () const
 Returns true if this is the indirect dest of an INLINEASM_BR.
 
void setIsInlineAsmBrIndirectTarget (bool V=true)
 Indicates if this is the indirect dest of an INLINEASM_BR.
 
LLVM_ABI bool isLegalToHoistInto () const
 Returns true if it is legal to hoist instructions into this block.
 
LLVM_ABI void moveBefore (MachineBasicBlock *NewAfter)
 Move 'this' block before or after the specified block.
 
LLVM_ABI void moveAfter (MachineBasicBlock *NewBefore)
 
bool sameSection (const MachineBasicBlock *MBB) const
 Returns true if this and MBB belong to the same section.
 
LLVM_ABI void updateTerminator (MachineBasicBlock *PreviousLayoutSuccessor)
 Update the terminator instructions in block to account for changes to block layout which may have been made.
 
LLVM_ABI void addSuccessor (MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
 Add Succ as a successor of this MachineBasicBlock.
 
LLVM_ABI void addSuccessorWithoutProb (MachineBasicBlock *Succ)
 Add Succ as a successor of this MachineBasicBlock.
 
LLVM_ABI void setSuccProbability (succ_iterator I, BranchProbability Prob)
 Set successor probability of a given iterator.
 
void normalizeSuccProbs ()
 Normalize probabilities of all successors so that the sum of them becomes one.
 
LLVM_ABI void validateSuccProbs () const
 Validate successors' probabilities and check if the sum of them is approximate one.
 
LLVM_ABI void removeSuccessor (MachineBasicBlock *Succ, bool NormalizeSuccProbs=false)
 Remove successor from the successors list of this MachineBasicBlock.
 
LLVM_ABI succ_iterator removeSuccessor (succ_iterator I, bool NormalizeSuccProbs=false)
 Remove specified successor from the successors list of this MachineBasicBlock.
 
LLVM_ABI void replaceSuccessor (MachineBasicBlock *Old, MachineBasicBlock *New)
 Replace successor OLD with NEW and update probability info.
 
LLVM_ABI void copySuccessor (const MachineBasicBlock *Orig, succ_iterator I)
 Copy a successor (and any probability info) from original block to this block's.
 
LLVM_ABI void splitSuccessor (MachineBasicBlock *Old, MachineBasicBlock *New, bool NormalizeSuccProbs=false)
 Split the old successor into old plus new and updates the probability info.
 
LLVM_ABI void transferSuccessors (MachineBasicBlock *FromMBB)
 Transfers all the successors from MBB to this machine basic block (i.e., copies all the successors FromMBB and remove all the successors from FromMBB).
 
LLVM_ABI void transferSuccessorsAndUpdatePHIs (MachineBasicBlock *FromMBB)
 Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor blocks which refer to FromMBB to refer to this.
 
bool hasSuccessorProbabilities () const
 Return true if any of the successors have probabilities attached to them.
 
LLVM_ABI bool isPredecessor (const MachineBasicBlock *MBB) const
 Return true if the specified MBB is a predecessor of this block.
 
LLVM_ABI bool isSuccessor (const MachineBasicBlock *MBB) const
 Return true if the specified MBB is a successor of this block.
 
LLVM_ABI bool isLayoutSuccessor (const MachineBasicBlock *MBB) const
 Return true if the specified MBB will be emitted immediately after this block, such that if this block exits by falling through, control will transfer to the specified MBB.
 
LLVM_ABI const MachineBasicBlockgetSingleSuccessor () const
 Return the successor of this block if it has a single successor.
 
MachineBasicBlockgetSingleSuccessor ()
 
LLVM_ABI const MachineBasicBlockgetSinglePredecessor () const
 Return the predecessor of this block if it has a single predecessor.
 
MachineBasicBlockgetSinglePredecessor ()
 
LLVM_ABI MachineBasicBlockgetFallThrough (bool JumpToFallThrough=true)
 Return the fallthrough block if the block can implicitly transfer control to the block after it by falling off the end of it.
 
MachineBasicBlockgetLogicalFallThrough ()
 Return the fallthrough block if the block can implicitly transfer control to it's successor, whether by a branch or a fallthrough.
 
LLVM_ABI bool canFallThrough ()
 Return true if the block can implicitly transfer control to the block after it by falling off the end of it.
 
LLVM_ABI iterator getFirstNonPHI ()
 Returns a pointer to the first instruction in this block that is not a PHINode instruction.
 
const_iterator getFirstNonPHI () const
 
LLVM_ABI iterator SkipPHIsAndLabels (iterator I)
 Return the first instruction in MBB after I that is not a PHI or a label.
 
LLVM_ABI iterator SkipPHIsLabelsAndDebug (iterator I, Register Reg=Register(), bool SkipPseudoOp=true)
 Return the first instruction in MBB after I that is not a PHI, label or debug.
 
LLVM_ABI iterator getFirstTerminator ()
 Returns an iterator to the first terminator instruction of this basic block.
 
const_iterator getFirstTerminator () const
 
LLVM_ABI instr_iterator getFirstInstrTerminator ()
 Same getFirstTerminator but it ignores bundles and return an instr_iterator instead.
 
LLVM_ABI iterator getFirstTerminatorForward ()
 Finds the first terminator in a block by scanning forward.
 
LLVM_ABI iterator getFirstNonDebugInstr (bool SkipPseudoOp=true)
 Returns an iterator to the first non-debug instruction in the basic block, or end().
 
const_iterator getFirstNonDebugInstr (bool SkipPseudoOp=true) const
 
LLVM_ABI iterator getLastNonDebugInstr (bool SkipPseudoOp=true)
 Returns an iterator to the last non-debug instruction in the basic block, or end().
 
const_iterator getLastNonDebugInstr (bool SkipPseudoOp=true) const
 
bool isReturnBlock () const
 Convenience function that returns true if the block ends in a return instruction.
 
bool isEHScopeReturnBlock () const
 Convenience function that returns true if the bock ends in a EH scope return instruction.
 
LLVM_ABI MachineBasicBlocksplitAt (MachineInstr &SplitInst, bool UpdateLiveIns=true, LiveIntervals *LIS=nullptr)
 Split a basic block into 2 pieces at SplitPoint.
 
MachineBasicBlockSplitCriticalEdge (MachineBasicBlock *Succ, Pass &P, std::vector< SparseBitVector<> > *LiveInSets=nullptr, MachineDomTreeUpdater *MDTU=nullptr)
 
MachineBasicBlockSplitCriticalEdge (MachineBasicBlock *Succ, MachineFunctionAnalysisManager &MFAM, std::vector< SparseBitVector<> > *LiveInSets=nullptr, MachineDomTreeUpdater *MDTU=nullptr)
 
LLVM_ABI MachineBasicBlockSplitCriticalEdge (MachineBasicBlock *Succ, const SplitCriticalEdgeAnalyses &Analyses, std::vector< SparseBitVector<> > *LiveInSets, MachineDomTreeUpdater *MDTU)
 
LLVM_ABI MachineBasicBlockSplitCriticalEdge (MachineBasicBlock *Succ, Pass *P, MachineFunctionAnalysisManager *MFAM, std::vector< SparseBitVector<> > *LiveInSets, MachineDomTreeUpdater *MDTU)
 
LLVM_ABI bool canSplitCriticalEdge (const MachineBasicBlock *Succ) const
 Check if the edge between this block and the given successor Succ, can be split.
 
void pop_front ()
 
void pop_back ()
 
void push_back (MachineInstr *MI)
 
LLVM_ABI instr_iterator insert (instr_iterator I, MachineInstr *M)
 Insert MI into the instruction list before I, possibly inside a bundle.
 
template<typename IT >
void insert (iterator I, IT S, IT E)
 Insert a range of instructions into the instruction list before I.
 
iterator insert (iterator I, MachineInstr *MI)
 Insert MI into the instruction list before I.
 
iterator insertAfter (iterator I, MachineInstr *MI)
 Insert MI into the instruction list after I.
 
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, otherwise insert MI immediately after I.
 
LLVM_ABI instr_iterator erase (instr_iterator I)
 Remove an instruction from the instruction list and delete it.
 
instr_iterator erase_instr (MachineInstr *I)
 Remove an instruction from the instruction list and delete it.
 
iterator erase (iterator I, iterator E)
 Remove a range of instructions from the instruction list and delete them.
 
iterator erase (iterator I)
 Remove an instruction or bundle from the instruction list and delete it.
 
iterator erase (MachineInstr *I)
 Remove an instruction from the instruction list and delete it.
 
MachineInstrremove (MachineInstr *I)
 Remove the unbundled instruction from the instruction list without deleting it.
 
LLVM_ABI MachineInstrremove_instr (MachineInstr *I)
 Remove the possibly bundled instruction from the instruction list without deleting it.
 
void clear ()
 
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 'Where'.
 
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 right before 'Where'.
 
LLVM_ABI MachineBasicBlockremoveFromParent ()
 This method unlinks 'this' from the containing function, and returns it, but does not delete it.
 
LLVM_ABI void eraseFromParent ()
 This method unlinks 'this' from the containing function and deletes it.
 
LLVM_ABI 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 'New' instead.
 
LLVM_ABI 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.
 
LLVM_ABI DebugLoc findDebugLoc (instr_iterator MBBI)
 Find the next valid DebugLoc starting at MBBI, skipping any debug instructions.
 
DebugLoc findDebugLoc (iterator MBBI)
 
LLVM_ABI DebugLoc rfindDebugLoc (reverse_instr_iterator MBBI)
 Has exact same behavior as findDebugLoc (it also searches towards the end of this MBB) except that this function takes a reverse iterator to identify the starting MI.
 
DebugLoc rfindDebugLoc (reverse_iterator MBBI)
 
LLVM_ABI DebugLoc findPrevDebugLoc (instr_iterator MBBI)
 Find the previous valid DebugLoc preceding MBBI, skipping any debug instructions.
 
DebugLoc findPrevDebugLoc (iterator MBBI)
 
LLVM_ABI DebugLoc rfindPrevDebugLoc (reverse_instr_iterator MBBI)
 Has exact same behavior as findPrevDebugLoc (it also searches towards the beginning of this MBB) except that this function takes reverse iterator to identify the starting MI.
 
DebugLoc rfindPrevDebugLoc (reverse_iterator MBBI)
 
LLVM_ABI DebugLoc findBranchDebugLoc ()
 Find and return the merged DebugLoc of the branch instructions of the block.
 
LLVM_ABI 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.
 
LLVM_ABI void dump () const
 
LLVM_ABI void print (raw_ostream &OS, const SlotIndexes *=nullptr, bool IsStandalone=true) const
 
LLVM_ABI void print (raw_ostream &OS, ModuleSlotTracker &MST, const SlotIndexes *=nullptr, bool IsStandalone=true) const
 
LLVM_ABI void printName (raw_ostream &os, unsigned printNameFlags=PrintNameIr, ModuleSlotTracker *moduleSlotTracker=nullptr) const
 Print the basic block's name as:
 
LLVM_ABI void printAsOperand (raw_ostream &OS, bool PrintType=true) const
 
int getNumber () const
 MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFunction yet, in which case this will return -1.
 
void setNumber (int N)
 
unsigned getCallFrameSize () const
 Return the call frame size on entry to this basic block.
 
void setCallFrameSize (unsigned N)
 Set the call frame size on entry to this basic block.
 
LLVM_ABI MCSymbolgetSymbol () const
 Return the MCSymbol for this basic block.
 
LLVM_ABI MCSymbolgetEHContSymbol () const
 Return the Windows EH Continuation Symbol for this basic block.
 
std::optional< uint64_tgetIrrLoopHeaderWeight () const
 
void setIrrLoopHeaderWeight (uint64_t Weight)
 
LLVM_ABI BranchProbability getSuccProbability (const_succ_iterator Succ) const
 Return probability of the edge from this block to MBB.
 
LLVM_ABI bool canPredictBranchProbabilities () const
 
- Public Member Functions inherited from llvm::ilist_node_with_parent< MachineBasicBlock, MachineFunction >
MachineBasicBlockgetPrevNode ()
 
const MachineBasicBlockgetPrevNode () const
 Get the previous node, or nullptr for the list head.
 
MachineBasicBlockgetNextNode ()
 Get the next node, or nullptr for the list tail.
 
const MachineBasicBlockgetNextNode () const
 Get the next node, or nullptr for the list tail.
 
- Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
self_iterator getIterator ()
 
const_self_iterator getIterator () const
 
reverse_self_iterator getReverseIterator ()
 
const_reverse_self_iterator getReverseIterator () const
 
std::enable_if_t< T::is_sentinel_tracking_explicit, boolisSentinel () const
 Check whether this is the sentinel node.
 
- Public Member Functions inherited from llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >
const ParentTy * getParent () const
 
ParentTy * getParent ()
 
void setParent (ParentTy *Parent)
 

Static Public Member Functions

static Instructions MachineBasicBlock::* getSublistAccess (MachineInstr *)
 Support for MachineInstr::getNextNode().
 

Friends

class MachineFunction
 
class MachineBranchProbabilityInfo
 
struct ilist_callback_traits< MachineBasicBlock >
 

Additional Inherited Members

- Protected Types inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
using self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, false, false >::type
 
using const_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, false, true >::type
 
using reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, true, false >::type
 
using const_reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, true, true >::type
 
- Protected Member Functions inherited from llvm::ilist_node_with_parent< MachineBasicBlock, MachineFunction >
 ilist_node_with_parent ()=default
 
- Protected Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
 ilist_node_impl ()=default
 

Detailed Description

Definition at line 121 of file MachineBasicBlock.h.

Member Typedef Documentation

◆ const_instr_iterator

Definition at line 337 of file MachineBasicBlock.h.

◆ const_instr_range

Definition at line 371 of file MachineBasicBlock.h.

◆ const_iterator

Definition at line 342 of file MachineBasicBlock.h.

◆ const_pred_iterator

Definition at line 414 of file MachineBasicBlock.h.

◆ const_pred_reverse_iterator

Definition at line 421 of file MachineBasicBlock.h.

◆ const_reverse_instr_iterator

Definition at line 339 of file MachineBasicBlock.h.

◆ const_reverse_iterator

Definition at line 344 of file MachineBasicBlock.h.

◆ const_succ_iterator

Definition at line 417 of file MachineBasicBlock.h.

◆ const_succ_reverse_iterator

Definition at line 425 of file MachineBasicBlock.h.

◆ instr_iterator

Definition at line 336 of file MachineBasicBlock.h.

◆ instr_range

Definition at line 370 of file MachineBasicBlock.h.

◆ iterator

Definition at line 341 of file MachineBasicBlock.h.

◆ livein_iterator

using llvm::MachineBasicBlock::livein_iterator = LiveInVector::const_iterator

Definition at line 514 of file MachineBasicBlock.h.

◆ pred_iterator

Definition at line 413 of file MachineBasicBlock.h.

◆ pred_reverse_iterator

Definition at line 419 of file MachineBasicBlock.h.

◆ reverse_instr_iterator

Definition at line 338 of file MachineBasicBlock.h.

◆ reverse_iterator

Definition at line 343 of file MachineBasicBlock.h.

◆ succ_iterator

Definition at line 416 of file MachineBasicBlock.h.

◆ succ_reverse_iterator

Definition at line 423 of file MachineBasicBlock.h.

Member Enumeration Documentation

◆ LivenessQueryResult

Possible outcome of a register liveness query to computeRegisterLiveness()

Enumerator
LQR_Live 

Register is known to be (at least partially) live.

LQR_Dead 

Register is known to be fully dead.

LQR_Unknown 

Register liveness not decidable from local neighborhood.

Definition at line 1220 of file MachineBasicBlock.h.

◆ PrintNameFlag

Enumerator
PrintNameIr 

Add IR name where available.

PrintNameAttributes 

Print attributes.

Definition at line 1246 of file MachineBasicBlock.h.

Member Function Documentation

◆ addLiveIn() [1/3]

void llvm::MachineBasicBlock::addLiveIn ( const RegisterMaskPair RegMaskPair)
inline

Definition at line 482 of file MachineBasicBlock.h.

◆ addLiveIn() [2/3]

Register MachineBasicBlock::addLiveIn ( MCRegister  PhysReg,
const TargetRegisterClass RC 
)

Add PhysReg as live in to this block, and ensure that there is a copy of PhysReg to a virtual register of class RC.

Return the virtual register that is a copy of the live in PhysReg.

Definition at line 643 of file MachineBasicBlock.cpp.

References addLiveIn(), llvm::MachineInstrBuilder::addReg(), assert(), begin(), llvm::BuildMI(), end(), front(), llvm::TargetSubtargetInfo::getInstrInfo(), getParent(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), I, isEHPad(), isLiveIn(), llvm::MCRegister::isPhysical(), llvm::RegState::Kill, llvm_unreachable, MRI, SkipPHIsAndLabels(), and TII.

◆ addLiveIn() [3/3]

void llvm::MachineBasicBlock::addLiveIn ( MCRegister  PhysReg,
LaneBitmask  LaneMask = LaneBitmask::getAll() 
)
inline

Adds the specified register as a live in.

Note that it is an error to add the same register to the same set more than once unless the intention is to call sortUniqueLiveIns after all registers are added.

Definition at line 478 of file MachineBasicBlock.h.

Referenced by addLiveIn(), addLiveInRegs(), llvm::addLiveIns(), addSavedGPR(), llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::X86FrameLowering::adjustForSegmentedStacks(), buildGitPtr(), llvm::AArch64InstrInfo::buildOutlinedFrame(), llvm::ARMBaseInstrInfo::buildOutlinedFrame(), llvm::RISCVInstrInfo::buildOutlinedFrame(), emitAlignedDPRCS2Spills(), llvm::SIFrameLowering::emitCSRSpillStores(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), llvm::SparcFrameLowering::emitEpilogue(), llvm::AArch64TargetLowering::EmitF128CSEL(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::X86TargetLowering::EmitInstrWithCustomInserter(), llvm::MachineRegisterInfo::EmitLiveInCopies(), llvm::AArch64FrameLowering::emitPrologue(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::SystemZXPLINKFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), emitShadowCallStackPrologue(), emitXBegin(), llvm::getFunctionLiveInPhysReg(), handleMustTailForwardedRegisters(), llvm::MipsFunctionInfo::initGlobalBaseReg(), INITIALIZE_PASS(), llvm::AArch64InstrInfo::insertOutlinedCall(), llvm::ARMBaseInstrInfo::insertOutlinedCall(), llvm::MipsCallLowering::lowerFormalArguments(), llvm::X86InstrInfo::optimizeCompareInstr(), llvm::SIFrameLowering::processFunctionBeforeFrameFinalized(), pushRegsToStack(), llvm::SIFrameLowering::restoreCalleeSavedRegisters(), llvm::IRTranslator::runOnMachineFunction(), llvm::SystemZELFFrameLowering::spillCalleeSavedRegisters(), llvm::SystemZXPLINKFrameLowering::spillCalleeSavedRegisters(), llvm::AArch64FrameLowering::spillCalleeSavedRegisters(), llvm::SIFrameLowering::spillCalleeSavedRegisters(), llvm::M68kFrameLowering::spillCalleeSavedRegisters(), llvm::Mips16FrameLowering::spillCalleeSavedRegisters(), llvm::MipsSEFrameLowering::spillCalleeSavedRegisters(), llvm::MSP430FrameLowering::spillCalleeSavedRegisters(), llvm::PPCFrameLowering::spillCalleeSavedRegisters(), llvm::RISCVFrameLowering::spillCalleeSavedRegisters(), llvm::X86FrameLowering::spillCalleeSavedRegisters(), llvm::XCoreFrameLowering::spillCalleeSavedRegisters(), llvm::XtensaFrameLowering::spillCalleeSavedRegisters(), SplitCriticalEdge(), splitEdge(), tryToSplitRestore(), updateLiveIn(), and updateLiveness().

◆ addSuccessor()

void MachineBasicBlock::addSuccessor ( MachineBasicBlock Succ,
BranchProbability  Prob = BranchProbability::getUnknown() 
)

Add Succ as a successor of this MachineBasicBlock.

The Predecessors list of Succ is automatically updated. PROB parameter is stored in Probabilities list. The default probability is set as unknown. Mixing known and unknown probabilities in successor list is not allowed. When all successors have unknown probabilities, 1 / N is returned as the probability for each successor, where N is the number of successors.

Note that duplicate Machine CFG edges are not allowed.

Definition at line 796 of file MachineBasicBlock.cpp.

Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::ARMFrameLowering::adjustForSegmentedStacks(), llvm::X86FrameLowering::adjustForSegmentedStacks(), copySuccessor(), createDedicatedExit(), llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::SystemZTargetLowering::emitEHSjLjSetJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::AArch64TargetLowering::EmitF128CSEL(), emitFROUND(), llvm::SITargetLowering::EmitInstrWithCustomInserter(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::AVRTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), EmitLoweredCascadedSelect(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::PPCTargetLowering::emitProbedAlloca(), emitReadCounterWidePseudo(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), llvm::VETargetLowering::emitSjLjDispatchBlock(), emitStackProbeInline(), emitVecCondBranchPseudo(), emitXBegin(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::SparcTargetLowering::expandSelectCC(), llvm::FastISel::fastEmitBranch(), llvm::FastISel::finishCondBranch(), INITIALIZE_PASS(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::SystemZELFFrameLowering::inlineStackProbe(), llvm::SystemZXPLINKFrameLowering::inlineStackProbe(), insertDivByZeroTrap(), llvm::SIInstrInfo::insertSimulatedTrap(), llvm::AMDGPULegalizerInfo::legalizeTrapEndpgm(), loadM0FromVGPR(), loadMBUFScalarOperandsFromVGPR(), LowerFPToInt(), LowerMemcpy(), LowerMemset(), llvm::PeelSingleBlockLoop(), llvm::AArch64InstrInfo::probedStackAlloc(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), llvm::ARMBlockPlacement::revertWhileToDoLoop(), splitAt(), splitBlockForLoop(), SplitCriticalEdge(), splitEdge(), splitMBB(), splitSuccessor(), transferSuccessors(), transferSuccessorsAndUpdatePHIs(), tryToSplitRestore(), and llvm::PeelingModuloScheduleExpander::validateAgainstModuloScheduleExpander().

◆ addSuccessorWithoutProb()

void MachineBasicBlock::addSuccessorWithoutProb ( MachineBasicBlock Succ)

Add Succ as a successor of this MachineBasicBlock.

The Predecessors list of Succ is automatically updated. The probability is not provided because BPI is not available (e.g. -O0 is used), in which case edge probabilities won't be used. Using this interface can save some space.

Definition at line 806 of file MachineBasicBlock.cpp.

Referenced by copySuccessor(), llvm::FastISel::fastEmitBranch(), llvm::FastISel::finishCondBranch(), transferSuccessors(), and transferSuccessorsAndUpdatePHIs().

◆ back() [1/2]

MachineInstr & llvm::MachineBasicBlock::back ( )
inline

◆ back() [2/2]

const MachineInstr & llvm::MachineBasicBlock::back ( ) const
inline

Definition at line 359 of file MachineBasicBlock.h.

References end().

◆ begin() [1/2]

iterator llvm::MachineBasicBlock::begin ( )
inline

Definition at line 377 of file MachineBasicBlock.h.

References instr_begin().

Referenced by addLiveIn(), llvm::LiveVariables::addNewBlock(), addUnreachableAfterTryTables(), llvm::R600InstrInfo::analyzeBranch(), llvm::ARCInstrInfo::analyzeBranch(), llvm::BPFInstrInfo::analyzeBranch(), llvm::MSP430InstrInfo::analyzeBranch(), llvm::NVPTXInstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), llvm::SystemZInstrInfo::analyzeBranch(), llvm::XCoreInstrInfo::analyzeBranch(), llvm::XtensaInstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::SparcInstrInfo::analyzeBranch(), llvm::VEInstrInfo::analyzeBranch(), llvm::LanaiInstrInfo::analyzeBranch(), llvm::avoidZeroOffsetLandingPad(), bothUsedInPHI(), llvm::AArch64InstrInfo::buildOutlinedFrame(), llvm::ARMBaseInstrInfo::buildOutlinedFrame(), llvm::RISCVInstrInfo::buildOutlinedFrame(), llvm::GCNDownwardRPTracker::bumpDownwardPressure(), llvm::ErrataWorkaround::checkSeqTN0010(), llvm::ErrataWorkaround::checkSeqTN0010First(), llvm::ErrataWorkaround::checkSeqTN0012(), cloneCfiPrologue(), computeRegisterLiveness(), copyDebugInfoToSuccessor(), CountTerminators(), llvm::SSAUpdaterTraits< MachineSSAUpdater >::CreateEmptyPHI(), llvm::SIInstrInfo::createPHIDestinationCopy(), createPHIsForCMOVsInSinkBB(), createPHIsForSelects(), llvm::MachineDominatorTree::dominates(), dominates(), llvm::M68kFrameLowering::eliminateCallFramePseudoInstr(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::LiveDebugVariables::LDVImpl::emitDebugValues(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::SystemZTargetLowering::emitEHSjLjSetJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), llvm::ARMFrameLowering::emitEpilogue(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::M68kFrameLowering::emitEpilogue(), llvm::MSP430FrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::AArch64TargetLowering::EmitF128CSEL(), emitFROUND(), llvm::AsmPrinter::emitFunctionBody(), emitGPDisp(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::AVRTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), llvm::MachineRegisterInfo::EmitLiveInCopies(), emitLoadM0FromVGPRLoop(), emitLoadScalarOpsFromVGPRLoop(), EmitLoweredCascadedSelect(), emitLpad(), llvm::AArch64FrameLowering::emitPacRetPlusLeafHardening(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::XtensaFrameLowering::emitPrologue(), llvm::AArch64FrameLowering::emitPrologue(), llvm::SIFrameLowering::emitPrologue(), llvm::ARCFrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), llvm::Thumb1FrameLowering::emitPrologue(), llvm::CSKYFrameLowering::emitPrologue(), llvm::LanaiFrameLowering::emitPrologue(), llvm::LoongArchFrameLowering::emitPrologue(), llvm::M68kFrameLowering::emitPrologue(), llvm::Mips16FrameLowering::emitPrologue(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::MSP430FrameLowering::emitPrologue(), llvm::NVPTXFrameLowering::emitPrologue(), llvm::PPCFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::SparcFrameLowering::emitPrologue(), llvm::SystemZELFFrameLowering::emitPrologue(), llvm::SystemZXPLINKFrameLowering::emitPrologue(), llvm::VEFrameLowering::emitPrologue(), llvm::WebAssemblyFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), emitReadCounterWidePseudo(), llvm::ScheduleDAGSDNodes::EmitSchedule(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), emitVecCondBranchPseudo(), emitXBegin(), ensureEntrySetPrio(), llvm::RegScavenger::enterBasicBlock(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::AArch64InstrInfo::expandPostRAPseudo(), llvm::SparcTargetLowering::expandSelectCC(), llvm::SPIRVTargetLowering::finalizeLowering(), llvm::WebAssembly::findCatch(), llvm::findCMPToFoldIntoCBZ(), findFirstPredicateSetterFrom(), findHoistingInsertPosAndDeps(), findIncDecBefore(), findInsertLocation(), llvm::findPHICopyInsertPoint(), llvm::findSplitPointForStackProtector(), findSurvivorBackwards(), fixupBlock(), TransferTracker::flushDbgValues(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), generateAssignInstrs(), llvm::rdf::Liveness::getAllReachingDefs(), getEarliestInsertPos(), getFirstNonDebugInstr(), getFirstTerminator(), llvm::getFirstValidInstructionInsertPoint(), llvm::getFunctionLiveInPhysReg(), getGatherLanePattern(), llvm::CSKYInstrInfo::getGlobalBaseReg(), llvm::SparcInstrInfo::getGlobalBaseReg(), llvm::VEInstrInfo::getGlobalBaseReg(), llvm::ARMHazardRecognizerFPMLx::getHazardType(), llvm::getInsertPtValidEnd(), getLatestInsertPos(), getNextMachineInstr(), llvm::ARMBasicBlockUtils::getOffsetOf(), llvm::getOpVariableMBBIt(), llvm::SITargetLowering::getPrefLoopAlignment(), getPreviousInstr(), llvm::RISCVRegisterInfo::getRegAllocationHints(), llvm::PhiLoweringHelper::getSaluInsertionAtEnd(), getSchedRegions(), llvm::WindowScheduler::getScheduleRange(), llvm::MachineSSAUpdater::GetValueInMiddleOfBlock(), indirectCopyToAGPR(), llvm::MipsFunctionInfo::initGlobalBaseReg(), INITIALIZE_PASS(), initMBBRange(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::SystemZELFFrameLowering::inlineStackProbe(), llvm::SystemZXPLINKFrameLowering::inlineStackProbe(), insertCSRRestores(), insertCSRSaves(), insertSEHRange(), insertSpeculationBarrier(), isConvertibleToVMV_V_V(), isEFLAGSLive(), jumpTableFollowsTB(), llvm::SplitEditor::leaveIntvAtTop(), llvm::FastISel::leaveLocalValueArea(), TransferTracker::loadInlocs(), loadM0FromVGPR(), loadMBUFScalarOperandsFromVGPR(), LookForIdenticalPHI(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::X86CallLowering::lowerFormalArguments(), LowerFPToInt(), LowerMemcpy(), LowerMemset(), llvm::CombinerHelper::matchOptBrCondByInvertingCond(), llvm::AArch64RegisterInfo::materializeFrameBaseRegister(), llvm::SIRegisterInfo::materializeFrameBaseRegister(), llvm::ARMBaseRegisterInfo::materializeFrameBaseRegister(), llvm::PPCRegisterInfo::materializeFrameBaseRegister(), llvm::RISCVRegisterInfo::materializeFrameBaseRegister(), llvm::M68kFrameLowering::mergeSPUpdates(), llvm::ARMBaseInstrInfo::optimizeCompareInstr(), llvm::LanaiInstrInfo::optimizeCompareInstr(), llvm::PPCInstrInfo::optimizeCompareInstr(), llvm::PeelingModuloScheduleExpander::peelKernel(), llvm::PeelSingleBlockLoop(), phis(), llvm::WindowScheduler::preProcess(), llvm::AArch64InstrInfo::probedStackAlloc(), llvm::AArch64FrameLowering::processFunctionBeforeFrameFinalized(), ProfitableToMerge(), llvm::RegPressureTracker::recede(), llvm::RegPressureTracker::recedeSkipDebugValues(), llvm::AArch64InstrInfo::removeBranch(), llvm::R600InstrInfo::removeBranch(), llvm::ARCInstrInfo::removeBranch(), llvm::ARMBaseInstrInfo::removeBranch(), llvm::BPFInstrInfo::removeBranch(), llvm::CSKYInstrInfo::removeBranch(), llvm::HexagonInstrInfo::removeBranch(), llvm::LanaiInstrInfo::removeBranch(), llvm::LoongArchInstrInfo::removeBranch(), llvm::M68kInstrInfo::removeBranch(), llvm::MSP430InstrInfo::removeBranch(), llvm::NVPTXInstrInfo::removeBranch(), llvm::PPCInstrInfo::removeBranch(), llvm::RISCVInstrInfo::removeBranch(), llvm::SparcInstrInfo::removeBranch(), llvm::SystemZInstrInfo::removeBranch(), llvm::VEInstrInfo::removeBranch(), llvm::X86InstrInfo::removeBranch(), llvm::XCoreInstrInfo::removeBranch(), llvm::XtensaInstrInfo::removeBranch(), llvm::SlotIndexes::repairIndexesInRange(), llvm::RegBankSelect::RepairingPlacement::RepairingPlacement(), llvm::LiveIntervals::repairIntervalsInRange(), llvm::X86InstrInfo::replaceBranchWithTailCall(), llvm::PPCFrameLowering::replaceFPWithRealFP(), llvm::Thumb2InstrInfo::ReplaceTailWithBranchTo(), rescheduleCanonically(), llvm::AArch64FrameLowering::resetCFIToInitialState(), llvm::TargetFrameLowering::restoreCalleeSavedRegister(), llvm::CSKYFrameLowering::restoreCalleeSavedRegisters(), llvm::PPCFrameLowering::restoreCalleeSavedRegisters(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), llvm::XCoreFrameLowering::restoreCalleeSavedRegisters(), llvm::WindowScheduler::restoreTripleMBB(), llvm::X86FrameLowering::restoreWinEHStackPointersInParent(), rollbackRestoreSplit(), runImpl(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::CFIFixup::runOnMachineFunction(), llvm::IRTranslator::runOnMachineFunction(), llvm::InsertNOPLoad::runOnMachineFunction(), llvm::FixAllFDIVSQRT::runOnMachineFunction(), scavengeFrameVirtualRegsInBlock(), signOutlinedFunction(), sizeWithoutDebugLargerThan(), skipBackwardPastNonInstructions(), llvm::X86FrameLowering::spillFPBP(), splitAt(), llvm::SystemZ::splitBlockAfter(), llvm::SystemZ::splitBlockBefore(), splitBlockForLoop(), splitEndLoopBB(), llvm::WindowScheduler::updateLiveIntervals(), llvm::PeelingModuloScheduleExpander::validateAgainstModuloScheduleExpander(), verifyCTRBranch(), llvm::MemorySSA::verifyOrderingDominationAndDefUses(), and VerifyPHIs().

◆ begin() [2/2]

const_iterator llvm::MachineBasicBlock::begin ( ) const
inline

Definition at line 378 of file MachineBasicBlock.h.

References instr_begin().

◆ canFallThrough()

bool MachineBasicBlock::canFallThrough ( )

Return true if the block can implicitly transfer control to the block after it by falling off the end of it.

This should return false if it can reach the block after it, but it uses an explicit branch to do so (e.g., a table jump). True is a conservative answer.

Definition at line 1019 of file MachineBasicBlock.cpp.

References getFallThrough().

Referenced by AlignBlocks(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), isImplicitFallthrough(), ProfitableToMerge(), and llvm::TailDuplicator::shouldTailDuplicate().

◆ canPredictBranchProbabilities()

bool MachineBasicBlock::canPredictBranchProbabilities ( ) const

◆ canSplitCriticalEdge()

bool MachineBasicBlock::canSplitCriticalEdge ( const MachineBasicBlock Succ) const

Check if the edge between this block and the given successor Succ, can be split.

If this returns true a subsequent call to SplitCriticalEdge is guaranteed to return a valid basic block if no changes occurred in the meantime.

Definition at line 1391 of file MachineBasicBlock.cpp.

References llvm::HexagonInstrInfo::analyzeBranch(), Cond, llvm::dbgs(), findJumpTableIndex(), llvm::TargetSubtargetInfo::getInstrInfo(), getParent(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), isEHPad(), isInlineAsmBrIndirectTarget(), jumpTableHasOtherUses(), LLVM_DEBUG, llvm::printMBBReference(), llvm::TargetMachine::requiresStructuredCFG(), TBB, and TII.

Referenced by SplitCriticalEdge().

◆ clear()

void llvm::MachineBasicBlock::clear ( )
inline

◆ clearBasicBlock()

void llvm::MachineBasicBlock::clearBasicBlock ( )
inline

Remove the reference to the underlying IR BasicBlock.

This is for reduction tools and should generally not be used.

Definition at line 257 of file MachineBasicBlock.h.

◆ clearLiveIns() [1/2]

void MachineBasicBlock::clearLiveIns ( )

Clear live in list.

Definition at line 1766 of file MachineBasicBlock.cpp.

Referenced by llvm::recomputeLiveIns().

◆ clearLiveIns() [2/2]

void MachineBasicBlock::clearLiveIns ( std::vector< RegisterMaskPair > &  OldLiveIns)

Clear the live in list, and return the removed live in's in OldLiveIns.

Requires that the vector OldLiveIns is empty.

Definition at line 1770 of file MachineBasicBlock.cpp.

References assert(), and std::swap().

◆ computeRegisterLiveness()

MachineBasicBlock::LivenessQueryResult MachineBasicBlock::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.

Return whether (physical) register "Reg" has been <def>ined and not <kill>ed as of just before "MI".

Search is localised to a neighborhood of Neighborhood instructions before (searching for defs or kills) and Neighborhood instructions after (searching just for defs) Before.

Reg must be a physical register.

Search is localised to a neighborhood of Neighborhood instructions before (searching for defs or kills) and N instructions after (searching just for defs) MI.

Definition at line 1655 of file MachineBasicBlock.cpp.

References llvm::AnalyzePhysRegInBundle(), begin(), end(), I, Info, liveins(), LQR_Dead, LQR_Live, LQR_Unknown, N, successors(), and TRI.

Referenced by loadMBUFScalarOperandsFromVGPR(), and llvm::X86InstrInfo::reMaterialize().

◆ copySuccessor()

void MachineBasicBlock::copySuccessor ( const MachineBasicBlock Orig,
succ_iterator  I 
)

Copy a successor (and any probability info) from original block to this block's.

Uses an iterator into the original blocks successors.

This is useful when doing a partial clone of successors. Afterward, the probabilities may need to be normalized.

Definition at line 897 of file MachineBasicBlock.cpp.

References addSuccessor(), addSuccessorWithoutProb(), getSuccProbability(), and I.

◆ dump()

LLVM_DUMP_METHOD void MachineBasicBlock::dump ( ) const

◆ empty()

bool llvm::MachineBasicBlock::empty ( ) const
inline

Definition at line 349 of file MachineBasicBlock.h.

Referenced by blockEndsInUnreachable(), bothUsedInPHI(), llvm::calculateDbgEntityHistory(), llvm::ARMBasicBlockUtils::computeBlockSize(), llvm::SSAUpdaterTraits< MachineSSAUpdater >::CreateEmptyPHI(), dominatesAllUsesOf(), llvm::MipsAsmPrinter::emitBasicBlockEnd(), llvm::SIFrameLowering::emitEpilogue(), llvm::CSKYFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::AsmPrinter::emitFunctionBody(), llvm::DwarfDebug::emitInitialLocDirective(), llvm::findPHICopyInsertPoint(), generateAssignInstrs(), getBBAddrMapMetadata(), getFallThrough(), getNextMachineInstr(), llvm::MachineSSAUpdater::GetValueInMiddleOfBlock(), llvm::XtensaInstrInfo::insertIndirectBranch(), llvm::AArch64InstrInfo::insertIndirectBranch(), llvm::SIInstrInfo::insertIndirectBranch(), llvm::LoongArchInstrInfo::insertIndirectBranch(), llvm::RISCVInstrInfo::insertIndirectBranch(), llvm::SlotIndexes::insertMBBInMaps(), llvm::AsmPrinter::isBlockOnlyReachableByFallthrough(), isEHScopeReturnBlock(), isImplicitFallthrough(), llvm::ARMBaseInstrInfo::isProfitableToIfCvt(), isReturnBlock(), jumpTableFollowsTB(), llvm::Legalizer::legalizeMachineFunction(), LookForIdenticalPHI(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::X86CallLowering::lowerFormalArguments(), performSink(), printMBB(), llvm::GCNRegPressurePrinter::runOnMachineFunction(), llvm::scavengeFrameVirtualRegs(), llvm::InstructionSelect::selectMachineFunction(), llvm::TailDuplicator::shouldTailDuplicate(), llvm::FastISel::startNewBlock(), and llvm::UpgradeDataLayoutString().

◆ end() [1/2]

iterator llvm::MachineBasicBlock::end ( )
inline

Definition at line 379 of file MachineBasicBlock.h.

References instr_end().

Referenced by addLiveIn(), llvm::LiveVariables::addNewBlock(), llvm::ScheduleDAGInstrs::addSchedBarrierDeps(), llvm::ARMFrameLowering::adjustForSegmentedStacks(), llvm::XtensaInstrInfo::adjustStackPtr(), llvm::RegPressureTracker::advance(), llvm::R600InstrInfo::analyzeBranch(), llvm::ARCInstrInfo::analyzeBranch(), llvm::BPFInstrInfo::analyzeBranch(), llvm::LoongArchInstrInfo::analyzeBranch(), llvm::MSP430InstrInfo::analyzeBranch(), llvm::NVPTXInstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), llvm::RISCVInstrInfo::analyzeBranch(), llvm::SystemZInstrInfo::analyzeBranch(), llvm::XCoreInstrInfo::analyzeBranch(), llvm::XtensaInstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::SIInstrInfo::analyzeBranch(), llvm::CSKYInstrInfo::analyzeBranch(), llvm::SparcInstrInfo::analyzeBranch(), llvm::VEInstrInfo::analyzeBranch(), llvm::LanaiInstrInfo::analyzeBranch(), llvm::SIInstrInfo::analyzeBranchImpl(), llvm::AArch64InstrInfo::analyzeBranchPredicate(), llvm::ARMBaseInstrInfo::analyzeLoopForPipelining(), llvm::HexagonInstrInfo::analyzeLoopForPipelining(), llvm::PPCInstrInfo::analyzeLoopForPipelining(), appendEndToFunction(), llvm::CombinerHelper::applyExtendThroughPhis(), back(), blockEndIsUnreachable(), llvm::BuildMI(), llvm::AArch64InstrInfo::buildOutlinedFrame(), llvm::ARMBaseInstrInfo::buildOutlinedFrame(), llvm::RISCVInstrInfo::buildOutlinedFrame(), llvm::X86InstrInfo::buildOutlinedFrame(), llvm::SIRegisterInfo::buildSpillLoadStore(), llvm::GCNDownwardRPTracker::bumpDownwardPressure(), checkAndUpdateCCRKill(), checkAndUpdateCPSRKill(), checkCCKill(), checkEFLAGSLive(), llvm::ErrataWorkaround::checkSeqTN0010(), llvm::ErrataWorkaround::checkSeqTN0010First(), llvm::ErrataWorkaround::checkSeqTN0012(), clearKillFlags(), cloneCfiPrologue(), ComputeCommonTailLength(), computeRegisterLiveness(), llvm::Thumb1InstrInfo::copyPhysReg(), CountTerminators(), llvm::SSAUpdaterTraits< MachineSSAUpdater >::CreateEmptyPHI(), llvm::SIInstrInfo::createPHIDestinationCopy(), llvm::SIInstrInfo::createPHISourceCopy(), dominates(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::X86RegisterInfo::eliminateFrameIndex(), emitAlignedDPRCS2Restores(), emitAlignedDPRCS2Spills(), llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::X86AsmPrinter::emitBasicBlockEnd(), llvm::AsmPrinter::emitCFIInstruction(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::SystemZTargetLowering::emitEHSjLjSetJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::SIFrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitEpilogue(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::CSKYFrameLowering::emitEpilogue(), llvm::LoongArchFrameLowering::emitEpilogue(), llvm::M68kFrameLowering::emitEpilogue(), llvm::Mips16FrameLowering::emitEpilogue(), llvm::MipsSEFrameLowering::emitEpilogue(), llvm::MSP430FrameLowering::emitEpilogue(), llvm::PPCFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::WebAssemblyFrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::AArch64TargetLowering::EmitF128CSEL(), emitFROUND(), llvm::AsmPrinter::emitFunctionBody(), llvm::R600TargetLowering::EmitInstrWithCustomInserter(), llvm::SITargetLowering::EmitInstrWithCustomInserter(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), emitLoadScalarOpsFromVGPRLoop(), EmitLoweredCascadedSelect(), llvm::AArch64FrameLowering::emitPacRetPlusLeafHardening(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::PPCTargetLowering::emitProbedAlloca(), llvm::XtensaFrameLowering::emitPrologue(), llvm::AArch64FrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), llvm::Thumb1FrameLowering::emitPrologue(), llvm::M68kFrameLowering::emitPrologue(), llvm::MSP430FrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::SystemZELFFrameLowering::emitPrologue(), llvm::SystemZXPLINKFrameLowering::emitPrologue(), llvm::WebAssemblyFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), emitReadCounterWidePseudo(), llvm::ScheduleDAGSDNodes::EmitSchedule(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), llvm::VETargetLowering::emitSjLjDispatchBlock(), emitStackProbeInline(), emitVecCondBranchPseudo(), emitXBegin(), ensureEntrySetPrio(), llvm::RegScavenger::enterBasicBlockEnd(), llvm::ScheduleDAGMILive::enterRegion(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::SparcTargetLowering::expandSelectCC(), llvm::SPIRVTargetLowering::finalizeLowering(), findBranchDebugLoc(), llvm::WebAssembly::findCatch(), llvm::X86RegisterInfo::findDeadCallerSavedReg(), findDeadCallerSavedReg(), findHoistingInsertPosAndDeps(), findIncDecAfter(), findIncDecBefore(), findInsertLocation(), findJumpTableIndex(), FindLastAluClause(), findNextInsertLocation(), findSurvivorBackwards(), llvm::fixStackStores(), fixupPHIOpBanks(), forEachJumpTableBranch(), generateAssignInstrs(), llvm::rdf::Liveness::getAllReachingDefs(), getArgumentStackToRestore(), llvm::RegPressureTracker::getCurrSlot(), getEarliestInsertPos(), llvm::getEHScopeMembership(), getFallThrough(), getFirstNonDebugInstr(), getFirstNonPrologue(), getFirstTerminator(), llvm::getFirstValidInstructionInsertPoint(), llvm::getInsertPtValidEnd(), llvm::InsertPointAnalysis::getLastInsertPointIter(), getLastNonDebugInstr(), getLatestInsertPos(), llvm::ReachingDefAnalysis::getLiveInUses(), llvm::ReachingDefAnalysis::getLocalLiveOutMIDef(), getNextFPInstruction(), getNextMachineInstr(), llvm::ARMBasicBlockUtils::getOffsetOf(), llvm::getOpVariableMBBIt(), getOrCreateFrameHelper(), getPreviousInstr(), llvm::ReachingDefAnalysis::getReachingLocalUses(), llvm::PhiLoweringHelper::getSaluInsertionAtEnd(), getSchedRegions(), llvm::X86InstrInfo::getSPAdjust(), llvm::MachineSSAUpdater::GetValueInMiddleOfBlock(), llvm::guessSuccessors(), HashEndOfMBB(), hasTailCall(), llvm::GCNSchedStage::initGCNRegion(), INITIALIZE_PASS(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::SystemZELFFrameLowering::inlineStackProbe(), llvm::X86FrameLowering::inlineStackProbe(), insert(), insertAfter(), llvm::R600InstrInfo::insertBranch(), llvm::HexagonInstrInfo::insertBranch(), llvm::XtensaInstrInfo::insertBranch(), insertDivByZeroTrap(), llvm::XtensaInstrInfo::insertIndirectBranch(), llvm::AArch64InstrInfo::insertIndirectBranch(), llvm::SIInstrInfo::insertIndirectBranch(), llvm::LoongArchInstrInfo::insertIndirectBranch(), llvm::RISCVInstrInfo::insertIndirectBranch(), llvm::SIInstrInfo::insertReturn(), llvm::SIInstrInfo::insertSimulatedTrap(), insertSpeculationBarrier(), IsBetterFallthrough(), IsBranchOnlyBlock(), IsEmptyBlock(), isInvoke(), llvm::Thumb2InstrInfo::isLegalToSplitMBBAt(), llvm::TargetInstrInfo::isMBBSafeToOutlineFrom(), llvm::isPhysRegUsedAfter(), llvm::CombinerHelper::isPredecessor(), llvm::ReachingDefAnalysis::isReachingDefLiveOut(), llvm::ReachingDefAnalysis::isRegDefinedAfter(), llvm::ReachingDefAnalysis::isSafeToDefRegAt(), isSafeToMove(), llvm::AArch64InstrInfo::isSchedulingBoundary(), llvm::ARMBaseInstrInfo::isSchedulingBoundary(), llvm::LoongArchInstrInfo::isSchedulingBoundary(), llvm::TailDuplicator::isSimpleBB(), llvm::SIInstrInfo::legalizeOperands(), llvm::AMDGPULegalizerInfo::legalizeTrapEndpgm(), llvm::XtensaInstrInfo::loadImmediate(), llvm::SystemZInstrInfo::loadImmediate(), llvm::XCoreInstrInfo::loadImmediate(), loadMBUFScalarOperandsFromVGPR(), llvm::Mips16InstrInfo::loadRegFromStack(), llvm::MipsSEInstrInfo::loadRegFromStack(), llvm::SystemZInstrInfo::loadRegFromStackSlot(), llvm::XtensaInstrInfo::loadRegFromStackSlot(), llvm::ARMBaseInstrInfo::loadRegFromStackSlot(), llvm::Thumb1InstrInfo::loadRegFromStackSlot(), llvm::Thumb2InstrInfo::loadRegFromStackSlot(), llvm::BPFInstrInfo::loadRegFromStackSlot(), llvm::SparcInstrInfo::loadRegFromStackSlot(), llvm::VEInstrInfo::loadRegFromStackSlot(), llvm::LoongArchInstrInfo::loadRegFromStackSlot(), llvm::MSP430InstrInfo::loadRegFromStackSlot(), llvm::CSKYInstrInfo::loadRegFromStackSlot(), llvm::XCoreInstrInfo::loadRegFromStackSlot(), llvm::LanaiInstrInfo::loadRegFromStackSlot(), llvm::PPCInstrInfo::loadRegFromStackSlotNoUpd(), LookForIdenticalPHI(), LowerFPToInt(), LowerMemcpy(), LowerMemset(), lowerWaveReduce(), llvm::MachineInstrSpan::MachineInstrSpan(), llvm::CombinerHelper::matchOptBrCondByInvertingCond(), llvm::AArch64RegisterInfo::materializeFrameBaseRegister(), llvm::SIRegisterInfo::materializeFrameBaseRegister(), llvm::ARMBaseRegisterInfo::materializeFrameBaseRegister(), llvm::PPCRegisterInfo::materializeFrameBaseRegister(), llvm::RISCVRegisterInfo::materializeFrameBaseRegister(), maybeRewriteToFallthrough(), mergeOperations(), llvm::M68kFrameLowering::mergeSPUpdates(), llvm::PeelingModuloScheduleExpander::moveStageBetweenBlocks(), MoveVPNOTBeforeFirstUser(), llvm::ARMBaseInstrInfo::optimizeCompareInstr(), llvm::LanaiInstrInfo::optimizeCompareInstr(), llvm::X86InstrInfo::optimizeCompareInstr(), llvm::PPCInstrInfo::optimizeCompareInstr(), llvm::PeelSingleBlockLoop(), performSink(), llvm::ScheduleDAGMI::placeDebugValues(), popRegsFromStack(), llvm::SystemZInstrInfo::prepareCompareSwapOperands(), llvm::AArch64InstrInfo::probedStackAlloc(), llvm::AArch64FrameLowering::processFunctionBeforeFrameFinalized(), ProfitableToMerge(), llvm::SIInstrInfo::reMaterialize(), llvm::AArch64InstrInfo::removeBranch(), llvm::R600InstrInfo::removeBranch(), llvm::ARCInstrInfo::removeBranch(), llvm::ARMBaseInstrInfo::removeBranch(), llvm::BPFInstrInfo::removeBranch(), llvm::CSKYInstrInfo::removeBranch(), llvm::HexagonInstrInfo::removeBranch(), llvm::LanaiInstrInfo::removeBranch(), llvm::LoongArchInstrInfo::removeBranch(), llvm::M68kInstrInfo::removeBranch(), llvm::MSP430InstrInfo::removeBranch(), llvm::NVPTXInstrInfo::removeBranch(), llvm::PPCInstrInfo::removeBranch(), llvm::RISCVInstrInfo::removeBranch(), llvm::SparcInstrInfo::removeBranch(), llvm::SPIRVInstrInfo::removeBranch(), llvm::SystemZInstrInfo::removeBranch(), llvm::VEInstrInfo::removeBranch(), llvm::X86InstrInfo::removeBranch(), llvm::XCoreInstrInfo::removeBranch(), llvm::XtensaInstrInfo::removeBranch(), removeImplicitFallthroughs(), llvm::SlotIndexes::repairIndexesInRange(), llvm::RegBankSelect::RepairingPlacement::RepairingPlacement(), llvm::LiveIntervals::repairIntervalsInRange(), llvm::X86InstrInfo::replaceBranchWithTailCall(), llvm::PPCFrameLowering::replaceFPWithRealFP(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), llvm::SystemZELFFrameLowering::restoreCalleeSavedRegisters(), llvm::SystemZXPLINKFrameLowering::restoreCalleeSavedRegisters(), llvm::AArch64FrameLowering::restoreCalleeSavedRegisters(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), llvm::CSKYFrameLowering::restoreCalleeSavedRegisters(), llvm::MSP430FrameLowering::restoreCalleeSavedRegisters(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), llvm::Mips16InstrInfo::restoreFrame(), llvm::ARMBlockPlacement::revertWhileToDoLoop(), rollbackRestoreSplit(), runImpl(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::InsertNOPLoad::runOnMachineFunction(), llvm::FixAllFDIVSQRT::runOnMachineFunction(), scavengeFrameVirtualRegsInBlock(), llvm::RegScavenger::scavengeRegisterBackwards(), llvm::impl_detail::MachineSchedulerBase::scheduleRegions(), setInsertPtAfterDef(), llvm::PPCInstrInfo::shouldReduceRegisterPressure(), shouldUseFrameHelper(), sizeWithoutDebugLargerThan(), skipBackwardPastNonInstructions(), SkipPHIsAndLabels(), SkipPHIsLabelsAndDebug(), llvm::CSKYFrameLowering::spillCalleeSavedRegisters(), llvm::MSP430FrameLowering::spillCalleeSavedRegisters(), llvm::RISCVFrameLowering::spillCalleeSavedRegisters(), llvm::XCoreFrameLowering::spillCalleeSavedRegisters(), llvm::SIRegisterInfo::spillEmergencySGPR(), splitAt(), llvm::SystemZ::splitBlockAfter(), llvm::SystemZ::splitBlockBefore(), splitBlockForLoop(), SplitCriticalEdge(), splitMBB(), llvm::Mips16InstrInfo::storeRegToStack(), llvm::Thumb1InstrInfo::storeRegToStackSlot(), llvm::Thumb2InstrInfo::storeRegToStackSlot(), llvm::BPFInstrInfo::storeRegToStackSlot(), llvm::SparcInstrInfo::storeRegToStackSlot(), llvm::SystemZInstrInfo::storeRegToStackSlot(), llvm::VEInstrInfo::storeRegToStackSlot(), llvm::XtensaInstrInfo::storeRegToStackSlot(), llvm::CSKYInstrInfo::storeRegToStackSlot(), llvm::MSP430InstrInfo::storeRegToStackSlot(), llvm::XCoreInstrInfo::storeRegToStackSlot(), llvm::LanaiInstrInfo::storeRegToStackSlot(), terminators(), updateGetPCBundle(), llvm::WindowScheduler::updateLiveIntervals(), llvm::ScheduleDAGMILive::updatePressureDiffs(), llvm::PeelingModuloScheduleExpander::validateAgainstModuloScheduleExpander(), verifyCFIntrinsic(), verifyCTRBranch(), llvm::MemorySSA::verifyOrderingDominationAndDefUses(), and VerifyPHIs().

◆ end() [2/2]

const_iterator llvm::MachineBasicBlock::end ( ) const
inline

Definition at line 380 of file MachineBasicBlock.h.

References instr_end().

◆ erase() [1/4]

Remove an instruction from the instruction list and delete it.

If the instruction is part of a bundle, the other instructions in the bundle will still be bundled after removing the single instruction.

Definition at line 1450 of file MachineBasicBlock.cpp.

References llvm::iplist_impl< IntrusiveListT, TraitsT >::erase(), I, and unbundleSingleMI().

Referenced by llvm::BPFInstrInfo::analyzeBranch(), llvm::MSP430InstrInfo::analyzeBranch(), llvm::SystemZInstrInfo::analyzeBranch(), llvm::LanaiInstrInfo::analyzeBranch(), convertCalleeSaveRestoreToSPPrePostIncDec(), llvm::AArch64FrameLowering::eliminateCallFramePseudoInstr(), llvm::ARCFrameLowering::eliminateCallFramePseudoInstr(), llvm::HexagonFrameLowering::eliminateCallFramePseudoInstr(), llvm::LanaiFrameLowering::eliminateCallFramePseudoInstr(), llvm::MipsFrameLowering::eliminateCallFramePseudoInstr(), llvm::MSP430FrameLowering::eliminateCallFramePseudoInstr(), llvm::NVPTXFrameLowering::eliminateCallFramePseudoInstr(), llvm::PPCFrameLowering::eliminateCallFramePseudoInstr(), llvm::SparcFrameLowering::eliminateCallFramePseudoInstr(), llvm::VEFrameLowering::eliminateCallFramePseudoInstr(), llvm::WebAssemblyFrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::XtensaFrameLowering::eliminateCallFramePseudoInstr(), llvm::SIFrameLowering::eliminateCallFramePseudoInstr(), llvm::Thumb1FrameLowering::eliminateCallFramePseudoInstr(), llvm::CSKYFrameLowering::eliminateCallFramePseudoInstr(), llvm::LoongArchFrameLowering::eliminateCallFramePseudoInstr(), llvm::M68kFrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVFrameLowering::eliminateCallFramePseudoInstr(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreRegisterInfo::eliminateFrameIndex(), llvm::CSKYRegisterInfo::eliminateFrameIndex(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::XCoreFrameLowering::emitEpilogue(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), erase(), erase_instr(), llvm::MachineInstr::eraseFromParent(), llvm::AArch64InstrInfo::expandPostRAPseudo(), llvm::R600InstrInfo::expandPostRAPseudo(), llvm::HexagonInstrInfo::expandPostRAPseudo(), llvm::Mips16InstrInfo::expandPostRAPseudo(), llvm::MipsSEInstrInfo::expandPostRAPseudo(), llvm::HexagonInstrInfo::expandVGatherPseudo(), INITIALIZE_PASS(), insertSEH(), llvm::PPCRegisterInfo::lowerACCRestore(), llvm::PPCRegisterInfo::lowerACCSpilling(), llvm::PPCRegisterInfo::lowerCRBitRestore(), llvm::PPCRegisterInfo::lowerCRBitSpilling(), llvm::PPCRegisterInfo::lowerCRRestore(), llvm::PPCRegisterInfo::lowerCRSpilling(), llvm::PPCRegisterInfo::lowerDMRRestore(), llvm::PPCRegisterInfo::lowerDMRSpilling(), llvm::PPCRegisterInfo::lowerDynamicAlloc(), llvm::PPCRegisterInfo::lowerDynamicAreaOffset(), llvm::PPCRegisterInfo::lowerOctWordSpilling(), llvm::PPCRegisterInfo::lowerPrepareProbedAlloca(), llvm::PPCRegisterInfo::lowerQuadwordRestore(), llvm::PPCRegisterInfo::lowerQuadwordSpilling(), llvm::PPCRegisterInfo::lowerWACCRestore(), llvm::PPCRegisterInfo::lowerWACCSpilling(), llvm::M68kFrameLowering::mergeSPUpdates(), popRegsFromStack(), llvm::HexagonInstrInfo::removeBranch(), removeDebugInstrs(), replaceFrameIndex(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), llvm::ThumbRegisterInfo::rewriteFrameIndex(), and rollbackRestoreSplit().

◆ erase() [2/4]

iterator llvm::MachineBasicBlock::erase ( iterator  I)
inline

Remove an instruction or bundle from the instruction list and delete it.

If I points to a bundle of instructions, they are all erased.

Definition at line 1112 of file MachineBasicBlock.h.

References erase(), and I.

◆ erase() [3/4]

iterator llvm::MachineBasicBlock::erase ( iterator  I,
iterator  E 
)
inline

Remove a range of instructions from the instruction list and delete them.

Definition at line 1105 of file MachineBasicBlock.h.

References E, and I.

◆ erase() [4/4]

iterator llvm::MachineBasicBlock::erase ( MachineInstr I)
inline

Remove an instruction from the instruction list and delete it.

If I is the head of a bundle of instructions, the whole bundle will be erased.

Definition at line 1120 of file MachineBasicBlock.h.

References erase(), and I.

◆ erase_instr()

instr_iterator llvm::MachineBasicBlock::erase_instr ( MachineInstr I)
inline

Remove an instruction from the instruction list and delete it.

If the instruction is part of a bundle, the other instructions in the bundle will still be bundled after removing the single instruction.

Definition at line 1100 of file MachineBasicBlock.h.

References erase(), and I.

Referenced by llvm::MachineInstr::eraseFromBundle().

◆ eraseFromParent()

void MachineBasicBlock::eraseFromParent ( )

◆ findBranchDebugLoc()

DebugLoc MachineBasicBlock::findBranchDebugLoc ( )

Find and return the merged DebugLoc of the branch instructions of the block.

Return UnknownLoc if there is none.

Definition at line 1566 of file MachineBasicBlock.cpp.

References DL, end(), getFirstTerminator(), and llvm::DebugLoc::getMergedLocation().

Referenced by FixTail(), INITIALIZE_PASS(), llvm::MIRProfileLoader::setBranchProbs(), SplitCriticalEdge(), updateBranches(), updateTerminator(), and updateTerminator().

◆ findDebugLoc() [1/2]

DebugLoc MachineBasicBlock::findDebugLoc ( instr_iterator  MBBI)

Find the next valid DebugLoc starting at MBBI, skipping any debug instructions.

Return UnknownLoc if there is none.

Definition at line 1523 of file MachineBasicBlock.cpp.

References instr_end(), MBBI, and llvm::skipDebugInstructionsForward().

Referenced by llvm::R600InstrInfo::buildDefaultInstruction(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::ARCFrameLowering::emitEpilogue(), emitGPDisp(), llvm::R600TargetLowering::EmitInstrWithCustomInserter(), emitLpad(), llvm::M68kFrameLowering::emitSPUpdate(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::VEInstrInfo::expandGetStackTopPseudo(), llvm::SIInstrInfo::expandMovDPP64(), llvm::SIInstrInfo::expandPostRAPseudo(), findDebugLoc(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::X86FrameLowering::inlineStackProbe(), llvm::SIInstrInfo::insertNoops(), llvm::SIInstrInfo::legalizeOpWithMove(), llvm::ARCInstrInfo::loadImmediate(), llvm::HexagonInstrInfo::loadRegFromStackSlot(), llvm::RISCVInstrInfo::loadRegFromStackSlot(), llvm::SIInstrInfo::loadRegFromStackSlot(), llvm::ARCInstrInfo::loadRegFromStackSlot(), llvm::M68kInstrInfo::loadRegFromStackSlot(), llvm::AArch64InstrInfo::probedStackAlloc(), llvm::X86InstrInfo::replaceBranchWithTailCall(), llvm::M68kFrameLowering::restoreCalleeSavedRegisters(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), rfindDebugLoc(), llvm::M68kFrameLowering::spillCalleeSavedRegisters(), llvm::X86FrameLowering::spillCalleeSavedRegisters(), llvm::HexagonInstrInfo::storeRegToStackSlot(), llvm::SIInstrInfo::storeRegToStackSlot(), llvm::ARCInstrInfo::storeRegToStackSlot(), and llvm::M68kInstrInfo::storeRegToStackSlot().

◆ findDebugLoc() [2/2]

DebugLoc llvm::MachineBasicBlock::findDebugLoc ( iterator  MBBI)
inline

Definition at line 1186 of file MachineBasicBlock.h.

References findDebugLoc(), and MBBI.

◆ findPrevDebugLoc() [1/2]

DebugLoc MachineBasicBlock::findPrevDebugLoc ( instr_iterator  MBBI)

Find the previous valid DebugLoc preceding MBBI, skipping any debug instructions.

It is possible to find the last DebugLoc in the MBB using findPrevDebugLoc(instr_end()). Return UnknownLoc if there is none.

Return UnknownLoc if there is none.

Definition at line 1543 of file MachineBasicBlock.cpp.

References instr_begin(), MBBI, and llvm::prev_nodbg().

Referenced by appendEndToFunction(), and findPrevDebugLoc().

◆ findPrevDebugLoc() [2/2]

DebugLoc llvm::MachineBasicBlock::findPrevDebugLoc ( iterator  MBBI)
inline

Definition at line 1202 of file MachineBasicBlock.h.

References findPrevDebugLoc(), and MBBI.

◆ front() [1/2]

MachineInstr & llvm::MachineBasicBlock::front ( )
inline

◆ front() [2/2]

const MachineInstr & llvm::MachineBasicBlock::front ( ) const
inline

Definition at line 358 of file MachineBasicBlock.h.

◆ getAddressTakenIRBlock()

BasicBlock * llvm::MachineBasicBlock::getAddressTakenIRBlock ( ) const
inline

Retrieves the BasicBlock which corresponds to this MachineBasicBlock.

Definition at line 304 of file MachineBasicBlock.h.

Referenced by llvm::AsmPrinter::emitBasicBlockStart(), and printName().

◆ getAlignment()

Align llvm::MachineBasicBlock::getAlignment ( ) const
inline

◆ getBasicBlock()

const BasicBlock * llvm::MachineBasicBlock::getBasicBlock ( ) const
inline

Return the LLVM basic block that this instance corresponded to originally.

Note that this may be NULL if this instance does not correspond directly to an LLVM basic block.

Definition at line 253 of file MachineBasicBlock.h.

Referenced by llvm::MachineFunction::addLandingPad(), llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::AsmPrinter::emitBasicBlockStart(), llvm::SystemZ::emitBlockAfter(), llvm::SelectionDAGBuilder::EmitBranchForMergedCondition(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::SystemZTargetLowering::emitEHSjLjSetJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::AArch64TargetLowering::EmitF128CSEL(), emitFROUND(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), EmitLoweredCascadedSelect(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::PPCTargetLowering::emitProbedAlloca(), emitReadCounterWidePseudo(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), emitStackProbeInline(), emitVecCondBranchPseudo(), emitXBegin(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::SparcTargetLowering::expandSelectCC(), llvm::FastISel::fastEmitBranch(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::FastISel::finishCondBranch(), getBranchHint(), getFullName(), llvm::MachineLoop::getLoopID(), getName(), hasName(), INITIALIZE_PASS(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::SystemZXPLINKFrameLowering::inlineStackProbe(), insertDivByZeroTrap(), LowerFPToInt(), LowerMemcpy(), LowerMemset(), llvm::WebAssemblyException::print(), printName(), llvm::AArch64InstrInfo::probedStackAlloc(), processBlockAddr(), llvm::ARMBlockPlacement::revertWhileToDoLoop(), llvm::SelectionDAG::shouldOptForSize(), llvm::GIMatchTableExecutor::shouldOptForSize(), splitAt(), and splitMBB().

◆ getBBID()

std::optional< UniqueBBID > llvm::MachineBasicBlock::getBBID ( ) const
inline

◆ getBeginClobberMask()

const uint32_t * MachineBasicBlock::getBeginClobberMask ( const TargetRegisterInfo TRI) const

Get the clobber mask for the start of this basic block.

Funclets use this to prevent register allocation across funclet transitions.

Definition at line 1753 of file MachineBasicBlock.cpp.

References isEHFuncletEntry(), and TRI.

◆ getCallFrameSize()

unsigned llvm::MachineBasicBlock::getCallFrameSize ( ) const
inline

Return the call frame size on entry to this basic block.

Definition at line 1264 of file MachineBasicBlock.h.

Referenced by llvm::TargetInstrInfo::getCallFrameSizeAt(), and SplitCriticalEdge().

◆ getEHContSymbol()

MCSymbol * MachineBasicBlock::getEHContSymbol ( ) const

Return the Windows EH Continuation Symbol for this basic block.

Definition at line 93 of file MachineBasicBlock.cpp.

References llvm::MachineFunction::getContext(), llvm::MachineFunction::getFunctionNumber(), getNumber(), llvm::MCContext::getOrCreateSymbol(), and getParent().

Referenced by llvm::AsmPrinter::emitBasicBlockStart().

◆ getEndClobberMask()

const uint32_t * MachineBasicBlock::getEndClobberMask ( const TargetRegisterInfo TRI) const

Get the clobber mask for the end of the basic block.

See also
getBeginClobberMask()

Definition at line 1759 of file MachineBasicBlock.cpp.

References isReturnBlock(), succ_empty(), and TRI.

◆ getEndSymbol()

MCSymbol * MachineBasicBlock::getEndSymbol ( ) const

◆ getFallThrough()

MachineBasicBlock * MachineBasicBlock::getFallThrough ( bool  JumpToFallThrough = true)

Return the fallthrough block if the block can implicitly transfer control to the block after it by falling off the end of it.

If an explicit branch to the fallthrough block is not allowed, set JumpToFallThrough to be false. Non-null return is a conservative answer.

Definition at line 975 of file MachineBasicBlock.cpp.

References llvm::HexagonInstrInfo::analyzeBranch(), back(), Cond, empty(), end(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), getParent(), llvm::MachineFunction::getSubtarget(), llvm::HexagonInstrInfo::isPredicated(), isSuccessor(), TBB, and TII.

Referenced by canFallThrough(), llvm::RISCVFrameLowering::canUseAsEpilogue(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), getLogicalFallThrough(), INITIALIZE_PASS(), and llvm::sortBasicBlocksAndUpdateBranches().

◆ getFirstInstrTerminator()

MachineBasicBlock::instr_iterator MachineBasicBlock::getFirstInstrTerminator ( )

Same getFirstTerminator but it ignores bundles and return an instr_iterator instead.

Definition at line 251 of file MachineBasicBlock.cpp.

References B, I, instr_begin(), and instr_end().

Referenced by llvm::PeelingModuloScheduleExpander::filterInstructions(), llvm::FinalizeBundleTestPass::run(), signOutlinedFunction(), and SplitCriticalEdge().

◆ getFirstNonDebugInstr() [1/2]

MachineBasicBlock::iterator MachineBasicBlock::getFirstNonDebugInstr ( bool  SkipPseudoOp = true)

Returns an iterator to the first non-debug instruction in the basic block, or end().

Skip any pseudo probe operation if SkipPseudoOp is true. Pseudo probes are like debug instructions which do not turn into real machine code. We try to use the function to skip both debug instructions and pseudo probe operations to avoid API proliferation. This should work most of the time when considering optimizing the rest of code in the block, except for certain cases where pseudo probes are designed to block the optimizations. For example, code merge like optimizations are supposed to be blocked by pseudo probes for better AutoFDO profile quality. Therefore, they should be considered as a valid instruction when this function is called in a context of such optimizations. On the other hand, SkipPseudoOp should be true when it's used in optimizations that unlikely hurt profile quality, e.g., without block merging. The default value of SkipPseudoOp is set to true to maximize code quality in general, with an explict false value passed in in a few places like branch folding and if-conversion to favor profile quality.

Definition at line 265 of file MachineBasicBlock.cpp.

References begin(), end(), and llvm::skipDebugInstructionsForward().

Referenced by getFirstNonDebugInstr(), IsBranchOnlyBlock(), IsEmptyBlock(), llvm::TargetInstrInfo::isMBBSafeToOutlineFrom(), and llvm::TailDuplicator::isSimpleBB().

◆ getFirstNonDebugInstr() [2/2]

const_iterator llvm::MachineBasicBlock::getFirstNonDebugInstr ( bool  SkipPseudoOp = true) const
inline

Definition at line 947 of file MachineBasicBlock.h.

References getFirstNonDebugInstr().

◆ getFirstNonPHI() [1/2]

MachineBasicBlock::iterator MachineBasicBlock::getFirstNonPHI ( )

◆ getFirstNonPHI() [2/2]

const_iterator llvm::MachineBasicBlock::getFirstNonPHI ( ) const
inline

Definition at line 897 of file MachineBasicBlock.h.

References getFirstNonPHI().

◆ getFirstTerminator() [1/2]

MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminator ( )

Returns an iterator to the first terminator instruction of this basic block.

If a terminator does not exist, it returns end().

Definition at line 242 of file MachineBasicBlock.cpp.

References B, begin(), end(), and I.

Referenced by llvm::SIInstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeLoopForPipelining(), llvm::ARMBaseInstrInfo::analyzeLoopForPipelining(), llvm::HexagonInstrInfo::analyzeLoopForPipelining(), llvm::PPCInstrInfo::analyzeLoopForPipelining(), llvm::AMDGPURegisterBankInfo::applyMappingImpl(), copyDebugInfoToPredecessor(), llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::LiveDebugVariables::LDVImpl::emitDebugValues(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::SIFrameLowering::emitEpilogue(), llvm::ARCFrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitEpilogue(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::CSKYFrameLowering::emitEpilogue(), llvm::LoongArchFrameLowering::emitEpilogue(), llvm::M68kFrameLowering::emitEpilogue(), llvm::Mips16FrameLowering::emitEpilogue(), llvm::MipsSEFrameLowering::emitEpilogue(), llvm::PPCFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::WebAssemblyFrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::AArch64FrameLowering::emitPacRetPlusLeafHardening(), llvm::AArch64FrameLowering::emitPrologue(), llvm::ScheduleDAGSDNodes::EmitSchedule(), llvm::SPIRVTargetLowering::finalizeLowering(), findBranchDebugLoc(), findHoistingInsertPosAndDeps(), findInsertLocation(), findJumpTableIndex(), llvm::findPHICopyInsertPoint(), llvm::findSplitPointForStackProtector(), forEachJumpTableBranch(), llvm::getEHScopeMembership(), getFirstTerminator(), llvm::SITargetLowering::getPrefLoopAlignment(), llvm::PhiLoweringHelper::getSaluInsertionAtEnd(), llvm::MachineSSAUpdater::GetValueInMiddleOfBlock(), INITIALIZE_PASS(), llvm::HexagonInstrInfo::insertBranch(), insertCSRRestores(), llvm::SIInstrInfo::insertReturn(), insertUndefLaneMask(), llvm::SystemZPostRASchedStrategy::leaveMBB(), llvm::SIInstrInfo::legalizeOperands(), llvm::LegalizerHelper::moreElementsVectorPhi(), llvm::WindowScheduler::preProcess(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::X86FrameLowering::spillFPBP(), SplitCriticalEdge(), splitMBB(), and terminators().

◆ getFirstTerminator() [2/2]

const_iterator llvm::MachineBasicBlock::getFirstTerminator ( ) const
inline

Definition at line 917 of file MachineBasicBlock.h.

References getFirstTerminator().

◆ getFirstTerminatorForward()

MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminatorForward ( )

Finds the first terminator in a block by scanning forward.

This can handle cases in GlobalISel where there may be non-terminator instructions between terminators, for which getFirstTerminator() will not work correctly.

Definition at line 260 of file MachineBasicBlock.cpp.

References llvm::find_if(), II, and instrs().

Referenced by llvm::LegalizerHelper::fewerElementsVectorPhi(), llvm::LegalizerHelper::narrowScalar(), and llvm::LegalizerHelper::widenScalar().

◆ getFullName()

std::string MachineBasicBlock::getFullName ( ) const

Return a formatted string to identify this block and its parent function.

Return a hopefully unique identifier for this block.

Definition at line 332 of file MachineBasicBlock.cpp.

References getBasicBlock(), llvm::MachineFunction::getName(), llvm::Value::getName(), getNumber(), getParent(), and Name.

Referenced by llvm::ARMBlockPlacement::fixBackwardsWLS(), llvm::ScheduleDAGInstrs::getDAGName(), llvm::ScheduleDAGSDNodes::getDAGName(), and verifyCTRBranch().

◆ getIrrLoopHeaderWeight()

std::optional< uint64_t > llvm::MachineBasicBlock::getIrrLoopHeaderWeight ( ) const
inline

Definition at line 1274 of file MachineBasicBlock.h.

◆ getLastNonDebugInstr() [1/2]

MachineBasicBlock::iterator MachineBasicBlock::getLastNonDebugInstr ( bool  SkipPseudoOp = true)

Returns an iterator to the last non-debug instruction in the basic block, or end().

Skip any pseudo operation if SkipPseudoOp is true. Pseudo probes are like debug instructions which do not turn into real machine code. We try to use the function to skip both debug instructions and pseudo probe operations to avoid API proliferation. This should work most of the time when considering optimizing the rest of code in the block, except for certain cases where pseudo probes are designed to block the optimizations. For example, code merge like optimizations are supposed to be blocked by pseudo probes for better AutoFDO profile quality. Therefore, they should be considered as a valid instruction when this function is called in a context of such optimizations. On the other hand, SkipPseudoOp should be true when it's used in optimizations that unlikely hurt profile quality, e.g., without block merging. The default value of SkipPseudoOp is set to true to maximize code quality in general, with an explict false value passed in in a few places like branch folding and if-conversion to favor profile quality.

Definition at line 271 of file MachineBasicBlock.cpp.

References B, end(), I, instr_begin(), and instr_end().

Referenced by llvm::R600InstrInfo::analyzeBranch(), llvm::LoongArchInstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), llvm::RISCVInstrInfo::analyzeBranch(), llvm::XCoreInstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::CSKYInstrInfo::analyzeBranch(), llvm::SparcInstrInfo::analyzeBranch(), llvm::VEInstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranchPredicate(), llvm::X86AsmPrinter::emitBasicBlockEnd(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::SIFrameLowering::emitEpilogue(), llvm::CSKYFrameLowering::emitEpilogue(), llvm::LanaiFrameLowering::emitEpilogue(), llvm::MSP430FrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::SparcFrameLowering::emitEpilogue(), llvm::SystemZELFFrameLowering::emitEpilogue(), llvm::SystemZXPLINKFrameLowering::emitEpilogue(), llvm::VEFrameLowering::emitEpilogue(), llvm::XCoreFrameLowering::emitEpilogue(), llvm::XtensaFrameLowering::emitEpilogue(), getArgumentStackToRestore(), getLastNonDebugInstr(), llvm::ReachingDefAnalysis::getLiveInUses(), llvm::ReachingDefAnalysis::getLocalLiveOutMIDef(), llvm::guessSuccessors(), HashEndOfMBB(), hasTailCall(), IsBetterFallthrough(), llvm::TargetInstrInfo::isMBBSafeToOutlineFrom(), llvm::SystemZInstrInfo::isProfitableToIfCvt(), llvm::ReachingDefAnalysis::isReachingDefLiveOut(), llvm::ReachingDefAnalysis::isRegDefinedAfter(), llvm::AArch64InstrInfo::removeBranch(), llvm::ARCInstrInfo::removeBranch(), llvm::ARMBaseInstrInfo::removeBranch(), llvm::CSKYInstrInfo::removeBranch(), llvm::LoongArchInstrInfo::removeBranch(), llvm::PPCInstrInfo::removeBranch(), llvm::RISCVInstrInfo::removeBranch(), llvm::SPIRVInstrInfo::removeBranch(), llvm::XCoreInstrInfo::removeBranch(), llvm::RegBankSelect::RepairingPlacement::RepairingPlacement(), llvm::restoreStatusRegister(), and verifyCTRBranch().

◆ getLastNonDebugInstr() [2/2]

const_iterator llvm::MachineBasicBlock::getLastNonDebugInstr ( bool  SkipPseudoOp = true) const
inline

Definition at line 969 of file MachineBasicBlock.h.

References getLastNonDebugInstr().

◆ getLiveIns()

const std::vector< RegisterMaskPair > & llvm::MachineBasicBlock::getLiveIns ( ) const
inline

Definition at line 535 of file MachineBasicBlock.h.

Referenced by llvm::recomputeLiveIns().

◆ getLogicalFallThrough()

MachineBasicBlock * llvm::MachineBasicBlock::getLogicalFallThrough ( )
inline

Return the fallthrough block if the block can implicitly transfer control to it's successor, whether by a branch or a fallthrough.

Non-null return is a conservative answer.

Definition at line 882 of file MachineBasicBlock.h.

References getFallThrough().

◆ getMaxBytesForAlignment()

unsigned llvm::MachineBasicBlock::getMaxBytesForAlignment ( ) const
inline

Return the maximum amount of padding allowed for aligning the basic block.

Definition at line 650 of file MachineBasicBlock.h.

Referenced by llvm::AsmPrinter::emitBasicBlockStart().

◆ getName()

StringRef MachineBasicBlock::getName ( ) const

◆ getNumber()

int llvm::MachineBasicBlock::getNumber ( ) const
inline

MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFunction yet, in which case this will return -1.

Definition at line 1260 of file MachineBasicBlock.h.

References Number.

Referenced by llvm::LiveVariables::addNewBlock(), llvm::ARMBasicBlockUtils::adjustBBOffsetsAfter(), assignSections(), llvm::SwitchCG::SwitchLowering::buildBitTests(), llvm::LiveIntervals::checkRegMaskInterference(), computeBlockInfo(), llvm::ARMBasicBlockUtils::computeBlockSize(), llvm::AsmPrinter::createCallsiteEndSymbol(), llvm::AsmPrinter::emitBasicBlockStart(), llvm::AMDGPUAsmPrinter::emitBasicBlockStart(), llvm::AsmPrinter::emitJumpTableEntry(), llvm::SwitchCG::SwitchLowering::findBitTestClusters(), fixupBlock(), llvm::WebAssembly::SortRegionInfo::getBottom(), llvm::MachineTraceMetrics::Ensemble::getDepthResources(), getEHContSymbol(), llvm::getEHScopeMembership(), getEndSymbol(), getFullName(), llvm::MachineTraceMetrics::Ensemble::getHeightResources(), getMCSymbolForMBB(), llvm::GraphTraits< const MachineBasicBlock * >::getNumber(), llvm::GraphTraits< Inverse< const MachineBasicBlock * > >::getNumber(), llvm::GraphTraits< MachineBasicBlock * >::getNumber(), llvm::GraphTraits< Inverse< MachineBasicBlock * > >::getNumber(), llvm::ARMBasicBlockUtils::getOffsetOf(), llvm::MachineTraceMetrics::Trace::getResourceLength(), llvm::MachineTraceMetrics::getResources(), getSymbol(), llvm::MachineTraceMetrics::Ensemble::getTrace(), llvm::LiveVariables::HandleVirtRegUse(), INITIALIZE_PASS(), llvm::po_iterator_storage< LoopBounds, true >::insertEdge(), llvm::SlotIndexes::insertMBBInMaps(), llvm::MachineTraceMetrics::Ensemble::invalidate(), llvm::MachineTraceMetrics::invalidate(), llvm::ARMBasicBlockUtils::isBBInRange(), llvm::LiveRangeCalc::isJointlyDominated(), llvm::LiveVariables::VarInfo::isLiveIn(), TransferTracker::loadVarInloc(), llvm::LiveVariables::MarkVirtRegAliveInBlock(), maybeUpdateTerminator(), llvm::CSKYConstantPoolMBB::print(), llvm::XtensaConstantPoolMBB::print(), llvm::WebAssemblyException::print(), printMBB(), printName(), llvm::SwiftErrorValueTracking::propagateVRegs(), llvm::LiveVariables::recomputeForSingleDefVirtReg(), llvm::MachineFunction::RenumberBlocks(), llvm::impl_detail::MachineSchedulerBase::scheduleRegions(), llvm::MIRProfileLoader::setBranchProbs(), llvm::sortBasicBlocksAndUpdateBranches(), sortBlocks(), llvm::LoopTraversal::traverse(), updateBranches(), llvm::MachineTraceMetrics::Ensemble::updateDepth(), llvm::MachineTraceMetrics::Ensemble::verify(), VerifyPHIs(), and llvm::WriteGraph().

◆ getParent() [1/2]

MachineFunction * llvm::MachineBasicBlock::getParent ( )
inline

Definition at line 324 of file MachineBasicBlock.h.

◆ getParent() [2/2]

const MachineFunction * llvm::MachineBasicBlock::getParent ( ) const
inline

Return the MachineFunction containing this basic block.

Definition at line 323 of file MachineBasicBlock.h.

Referenced by llvm::SIRegisterInfo::addImplicitUsesForBlockCSRLoad(), addLiveIn(), addLiveInRegs(), llvm::LivePhysRegs::addLiveIns(), llvm::LiveRegUnits::addLiveIns(), llvm::addLiveIns(), llvm::LivePhysRegs::addLiveOuts(), llvm::LiveRegUnits::addLiveOuts(), llvm::LivePhysRegs::addLiveOutsNoPristines(), llvm::MachineInstr::addOperand(), llvm::SSAUpdaterTraits< MachineSSAUpdater >::AddPHIOperand(), addSavedGPR(), llvm::ARMBasicBlockUtils::adjustBBOffsetsAfter(), llvm::RISCVRegisterInfo::adjustReg(), llvm::XtensaInstrInfo::adjustStackPtr(), llvm::ARMBaseInstrInfo::analyzeBranch(), llvm::WebAssemblyInstrInfo::analyzeBranch(), analyzeCompressibleUses(), llvm::ARMBaseInstrInfo::analyzeLoopForPipelining(), llvm::PPCInstrInfo::analyzeLoopForPipelining(), llvm::RISCVInstrInfo::analyzeLoopForPipelining(), llvm::CombinerHelper::applyExtendThroughPhis(), llvm::AMDGPURegisterBankInfo::applyMappingImpl(), assignSections(), bbHasFallthrough(), BBHasFallthrough(), llvm::DwarfCFIException::beginBasicBlockSection(), llvm::DwarfDebug::beginCodeAlignment(), buildCFAOffs(), llvm::MSP430FrameLowering::BuildCFI(), llvm::X86FrameLowering::BuildCFI(), llvm::AArch64InstrInfo::buildClearRegister(), llvm::X86InstrInfo::buildClearRegister(), buildDefCFAReg(), buildGitPtr(), llvm::BuildMI(), BuildPACM(), llvm::SIRegisterInfo::buildSpillLoadStore(), llvm::ModuloScheduleExpanderMVE::canApply(), canCombine(), canFallThroughTo(), llvm::AArch64InstrInfo::canInsertSelect(), llvm::PPCInstrInfo::canInsertSelect(), llvm::SystemZInstrInfo::canInsertSelect(), llvm::X86InstrInfo::canInsertSelect(), llvm::SIInstrInfo::canInsertSelect(), cannotInsertTailCall(), canPredictSuccessors(), canSplitCriticalEdge(), llvm::Thumb1FrameLowering::canUseAsEpilogue(), llvm::RISCVFrameLowering::canUseAsEpilogue(), llvm::X86FrameLowering::canUseAsEpilogue(), llvm::AArch64FrameLowering::canUseAsPrologue(), llvm::RISCVFrameLowering::canUseAsPrologue(), llvm::X86FrameLowering::canUseAsPrologue(), cloneCfiPrologue(), cloneInstr(), llvm::WebAssemblyDebugValueManager::cloneSink(), CombineCVTAToLocal(), llvm::ARMBasicBlockUtils::computeBlockSize(), llvm::HexagonBlockRanges::computeDeadMap(), llvm::computeLiveIns(), llvm::constrainSelectedInstRegOperands(), convertCalleeSaveRestoreToSPPrePostIncDec(), llvm::SIInstrInfo::convertToThreeAddress(), llvm::Thumb1InstrInfo::copyPhysReg(), llvm::NVPTXInstrInfo::copyPhysReg(), llvm::SystemZInstrInfo::copyPhysReg(), llvm::M68kInstrInfo::copyPhysReg(), llvm::WebAssemblyInstrInfo::copyPhysReg(), llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), createPHIsForCMOVsInSinkBB(), createPHIsForSelects(), llvm::MachineFunction::deleteMachineBasicBlock(), llvm::ilist_alloc_traits< MachineBasicBlock >::deleteNode(), llvm::LexicalScopes::dominates(), llvm::TargetInstrInfo::duplicate(), llvm::ARMBaseInstrInfo::duplicate(), llvm::AArch64RegisterInfo::eliminateFrameIndex(), llvm::ARMBaseRegisterInfo::eliminateFrameIndex(), llvm::ThumbRegisterInfo::eliminateFrameIndex(), llvm::HexagonRegisterInfo::eliminateFrameIndex(), llvm::MSP430RegisterInfo::eliminateFrameIndex(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::SystemZRegisterInfo::eliminateFrameIndex(), llvm::BPFRegisterInfo::eliminateFrameIndex(), llvm::WebAssemblyRegisterInfo::eliminateFrameIndex(), llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::XtensaRegisterInfo::eliminateFrameIndex(), emitAlignedDPRCS2Restores(), emitAlignedDPRCS2Spills(), llvm::AArch64TargetLowering::EmitAllocateSMESaveBuffer(), llvm::AArch64TargetLowering::EmitAllocateZABuffer(), llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::SystemZ::emitBlockAfter(), emitBuildPairF64Pseudo(), llvm::MSP430FrameLowering::emitCalleeSavedFrameMoves(), llvm::X86FrameLowering::emitCalleeSavedFrameMoves(), llvm::X86FrameLowering::emitCalleeSavedFrameMovesFullCFA(), emitCalleeSavedRestores(), llvm::AsmPrinter::emitCFIInstruction(), EmitCfiOffset(), EmitDefCfaOffset(), llvm::AArch64TargetLowering::EmitDynamicProbedAlloc(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::PPCTargetLowering::emitEHSjLjLongJmp(), llvm::SystemZTargetLowering::emitEHSjLjLongJmp(), llvm::VETargetLowering::emitEHSjLjLongJmp(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::SystemZTargetLowering::emitEHSjLjSetJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::AArch64TargetLowering::EmitEntryPStateSM(), llvm::AArch64TargetLowering::EmitF128CSEL(), llvm::emitFrameOffset(), emitFrameOffsetAdj(), emitFROUND(), llvm::AArch64TargetLowering::EmitGetSMESaveSize(), llvm::SITargetLowering::emitGWSMemViolTestLoop(), emitIndirectDst(), emitIndirectSrc(), llvm::AArch64TargetLowering::EmitInitTPIDR2Object(), llvm::R600TargetLowering::EmitInstrWithCustomInserter(), llvm::SITargetLowering::EmitInstrWithCustomInserter(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::X86TargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), llvm::X86TargetLowering::EmitKCFICheck(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), llvm::ThumbRegisterInfo::emitLoadConstPool(), emitLoadM0FromVGPRLoop(), emitLoadScalarOpsFromVGPRLoop(), EmitLoweredCascadedSelect(), llvm::AArch64TargetLowering::EmitLoweredCatchRet(), emitPACCFI(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::PPCTargetLowering::emitProbedAlloca(), emitPrologueEpilogueSPUpdate(), emitPseudoCTPOP(), emitPseudoVMSKCOND(), emitPseudoXVINSGR2VR(), emitQuietFCMP(), emitReadCounterWidePseudo(), llvm::ScheduleDAGSDNodes::EmitSchedule(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), llvm::VETargetLowering::emitSjLjDispatchBlock(), emitSplitF64Pseudo(), emitSplitPairF64Pseudo(), llvm::X86FrameLowering::emitSPUpdate(), emitStackProbeInline(), emitThumb1LoadConstPool(), emitThumb2LoadConstPool(), emitThumbRegPlusImmInReg(), emitVecCondBranchPseudo(), emitVFROUND_NOEXCEPT_MASK(), emitXBegin(), llvm::SIInstrInfo::enforceOperandRCAlignment(), eraseFromParent(), llvm::VEInstrInfo::expandExtendStackPseudo(), expandFillPPRFromZPRSlotPseudo(), llvm::VEInstrInfo::expandGetStackTopPseudo(), expandLoadStackGuard(), llvm::ARMBaseInstrInfo::expandLoadStackGuardBase(), llvm::SIInstrInfo::expandMovDPP64(), ExpandMOVImmSExti8(), llvm::AArch64InstrInfo::expandPostRAPseudo(), llvm::SIInstrInfo::expandPostRAPseudo(), llvm::HexagonInstrInfo::expandPostRAPseudo(), llvm::PPCInstrInfo::expandPostRAPseudo(), llvm::SparcTargetLowering::expandSelectCC(), expandSpillPPRToZPRSlotPseudo(), expandXorFP(), extractRsrcPtr(), llvm::finalizeBundle(), llvm::X86RegisterInfo::findDeadCallerSavedReg(), findDeadCallerSavedReg(), findIncDecAfter(), findIncDecBefore(), findJumpTableIndex(), findLoopIncrementValue(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::findPHICopyInsertPoint(), findRenameRegForSameLdStRegPair(), findScratchNonCalleeSaveRegister(), FixTail(), fixupBlock(), fixupPHIOpBanks(), llvm::SystemZInstrInfo::foldImmediate(), llvm::TargetInstrInfo::foldMemoryOperand(), forceReg(), llvm::TargetInstrInfo::genAlternativeCodeSequence(), llvm::AArch64InstrInfo::genAlternativeCodeSequence(), generateEndPgm(), generateGatherLanePattern(), llvm::TargetInstrInfo::getAccumulatorChain(), llvm::TargetInstrInfo::getAccumulatorReassociationPatterns(), llvm::SIInstrInfo::getAddNoCarry(), getBBAddrMapMetadata(), getBBFallenThrough(), llvm::MachineLoop::getBottomBlock(), llvm::MachineInstr::getDebugInstrNum(), getEHContSymbol(), getEndSymbol(), getFallThrough(), llvm::PPCInstrInfo::getFMAPatterns(), getFMULPatterns(), getFNEGPatterns(), getFoldableImm(), getFrameIndexMMO(), getFullName(), getImmedFromMO(), getIndVarInfo(), llvm::AArch64InstrInfo::getInstSizeInBytes(), llvm::ARMBaseInstrInfo::getInstSizeInBytes(), getLayoutSuccessorProbThreshold(), getLiveRegsForEntryMBB(), getLoadStoreOffsetSizeInBits(), getMCSymbolForMBB(), llvm::MipsInstrInfo::GetMemOperand(), llvm::MachineInstr::getMF(), getMFIfAvailable(), getNextBlock(), llvm::AArch64InstrInfo::getOutlinableRanges(), llvm::RISCVInstrInfo::getOutliningTypeImpl(), getSchedRegions(), llvm::TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(), llvm::HexagonInstrInfo::getSize(), llvm::LiveIntervals::getSpillWeight(), getSymbol(), GetSymbolRef(), llvm::MachineLoop::getTopBlock(), llvm::TargetInstrInfo::hasReassociableOperands(), llvm::RISCVInstrInfo::hasReassociableOperands(), llvm::TargetInstrInfo::hasReassociableSibling(), hoistAndMergeSGPRInits(), indirectCopyToAGPR(), INITIALIZE_PASS(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::ARMBaseInstrInfo::insertBranch(), llvm::VEInstrInfo::insertBranch(), insertCSRRestores(), insertCSRSaves(), insertDivByZeroTrap(), llvm::SIInstrInfo::insertEQ(), llvm::XtensaInstrInfo::insertIndirectBranch(), llvm::AArch64InstrInfo::insertIndirectBranch(), llvm::SIInstrInfo::insertIndirectBranch(), llvm::LoongArchInstrInfo::insertIndirectBranch(), llvm::RISCVInstrInfo::insertIndirectBranch(), llvm::SlotIndexes::insertMBBInMaps(), llvm::insertMultibyteShift(), llvm::SIInstrInfo::insertNE(), insertRememberRestorePair(), llvm::SIInstrInfo::insertReturn(), InsertSEH(), insertSEH(), llvm::SIInstrInfo::insertSelect(), llvm::AArch64InstrInfo::insertSelect(), llvm::PPCInstrInfo::insertSelect(), llvm::SystemZInstrInfo::insertSelect(), llvm::X86InstrInfo::insertSelect(), llvm::SIInstrInfo::insertSimulatedTrap(), insertUndefLaneMask(), llvm::SIInstrInfo::insertVectorSelect(), llvm::InstrEmitter::InstrEmitter(), isCandidatePatchable(), isCombineInstrCandidateFP(), isCVTAToLocalCombinationCandidate(), isDefinedOutside(), llvm::MachineInstr::isDereferenceableInvariantLoad(), isEntryBlock(), llvm::LiveRangeCalc::isJointlyDominated(), llvm::SIInstrInfo::isLegalRegOperand(), isLibCallInTailPosition(), llvm::ARMBaseInstrInfo::isMBBSafeToOutlineFrom(), llvm::AArch64InstrInfo::isMBBSafeToSplitToCold(), isNoReturnDef(), llvm::ARMBaseInstrInfo::isProfitableToIfCvt(), jumpTableFollowsTB(), llvm::SIInstrInfo::legalizeOpWithMove(), llvm::AMDGPULegalizerInfo::legalizeTrapEndpgm(), livein_begin(), liveout_begin(), llvm::MipsSEInstrInfo::loadImmediate(), llvm::XtensaInstrInfo::loadImmediate(), llvm::SystemZInstrInfo::loadImmediate(), llvm::XCoreInstrInfo::loadImmediate(), loadM0FromVGPR(), loadMBUFScalarOperandsFromVGPR(), llvm::MipsSEInstrInfo::loadRegFromStack(), llvm::AArch64InstrInfo::loadRegFromStackSlot(), llvm::ARMBaseInstrInfo::loadRegFromStackSlot(), llvm::Thumb1InstrInfo::loadRegFromStackSlot(), llvm::Thumb2InstrInfo::loadRegFromStackSlot(), llvm::HexagonInstrInfo::loadRegFromStackSlot(), llvm::SparcInstrInfo::loadRegFromStackSlot(), llvm::VEInstrInfo::loadRegFromStackSlot(), llvm::LoongArchInstrInfo::loadRegFromStackSlot(), llvm::RISCVInstrInfo::loadRegFromStackSlot(), llvm::MSP430InstrInfo::loadRegFromStackSlot(), llvm::SIInstrInfo::loadRegFromStackSlot(), llvm::ARCInstrInfo::loadRegFromStackSlot(), llvm::CSKYInstrInfo::loadRegFromStackSlot(), llvm::M68kInstrInfo::loadRegFromStackSlot(), llvm::X86InstrInfo::loadRegFromStackSlot(), llvm::XCoreInstrInfo::loadRegFromStackSlot(), llvm::PPCInstrInfo::loadRegFromStackSlotNoUpd(), llvm::X86InstrInfo::loadStoreTileReg(), llvm::PPCRegisterInfo::lowerACCRestore(), llvm::PPCRegisterInfo::lowerACCSpilling(), LowerCallResults(), llvm::PPCRegisterInfo::lowerCRBitRestore(), llvm::PPCRegisterInfo::lowerCRBitSpilling(), llvm::PPCRegisterInfo::lowerCRRestore(), llvm::PPCRegisterInfo::lowerCRSpilling(), llvm::VETargetLowering::LowerCustomJumpTableEntry(), llvm::PPCRegisterInfo::lowerDMRRestore(), llvm::PPCRegisterInfo::lowerDMRSpilling(), llvm::PPCRegisterInfo::lowerDynamicAlloc(), llvm::PPCRegisterInfo::lowerDynamicAreaOffset(), LowerFPToInt(), LowerMemcpy(), LowerMemset(), llvm::PPCRegisterInfo::lowerOctWordSpilling(), llvm::PPCRegisterInfo::lowerPrepareProbedAlloca(), llvm::PPCRegisterInfo::lowerQuadwordRestore(), llvm::PPCRegisterInfo::lowerQuadwordSpilling(), llvm::RISCVRegisterInfo::lowerSegmentSpillReload(), llvm::AArch64MCInstLower::lowerSymbolOperandELF(), llvm::PPCRegisterInfo::lowerWACCRestore(), llvm::PPCRegisterInfo::lowerWACCSpilling(), lowerWaveReduce(), llvm::Mips16InstrInfo::makeFrame(), mapWasmLandingPadIndex(), llvm::AArch64RegisterInfo::materializeFrameBaseRegister(), llvm::SIRegisterInfo::materializeFrameBaseRegister(), llvm::ARMBaseRegisterInfo::materializeFrameBaseRegister(), llvm::PPCRegisterInfo::materializeFrameBaseRegister(), llvm::RISCVRegisterInfo::materializeFrameBaseRegister(), llvm::PPCInstrInfo::materializeImmPostRA(), maybeUpdateTerminator(), mergeOperations(), moveAfter(), llvm::ARMBlockPlacement::moveBasicBlock(), moveBefore(), llvm::SIInstrInfo::moveToVALUImpl(), llvm::CSKYInstrInfo::movImm(), llvm::PPCRegisterInfo::needsFrameBaseReg(), llvm::PPCInstrInfo::optimizeCmpPostRA(), llvm::AArch64InstrInfo::optimizeCondBranch(), llvm::RISCVInstrInfo::optimizeCondBranch(), popRegsFromStack(), llvm::SystemZInstrInfo::prepareCompareSwapOperands(), llvm::PPCRegisterInfo::prepareDynamicAlloca(), llvm::VETargetLowering::prepareMBB(), llvm::VETargetLowering::prepareSymbol(), print(), printMBB(), llvm::AArch64InstrInfo::probedStackAlloc(), llvm::ARMBaseInstrInfo::produceSameValue(), ProfitableToMerge(), propagateLocalCopies(), pushRegsToStack(), llvm::recomputeLivenessFlags(), reduceDbgValsForwardScan(), llvm::TargetInstrInfo::reMaterialize(), llvm::SIInstrInfo::reMaterialize(), llvm::ARMBaseInstrInfo::reMaterialize(), llvm::X86InstrInfo::reMaterialize(), removeFromParent(), replaceDominatedUses(), replaceFrameIndex(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), llvm::Thumb2InstrInfo::ReplaceTailWithBranchTo(), reportIllegalCopy(), rescheduleCanonically(), llvm::AArch64FrameLowering::resetCFIToInitialState(), llvm::SIRegisterInfo::resolveFrameIndex(), llvm::ARMBaseRegisterInfo::resolveFrameIndex(), llvm::PPCRegisterInfo::resolveFrameIndex(), llvm::SystemZELFFrameLowering::restoreCalleeSavedRegisters(), llvm::SystemZXPLINKFrameLowering::restoreCalleeSavedRegisters(), llvm::AArch64FrameLowering::restoreCalleeSavedRegisters(), llvm::SIFrameLowering::restoreCalleeSavedRegisters(), llvm::ARCFrameLowering::restoreCalleeSavedRegisters(), llvm::ARMFrameLowering::restoreCalleeSavedRegisters(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), llvm::CSKYFrameLowering::restoreCalleeSavedRegisters(), llvm::MSP430FrameLowering::restoreCalleeSavedRegisters(), llvm::PPCFrameLowering::restoreCalleeSavedRegisters(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), llvm::XCoreFrameLowering::restoreCalleeSavedRegisters(), restoreCRs(), llvm::Mips16InstrInfo::restoreFrame(), llvm::X86FrameLowering::restoreWin32EHStackPointers(), llvm::ARMBlockPlacement::revertWhileToDoLoop(), llvm::ThumbRegisterInfo::rewriteFrameIndex(), llvm::MachineFunction::salvageCopySSAImpl(), llvm::Mips16RegisterInfo::saveScavengerRegister(), llvm::RegScavenger::scavengeRegisterBackwards(), scavengeVReg(), llvm::VLIWMachineScheduler::schedule(), setCallTargetReg(), llvm::SGPRSpillBuilder::setMI(), llvm::AArch64InstrInfo::shouldClusterMemOps(), llvm::ARMBaseRegisterInfo::shouldCoalesce(), llvm::shouldOptimizeForSize(), llvm::PPCInstrInfo::shouldReduceRegisterPressure(), llvm::TailDuplicator::shouldTailDuplicate(), shouldUseFrameHelper(), llvm::WebAssemblyDebugValueManager::sink(), SkipPHIsAndLabels(), SkipPHIsLabelsAndDebug(), llvm::SystemZELFFrameLowering::spillCalleeSavedRegisters(), llvm::SystemZXPLINKFrameLowering::spillCalleeSavedRegisters(), llvm::AArch64FrameLowering::spillCalleeSavedRegisters(), llvm::SIFrameLowering::spillCalleeSavedRegisters(), llvm::ARCFrameLowering::spillCalleeSavedRegisters(), llvm::ARMFrameLowering::spillCalleeSavedRegisters(), llvm::Thumb1FrameLowering::spillCalleeSavedRegisters(), llvm::CSKYFrameLowering::spillCalleeSavedRegisters(), llvm::LoongArchFrameLowering::spillCalleeSavedRegisters(), llvm::M68kFrameLowering::spillCalleeSavedRegisters(), llvm::Mips16FrameLowering::spillCalleeSavedRegisters(), llvm::MipsSEFrameLowering::spillCalleeSavedRegisters(), llvm::MSP430FrameLowering::spillCalleeSavedRegisters(), llvm::PPCFrameLowering::spillCalleeSavedRegisters(), llvm::RISCVFrameLowering::spillCalleeSavedRegisters(), llvm::X86FrameLowering::spillCalleeSavedRegisters(), llvm::XCoreFrameLowering::spillCalleeSavedRegisters(), llvm::XtensaFrameLowering::spillCalleeSavedRegisters(), spillVGPRtoAGPR(), splitAt(), splitBlock(), splitBlockForLoop(), SplitCriticalEdge(), splitEdge(), splitEndLoopBB(), splitMBB(), llvm::stableHashValue(), llvm::MipsSEInstrInfo::storeRegToStack(), llvm::AArch64InstrInfo::storeRegToStackSlot(), llvm::ARMBaseInstrInfo::storeRegToStackSlot(), llvm::Thumb1InstrInfo::storeRegToStackSlot(), llvm::Thumb2InstrInfo::storeRegToStackSlot(), llvm::HexagonInstrInfo::storeRegToStackSlot(), llvm::LoongArchInstrInfo::storeRegToStackSlot(), llvm::RISCVInstrInfo::storeRegToStackSlot(), llvm::SparcInstrInfo::storeRegToStackSlot(), llvm::VEInstrInfo::storeRegToStackSlot(), llvm::SIInstrInfo::storeRegToStackSlot(), llvm::ARCInstrInfo::storeRegToStackSlot(), llvm::CSKYInstrInfo::storeRegToStackSlot(), llvm::M68kInstrInfo::storeRegToStackSlot(), llvm::MSP430InstrInfo::storeRegToStackSlot(), llvm::X86InstrInfo::storeRegToStackSlot(), llvm::XCoreInstrInfo::storeRegToStackSlot(), llvm::PPCInstrInfo::storeRegToStackSlotNoUpd(), llvm::HexagonInstrInfo::translateInstrsForDup(), tryToSplitRestore(), unstackifyVRegsUsedInSplitBB(), updateLiveIn(), UpdateOperandRegClass(), updateTerminator(), validateFunCall(), validateFunCallMachineDef(), validatePtrTypes(), verifyCFIntrinsic(), verifyCTRBranch(), llvm::SelectionDAGBuilder::visitSPDescriptorFailure(), and llvm::SelectionDAGBuilder::visitSPDescriptorParent().

◆ getSectionID()

MBBSectionID llvm::MachineBasicBlock::getSectionID ( ) const
inline

◆ getSinglePredecessor() [1/2]

MachineBasicBlock * llvm::MachineBasicBlock::getSinglePredecessor ( )
inline

Definition at line 867 of file MachineBasicBlock.h.

References getSinglePredecessor().

◆ getSinglePredecessor() [2/2]

const MachineBasicBlock * MachineBasicBlock::getSinglePredecessor ( ) const

Return the predecessor of this block if it has a single predecessor.

Otherwise return a null pointer.

Definition at line 971 of file MachineBasicBlock.cpp.

Referenced by getSinglePredecessor().

◆ getSingleSuccessor() [1/2]

MachineBasicBlock * llvm::MachineBasicBlock::getSingleSuccessor ( )
inline

Definition at line 858 of file MachineBasicBlock.h.

References getSingleSuccessor().

◆ getSingleSuccessor() [2/2]

const MachineBasicBlock * MachineBasicBlock::getSingleSuccessor ( ) const

Return the successor of this block if it has a single successor.

Otherwise return a null pointer.

Definition at line 967 of file MachineBasicBlock.cpp.

Referenced by getSingleSuccessor().

◆ getSublistAccess()

static Instructions MachineBasicBlock::* llvm::MachineBasicBlock::getSublistAccess ( MachineInstr )
inlinestatic

Support for MachineInstr::getNextNode().

Definition at line 393 of file MachineBasicBlock.h.

◆ getSuccProbability()

BranchProbability MachineBasicBlock::getSuccProbability ( const_succ_iterator  Succ) const

Return probability of the edge from this block to MBB.

This method should NOT be called directly, but by using getEdgeProbability method from MachineBranchProbabilityInfo class.

Definition at line 1583 of file MachineBasicBlock.cpp.

References llvm::BranchProbability::getZero(), P, and succ_size().

Referenced by copySuccessor(), print(), and printMBB().

◆ getSymbol()

MCSymbol * MachineBasicBlock::getSymbol ( ) const

Return the MCSymbol for this basic block.

Definition at line 61 of file MachineBasicBlock.cpp.

References llvm::MBBSectionID::ColdSectionID, llvm::MCContext::createBlockSymbol(), llvm::MBBSectionID::ExceptionSectionID, llvm::MachineFunction::getContext(), llvm::MachineFunction::getFunctionNumber(), llvm::MachineFunction::getName(), getNumber(), llvm::MCContext::getOrCreateSymbol(), getParent(), llvm::MachineFunction::hasBBSections(), hasLabelMustBeEmitted(), isBeginSection(), and llvm::MBBSectionID::Number.

Referenced by llvm::DebugHandlerBase::beginBasicBlockSection(), llvm::AsmPrinter::emitBasicBlockStart(), llvm::AsmPrinter::emitBBAddrMapSection(), EmitInlineAsmStr(), llvm::ARMAsmPrinter::emitInstruction(), llvm::ARMAsmPrinter::emitJumpTableAddrs(), llvm::AsmPrinter::emitJumpTableEntry(), llvm::ARMAsmPrinter::emitJumpTableInsts(), llvm::ARMAsmPrinter::emitJumpTableTBInst(), llvm::ARMAsmPrinter::emitMachineConstantPoolValue(), llvm::CSKYAsmPrinter::emitMachineConstantPoolValue(), llvm::XtensaAsmPrinter::emitMachineConstantPoolValue(), llvm::SystemZMCInstLower::getExpr(), llvm::TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(), llvm::M68kMCInstLower::GetSymbolFromOperand(), llvm::SIInstrInfo::insertIndirectBranch(), llvm::M68kTargetLowering::LowerCustomJumpTableEntry(), llvm::RISCVTargetLowering::LowerCustomJumpTableEntry(), llvm::VETargetLowering::LowerCustomJumpTableEntry(), llvm::X86TargetLowering::LowerCustomJumpTableEntry(), llvm::lowerLoongArchMachineOperandToMCOperand(), LowerOperand(), llvm::ARMAsmPrinter::lowerOperand(), llvm::AArch64MCInstLower::lowerOperand(), llvm::AMDGPUMCInstLower::lowerOperand(), llvm::CSKYMCInstLower::lowerOperand(), llvm::LowerPPCMachineOperandToMCOperand(), llvm::XtensaAsmPrinter::LowerSymbolOperand(), llvm::WebAssemblyAsmPrinter::PrintAsmOperand(), llvm::ARMAsmPrinter::printOperand(), llvm::MipsAsmPrinter::printOperand(), and llvm::HexagonAsmPrinter::printOperand().

◆ hasAddressTaken()

bool llvm::MachineBasicBlock::hasAddressTaken ( ) const
inline

Test whether this block is used as something other than the target of a terminator, exception-handling target, or jump table.

This is either the result of an IR-level "blockaddress", or some form of target-specific branch lowering.

The name of this function hasAddressTaken implies that the address of the block is known and used in a general sense, but not necessarily that the address is used by an indirect branch instruction. So branch target enforcement need not put a BTI instruction (or equivalent) at the start of a block just because this function returns true. The decision about whether to add a BTI can be more subtle than that, and depends on the more detailed checks that this function aggregates together.

Definition at line 282 of file MachineBasicBlock.h.

Referenced by llvm::MachineLoopInfo::findLoopPreheader(), llvm::HexagonAsmPrinter::isBlockOnlyReachableByFallthrough(), GCEmptyBasicBlocks::runOnMachineFunction(), and llvm::TailDuplicator::tailDuplicateAndUpdate().

◆ hasEHPadSuccessor()

bool MachineBasicBlock::hasEHPadSuccessor ( ) const

Definition at line 287 of file MachineBasicBlock.cpp.

References successors().

Referenced by isInvoke(), and isLegalToHoistInto().

◆ hasLabelMustBeEmitted()

bool llvm::MachineBasicBlock::hasLabelMustBeEmitted ( ) const
inline

Test whether this block must have its label emitted.

Definition at line 316 of file MachineBasicBlock.h.

Referenced by llvm::AsmPrinter::emitBasicBlockStart(), and getSymbol().

◆ hasName()

bool MachineBasicBlock::hasName ( ) const

Check if there is a name of corresponding LLVM basic block.

Definition at line 318 of file MachineBasicBlock.cpp.

References getBasicBlock().

◆ hasSuccessorProbabilities()

bool llvm::MachineBasicBlock::hasSuccessorProbabilities ( ) const
inline

Return true if any of the successors have probabilities attached to them.

Definition at line 839 of file MachineBasicBlock.h.

Referenced by canPredictBranchProbabilities().

◆ insert() [1/3]

MachineBasicBlock::instr_iterator MachineBasicBlock::insert ( instr_iterator  I,
MachineInstr M 
)

Insert MI into the instruction list before I, possibly inside a bundle.

If the insertion point is inside a bundle, MI will be added to the bundle, otherwise MI will not be added to any bundle. That means this function alone can't be used to prepend or append instructions to bundles. See MIBundleBuilder::insert() for a more reliable way of doing that.

Definition at line 1463 of file MachineBasicBlock.cpp.

References assert(), llvm::MachineInstr::BundledPred, llvm::MachineInstr::BundledSucc, I, llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), instr_end(), and MI.

Referenced by llvm::M68kInstrInfo::AnalyzeBranchImpl(), llvm::BuildMI(), llvm::AArch64InstrInfo::buildOutlinedFrame(), llvm::RISCVInstrInfo::buildOutlinedFrame(), llvm::X86InstrInfo::buildOutlinedFrame(), cloneCfiPrologue(), cloneInstr(), llvm::MachineFunction::cloneMachineInstrBundle(), llvm::WebAssemblyDebugValueManager::cloneSink(), CombineCVTAToLocal(), llvm::X86InstrInfo::convertToThreeAddress(), llvm::MSP430FrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::LiveDebugVariables::LDVImpl::emitDebugValues(), llvm::X86TargetLowering::EmitKCFICheck(), llvm::TargetLoweringBase::emitPatchPoint(), llvm::X86FrameLowering::emitPrologue(), llvm::ScheduleDAGSDNodes::EmitSchedule(), llvm::SPIRVTargetLowering::finalizeLowering(), llvm::TargetInstrInfo::foldMemoryOperand(), fuseInst(), fuseTwoAddrInst(), llvm::RegBankSelect::InsertPoint::insert(), insertDeleteInstructions(), llvm::MachineIRBuilder::insertInstr(), llvm::AArch64InstrInfo::insertOutlinedCall(), llvm::ARMBaseInstrInfo::insertOutlinedCall(), llvm::RISCVInstrInfo::insertOutlinedCall(), llvm::X86InstrInfo::insertOutlinedCall(), llvm::PPCInstrInfo::loadRegFromStackSlotNoUpd(), LowerCallResults(), llvm::PeelingModuloScheduleExpander::moveStageBetweenBlocks(), llvm::ARMBaseInstrInfo::optimizeCompareInstr(), llvm::PeelSingleBlockLoop(), performSink(), popRegsFromStack(), ProcessSDDbgValues(), pushRegsToStack(), llvm::TargetInstrInfo::reMaterialize(), llvm::SIInstrInfo::reMaterialize(), llvm::ARMBaseInstrInfo::reMaterialize(), llvm::X86InstrInfo::reMaterialize(), restoreCRs(), llvm::ARMBlockPlacement::revertWhileToDoLoop(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::GCNIterativeScheduler::scheduleRegion(), llvm::WebAssemblyDebugValueManager::sink(), llvm::PPCFrameLowering::spillCalleeSavedRegisters(), and llvm::PPCInstrInfo::storeRegToStackSlotNoUpd().

◆ insert() [2/3]

template<typename IT >
void llvm::MachineBasicBlock::insert ( iterator  I,
IT  S,
IT  E 
)
inline

Insert a range of instructions into the instruction list before I.

Definition at line 1054 of file MachineBasicBlock.h.

References assert(), E, end(), and I.

◆ insert() [3/3]

iterator llvm::MachineBasicBlock::insert ( iterator  I,
MachineInstr MI 
)
inline

Insert MI into the instruction list before I.

Definition at line 1061 of file MachineBasicBlock.h.

References assert(), end(), I, and MI.

◆ insertAfter()

iterator llvm::MachineBasicBlock::insertAfter ( iterator  I,
MachineInstr MI 
)
inline

Insert MI into the instruction list after I.

Definition at line 1070 of file MachineBasicBlock.h.

References assert(), end(), I, and MI.

Referenced by llvm::ARMFrameLowering::emitPrologue(), INITIALIZE_PASS(), InsertSEH(), insertSEH(), LowerCallResults(), packCmovGroup(), and llvm::SelectionDAGISel::runOnMachineFunction().

◆ insertAfterBundle()

instr_iterator llvm::MachineBasicBlock::insertAfterBundle ( instr_iterator  I,
MachineInstr MI 
)
inline

If I is bundled then insert MI into the instruction list after the end of the bundle, otherwise insert MI immediately after I.

Definition at line 1080 of file MachineBasicBlock.h.

References assert(), I, instr_end(), and MI.

◆ instr_back() [1/2]

MachineInstr & llvm::MachineBasicBlock::instr_back ( )
inline

Definition at line 352 of file MachineBasicBlock.h.

Referenced by llvm::SIFrameLowering::emitCSRSpillRestores().

◆ instr_back() [2/2]

const MachineInstr & llvm::MachineBasicBlock::instr_back ( ) const
inline

Definition at line 354 of file MachineBasicBlock.h.

◆ instr_begin() [1/2]

instr_iterator llvm::MachineBasicBlock::instr_begin ( )
inline

◆ instr_begin() [2/2]

const_instr_iterator llvm::MachineBasicBlock::instr_begin ( ) const
inline

Definition at line 362 of file MachineBasicBlock.h.

◆ instr_end() [1/2]

instr_iterator llvm::MachineBasicBlock::instr_end ( )
inline

◆ instr_end() [2/2]

const_instr_iterator llvm::MachineBasicBlock::instr_end ( ) const
inline

Definition at line 364 of file MachineBasicBlock.h.

◆ instr_front() [1/2]

MachineInstr & llvm::MachineBasicBlock::instr_front ( )
inline

Definition at line 351 of file MachineBasicBlock.h.

◆ instr_front() [2/2]

const MachineInstr & llvm::MachineBasicBlock::instr_front ( ) const
inline

Definition at line 353 of file MachineBasicBlock.h.

◆ instr_rbegin() [1/2]

reverse_instr_iterator llvm::MachineBasicBlock::instr_rbegin ( )
inline

◆ instr_rbegin() [2/2]

const_reverse_instr_iterator llvm::MachineBasicBlock::instr_rbegin ( ) const
inline

Definition at line 366 of file MachineBasicBlock.h.

◆ instr_rend() [1/2]

reverse_instr_iterator llvm::MachineBasicBlock::instr_rend ( )
inline

◆ instr_rend() [2/2]

const_reverse_instr_iterator llvm::MachineBasicBlock::instr_rend ( ) const
inline

Definition at line 368 of file MachineBasicBlock.h.

◆ instrs() [1/2]

instr_range llvm::MachineBasicBlock::instrs ( )
inline

◆ instrs() [2/2]

const_instr_range llvm::MachineBasicBlock::instrs ( ) const
inline

Definition at line 373 of file MachineBasicBlock.h.

References instr_begin(), and instr_end().

◆ isBeginSection()

bool llvm::MachineBasicBlock::isBeginSection ( ) const
inline

◆ isCleanupFuncletEntry()

bool llvm::MachineBasicBlock::isCleanupFuncletEntry ( ) const
inline

Returns true if this is the entry block of a cleanup funclet.

Definition at line 691 of file MachineBasicBlock.h.

Referenced by llvm::WinException::beginFunclet(), llvm::X86FrameLowering::emitPrologue(), and getMCSymbolForMBB().

◆ isEHContTarget()

bool llvm::MachineBasicBlock::isEHContTarget ( ) const
inline

Returns true if this is a target of Windows EH Continuation Guard.

Definition at line 679 of file MachineBasicBlock.h.

Referenced by llvm::AsmPrinter::emitBasicBlockStart().

◆ isEHFuncletEntry()

bool llvm::MachineBasicBlock::isEHFuncletEntry ( ) const
inline

◆ isEHPad()

bool llvm::MachineBasicBlock::isEHPad ( ) const
inline

◆ isEHScopeEntry()

bool llvm::MachineBasicBlock::isEHScopeEntry ( ) const
inline

Returns true if this is the entry block of an EH scope, i.e., the block that used to have a catchpad or cleanuppad instruction in the LLVM IR.

Definition at line 672 of file MachineBasicBlock.h.

Referenced by llvm::getEHScopeMembership().

◆ isEHScopeReturnBlock()

bool llvm::MachineBasicBlock::isEHScopeReturnBlock ( ) const
inline

Convenience function that returns true if the bock ends in a EH scope return instruction.

Definition at line 982 of file MachineBasicBlock.h.

References back(), empty(), and llvm::MachineInstr::isEHScopeReturn().

Referenced by collectEHScopeMembers().

◆ isEndSection()

bool llvm::MachineBasicBlock::isEndSection ( ) const
inline

◆ isEntryBlock()

bool MachineBasicBlock::isEntryBlock ( ) const

◆ isInlineAsmBrIndirectTarget()

bool llvm::MachineBasicBlock::isInlineAsmBrIndirectTarget ( ) const
inline

◆ isIRBlockAddressTaken()

bool llvm::MachineBasicBlock::isIRBlockAddressTaken ( ) const
inline

Test whether this block is the target of an IR BlockAddress.

(There can more than one MBB associated with an IR BB where the address is taken.)

If this function returns true, it does mean that branch target enforcement needs to put a BTI or equivalent at the start of the block.

Definition at line 301 of file MachineBasicBlock.h.

Referenced by llvm::AsmPrinter::emitBasicBlockStart(), printName(), and terminatorIsComputedGotoWithSuccessors().

◆ isLayoutSuccessor()

bool MachineBasicBlock::isLayoutSuccessor ( const MachineBasicBlock MBB) const

Return true if the specified MBB will be emitted immediately after this block, such that if this block exits by falling through, control will transfer to the specified MBB.

Note that MBB need not be a successor at all, for example if this block ends with an unconditional branch to some other block.

Definition at line 962 of file MachineBasicBlock.cpp.

References I, and MBB.

Referenced by llvm::BPFInstrInfo::analyzeBranch(), llvm::HexagonInstrInfo::analyzeBranch(), llvm::MSP430InstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), llvm::SystemZInstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::ARMBaseInstrInfo::analyzeBranch(), llvm::LanaiInstrInfo::analyzeBranch(), llvm::M68kInstrInfo::AnalyzeBranchImpl(), llvm::FastISel::fastEmitBranch(), llvm::AsmPrinter::isBlockOnlyReachableByFallthrough(), llvm::CombinerHelper::matchOptBrCondByInvertingCond(), ProfitableToMerge(), SplitCriticalEdge(), splitEdge(), updateTerminator(), and updateTerminator().

◆ isLegalToHoistInto()

bool MachineBasicBlock::isLegalToHoistInto ( ) const

Returns true if it is legal to hoist instructions into this block.

Definition at line 312 of file MachineBasicBlock.cpp.

References hasEHPadSuccessor(), isReturnBlock(), and mayHaveInlineAsmBr().

◆ isLiveIn()

bool MachineBasicBlock::isLiveIn ( MCRegister  Reg,
LaneBitmask  LaneMask = LaneBitmask::getAll() 
) const

◆ isMachineBlockAddressTaken()

bool llvm::MachineBasicBlock::isMachineBlockAddressTaken ( ) const
inline

Test whether this block is used as something other than the target of a terminator, exception-handling target, jump table, or IR blockaddress.

For example, its address might be loaded into a register, or stored in some branch table that isn't part of MachineJumpTableInfo.

If this function returns true, it does mean that branch target enforcement needs to put a BTI or equivalent at the start of the block.

Definition at line 294 of file MachineBasicBlock.h.

Referenced by llvm::AsmPrinter::emitBasicBlockStart(), and printName().

◆ isPredecessor()

bool MachineBasicBlock::isPredecessor ( const MachineBasicBlock MBB) const

Return true if the specified MBB is a predecessor of this block.

Definition at line 954 of file MachineBasicBlock.cpp.

References llvm::is_contained(), MBB, and predecessors().

Referenced by getPreviousInstr(), llvm::MachineTraceMetrics::Ensemble::invalidate(), and llvm::MachineTraceMetrics::Ensemble::verify().

◆ isReturnBlock()

bool llvm::MachineBasicBlock::isReturnBlock ( ) const
inline

◆ isSuccessor()

bool MachineBasicBlock::isSuccessor ( const MachineBasicBlock MBB) const

◆ livein_begin()

MachineBasicBlock::livein_iterator MachineBasicBlock::livein_begin ( ) const

Definition at line 1776 of file MachineBasicBlock.cpp.

References assert(), and getParent().

Referenced by liveins().

◆ livein_begin_dbg()

livein_iterator llvm::MachineBasicBlock::livein_begin_dbg ( ) const
inline

Unlike livein_begin, this method does not check that the liveness information is accurate.

Still for debug purposes it may be useful to have iterators that won't assert if the liveness information is not current.

Definition at line 520 of file MachineBasicBlock.h.

Referenced by liveins_dbg().

◆ livein_empty()

bool llvm::MachineBasicBlock::livein_empty ( ) const
inline

Definition at line 527 of file MachineBasicBlock.h.

Referenced by llvm::addLiveIns(), print(), and printMBB().

◆ livein_end()

livein_iterator llvm::MachineBasicBlock::livein_end ( ) const
inline

Definition at line 526 of file MachineBasicBlock.h.

Referenced by isLiveIn(), liveins(), and liveins_dbg().

◆ liveins()

iterator_range< livein_iterator > llvm::MachineBasicBlock::liveins ( ) const
inline

◆ liveins_dbg()

iterator_range< livein_iterator > llvm::MachineBasicBlock::liveins_dbg ( ) const
inline

Definition at line 521 of file MachineBasicBlock.h.

References livein_begin_dbg(), livein_end(), and llvm::make_range().

Referenced by printMBB().

◆ liveout_begin()

MachineBasicBlock::liveout_iterator MachineBasicBlock::liveout_begin ( ) const

Iterator scanning successor basic blocks' liveins to determine the registers potentially live at the end of this block.

There may be duplicates or overlapping registers in the list returned.

Definition at line 1782 of file MachineBasicBlock.cpp.

References llvm::TargetLoweringBase::getExceptionPointerRegister(), llvm::TargetLoweringBase::getExceptionSelectorRegister(), llvm::MachineFunction::getFunction(), getParent(), llvm::Function::getPersonalityFn(), llvm::MachineFunction::getSubtarget(), llvm::TargetSubtargetInfo::getTargetLowering(), and llvm::Function::hasPersonalityFn().

Referenced by liveouts().

◆ liveout_end()

liveout_iterator llvm::MachineBasicBlock::liveout_end ( ) const
inline

Definition at line 621 of file MachineBasicBlock.h.

Referenced by liveouts().

◆ liveouts()

iterator_range< liveout_iterator > llvm::MachineBasicBlock::liveouts ( ) const
inline

◆ mayHaveInlineAsmBr()

bool MachineBasicBlock::mayHaveInlineAsmBr ( ) const

Returns true if this block may have an INLINEASM_BR (overestimate, by checking if any of the successors are indirect targets of any inlineasm_br in the function).

Definition at line 304 of file MachineBasicBlock.cpp.

References successors().

Referenced by isLegalToHoistInto().

◆ moveAfter()

void MachineBasicBlock::moveAfter ( MachineBasicBlock NewBefore)

◆ moveBefore()

void MachineBasicBlock::moveBefore ( MachineBasicBlock NewAfter)

Move 'this' block before or after the specified block.

This only moves the block, it does not modify the CFG or adjust potential fall-throughs at the end of the block.

Definition at line 674 of file MachineBasicBlock.cpp.

References llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::MachineFunction::splice().

Referenced by llvm::ARMBlockPlacement::moveBasicBlock().

◆ normalizeSuccProbs()

void llvm::MachineBasicBlock::normalizeSuccProbs ( )
inline

Normalize probabilities of all successors so that the sum of them becomes one.

This is usually done when the current update on this MBB is done, and the sum of its successors' probabilities is not guaranteed to be one. The user is responsible for the correct use of this function. MBB::removeSuccessor() has an option to do this automatically.

Definition at line 790 of file MachineBasicBlock.h.

References llvm::BranchProbability::normalizeProbabilities().

Referenced by llvm::SwitchCG::SwitchLowering::buildJumpTable(), removeSuccessor(), splitSuccessor(), transferSuccessorsAndUpdatePHIs(), llvm::SelectionDAGBuilder::visitBitTestCase(), llvm::SelectionDAGBuilder::visitBitTestHeader(), and llvm::SelectionDAGBuilder::visitSwitchCase().

◆ phis() [1/2]

iterator_range< iterator > llvm::MachineBasicBlock::phis ( )
inline

◆ phis() [2/2]

iterator_range< const_iterator > llvm::MachineBasicBlock::phis ( ) const
inline

Definition at line 408 of file MachineBasicBlock.h.

References phis().

◆ pop_back()

void llvm::MachineBasicBlock::pop_back ( )
inline

Definition at line 1041 of file MachineBasicBlock.h.

◆ pop_front()

void llvm::MachineBasicBlock::pop_front ( )
inline

Definition at line 1040 of file MachineBasicBlock.h.

◆ pred_begin() [1/2]

pred_iterator llvm::MachineBasicBlock::pred_begin ( )
inline

◆ pred_begin() [2/2]

const_pred_iterator llvm::MachineBasicBlock::pred_begin ( ) const
inline

◆ pred_empty()

bool llvm::MachineBasicBlock::pred_empty ( ) const
inline

◆ pred_end() [1/2]

pred_iterator llvm::MachineBasicBlock::pred_end ( )
inline

◆ pred_end() [2/2]

const_pred_iterator llvm::MachineBasicBlock::pred_end ( ) const
inline

◆ pred_rbegin() [1/2]

pred_reverse_iterator llvm::MachineBasicBlock::pred_rbegin ( )
inline

◆ pred_rbegin() [2/2]

const_pred_reverse_iterator llvm::MachineBasicBlock::pred_rbegin ( ) const
inline

◆ pred_rend() [1/2]

pred_reverse_iterator llvm::MachineBasicBlock::pred_rend ( )
inline

◆ pred_rend() [2/2]

const_pred_reverse_iterator llvm::MachineBasicBlock::pred_rend ( ) const
inline

◆ pred_size()

unsigned llvm::MachineBasicBlock::pred_size ( ) const
inline

◆ predecessors() [1/2]

iterator_range< pred_iterator > llvm::MachineBasicBlock::predecessors ( )
inline

◆ predecessors() [2/2]

iterator_range< const_pred_iterator > llvm::MachineBasicBlock::predecessors ( ) const
inline

Definition at line 463 of file MachineBasicBlock.h.

References llvm::make_range(), pred_begin(), and pred_end().

◆ print() [1/2]

void MachineBasicBlock::print ( raw_ostream OS,
const SlotIndexes Indexes = nullptr,
bool  IsStandalone = true 
) const

◆ print() [2/2]

void MachineBasicBlock::print ( raw_ostream OS,
ModuleSlotTracker MST,
const SlotIndexes Indexes = nullptr,
bool  IsStandalone = true 
) const

◆ printAsOperand()

void MachineBasicBlock::printAsOperand ( raw_ostream OS,
bool  PrintType = true 
) const

Definition at line 592 of file MachineBasicBlock.cpp.

References OS, and printName().

Referenced by llvm::MachineInstr::print(), llvm::printMBBReference(), and printMI().

◆ printName()

void MachineBasicBlock::printName ( raw_ostream os,
unsigned  printNameFlags = PrintNameIr,
ModuleSlotTracker moduleSlotTracker = nullptr 
) const

Print the basic block's name as:

bb.{number}[.{ir-name}] [(attributes...)]

The {ir-name} is only printed when the PrintNameIr flag is passed (which is the default). If the IR block has no name, it is identified numerically using the attribute syntax as "(%ir-block.{ir-slot})".

When the PrintNameAttributes flag is passed, additional attributes of the block are printed when set.

Parameters
printNameFlagsCombination of PrintNameFlag flags indicating the parts to print.
moduleSlotTrackerOptional ModuleSlotTracker. This method will incorporate its own tracker when necessary to determine the block's IR name.

Definition at line 488 of file MachineBasicBlock.cpp.

References llvm::MBBSectionID::Cold, llvm::MBBSectionID::Exception, getAddressTakenIRBlock(), getAlignment(), getBasicBlock(), getBBID(), llvm::ModuleSlotTracker::getLocalSlot(), getNumber(), getSectionID(), llvm::ModuleSlotTracker::incorporateFunction(), isEHFuncletEntry(), isEHPad(), isInlineAsmBrIndirectTarget(), isIRBlockAddressTaken(), isMachineBlockAddressTaken(), llvm::MBBSectionID::Number, PrintNameAttributes, PrintNameIr, llvm::MBBSectionID::Type, and llvm::Align::value().

Referenced by print(), printAsOperand(), printMBB(), and llvm::GCNRegPressurePrinter::runOnMachineFunction().

◆ push_back()

void llvm::MachineBasicBlock::push_back ( MachineInstr MI)
inline

◆ rbegin() [1/2]

reverse_iterator llvm::MachineBasicBlock::rbegin ( )
inline

◆ rbegin() [2/2]

const_reverse_iterator llvm::MachineBasicBlock::rbegin ( ) const
inline

◆ remove()

MachineInstr * llvm::MachineBasicBlock::remove ( MachineInstr I)
inline

Remove the unbundled instruction from the instruction list without deleting it.

This function can not be used to remove bundled instructions, use remove_instr to remove individual instructions from a bundle.

Definition at line 1129 of file MachineBasicBlock.h.

References assert(), and I.

Referenced by llvm::WindowScheduler::backupMBB(), llvm::X86InstrInfo::optimizeCompareInstr(), llvm::MachineInstr::removeFromParent(), and llvm::GCNIterativeScheduler::scheduleRegion().

◆ remove_instr()

MachineInstr * MachineBasicBlock::remove_instr ( MachineInstr I)

Remove the possibly bundled instruction from the instruction list without deleting it.

If the instruction is part of a bundle, the other instructions in the bundle will still be bundled after removing the single instruction.

Definition at line 1455 of file MachineBasicBlock.cpp.

References llvm::MachineInstr::BundledPred, llvm::MachineInstr::BundledSucc, MI, llvm::iplist_impl< IntrusiveListT, TraitsT >::remove(), and unbundleSingleMI().

Referenced by llvm::AArch64TargetLowering::EmitAllocateSMESaveBuffer(), llvm::AArch64TargetLowering::EmitAllocateZABuffer(), llvm::AArch64TargetLowering::EmitGetSMESaveSize(), llvm::AArch64TargetLowering::EmitInitTPIDR2Object(), llvm::SPIRVTargetLowering::finalizeLowering(), and llvm::MachineInstr::removeFromBundle().

◆ removeFromParent()

MachineBasicBlock * MachineBasicBlock::removeFromParent ( )

This method unlinks 'this' from the containing function, and returns it, but does not delete it.

Definition at line 1476 of file MachineBasicBlock.cpp.

References assert(), getParent(), and llvm::MachineFunction::remove().

◆ removeLiveIn() [1/2]

Remove entry from the livein set and return iterator to the next.

Definition at line 610 of file MachineBasicBlock.cpp.

References I.

◆ removeLiveIn() [2/2]

void MachineBasicBlock::removeLiveIn ( MCRegister  Reg,
LaneBitmask  LaneMask = LaneBitmask::getAll() 
)

Remove the specified register from the live in set.

Definition at line 598 of file MachineBasicBlock.cpp.

References llvm::find_if(), I, and llvm::MachineBasicBlock::RegisterMaskPair::PhysReg.

Referenced by emitGPDisp(), llvm::SIMachineFunctionInfo::shiftWwmVGPRsToLowestRange(), and updateLiveIn().

◆ removeSuccessor() [1/2]

void MachineBasicBlock::removeSuccessor ( MachineBasicBlock Succ,
bool  NormalizeSuccProbs = false 
)

Remove successor from the successors list of this MachineBasicBlock.

The Predecessors list of Succ is automatically updated. If NormalizeSuccProbs is true, then normalize successors' probabilities after the successor is removed.

Definition at line 834 of file MachineBasicBlock.cpp.

References llvm::find(), I, and removeSuccessor().

Referenced by llvm::VETargetLowering::emitSjLjDispatchBlock(), eraseDeadBBsAndChildren(), INITIALIZE_PASS(), removeSuccessor(), replaceSuccessor(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), rollbackRestoreSplit(), GCEmptyBasicBlocks::runOnMachineFunction(), transferSuccessors(), transferSuccessorsAndUpdatePHIs(), and llvm::PeelingModuloScheduleExpander::validateAgainstModuloScheduleExpander().

◆ removeSuccessor() [2/2]

MachineBasicBlock::succ_iterator MachineBasicBlock::removeSuccessor ( succ_iterator  I,
bool  NormalizeSuccProbs = false 
)

Remove specified successor from the successors list of this MachineBasicBlock.

The Predecessors list of Succ is automatically updated. If NormalizeSuccProbs is true, then normalize successors' probabilities after the successor is removed. Return the iterator to the element after the one removed.

Definition at line 841 of file MachineBasicBlock.cpp.

References assert(), I, and normalizeSuccProbs().

◆ rend() [1/2]

reverse_iterator llvm::MachineBasicBlock::rend ( )
inline

◆ rend() [2/2]

const_reverse_iterator llvm::MachineBasicBlock::rend ( ) const
inline

Definition at line 388 of file MachineBasicBlock.h.

References instr_rend().

◆ replacePhiUsesWith()

void MachineBasicBlock::replacePhiUsesWith ( MachineBasicBlock Old,
MachineBasicBlock New 
)

Update all phi nodes in this basic block to refer to basic block New instead of basic block Old.

Definition at line 1510 of file MachineBasicBlock.cpp.

References llvm::MachineOperand::getMBB(), MI, phis(), and llvm::MachineOperand::setMBB().

Referenced by SplitCriticalEdge(), and transferSuccessorsAndUpdatePHIs().

◆ replaceSuccessor()

void MachineBasicBlock::replaceSuccessor ( MachineBasicBlock Old,
MachineBasicBlock New 
)

◆ ReplaceUsesOfBlockWith()

void MachineBasicBlock::ReplaceUsesOfBlockWith ( MachineBasicBlock Old,
MachineBasicBlock New 
)

Given a machine basic block that branched to 'Old', change the code and CFG so that it branches to 'New' instead.

Definition at line 1490 of file MachineBasicBlock.cpp.

References assert(), I, instr_begin(), instr_end(), and replaceSuccessor().

Referenced by llvm::ARMFrameLowering::adjustForSegmentedStacks(), llvm::PeelSingleBlockLoop(), and SplitCriticalEdge().

◆ rfindDebugLoc() [1/2]

DebugLoc MachineBasicBlock::rfindDebugLoc ( reverse_instr_iterator  MBBI)

Has exact same behavior as findDebugLoc (it also searches towards the end of this MBB) except that this function takes a reverse iterator to identify the starting MI.

Definition at line 1531 of file MachineBasicBlock.cpp.

References findDebugLoc(), instr_begin(), instr_rbegin(), instr_rend(), MBBI, and llvm::skipDebugInstructionsBackward().

Referenced by llvm::M68kInstrInfo::AnalyzeBranchImpl(), and rfindDebugLoc().

◆ rfindDebugLoc() [2/2]

DebugLoc llvm::MachineBasicBlock::rfindDebugLoc ( reverse_iterator  MBBI)
inline

Definition at line 1194 of file MachineBasicBlock.h.

References MBBI, and rfindDebugLoc().

◆ rfindPrevDebugLoc() [1/2]

DebugLoc MachineBasicBlock::rfindPrevDebugLoc ( reverse_instr_iterator  MBBI)

Has exact same behavior as findPrevDebugLoc (it also searches towards the beginning of this MBB) except that this function takes reverse iterator to identify the starting MI.

A minor difference compared to findPrevDebugLoc is that we can't start scanning at "instr_end".

Definition at line 1553 of file MachineBasicBlock.cpp.

References instr_rend(), MBBI, and llvm::next_nodbg().

Referenced by rfindPrevDebugLoc().

◆ rfindPrevDebugLoc() [2/2]

DebugLoc llvm::MachineBasicBlock::rfindPrevDebugLoc ( reverse_iterator  MBBI)
inline

Definition at line 1211 of file MachineBasicBlock.h.

References MBBI, and rfindPrevDebugLoc().

◆ sameSection()

bool llvm::MachineBasicBlock::sameSection ( const MachineBasicBlock MBB) const
inline

Returns true if this and MBB belong to the same section.

Definition at line 750 of file MachineBasicBlock.h.

References getSectionID(), and MBB.

Referenced by llvm::DwarfCompileUnit::attachRangesOrLowHighPC(), and llvm::AsmPrinter::emitFunctionBody().

◆ setAddressTakenIRBlock()

void llvm::MachineBasicBlock::setAddressTakenIRBlock ( BasicBlock BB)
inline

Set this block to reflect that it corresponds to an IR-level basic block with a BlockAddress.

Definition at line 313 of file MachineBasicBlock.h.

Referenced by llvm::IRTranslator::runOnMachineFunction(), and llvm::FunctionLoweringInfo::set().

◆ setAlignment() [1/2]

void llvm::MachineBasicBlock::setAlignment ( Align  A)
inline

Set alignment of the basic block.

Definition at line 642 of file MachineBasicBlock.h.

References A.

Referenced by AlignBlocks(), and setAlignment().

◆ setAlignment() [2/2]

void llvm::MachineBasicBlock::setAlignment ( Align  A,
unsigned  MaxBytes 
)
inline

Definition at line 644 of file MachineBasicBlock.h.

References A, setAlignment(), and setMaxBytesForAlignment().

◆ setBBID()

void llvm::MachineBasicBlock::setBBID ( const UniqueBBID V)
inline

Sets the fixed BBID of this basic block.

Definition at line 712 of file MachineBasicBlock.h.

References assert().

Referenced by llvm::MachineFunction::CreateMachineBasicBlock().

◆ setCallFrameSize()

void llvm::MachineBasicBlock::setCallFrameSize ( unsigned  N)
inline

◆ setIrrLoopHeaderWeight()

void llvm::MachineBasicBlock::setIrrLoopHeaderWeight ( uint64_t  Weight)
inline

Definition at line 1278 of file MachineBasicBlock.h.

◆ setIsBeginSection()

void llvm::MachineBasicBlock::setIsBeginSection ( bool  V = true)
inline

Definition at line 702 of file MachineBasicBlock.h.

Referenced by llvm::MachineFunction::assignBeginEndSections().

◆ setIsCleanupFuncletEntry()

void llvm::MachineBasicBlock::setIsCleanupFuncletEntry ( bool  V = true)
inline

Indicates if this is the entry block of a cleanup funclet.

Definition at line 694 of file MachineBasicBlock.h.

◆ setIsEHContTarget()

void llvm::MachineBasicBlock::setIsEHContTarget ( bool  V = true)
inline

Indicates if this is a target of Windows EH Continuation Guard.

Definition at line 682 of file MachineBasicBlock.h.

◆ setIsEHFuncletEntry()

void llvm::MachineBasicBlock::setIsEHFuncletEntry ( bool  V = true)
inline

Indicates if this is the entry block of an EH funclet.

Definition at line 688 of file MachineBasicBlock.h.

◆ setIsEHPad()

void llvm::MachineBasicBlock::setIsEHPad ( bool  V = true)
inline

Indicates the block is a landing pad.

That is this basic block is entered via an exception handler.

Definition at line 663 of file MachineBasicBlock.h.

Referenced by llvm::VETargetLowering::emitSjLjDispatchBlock(), and llvm::FunctionLoweringInfo::set().

◆ setIsEHScopeEntry()

void llvm::MachineBasicBlock::setIsEHScopeEntry ( bool  V = true)
inline

Indicates if this is the entry block of an EH scope, i.e., the block that that used to have a catchpad or cleanuppad instruction in the LLVM IR.

Definition at line 676 of file MachineBasicBlock.h.

◆ setIsEndSection()

void llvm::MachineBasicBlock::setIsEndSection ( bool  V = true)
inline

Definition at line 704 of file MachineBasicBlock.h.

Referenced by llvm::MachineFunction::assignBeginEndSections().

◆ setIsInlineAsmBrIndirectTarget()

void llvm::MachineBasicBlock::setIsInlineAsmBrIndirectTarget ( bool  V = true)
inline

Indicates if this is the indirect dest of an INLINEASM_BR.

Definition at line 734 of file MachineBasicBlock.h.

◆ setLabelMustBeEmitted()

void llvm::MachineBasicBlock::setLabelMustBeEmitted ( )
inline

Set this block to reflect that, regardless how we flow to it, we need its label be emitted.

Definition at line 320 of file MachineBasicBlock.h.

◆ setMachineBlockAddressTaken()

void llvm::MachineBasicBlock::setMachineBlockAddressTaken ( )
inline

Set this block to indicate that its address is used as something other than the target of a terminator, exception-handling target, jump table, or IR-level "blockaddress".

Definition at line 309 of file MachineBasicBlock.h.

Referenced by llvm::SystemZTargetLowering::emitEHSjLjSetJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), and llvm::AArch64InstrInfo::expandPostRAPseudo().

◆ setMaxBytesForAlignment()

void llvm::MachineBasicBlock::setMaxBytesForAlignment ( unsigned  MaxBytes)
inline

Set the maximum amount of padding allowed for aligning the basic block.

Definition at line 653 of file MachineBasicBlock.h.

Referenced by setAlignment().

◆ setNumber()

void llvm::MachineBasicBlock::setNumber ( int  N)
inline

Definition at line 1261 of file MachineBasicBlock.h.

References N, and Number.

Referenced by llvm::MachineFunction::RenumberBlocks().

◆ setSectionID()

void llvm::MachineBasicBlock::setSectionID ( MBBSectionID  V)
inline

Sets the section ID for this basic block.

Definition at line 718 of file MachineBasicBlock.h.

Referenced by assignSections().

◆ setSuccProbability()

void MachineBasicBlock::setSuccProbability ( succ_iterator  I,
BranchProbability  Prob 
)

Set successor probability of a given iterator.

Definition at line 1621 of file MachineBasicBlock.cpp.

References assert(), I, and llvm::BranchProbability::isUnknown().

Referenced by llvm::MIRProfileLoader::setBranchProbs(), and splitMBB().

◆ size()

unsigned llvm::MachineBasicBlock::size ( ) const
inline

◆ sizeWithoutDebugLargerThan()

bool MachineBasicBlock::sizeWithoutDebugLargerThan ( unsigned  Limit) const

Definition at line 1795 of file MachineBasicBlock.cpp.

References begin(), end(), I, and llvm::instructionsWithoutDebug().

◆ SkipPHIsAndLabels()

MachineBasicBlock::iterator MachineBasicBlock::SkipPHIsAndLabels ( MachineBasicBlock::iterator  I)

Return the first instruction in MBB after I that is not a PHI or a label.

This is the correct point to insert lowered copies at the beginning of a basic block that must be before any debugging information.

Definition at line 210 of file MachineBasicBlock.cpp.

References assert(), end(), llvm::TargetSubtargetInfo::getInstrInfo(), getParent(), llvm::MachineFunction::getSubtarget(), I, and TII.

Referenced by addLiveIn(), llvm::AMDGPU::RegBankLegalizeHelper::applyMappingPHI(), RegBankSelectHelper::constrainRegBankUse(), copyDebugInfoToSuccessor(), llvm::findPHICopyInsertPoint(), llvm::getOpVariableMBBIt(), and RegBankSelectHelper::reAssignRegBankOnDef().

◆ SkipPHIsLabelsAndDebug()

MachineBasicBlock::iterator MachineBasicBlock::SkipPHIsLabelsAndDebug ( MachineBasicBlock::iterator  I,
Register  Reg = Register(),
bool  SkipPseudoOp = true 
)

Return the first instruction in MBB after I that is not a PHI, label or debug.

This is the correct point to insert copies at the beginning of a basic block. Reg is the register being used by a spill or defined for a restore/split during register allocation.

Definition at line 225 of file MachineBasicBlock.cpp.

References assert(), end(), llvm::TargetSubtargetInfo::getInstrInfo(), getParent(), llvm::MachineFunction::getSubtarget(), I, and TII.

Referenced by findInsertLocation(), and llvm::SplitEditor::leaveIntvAtTop().

◆ sortUniqueLiveIns()

void MachineBasicBlock::sortUniqueLiveIns ( )

◆ splice() [1/2]

void llvm::MachineBasicBlock::splice ( iterator  Where,
MachineBasicBlock Other,
iterator  From 
)
inline

Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before 'Where'.

If From points to a bundle of instructions, the whole bundle is moved.

Definition at line 1149 of file MachineBasicBlock.h.

References From, llvm::Other, and splice().

Referenced by llvm::AMDGPURegisterBankInfo::applyMappingImpl(), llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::SystemZTargetLowering::emitEHSjLjSetJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::AArch64TargetLowering::EmitF128CSEL(), emitFROUND(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::AVRTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), EmitLoweredCascadedSelect(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::PPCTargetLowering::emitProbedAlloca(), emitReadCounterWidePseudo(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), emitStackProbeInline(), emitVecCondBranchPseudo(), emitXBegin(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::SparcTargetLowering::expandSelectCC(), hoistAndMergeSGPRInits(), llvm::PPCFrameLowering::inlineStackProbe(), loadMBUFScalarOperandsFromVGPR(), LowerFPToInt(), LowerMemcpy(), LowerMemset(), llvm::MachineInstr::moveBefore(), llvm::ScheduleDAGMI::moveInstruction(), MoveVPNOTBeforeFirstUser(), performSink(), llvm::ScheduleDAGMI::placeDebugValues(), llvm::AArch64InstrInfo::probedStackAlloc(), rescheduleCanonically(), rescheduleLexographically(), llvm::WindowScheduler::restoreTripleMBB(), llvm::GCNSchedStage::revertScheduling(), llvm::IRTranslator::runOnMachineFunction(), llvm::WebAssemblyDebugValueManager::sink(), splice(), splitAt(), llvm::SystemZ::splitBlockAfter(), llvm::SystemZ::splitBlockBefore(), splitBlockForLoop(), and splitMBB().

◆ splice() [2/2]

void llvm::MachineBasicBlock::splice ( iterator  Where,
MachineBasicBlock Other,
iterator  From,
iterator  To 
)
inline

Take a block of instructions from MBB 'Other' in the range [From, To), and insert them into this MBB right before 'Where'.

The instruction at 'Where' must not be included in the range of instructions to move.

Definition at line 1160 of file MachineBasicBlock.h.

References From, llvm::MachineInstrBundleIterator< Ty, IsReverse >::getInstrIterator(), and llvm::Other.

◆ splitAt()

MachineBasicBlock * MachineBasicBlock::splitAt ( MachineInstr SplitInst,
bool  UpdateLiveIns = true,
LiveIntervals LIS = nullptr 
)

Split a basic block into 2 pieces at SplitPoint.

A new block will be inserted after this block, and all instructions after SplitInst moved to it (SplitInst will be in the original block). If LIS is provided, LiveIntervals will be appropriately updated.

Returns
the newly inserted block.

If UpdateLiveIns is true, this will ensure the live ins list is accurate, including for physreg uses/defs in the original block.

Definition at line 1023 of file MachineBasicBlock.cpp.

References llvm::addLiveIns(), addSuccessor(), begin(), llvm::MachineFunction::CreateMachineBasicBlock(), end(), getBasicBlock(), getParent(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineInstrBundleIterator< Ty, IsReverse >::getReverse(), llvm::MachineFunction::getSubtarget(), I, llvm::MachineFunction::insert(), llvm::LiveIntervals::insertMBBInMaps(), MI, rbegin(), splice(), and transferSuccessorsAndUpdatePHIs().

Referenced by llvm::SITargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::SIInstrInfo::insertSimulatedTrap(), llvm::AMDGPULegalizerInfo::legalizeTrapEndpgm(), splitBlock(), and llvm::SITargetLowering::splitKillBlock().

◆ SplitCriticalEdge() [1/4]

MachineBasicBlock * MachineBasicBlock::SplitCriticalEdge ( MachineBasicBlock Succ,
const SplitCriticalEdgeAnalyses Analyses,
std::vector< SparseBitVector<> > *  LiveInSets,
MachineDomTreeUpdater MDTU 
)

Definition at line 1160 of file MachineBasicBlock.cpp.

References addLiveIn(), llvm::LiveRange::addSegment(), addSuccessor(), assert(), canSplitCriticalEdge(), Cond, llvm::SmallSet< T, N, C >::count(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::dbgs(), DL, llvm::SmallVectorBase< Size_T >::empty(), end(), llvm::MachineFunction::end(), findBranchDebugLoc(), findJumpTableIndex(), getCallFrameSize(), llvm::DebugLoc::getCol(), getFirstInstrTerminator(), getFirstTerminator(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getJumpTableInfo(), llvm::DebugLoc::getLine(), llvm::ilist_node_with_parent< MachineBasicBlock, MachineFunction >::getNextNode(), getParent(), llvm::SlotIndex::getPrevSlot(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::LiveRange::getVNInfoAt(), I, llvm::Register::index2VirtReg(), llvm::SmallSet< T, N, C >::insert(), llvm::MachineFunction::insert(), llvm::HexagonInstrInfo::insertBranch(), llvm::LiveIntervals::insertMBBInMaps(), llvm::SlotIndexes::insertMBBInMaps(), instr_begin(), instr_end(), llvm::is_contained(), isLayoutSuccessor(), isLiveOut(), llvm::MachineOperand::isUndef(), llvm::MachineBasicBlock::SplitCriticalEdgeAnalyses::LIS, llvm::LiveRange::liveAt(), liveins(), LLVM_DEBUG, llvm::MachineBasicBlock::SplitCriticalEdgeAnalyses::LV, llvm::make_range(), MI, llvm::MachineBasicBlock::SplitCriticalEdgeAnalyses::MLI, MRI, P, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::printMBBReference(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LiveRange::removeSegment(), llvm::MachineJumpTableInfo::ReplaceMBBInJumpTable(), replacePhiUsesWith(), ReplaceUsesOfBlockWith(), setCallFrameSize(), llvm::MachineBasicBlock::SplitCriticalEdgeAnalyses::SI, llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::splitCriticalEdge(), llvm::LiveInterval::subranges(), TII, TRI, and updateTerminator().

◆ SplitCriticalEdge() [2/4]

MachineBasicBlock * llvm::MachineBasicBlock::SplitCriticalEdge ( MachineBasicBlock Succ,
MachineFunctionAnalysisManager MFAM,
std::vector< SparseBitVector<> > *  LiveInSets = nullptr,
MachineDomTreeUpdater MDTU = nullptr 
)
inline

Definition at line 1018 of file MachineBasicBlock.h.

References SplitCriticalEdge().

◆ SplitCriticalEdge() [3/4]

MachineBasicBlock * llvm::MachineBasicBlock::SplitCriticalEdge ( MachineBasicBlock Succ,
Pass P,
std::vector< SparseBitVector<> > *  LiveInSets = nullptr,
MachineDomTreeUpdater MDTU = nullptr 
)
inline

Definition at line 1011 of file MachineBasicBlock.h.

References P, and SplitCriticalEdge().

Referenced by SplitCriticalEdge().

◆ SplitCriticalEdge() [4/4]

MachineBasicBlock * MachineBasicBlock::SplitCriticalEdge ( MachineBasicBlock Succ,
Pass P,
MachineFunctionAnalysisManager MFAM,
std::vector< SparseBitVector<> > *  LiveInSets,
MachineDomTreeUpdater MDTU 
)

Definition at line 1138 of file MachineBasicBlock.cpp.

References assert(), GET_RESULT, getParent(), Info, P, and SplitCriticalEdge().

◆ splitSuccessor()

void MachineBasicBlock::splitSuccessor ( MachineBasicBlock Old,
MachineBasicBlock New,
bool  NormalizeSuccProbs = false 
)

Split the old successor into old plus new and updates the probability info.

Definition at line 815 of file MachineBasicBlock.cpp.

References addSuccessor(), assert(), llvm::find(), llvm::BranchProbability::getUnknown(), llvm::is_contained(), normalizeSuccProbs(), succ_end(), and successors().

Referenced by splitEdge().

◆ succ_begin() [1/2]

succ_iterator llvm::MachineBasicBlock::succ_begin ( )
inline

◆ succ_begin() [2/2]

const_succ_iterator llvm::MachineBasicBlock::succ_begin ( ) const
inline

◆ succ_empty()

bool llvm::MachineBasicBlock::succ_empty ( ) const
inline

◆ succ_end() [1/2]

succ_iterator llvm::MachineBasicBlock::succ_end ( )
inline

◆ succ_end() [2/2]

const_succ_iterator llvm::MachineBasicBlock::succ_end ( ) const
inline

◆ succ_rbegin() [1/2]

succ_reverse_iterator llvm::MachineBasicBlock::succ_rbegin ( )
inline

◆ succ_rbegin() [2/2]

const_succ_reverse_iterator llvm::MachineBasicBlock::succ_rbegin ( ) const
inline

◆ succ_rend() [1/2]

succ_reverse_iterator llvm::MachineBasicBlock::succ_rend ( )
inline

◆ succ_rend() [2/2]

const_succ_reverse_iterator llvm::MachineBasicBlock::succ_rend ( ) const
inline

◆ succ_size()

unsigned llvm::MachineBasicBlock::succ_size ( ) const
inline

◆ successors() [1/2]

iterator_range< succ_iterator > llvm::MachineBasicBlock::successors ( )
inline

Definition at line 466 of file MachineBasicBlock.h.

References llvm::make_range(), succ_begin(), and succ_end().

Referenced by llvm::ScheduleDAGInstrs::addSchedBarrierDeps(), llvm::X86InstrInfo::analyzeBranchPredicate(), areCFlagsAliveInSuccessors(), BBHasFallthrough(), blockEndIsUnreachable(), CanLowerPriorityDirectlyInPredecessors(), checkAndUpdateCCRKill(), checkAndUpdateCPSRKill(), checkCCKill(), checkEFLAGSLive(), collectEHScopeMembers(), computeBlockInfo(), computeRegisterLiveness(), llvm::AsmPrinter::emitBBAddrMapSection(), eraseDeadBBsAndChildren(), findFalseBlock(), llvm::MachineLoopInfo::findLoopPreheader(), flagsNeedToBePreservedBeforeTheTerminators(), getFallThroughMBB(), llvm::ReachingDefAnalysis::getGlobalUses(), getSingleLiveInSuccBB(), llvm::afdo_detail::IRTraits< MachineBasicBlock >::getSuccessors(), hasEHPadSuccessor(), hasSameSuccessors(), llvm::MachineTraceMetrics::Ensemble::invalidate(), isLiveOut(), llvm::LiveVariables::isLiveOut(), isReachableAmongDominated(), llvm::HexagonInstrInfo::isSchedulingBoundary(), isSuccessor(), loadMBUFScalarOperandsFromVGPR(), markAllReachable(), mayHaveInlineAsmBr(), llvm::rdf::operator<<(), llvm::ARMBaseInstrInfo::optimizeCompareInstr(), llvm::LanaiInstrInfo::optimizeCompareInstr(), llvm::X86InstrInfo::optimizeCompareInstr(), OtherSucc(), llvm::LiveIntervals::pruneValue(), removeImplicitFallthroughs(), llvm::MachineBranchProbabilityPrinterPass::run(), salvageDebugInfoFromEmptyBlock(), llvm::MIRProfileLoader::setBranchProbs(), llvm::TailDuplicator::shouldTailDuplicate(), shouldUseFrameHelper(), sortBlocks(), splitBlock(), splitMBB(), splitSuccessor(), llvm::AggressiveAntiDepBreaker::StartBlock(), llvm::CriticalAntiDepBreaker::StartBlock(), llvm::successors(), terminatorIsComputedGotoWithSuccessors(), llvm::LoopTraversal::traverse(), updateLiveness(), ValidateMVEStore(), visit(), and llvm::WriteGraph().

◆ successors() [2/2]

iterator_range< const_succ_iterator > llvm::MachineBasicBlock::successors ( ) const
inline

Definition at line 469 of file MachineBasicBlock.h.

References llvm::make_range(), succ_begin(), and succ_end().

◆ terminatorIsComputedGotoWithSuccessors()

bool llvm::MachineBasicBlock::terminatorIsComputedGotoWithSuccessors ( ) const
inline

Returns true if the original IR terminator is an indirectbr with successor blocks.

This typically corresponds to a goto in C, rather than jump tables.

Definition at line 329 of file MachineBasicBlock.h.

References llvm::all_of(), back(), llvm::MachineInstr::isIndirectBranch(), isIRBlockAddressTaken(), succ_empty(), and successors().

Referenced by llvm::TailDuplicator::shouldTailDuplicate().

◆ terminators() [1/2]

iterator_range< iterator > llvm::MachineBasicBlock::terminators ( )
inline

◆ terminators() [2/2]

iterator_range< const_iterator > llvm::MachineBasicBlock::terminators ( ) const
inline

Definition at line 400 of file MachineBasicBlock.h.

References end(), getFirstTerminator(), and llvm::make_range().

◆ transferSuccessors()

void MachineBasicBlock::transferSuccessors ( MachineBasicBlock FromMBB)

Transfers all the successors from MBB to this machine basic block (i.e., copies all the successors FromMBB and remove all the successors from FromMBB).

Definition at line 915 of file MachineBasicBlock.cpp.

References addSuccessor(), addSuccessorWithoutProb(), removeSuccessor(), succ_begin(), and succ_empty().

Referenced by splitMBB().

◆ transferSuccessorsAndUpdatePHIs()

void MachineBasicBlock::transferSuccessorsAndUpdatePHIs ( MachineBasicBlock FromMBB)

Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor blocks which refer to FromMBB to refer to this.

Definition at line 935 of file MachineBasicBlock.cpp.

References addSuccessor(), addSuccessorWithoutProb(), normalizeSuccProbs(), removeSuccessor(), replacePhiUsesWith(), succ_begin(), and succ_empty().

Referenced by llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::SystemZTargetLowering::emitEHSjLjSetJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::AArch64TargetLowering::EmitF128CSEL(), emitFROUND(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::AVRTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), EmitLoweredCascadedSelect(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::PPCTargetLowering::emitProbedAlloca(), emitReadCounterWidePseudo(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), emitStackProbeInline(), emitVecCondBranchPseudo(), emitXBegin(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::SparcTargetLowering::expandSelectCC(), llvm::PPCFrameLowering::inlineStackProbe(), loadMBUFScalarOperandsFromVGPR(), LowerFPToInt(), LowerMemcpy(), LowerMemset(), llvm::AArch64InstrInfo::probedStackAlloc(), splitAt(), llvm::SystemZ::splitBlockAfter(), llvm::SystemZ::splitBlockBefore(), and splitBlockForLoop().

◆ updateTerminator()

void MachineBasicBlock::updateTerminator ( MachineBasicBlock PreviousLayoutSuccessor)

Update the terminator instructions in block to account for changes to block layout which may have been made.

PreviousLayoutSuccessor should be set to the block which may have been used as fallthrough before the block layout was modified. If the block previously fell through to that block, it may now need a branch. If it previously branched to another block, it may now be able to fallthrough to the current layout successor.

Definition at line 691 of file MachineBasicBlock.cpp.

References llvm::HexagonInstrInfo::analyzeBranch(), assert(), B, Cond, llvm::dbgs(), DL, findBranchDebugLoc(), llvm::TargetSubtargetInfo::getInstrInfo(), getParent(), llvm::MachineFunction::getSubtarget(), llvm::HexagonInstrInfo::insertBranch(), isEHPad(), isLayoutSuccessor(), isSuccessor(), LLVM_DEBUG, llvm::printMBBReference(), llvm::HexagonInstrInfo::removeBranch(), llvm::HexagonInstrInfo::reverseBranchCondition(), succ_empty(), TBB, and TII.

Referenced by maybeUpdateTerminator(), llvm::PeelSingleBlockLoop(), SplitCriticalEdge(), and updateBranches().

◆ validateSuccProbs()

void MachineBasicBlock::validateSuccProbs ( ) const

Validate successors' probabilities and check if the sum of them is approximate one.

This only works in DEBUG mode.

Definition at line 782 of file MachineBasicBlock.cpp.

References assert(), and llvm::BranchProbability::getDenominator().

Friends And Related Function Documentation

◆ ilist_callback_traits< MachineBasicBlock >

friend struct ilist_callback_traits< MachineBasicBlock >
friend

Definition at line 1296 of file MachineBasicBlock.h.

◆ MachineBranchProbabilityInfo

friend class MachineBranchProbabilityInfo
friend

Definition at line 1296 of file MachineBasicBlock.h.

◆ MachineFunction

friend class MachineFunction
friend

Definition at line 247 of file MachineBasicBlock.h.


The documentation for this class was generated from the following files: