LLVM  13.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:
Inheritance graph
[legend]
Collaboration diagram for llvm::MachineBasicBlock:
Collaboration graph
[legend]

Classes

struct  RegisterMaskPair
 Pair of physical register and lane mask. 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 = std::vector< MachineBasicBlock * >::iterator
 
using const_pred_iterator = std::vector< MachineBasicBlock * >::const_iterator
 
using succ_iterator = std::vector< MachineBasicBlock * >::iterator
 
using const_succ_iterator = std::vector< MachineBasicBlock * >::const_iterator
 
using pred_reverse_iterator = std::vector< MachineBasicBlock * >::reverse_iterator
 
using const_pred_reverse_iterator = std::vector< MachineBasicBlock * >::const_reverse_iterator
 
using succ_reverse_iterator = std::vector< MachineBasicBlock * >::reverse_iterator
 
using const_succ_reverse_iterator = std::vector< 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. More...
 
StringRef getName () const
 Return the name of the corresponding LLVM basic block, or an empty string. More...
 
std::string getFullName () const
 Return a formatted string to identify this block and its parent function. More...
 
bool hasAddressTaken () const
 Test whether this block is potentially the target of an indirect branch. More...
 
void setHasAddressTaken ()
 Set this block to reflect that it potentially is the target of an indirect branch. More...
 
bool hasLabelMustBeEmitted () const
 Test whether this block must have its label emitted. More...
 
void setLabelMustBeEmitted ()
 Set this block to reflect that, regardless how we flow to it, we need its label be emitted. More...
 
const MachineFunctiongetParent () const
 Return the MachineFunction containing this basic block. More...
 
MachineFunctiongetParent ()
 
unsigned size () 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. More...
 
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. More...
 
void addLiveIn (const RegisterMaskPair &RegMaskPair)
 
void sortUniqueLiveIns ()
 Sorts and uniques the LiveIns vector. More...
 
void clearLiveIns ()
 Clear live in list. More...
 
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. More...
 
void removeLiveIn (MCPhysReg Reg, LaneBitmask LaneMask=LaneBitmask::getAll())
 Remove the specified register from the live in set. More...
 
bool isLiveIn (MCPhysReg Reg, LaneBitmask LaneMask=LaneBitmask::getAll()) const
 Return true if the specified register is in the live in set. More...
 
livein_iterator livein_begin_dbg () const
 Unlike livein_begin, this method does not check that the liveness information is accurate. More...
 
iterator_range< livein_iteratorliveins_dbg () const
 
livein_iterator livein_begin () const
 
livein_iterator livein_end () const
 
bool livein_empty () const
 
iterator_range< livein_iteratorliveins () const
 
livein_iterator removeLiveIn (livein_iterator I)
 Remove entry from the livein set and return iterator to the next. More...
 
const uint32_tgetBeginClobberMask (const TargetRegisterInfo *TRI) const
 Get the clobber mask for the start of this basic block. More...
 
const uint32_tgetEndClobberMask (const TargetRegisterInfo *TRI) const
 Get the clobber mask for the end of the basic block. More...
 
Align getAlignment () const
 Return alignment of the basic block. More...
 
void setAlignment (Align A)
 Set alignment of the basic block. More...
 
bool isEHPad () const
 Returns true if the block is a landing pad. More...
 
void setIsEHPad (bool V=true)
 Indicates the block is a landing pad. More...
 
bool hasEHPadSuccessor () const
 
bool isEntryBlock () const
 Returns true if this is the entry block of the function. More...
 
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. More...
 
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. More...
 
bool isEHCatchretTarget () const
 Returns true if this is a target block of a catchret. More...
 
void setIsEHCatchretTarget (bool V=true)
 Indicates if this is a target block of a catchret. More...
 
bool isEHFuncletEntry () const
 Returns true if this is the entry block of an EH funclet. More...
 
void setIsEHFuncletEntry (bool V=true)
 Indicates if this is the entry block of an EH funclet. More...
 
bool isCleanupFuncletEntry () const
 Returns true if this is the entry block of a cleanup funclet. More...
 
void setIsCleanupFuncletEntry (bool V=true)
 Indicates if this is the entry block of a cleanup funclet. More...
 
bool isBeginSection () const
 Returns true if this block begins any section. More...
 
bool isEndSection () const
 Returns true if this block ends any section. More...
 
void setIsBeginSection (bool V=true)
 
void setIsEndSection (bool V=true)
 
MBBSectionID getSectionID () const
 Returns the section ID of this basic block. More...
 
unsigned getSectionIDNum () const
 Returns the unique section ID number of this basic block. More...
 
void setSectionID (MBBSectionID V)
 Sets the section ID for this basic block. More...
 
MCSymbolgetEndSymbol () const
 Returns the MCSymbol marking the end of this basic block. More...
 
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). More...
 
bool isInlineAsmBrIndirectTarget () const
 Returns true if this is the indirect dest of an INLINEASM_BR. More...
 
void setIsInlineAsmBrIndirectTarget (bool V=true)
 Indicates if this is the indirect dest of an INLINEASM_BR. More...
 
bool isLegalToHoistInto () const
 Returns true if it is legal to hoist instructions into this block. More...
 
void moveBefore (MachineBasicBlock *NewAfter)
 Move 'this' block before or after the specified block. More...
 
void moveAfter (MachineBasicBlock *NewBefore)
 
bool sameSection (const MachineBasicBlock *MBB) const
 Returns true if this and MBB belong to the same section. More...
 
void updateTerminator (MachineBasicBlock *PreviousLayoutSuccessor)
 Update the terminator instructions in block to account for changes to block layout which may have been made. More...
 
void addSuccessor (MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
 Add Succ as a successor of this MachineBasicBlock. More...
 
void addSuccessorWithoutProb (MachineBasicBlock *Succ)
 Add Succ as a successor of this MachineBasicBlock. More...
 
void setSuccProbability (succ_iterator I, BranchProbability Prob)
 Set successor probability of a given iterator. More...
 
void normalizeSuccProbs ()
 Normalize probabilities of all successors so that the sum of them becomes one. More...
 
void validateSuccProbs () const
 Validate successors' probabilities and check if the sum of them is approximate one. More...
 
void removeSuccessor (MachineBasicBlock *Succ, bool NormalizeSuccProbs=false)
 Remove successor from the successors list of this MachineBasicBlock. More...
 
succ_iterator removeSuccessor (succ_iterator I, bool NormalizeSuccProbs=false)
 Remove specified successor from the successors list of this MachineBasicBlock. More...
 
void replaceSuccessor (MachineBasicBlock *Old, MachineBasicBlock *New)
 Replace successor OLD with NEW and update probability info. More...
 
void copySuccessor (MachineBasicBlock *Orig, succ_iterator I)
 Copy a successor (and any probability info) from original block to this block's. More...
 
void splitSuccessor (MachineBasicBlock *Old, MachineBasicBlock *New, bool NormalizeSuccProbs=false)
 Split the old successor into old plus new and updates the probability info. More...
 
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). More...
 
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. More...
 
void moveAndDanglePseudoProbes (MachineBasicBlock *ToMBB)
 move all pseudo probes in this block to the end of /c ToMBB To and tag them dangling. More...
 
bool hasSuccessorProbabilities () const
 Return true if any of the successors have probabilities attached to them. More...
 
bool isPredecessor (const MachineBasicBlock *MBB) const
 Return true if the specified MBB is a predecessor of this block. More...
 
bool isSuccessor (const MachineBasicBlock *MBB) const
 Return true if the specified MBB is a successor of this block. More...
 
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. More...
 
MachineBasicBlockgetFallThrough ()
 Return the fallthrough block if the block can implicitly transfer control to the block after it by falling off the end of it. More...
 
bool canFallThrough ()
 Return true if the block can implicitly transfer control to the block after it by falling off the end of it. More...
 
iterator getFirstNonPHI ()
 Returns a pointer to the first instruction in this block that is not a PHINode instruction. More...
 
iterator SkipPHIsAndLabels (iterator I)
 Return the first instruction in MBB after I that is not a PHI or a label. More...
 
iterator SkipPHIsLabelsAndDebug (iterator I, bool SkipPseudoOp=true)
 Return the first instruction in MBB after I that is not a PHI, label or debug. More...
 
iterator getFirstTerminator ()
 Returns an iterator to the first terminator instruction of this basic block. More...
 
const_iterator getFirstTerminator () const
 
instr_iterator getFirstInstrTerminator ()
 Same getFirstTerminator but it ignores bundles and return an instr_iterator instead. More...
 
iterator getFirstNonDebugInstr (bool SkipPseudoOp=true)
 Returns an iterator to the first non-debug instruction in the basic block, or end(). More...
 
const_iterator getFirstNonDebugInstr (bool SkipPseudoOp=true) const
 
iterator getLastNonDebugInstr (bool SkipPseudoOp=true)
 Returns an iterator to the last non-debug instruction in the basic block, or end(). More...
 
const_iterator getLastNonDebugInstr (bool SkipPseudoOp=true) const
 
bool isReturnBlock () const
 Convenience function that returns true if the block ends in a return instruction. More...
 
bool isEHScopeReturnBlock () const
 Convenience function that returns true if the bock ends in a EH scope return instruction. More...
 
MachineBasicBlocksplitAt (MachineInstr &SplitInst, bool UpdateLiveIns=true, LiveIntervals *LIS=nullptr)
 Split a basic block into 2 pieces at SplitPoint. More...
 
MachineBasicBlockSplitCriticalEdge (MachineBasicBlock *Succ, Pass &P, std::vector< SparseBitVector<>> *LiveInSets=nullptr)
 Split the critical edge from this block to the given successor block, and return the newly created block, or null if splitting is not possible. More...
 
bool canSplitCriticalEdge (const MachineBasicBlock *Succ) const
 Check if the edge between this block and the given successor Succ, can be split. More...
 
void pop_front ()
 
void pop_back ()
 
void push_back (MachineInstr *MI)
 
instr_iterator insert (instr_iterator I, MachineInstr *M)
 Insert MI into the instruction list before I, possibly inside a bundle. More...
 
template<typename IT >
void insert (iterator I, IT S, IT E)
 Insert a range of instructions into the instruction list before I. More...
 
iterator insert (iterator I, MachineInstr *MI)
 Insert MI into the instruction list before I. More...
 
iterator insertAfter (iterator I, MachineInstr *MI)
 Insert MI into the instruction list after I. More...
 
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. More...
 
instr_iterator erase (instr_iterator I)
 Remove an instruction from the instruction list and delete it. More...
 
instr_iterator erase_instr (MachineInstr *I)
 Remove an instruction from the instruction list and delete it. More...
 
iterator erase (iterator I, iterator E)
 Remove a range of instructions from the instruction list and delete them. More...
 
iterator erase (iterator I)
 Remove an instruction or bundle from the instruction list and delete it. More...
 
iterator erase (MachineInstr *I)
 Remove an instruction from the instruction list and delete it. More...
 
MachineInstrremove (MachineInstr *I)
 Remove the unbundled instruction from the instruction list without deleting it. More...
 
MachineInstrremove_instr (MachineInstr *I)
 Remove the possibly bundled instruction from the instruction list without deleting it. More...
 
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'. More...
 
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'. More...
 
MachineBasicBlockremoveFromParent ()
 This method unlinks 'this' from the containing function, and returns it, but does not delete it. More...
 
void eraseFromParent ()
 This method unlinks 'this' from the containing function and deletes it. More...
 
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. More...
 
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. More...
 
DebugLoc findDebugLoc (instr_iterator MBBI)
 Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE and DBG_LABEL instructions. More...
 
DebugLoc findDebugLoc (iterator MBBI)
 
DebugLoc rfindDebugLoc (reverse_instr_iterator MBBI)
 Has exact same behavior as findDebugLoc (it also searches from the first to the last MI of this MBB) except that this takes reverse iterator. More...
 
DebugLoc rfindDebugLoc (reverse_iterator MBBI)
 
DebugLoc findPrevDebugLoc (instr_iterator MBBI)
 Find the previous valid DebugLoc preceding MBBI, skipping and DBG_VALUE instructions. More...
 
DebugLoc findPrevDebugLoc (iterator MBBI)
 
DebugLoc rfindPrevDebugLoc (reverse_instr_iterator MBBI)
 Has exact same behavior as findPrevDebugLoc (it also searches from the last to the first MI of this MBB) except that this takes reverse iterator. More...
 
DebugLoc rfindPrevDebugLoc (reverse_iterator MBBI)
 
DebugLoc findBranchDebugLoc ()
 Find and return the merged DebugLoc of the branch instructions of the block. More...
 
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. More...
 
void dump () const
 
void print (raw_ostream &OS, const SlotIndexes *=nullptr, bool IsStandalone=true) const
 
void print (raw_ostream &OS, ModuleSlotTracker &MST, const SlotIndexes *=nullptr, bool IsStandalone=true) const
 
void printName (raw_ostream &os, unsigned printNameFlags=PrintNameIr, ModuleSlotTracker *moduleSlotTracker=nullptr) const
 Print the basic block's name as: More...
 
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. More...
 
void setNumber (int N)
 
MCSymbolgetSymbol () const
 Return the MCSymbol for this basic block. More...
 
MCSymbolgetEHCatchretSymbol () const
 Return the EHCatchret Symbol for this basic block. More...
 
Optional< uint64_t > getIrrLoopHeaderWeight () const
 
void setIrrLoopHeaderWeight (uint64_t Weight)
 
- 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. More...
 
MachineBasicBlockgetNextNode ()
 Get the next node, or nullptr for the list tail. More...
 
const MachineBasicBlockgetNextNode () const
 Get the next node, or nullptr for the list tail. More...
 
- Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< MachineBasicBlock, Options... >::type >
self_iterator getIterator ()
 
const_self_iterator getIterator () const
 
reverse_self_iterator getReverseIterator ()
 
const_reverse_self_iterator getReverseIterator () const
 
bool isSentinel () const
 Check whether this is the sentinel node. More...
 

Static Public Member Functions

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

Friends

class MachineFunction
 
class MachineBranchProbabilityInfo
 
class MIPrinter
 
struct ilist_callback_traits< MachineBasicBlock >
 

Additional Inherited Members

- Protected Types inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< MachineBasicBlock, Options... >::type >
using self_iterator = ilist_iterator< ilist_detail::compute_node_options< MachineBasicBlock, Options... >::type, false, false >
 
using const_self_iterator = ilist_iterator< ilist_detail::compute_node_options< MachineBasicBlock, Options... >::type, false, true >
 
using reverse_self_iterator = ilist_iterator< ilist_detail::compute_node_options< MachineBasicBlock, Options... >::type, true, false >
 
using const_reverse_self_iterator = ilist_iterator< ilist_detail::compute_node_options< MachineBasicBlock, Options... >::type, true, true >
 
- 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< MachineBasicBlock, Options... >::type >
 ilist_node_impl ()=default
 

Detailed Description

Definition at line 95 of file MachineBasicBlock.h.

Member Typedef Documentation

◆ const_instr_iterator

Definition at line 229 of file MachineBasicBlock.h.

◆ const_instr_range

Definition at line 262 of file MachineBasicBlock.h.

◆ const_iterator

Definition at line 234 of file MachineBasicBlock.h.

◆ const_pred_iterator

Definition at line 305 of file MachineBasicBlock.h.

◆ const_pred_reverse_iterator

Definition at line 311 of file MachineBasicBlock.h.

◆ const_reverse_instr_iterator

Definition at line 231 of file MachineBasicBlock.h.

◆ const_reverse_iterator

Definition at line 237 of file MachineBasicBlock.h.

◆ const_succ_iterator

Definition at line 307 of file MachineBasicBlock.h.

◆ const_succ_reverse_iterator

Definition at line 315 of file MachineBasicBlock.h.

◆ instr_iterator

Definition at line 228 of file MachineBasicBlock.h.

◆ instr_range

Definition at line 261 of file MachineBasicBlock.h.

◆ iterator

Definition at line 233 of file MachineBasicBlock.h.

◆ livein_iterator

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

Definition at line 398 of file MachineBasicBlock.h.

◆ pred_iterator

Definition at line 304 of file MachineBasicBlock.h.

◆ pred_reverse_iterator

Definition at line 309 of file MachineBasicBlock.h.

◆ reverse_instr_iterator

Definition at line 230 of file MachineBasicBlock.h.

◆ reverse_iterator

Definition at line 235 of file MachineBasicBlock.h.

◆ succ_iterator

Definition at line 306 of file MachineBasicBlock.h.

◆ succ_reverse_iterator

Definition at line 313 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 930 of file MachineBasicBlock.h.

◆ PrintNameFlag

Enumerator
PrintNameIr 

Add IR name where available.

PrintNameAttributes 

Print attributes.

Definition at line 956 of file MachineBasicBlock.h.

Member Function Documentation

◆ addLiveIn() [1/3]

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

Definition at line 371 of file MachineBasicBlock.h.

◆ addLiveIn() [2/3]

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

◆ 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 367 of file MachineBasicBlock.h.

Referenced by addLiveIn(), addLiveInRegs(), llvm::addLiveIns(), addSavedGPR(), llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::X86FrameLowering::adjustForSegmentedStacks(), buildGitPtr(), llvm::RISCVInstrInfo::buildOutlinedFrame(), llvm::AArch64InstrInfo::buildOutlinedFrame(), llvm::ARMBaseInstrInfo::buildOutlinedFrame(), emitAlignedDPRCS2Spills(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), llvm::AArch64TargetLowering::EmitF128CSEL(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::MachineRegisterInfo::EmitLiveInCopies(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), llvm::SIFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), emitXBegin(), llvm::getFunctionLiveInPhysReg(), handleMustTailForwardedRegisters(), llvm::MipsFunctionInfo::initGlobalBaseReg(), INITIALIZE_PASS(), llvm::ARMBaseInstrInfo::insertOutlinedCall(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), lowerShiftReservedVGPR(), llvm::IRTranslator::runOnMachineFunction(), llvm::Mips16FrameLowering::spillCalleeSavedRegisters(), llvm::Thumb1FrameLowering::spillCalleeSavedRegisters(), llvm::MipsSEFrameLowering::spillCalleeSavedRegisters(), llvm::SystemZFrameLowering::spillCalleeSavedRegisters(), llvm::XCoreFrameLowering::spillCalleeSavedRegisters(), llvm::MSP430FrameLowering::spillCalleeSavedRegisters(), llvm::RISCVFrameLowering::spillCalleeSavedRegisters(), llvm::AArch64FrameLowering::spillCalleeSavedRegisters(), llvm::X86FrameLowering::spillCalleeSavedRegisters(), llvm::M68kFrameLowering::spillCalleeSavedRegisters(), llvm::PPCFrameLowering::spillCalleeSavedRegisters(), SplitCriticalEdge(), splitEdge(), 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 745 of file MachineBasicBlock.cpp.

Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::ARMFrameLowering::adjustForSegmentedStacks(), llvm::X86FrameLowering::adjustForSegmentedStacks(), copySuccessor(), llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::AArch64TargetLowering::EmitF128CSEL(), llvm::AVRTargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::emitProbedAlloca(), emitReadCycleWidePseudo(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), llvm::VETargetLowering::emitSjLjDispatchBlock(), emitXBegin(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::SparcTargetLowering::expandSelectCC(), INITIALIZE_PASS(), llvm::SystemZFrameLowering::inlineStackProbe(), llvm::PPCFrameLowering::inlineStackProbe(), loadM0FromVGPR(), LowerFPToInt(), llvm::PeelSingleBlockLoop(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), split(), splitAt(), splitBlockForLoop(), SplitCriticalEdge(), splitEdge(), splitMBB(), splitSuccessor(), transferSuccessors(), transferSuccessorsAndUpdatePHIs(), 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 755 of file MachineBasicBlock.cpp.

Referenced by copySuccessor(), transferSuccessors(), and transferSuccessorsAndUpdatePHIs().

◆ back() [1/2]

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

◆ back() [2/2]

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

Definition at line 250 of file MachineBasicBlock.h.

References end().

◆ begin() [1/2]

iterator llvm::MachineBasicBlock::begin ( )
inline

Definition at line 268 of file MachineBasicBlock.h.

References instr_begin().

Referenced by addLiveIn(), llvm::LiveVariables::addNewBlock(), llvm::BPFInstrInfo::analyzeBranch(), llvm::XCoreInstrInfo::analyzeBranch(), llvm::ARCInstrInfo::analyzeBranch(), llvm::NVPTXInstrInfo::analyzeBranch(), llvm::MSP430InstrInfo::analyzeBranch(), llvm::VEInstrInfo::analyzeBranch(), llvm::SparcInstrInfo::analyzeBranch(), llvm::LanaiInstrInfo::analyzeBranch(), llvm::R600InstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::SystemZInstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), avoidZeroOffsetLandingPad(), llvm::RegScavenger::backward(), llvm::RISCVInstrInfo::buildOutlinedFrame(), llvm::AArch64InstrInfo::buildOutlinedFrame(), llvm::ARMBaseInstrInfo::buildOutlinedFrame(), computeRegisterLiveness(), llvm::SIInstrInfo::convertNonUniformLoopRegion(), copyDebugInfoToSuccessor(), CountTerminators(), llvm::SIInstrInfo::createPHIDestinationCopy(), createPHIsForCMOVsInSinkBB(), createPHIsForSelects(), llvm::MachineDominatorTree::dominates(), dominates(), llvm::M68kFrameLowering::eliminateCallFramePseudoInstr(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitEpilogue(), llvm::MSP430FrameLowering::emitEpilogue(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::M68kFrameLowering::emitEpilogue(), llvm::AArch64TargetLowering::EmitF128CSEL(), llvm::AsmPrinter::emitFunctionBody(), emitGPDisp(), llvm::SITargetLowering::emitGWSMemViolTestLoop(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), llvm::AVRTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::MachineRegisterInfo::EmitLiveInCopies(), emitLoadM0FromVGPRLoop(), emitLoadSRsrcFromVGPRLoop(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::Thumb1FrameLowering::emitPrologue(), llvm::Mips16FrameLowering::emitPrologue(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::SparcFrameLowering::emitPrologue(), llvm::VEFrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), llvm::MSP430FrameLowering::emitPrologue(), llvm::SIFrameLowering::emitPrologue(), llvm::ARCFrameLowering::emitPrologue(), llvm::AArch64FrameLowering::emitPrologue(), llvm::LanaiFrameLowering::emitPrologue(), llvm::WebAssemblyFrameLowering::emitPrologue(), llvm::SystemZFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::M68kFrameLowering::emitPrologue(), llvm::PPCFrameLowering::emitPrologue(), emitReadCycleWidePseudo(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), emitXBegin(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::AArch64InstrInfo::expandPostRAPseudo(), llvm::SparcTargetLowering::expandSelectCC(), llvm::WebAssembly::findCatch(), llvm::findCMPToFoldIntoCBZ(), findFirstPredicateSetterFrom(), findHoistingInsertPosAndDeps(), findIncDecBefore(), llvm::findPHICopyInsertPoint(), findSurvivorBackwards(), llvm::RegScavenger::forward(), getEarliestInsertPos(), getFirstNonDebugInstr(), getFirstTerminator(), llvm::getFunctionLiveInPhysReg(), llvm::SparcInstrInfo::getGlobalBaseReg(), llvm::VEInstrInfo::getGlobalBaseReg(), llvm::ARMHazardRecognizerFPMLx::getHazardType(), getLatestInsertPos(), getNextMachineInstr(), llvm::ARMBasicBlockUtils::getOffsetOf(), getPreviousInstr(), getSchedRegions(), indirectCopyToAGPR(), llvm::MipsFunctionInfo::initGlobalBaseReg(), INITIALIZE_PASS(), llvm::SystemZFrameLowering::inlineStackProbe(), llvm::PPCFrameLowering::inlineStackProbe(), insertCSRRestores(), insertCSRSaves(), llvm::MipsAsmPrinter::isBlockOnlyReachableByFallthrough(), isEFLAGSLive(), jumpTableFollowsTB(), loadM0FromVGPR(), llvm::X86CallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::AMDGPUCallLowering::lowerFormalArguments(), LowerFPToInt(), llvm::CombinerHelper::matchOptBrCondByInvertingCond(), llvm::SIRegisterInfo::materializeFrameBaseRegister(), llvm::AArch64RegisterInfo::materializeFrameBaseRegister(), llvm::PPCRegisterInfo::materializeFrameBaseRegister(), llvm::ARMBaseRegisterInfo::materializeFrameBaseRegister(), MBBDefinesCTR(), llvm::X86FrameLowering::mergeSPUpdates(), llvm::M68kFrameLowering::mergeSPUpdates(), llvm::LanaiInstrInfo::optimizeCompareInstr(), llvm::ARMBaseInstrInfo::optimizeCompareInstr(), llvm::PPCInstrInfo::optimizeCompareInstr(), llvm::PeelingModuloScheduleExpander::peelKernel(), llvm::PeelSingleBlockLoop(), phis(), PrevCrossBBInst(), llvm::AArch64FrameLowering::processFunctionBeforeFrameFinalized(), ProfitableToMerge(), llvm::RegPressureTracker::recede(), llvm::RegPressureTracker::recedeSkipDebugValues(), llvm::BPFInstrInfo::removeBranch(), llvm::NVPTXInstrInfo::removeBranch(), llvm::XCoreInstrInfo::removeBranch(), llvm::ARCInstrInfo::removeBranch(), llvm::MSP430InstrInfo::removeBranch(), llvm::VEInstrInfo::removeBranch(), llvm::SparcInstrInfo::removeBranch(), llvm::RISCVInstrInfo::removeBranch(), llvm::LanaiInstrInfo::removeBranch(), llvm::HexagonInstrInfo::removeBranch(), llvm::ARMBaseInstrInfo::removeBranch(), llvm::R600InstrInfo::removeBranch(), llvm::AArch64InstrInfo::removeBranch(), llvm::SystemZInstrInfo::removeBranch(), llvm::M68kInstrInfo::removeBranch(), llvm::X86InstrInfo::removeBranch(), llvm::PPCInstrInfo::removeBranch(), removeDebugInstrs(), llvm::RegBankSelect::RepairingPlacement::RepairingPlacement(), llvm::X86InstrInfo::replaceBranchWithTailCall(), llvm::PPCFrameLowering::replaceFPWithRealFP(), llvm::Thumb2InstrInfo::ReplaceTailWithBranchTo(), rescheduleCanonically(), llvm::XCoreFrameLowering::restoreCalleeSavedRegisters(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), llvm::PPCFrameLowering::restoreCalleeSavedRegisters(), llvm::X86FrameLowering::restoreWinEHStackPointersInParent(), llvm::InsertNOPLoad::runOnMachineFunction(), llvm::InstructionSelect::runOnMachineFunction(), llvm::DetectRoundChange::runOnMachineFunction(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::FixAllFDIVSQRT::runOnMachineFunction(), llvm::AVRDynAllocaSR::runOnMachineFunction(), llvm::RegBankSelect::runOnMachineFunction(), llvm::IRTranslator::runOnMachineFunction(), scavengeFrameVirtualRegsInBlock(), signOutlinedFunction(), skipBackwardPastNonInstructions(), splitAt(), llvm::SystemZ::splitBlockAfter(), llvm::SystemZ::splitBlockBefore(), splitBlockForLoop(), unstackifyVRegsUsedInSplitBB(), llvm::PeelingModuloScheduleExpander::validateAgainstModuloScheduleExpander(), verifyCTRBranch(), llvm::MemorySSA::verifyOrderingDominationAndDefUses(), and VerifyPHIs().

◆ begin() [2/2]

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

Definition at line 269 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 986 of file MachineBasicBlock.cpp.

References getFallThrough().

Referenced by AlignBlocks(), getBBAddrMapMetadata(), ProfitableToMerge(), and llvm::TailDuplicator::shouldTailDuplicate().

◆ 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 1270 of file MachineBasicBlock.cpp.

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

Referenced by SplitCriticalEdge().

◆ clear()

void llvm::MachineBasicBlock::clear ( )
inline

Definition at line 855 of file MachineBasicBlock.h.

◆ clearLiveIns()

void MachineBasicBlock::clearLiveIns ( )

Clear live in list.

Definition at line 1621 of file MachineBasicBlock.cpp.

Referenced by llvm::recomputeLiveIns().

◆ 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 1510 of file MachineBasicBlock.cpp.

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

Referenced by llvm::Thumb1InstrInfo::copyPhysReg(), llvm::X86InstrInfo::reMaterialize(), and updateOperand().

◆ copySuccessor()

void MachineBasicBlock::copySuccessor ( 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 846 of file MachineBasicBlock.cpp.

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

◆ dump()

LLVM_DUMP_METHOD void MachineBasicBlock::dump ( ) const

◆ empty()

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

◆ end() [1/2]

iterator llvm::MachineBasicBlock::end ( )
inline

Definition at line 270 of file MachineBasicBlock.h.

References instr_end().

Referenced by addLiveIn(), llvm::LiveVariables::addNewBlock(), llvm::ScheduleDAGInstrs::addSchedBarrierDeps(), llvm::RegPressureTracker::advance(), llvm::BPFInstrInfo::analyzeBranch(), llvm::XCoreInstrInfo::analyzeBranch(), llvm::ARCInstrInfo::analyzeBranch(), llvm::NVPTXInstrInfo::analyzeBranch(), llvm::MSP430InstrInfo::analyzeBranch(), llvm::RISCVInstrInfo::analyzeBranch(), llvm::VEInstrInfo::analyzeBranch(), llvm::SparcInstrInfo::analyzeBranch(), llvm::LanaiInstrInfo::analyzeBranch(), llvm::R600InstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::SystemZInstrInfo::analyzeBranch(), llvm::SIInstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), llvm::SIInstrInfo::analyzeBranchImpl(), llvm::AArch64InstrInfo::analyzeBranchPredicate(), llvm::HexagonInstrInfo::analyzeLoopForPipelining(), llvm::PPCInstrInfo::analyzeLoopForPipelining(), appendEndToFunction(), llvm::CombinerHelper::applyExtendThroughPhis(), back(), blockEndIsUnreachable(), llvm::RISCVInstrInfo::buildOutlinedFrame(), llvm::AArch64InstrInfo::buildOutlinedFrame(), llvm::ARMBaseInstrInfo::buildOutlinedFrame(), llvm::X86InstrInfo::buildOutlinedFrame(), checkCCKill(), clearKillFlags(), ComputeCommonTailLength(), computeRegisterLiveness(), llvm::SIInstrInfo::convertNonUniformIfRegion(), llvm::SIInstrInfo::convertNonUniformLoopRegion(), CountTerminators(), llvm::SIInstrInfo::createPHIDestinationCopy(), llvm::SIInstrInfo::createPHISourceCopy(), dominates(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::X86RegisterInfo::eliminateFrameIndex(), emitAlignedDPRCS2Restores(), emitAlignedDPRCS2Spills(), llvm::AsmPrinter::emitCFIInstruction(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::Mips16FrameLowering::emitEpilogue(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::MipsSEFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitEpilogue(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::WebAssemblyFrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::M68kFrameLowering::emitEpilogue(), llvm::PPCFrameLowering::emitEpilogue(), llvm::AArch64TargetLowering::EmitF128CSEL(), llvm::SITargetLowering::emitGWSMemViolTestLoop(), emitLoadSRsrcFromVGPRLoop(), llvm::PPCTargetLowering::emitProbedAlloca(), llvm::Thumb1FrameLowering::emitPrologue(), llvm::MSP430FrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), llvm::WebAssemblyFrameLowering::emitPrologue(), llvm::SystemZFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::M68kFrameLowering::emitPrologue(), emitSelectPseudo(), llvm::VETargetLowering::emitSjLjDispatchBlock(), emitXBegin(), llvm::RegScavenger::enterBasicBlockEnd(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::SparcTargetLowering::expandSelectCC(), llvm::GCNScheduleDAGMILive::finalizeSchedule(), findBranchDebugLoc(), llvm::WebAssembly::findCatch(), llvm::X86RegisterInfo::findDeadCallerSavedReg(), findDeadCallerSavedReg(), findHoistingInsertPosAndDeps(), findIncDecAfter(), findIncDecBefore(), FindLastAluClause(), findNextInsertLocation(), findSurvivorBackwards(), llvm::fixStackStores(), llvm::RegScavenger::forward(), getArgumentPopSize(), getBranchDebugLoc(), llvm::RegPressureTracker::getCurrSlot(), getEarliestInsertPos(), llvm::getEHScopeMembership(), getFallThrough(), getFirstNonDebugInstr(), getFirstNonPrologue(), getFirstTerminator(), llvm::InsertPointAnalysis::getLastInsertPointIter(), getLastNonDebugInstr(), getLatestInsertPos(), llvm::ReachingDefAnalysis::getLiveInUses(), llvm::ReachingDefAnalysis::getLocalLiveOutMIDef(), getNextMachineInstr(), llvm::ARMBasicBlockUtils::getOffsetOf(), getOrCreateFrameHelper(), getPreviousInstr(), llvm::ReachingDefAnalysis::getReachingLocalUses(), getSchedRegions(), llvm::X86InstrInfo::getSPAdjust(), llvm::guessSuccessors(), handleADRP(), HashEndOfMBB(), hasReturn(), hasTailCall(), INITIALIZE_PASS(), llvm::SystemZFrameLowering::inlineStackProbe(), llvm::X86FrameLowering::inlineStackProbe(), llvm::PPCFrameLowering::inlineStackProbe(), insert(), insertAfter(), llvm::HexagonInstrInfo::insertBranch(), llvm::R600InstrInfo::insertBranch(), llvm::RISCVInstrInfo::insertIndirectBranch(), llvm::SIInstrInfo::insertIndirectBranch(), llvm::SIInstrInfo::insertReturn(), InsertReturnAddressAuth(), IsBetterFallthrough(), llvm::MipsAsmPrinter::isBlockOnlyReachableByFallthrough(), IsBranchOnlyBlock(), IsEmptyBlock(), llvm::Thumb2InstrInfo::isLegalToSplitMBBAt(), llvm::CombinerHelper::isPredecessor(), llvm::ReachingDefAnalysis::isReachingDefLiveOut(), llvm::ReachingDefAnalysis::isRegDefinedAfter(), llvm::ReachingDefAnalysis::isSafeToDefRegAt(), isSafeToMove(), llvm::ARMBaseInstrInfo::isSchedulingBoundary(), llvm::TailDuplicator::isSimpleBB(), llvm::XCoreInstrInfo::loadImmediate(), llvm::SystemZInstrInfo::loadImmediate(), llvm::MipsSEInstrInfo::loadRegFromStack(), llvm::Mips16InstrInfo::loadRegFromStack(), llvm::BPFInstrInfo::loadRegFromStackSlot(), llvm::MSP430InstrInfo::loadRegFromStackSlot(), llvm::RISCVInstrInfo::loadRegFromStackSlot(), llvm::Thumb1InstrInfo::loadRegFromStackSlot(), llvm::Thumb2InstrInfo::loadRegFromStackSlot(), llvm::LanaiInstrInfo::loadRegFromStackSlot(), llvm::XCoreInstrInfo::loadRegFromStackSlot(), llvm::SparcInstrInfo::loadRegFromStackSlot(), llvm::VEInstrInfo::loadRegFromStackSlot(), llvm::ARMBaseInstrInfo::loadRegFromStackSlot(), llvm::SystemZInstrInfo::loadRegFromStackSlot(), llvm::PPCInstrInfo::loadRegFromStackSlotNoUpd(), llvm::CombinerHelper::matchOptBrCondByInvertingCond(), llvm::SIRegisterInfo::materializeFrameBaseRegister(), llvm::AArch64RegisterInfo::materializeFrameBaseRegister(), llvm::PPCRegisterInfo::materializeFrameBaseRegister(), llvm::ARMBaseRegisterInfo::materializeFrameBaseRegister(), MBBDefinesCTR(), mergeOperations(), llvm::X86FrameLowering::mergeSPUpdates(), llvm::M68kFrameLowering::mergeSPUpdates(), llvm::PeelingModuloScheduleExpander::moveStageBetweenBlocks(), MoveVPNOTBeforeFirstUser(), llvm::LanaiInstrInfo::optimizeCompareInstr(), llvm::ARMBaseInstrInfo::optimizeCompareInstr(), llvm::X86InstrInfo::optimizeCompareInstr(), llvm::PPCInstrInfo::optimizeCompareInstr(), llvm::PeelSingleBlockLoop(), performSink(), llvm::SystemZInstrInfo::prepareCompareSwapOperands(), PrevCrossBBInst(), llvm::AArch64FrameLowering::processFunctionBeforeFrameFinalized(), ProfitableToMerge(), llvm::BPFInstrInfo::removeBranch(), llvm::NVPTXInstrInfo::removeBranch(), llvm::XCoreInstrInfo::removeBranch(), llvm::ARCInstrInfo::removeBranch(), llvm::MSP430InstrInfo::removeBranch(), llvm::VEInstrInfo::removeBranch(), llvm::SparcInstrInfo::removeBranch(), llvm::RISCVInstrInfo::removeBranch(), llvm::LanaiInstrInfo::removeBranch(), llvm::HexagonInstrInfo::removeBranch(), llvm::ARMBaseInstrInfo::removeBranch(), llvm::R600InstrInfo::removeBranch(), llvm::AArch64InstrInfo::removeBranch(), llvm::SystemZInstrInfo::removeBranch(), llvm::M68kInstrInfo::removeBranch(), llvm::SIInstrInfo::removeBranch(), llvm::X86InstrInfo::removeBranch(), llvm::PPCInstrInfo::removeBranch(), removeDebugInstrs(), llvm::RegBankSelect::RepairingPlacement::RepairingPlacement(), llvm::X86InstrInfo::replaceBranchWithTailCall(), llvm::PPCFrameLowering::replaceFPWithRealFP(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), llvm::SystemZFrameLowering::restoreCalleeSavedRegisters(), llvm::MSP430FrameLowering::restoreCalleeSavedRegisters(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), llvm::AArch64FrameLowering::restoreCalleeSavedRegisters(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), llvm::Mips16InstrInfo::restoreFrame(), llvm::InsertNOPLoad::runOnMachineFunction(), llvm::InstructionSelect::runOnMachineFunction(), llvm::DetectRoundChange::runOnMachineFunction(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::FixAllFDIVSQRT::runOnMachineFunction(), scavengeFrameVirtualRegsInBlock(), llvm::RegScavenger::scavengeRegisterBackwards(), llvm::PPCInstrInfo::shouldReduceRegisterPressure(), shouldUseFrameHelper(), signOutlinedFunction(), skipBackwardPastNonInstructions(), SkipPHIsAndLabels(), SkipPHIsLabelsAndDebug(), llvm::XCoreFrameLowering::spillCalleeSavedRegisters(), llvm::MSP430FrameLowering::spillCalleeSavedRegisters(), llvm::RISCVFrameLowering::spillCalleeSavedRegisters(), split(), splitAt(), llvm::SystemZ::splitBlockAfter(), llvm::SystemZ::splitBlockBefore(), splitBlockForLoop(), SplitCriticalEdge(), splitMBB(), llvm::Mips16InstrInfo::storeRegToStack(), llvm::BPFInstrInfo::storeRegToStackSlot(), llvm::MSP430InstrInfo::storeRegToStackSlot(), llvm::RISCVInstrInfo::storeRegToStackSlot(), llvm::Thumb1InstrInfo::storeRegToStackSlot(), llvm::Thumb2InstrInfo::storeRegToStackSlot(), llvm::LanaiInstrInfo::storeRegToStackSlot(), llvm::XCoreInstrInfo::storeRegToStackSlot(), llvm::SparcInstrInfo::storeRegToStackSlot(), llvm::VEInstrInfo::storeRegToStackSlot(), llvm::SystemZInstrInfo::storeRegToStackSlot(), terminators(), unstackifyVRegsUsedInSplitBB(), llvm::ScheduleDAGMILive::updatePressureDiffs(), llvm::PeelingModuloScheduleExpander::validateAgainstModuloScheduleExpander(), verifyCFIntrinsic(), verifyCTRBranch(), llvm::MemorySSA::verifyOrderingDominationAndDefUses(), VerifyPHIs(), and llvm::WebAssemblyDebugValueManager::WebAssemblyDebugValueManager().

◆ end() [2/2]

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

Definition at line 271 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 1324 of file MachineBasicBlock.cpp.

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

Referenced by convertCalleeSaveRestoreToSPPrePostIncDec(), llvm::SIInstrInfo::convertNonUniformIfRegion(), llvm::SIInstrInfo::convertNonUniformLoopRegion(), llvm::NVPTXFrameLowering::eliminateCallFramePseudoInstr(), llvm::SparcFrameLowering::eliminateCallFramePseudoInstr(), llvm::AArch64FrameLowering::eliminateCallFramePseudoInstr(), llvm::MSP430FrameLowering::eliminateCallFramePseudoInstr(), llvm::WebAssemblyFrameLowering::eliminateCallFramePseudoInstr(), llvm::VEFrameLowering::eliminateCallFramePseudoInstr(), llvm::Thumb1FrameLowering::eliminateCallFramePseudoInstr(), llvm::LanaiFrameLowering::eliminateCallFramePseudoInstr(), llvm::MipsFrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVFrameLowering::eliminateCallFramePseudoInstr(), llvm::SIFrameLowering::eliminateCallFramePseudoInstr(), llvm::SystemZFrameLowering::eliminateCallFramePseudoInstr(), llvm::ARCFrameLowering::eliminateCallFramePseudoInstr(), llvm::HexagonFrameLowering::eliminateCallFramePseudoInstr(), llvm::M68kFrameLowering::eliminateCallFramePseudoInstr(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::PPCFrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreRegisterInfo::eliminateFrameIndex(), llvm::XCoreFrameLowering::emitEpilogue(), erase(), erase_instr(), llvm::MachineInstr::eraseFromParent(), llvm::MipsSEInstrInfo::expandPostRAPseudo(), llvm::Mips16InstrInfo::expandPostRAPseudo(), llvm::HexagonInstrInfo::expandPostRAPseudo(), llvm::R600InstrInfo::expandPostRAPseudo(), llvm::AArch64InstrInfo::expandPostRAPseudo(), llvm::HexagonInstrInfo::expandVGatherPseudo(), INITIALIZE_PASS(), InsertReturnAddressAuth(), llvm::PPCRegisterInfo::lowerACCRestore(), llvm::PPCRegisterInfo::lowerACCSpilling(), llvm::PPCRegisterInfo::lowerCRBitRestore(), llvm::PPCRegisterInfo::lowerCRBitSpilling(), llvm::PPCRegisterInfo::lowerCRRestore(), llvm::PPCRegisterInfo::lowerCRSpilling(), llvm::PPCRegisterInfo::lowerDynamicAlloc(), llvm::PPCRegisterInfo::lowerDynamicAreaOffset(), llvm::PPCRegisterInfo::lowerPrepareProbedAlloca(), llvm::X86FrameLowering::mergeSPUpdates(), llvm::M68kFrameLowering::mergeSPUpdates(), llvm::HexagonInstrInfo::removeBranch(), removeDebugInstrs(), ReplaceFrameIndex(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), llvm::ThumbRegisterInfo::rewriteFrameIndex(), and signOutlinedFunction().

◆ 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 826 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 819 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 834 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 814 of file MachineBasicBlock.h.

References erase(), and I.

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

◆ eraseFromParent()

void MachineBasicBlock::eraseFromParent ( )

This method unlinks 'this' from the containing function and deletes it.

This method unlinks 'this' from the containing function, and deletes it.

Definition at line 1357 of file MachineBasicBlock.cpp.

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

Referenced by eraseDeadBBsAndChildren(), and llvm::Thumb2InstrInfo::ReplaceTailWithBranchTo().

◆ 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 1437 of file MachineBasicBlock.cpp.

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

Referenced by FixTail(), for(), and updateTerminator().

◆ findDebugLoc() [1/2]

DebugLoc MachineBasicBlock::findDebugLoc ( instr_iterator  MBBI)

Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE and DBG_LABEL instructions.

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

Return UnknownLoc if there is none.

Definition at line 1398 of file MachineBasicBlock.cpp.

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

Referenced by llvm::R600InstrInfo::buildDefaultInstruction(), llvm::AArch64FrameLowering::emitCalleeSavedFrameMoves(), llvm::ARCFrameLowering::emitEpilogue(), emitGPDisp(), llvm::M68kFrameLowering::emitSPUpdate(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::VEInstrInfo::expandGetStackTopPseudo(), llvm::SIInstrInfo::expandMovDPP64(), llvm::SIInstrInfo::expandPostRAPseudo(), findDebugLoc(), llvm::X86FrameLowering::inlineStackProbe(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::SIInstrInfo::insertNoops(), llvm::SIInstrInfo::legalizeOpWithMove(), llvm::ARCInstrInfo::loadImmediate(), llvm::ARCInstrInfo::loadRegFromStackSlot(), llvm::HexagonInstrInfo::loadRegFromStackSlot(), llvm::SIInstrInfo::loadRegFromStackSlot(), llvm::M68kInstrInfo::loadRegFromStackSlot(), llvm::X86InstrInfo::replaceBranchWithTailCall(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), llvm::M68kFrameLowering::restoreCalleeSavedRegisters(), llvm::AVRDynAllocaSR::runOnMachineFunction(), llvm::X86FrameLowering::spillCalleeSavedRegisters(), llvm::M68kFrameLowering::spillCalleeSavedRegisters(), llvm::ARCInstrInfo::storeRegToStackSlot(), llvm::HexagonInstrInfo::storeRegToStackSlot(), llvm::SIInstrInfo::storeRegToStackSlot(), and llvm::M68kInstrInfo::storeRegToStackSlot().

◆ findDebugLoc() [2/2]

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

Definition at line 898 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 and DBG_VALUE instructions.

Return UnknownLoc if there is none.

Definition at line 1416 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 913 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 249 of file MachineBasicBlock.h.

◆ getAlignment()

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

◆ getBasicBlock()

const BasicBlock* llvm::MachineBasicBlock::getBasicBlock ( ) 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 1608 of file MachineBasicBlock.cpp.

References llvm::TargetRegisterInfo::getNoPreservedMask(), isEHFuncletEntry(), and TRI.

◆ getEHCatchretSymbol()

MCSymbol * MachineBasicBlock::getEHCatchretSymbol ( ) const

◆ 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 1614 of file MachineBasicBlock.cpp.

References llvm::TargetRegisterInfo::getNoPreservedMask(), isReturnBlock(), succ_empty(), and TRI.

◆ getEndSymbol()

MCSymbol * MachineBasicBlock::getEndSymbol ( ) const

◆ getFallThrough()

MachineBasicBlock * MachineBasicBlock::getFallThrough ( )

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

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

Definition at line 942 of file MachineBasicBlock.cpp.

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

Referenced by canFallThrough(), llvm::RISCVFrameLowering::canUseAsEpilogue(), 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 250 of file MachineBasicBlock.cpp.

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

Referenced by llvm::PeelingModuloScheduleExpander::filterInstructions(), 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 260 of file MachineBasicBlock.cpp.

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

Referenced by getFirstNonDebugInstr(), llvm::SITargetLowering::getPrefLoopAlignment(), IsBranchOnlyBlock(), IsEmptyBlock(), and llvm::TailDuplicator::isSimpleBB().

◆ getFirstNonDebugInstr() [2/2]

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

Definition at line 689 of file MachineBasicBlock.h.

References getFirstNonDebugInstr().

◆ getFirstNonPHI()

MachineBasicBlock::iterator MachineBasicBlock::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 241 of file MachineBasicBlock.cpp.

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

Referenced by llvm::SIInstrInfo::analyzeBranch(), llvm::HexagonInstrInfo::analyzeLoopForPipelining(), llvm::PPCInstrInfo::analyzeLoopForPipelining(), llvm::AMDGPURegisterBankInfo::applyMappingImpl(), llvm::SIInstrInfo::convertNonUniformIfRegion(), llvm::SIInstrInfo::convertNonUniformLoopRegion(), copyDebugInfoToPredecessor(), llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::Mips16FrameLowering::emitEpilogue(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::MipsSEFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitEpilogue(), llvm::SIFrameLowering::emitEpilogue(), llvm::ARCFrameLowering::emitEpilogue(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::WebAssemblyFrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::M68kFrameLowering::emitEpilogue(), llvm::PPCFrameLowering::emitEpilogue(), llvm::LegalizerHelper::fewerElementsVectorPhi(), findBranchDebugLoc(), findHoistingInsertPosAndDeps(), llvm::findPHICopyInsertPoint(), llvm::getEHScopeMembership(), getFirstTerminator(), llvm::SITargetLowering::getPrefLoopAlignment(), hasReturn(), llvm::HexagonInstrInfo::insertBranch(), insertCSRRestores(), llvm::SIInstrInfo::insertReturn(), InsertReturnAddressAuth(), insertUndefLaneMask(), llvm::SystemZPostRASchedStrategy::leaveMBB(), llvm::SIInstrInfo::legalizeOperands(), llvm::LegalizerHelper::moreElementsVectorPhi(), moveAndDanglePseudoProbes(), llvm::LegalizerHelper::narrowScalar(), llvm::SIInstrInfo::removeBranch(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), llvm::SelectionDAGISel::runOnMachineFunction(), signOutlinedFunction(), SplitCriticalEdge(), splitMBB(), terminators(), and llvm::LegalizerHelper::widenScalar().

◆ getFirstTerminator() [2/2]

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

Definition at line 664 of file MachineBasicBlock.h.

References getFirstTerminator().

◆ 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 321 of file MachineBasicBlock.cpp.

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

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

◆ getIrrLoopHeaderWeight()

Optional<uint64_t> llvm::MachineBasicBlock::getIrrLoopHeaderWeight ( ) const
inline

Definition at line 978 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 266 of file MachineBasicBlock.cpp.

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

Referenced by llvm::XCoreInstrInfo::analyzeBranch(), llvm::RISCVInstrInfo::analyzeBranch(), llvm::VEInstrInfo::analyzeBranch(), llvm::SparcInstrInfo::analyzeBranch(), llvm::R600InstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranchPredicate(), llvm::VEFrameLowering::emitEpilogue(), llvm::SparcFrameLowering::emitEpilogue(), llvm::XCoreFrameLowering::emitEpilogue(), llvm::MSP430FrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::LanaiFrameLowering::emitEpilogue(), llvm::SystemZFrameLowering::emitEpilogue(), getArgumentPopSize(), getBranchDebugLoc(), getLastNonDebugInstr(), llvm::ReachingDefAnalysis::getLiveInUses(), llvm::ReachingDefAnalysis::getLocalLiveOutMIDef(), llvm::guessSuccessors(), HashEndOfMBB(), hasTailCall(), IsBetterFallthrough(), llvm::SystemZInstrInfo::isProfitableToIfCvt(), llvm::ReachingDefAnalysis::isReachingDefLiveOut(), llvm::ReachingDefAnalysis::isRegDefinedAfter(), llvm::XCoreInstrInfo::removeBranch(), llvm::ARCInstrInfo::removeBranch(), llvm::RISCVInstrInfo::removeBranch(), llvm::ARMBaseInstrInfo::removeBranch(), llvm::AArch64InstrInfo::removeBranch(), llvm::PPCInstrInfo::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 711 of file MachineBasicBlock.h.

References getLastNonDebugInstr().

◆ 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 969 of file MachineBasicBlock.h.

References Number.

Referenced by llvm::LiveVariables::addNewBlock(), assignSections(), llvm::SwitchCG::SwitchLowering::buildBitTests(), llvm::LiveIntervals::checkRegMaskInterference(), CompareMBBNumbers(), llvm::ARMBasicBlockUtils::computeBlockSize(), llvm::AMDGPUAsmPrinter::emitBasicBlockStart(), llvm::AsmPrinter::emitBasicBlockStart(), llvm::AsmPrinter::emitJumpTableInfo(), llvm::SwitchCG::SwitchLowering::findBitTestClusters(), for(), llvm::WebAssembly::SortRegionInfo::getBottom(), llvm::MachineTraceMetrics::Ensemble::getDepthResources(), getEHCatchretSymbol(), llvm::getEHScopeMembership(), getEndSymbol(), getFullName(), llvm::MachineTraceMetrics::Ensemble::getHeightResources(), getMCSymbolForMBB(), llvm::ARMBasicBlockUtils::getOffsetOf(), llvm::MachineTraceMetrics::Trace::getResourceLength(), llvm::MachineTraceMetrics::getResources(), getSymbol(), llvm::MachineTraceMetrics::Ensemble::getTrace(), llvm::LiveVariables::HandleVirtRegUse(), 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(), llvm::LiveVariables::MarkVirtRegAliveInBlock(), maybeUpdateTerminator(), llvm::WebAssemblyException::print(), llvm::MIPrinter::print(), printName(), llvm::WebAssemblyExceptionInfo::recalculate(), llvm::MachineFunction::RenumberBlocks(), llvm::SlotIndexes::runOnMachineFunction(), llvm::sortBasicBlocksAndUpdateBranches(), sortBlocks(), llvm::MachineTraceMetrics::Ensemble::updateDepth(), llvm::MachineTraceMetrics::Ensemble::verify(), VerifyPHIs(), llvm::yaml::WebAssemblyFunctionInfo::WebAssemblyFunctionInfo(), and llvm::WriteGraph().

◆ getParent() [1/2]

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

Definition at line 226 of file MachineBasicBlock.h.

◆ getParent() [2/2]

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

Return the MachineFunction containing this basic block.

Definition at line 225 of file MachineBasicBlock.h.

Referenced by addLiveIn(), addLiveInRegs(), llvm::LivePhysRegs::addLiveIns(), llvm::LiveRegUnits::addLiveIns(), llvm::addLiveIns(), llvm::LiveRegUnits::addLiveOuts(), llvm::LivePhysRegs::addLiveOuts(), llvm::LivePhysRegs::addLiveOutsNoPristines(), llvm::MachineInstr::addOperand(), llvm::SSAUpdaterTraits< MachineSSAUpdater >::AddPHIOperand(), addSavedGPR(), llvm::WebAssemblyInstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeLoopForPipelining(), llvm::CombinerHelper::applyExtendThroughPhis(), llvm::AMDGPURegisterBankInfo::applyMappingImpl(), BBHasFallthrough(), llvm::DwarfCFIException::beginFragment(), buildCFAOffs(), llvm::X86FrameLowering::BuildCFI(), buildDefCFAReg(), buildGitPtr(), canCombine(), canFallThroughTo(), llvm::AArch64InstrInfo::canInsertSelect(), llvm::SystemZInstrInfo::canInsertSelect(), llvm::SIInstrInfo::canInsertSelect(), llvm::X86InstrInfo::canInsertSelect(), llvm::PPCInstrInfo::canInsertSelect(), canRenameUpToDef(), canSplitCriticalEdge(), llvm::Thumb1FrameLowering::canUseAsEpilogue(), llvm::RISCVFrameLowering::canUseAsEpilogue(), llvm::X86FrameLowering::canUseAsEpilogue(), llvm::AArch64FrameLowering::canUseAsPrologue(), llvm::RISCVFrameLowering::canUseAsPrologue(), llvm::X86FrameLowering::canUseAsPrologue(), llvm::WebAssemblyDebugValueManager::clone(), CombineCVTAToLocal(), llvm::ARMBasicBlockUtils::computeBlockSize(), llvm::HexagonBlockRanges::computeDeadMap(), llvm::computeLiveIns(), llvm::constrainSelectedInstRegOperands(), llvm::SIInstrInfo::convertNonUniformIfRegion(), llvm::SIInstrInfo::convertNonUniformLoopRegion(), llvm::SIInstrInfo::convertToThreeAddress(), llvm::Thumb1InstrInfo::copyPhysReg(), llvm::WebAssemblyInstrInfo::copyPhysReg(), llvm::NVPTXInstrInfo::copyPhysReg(), llvm::SystemZInstrInfo::copyPhysReg(), llvm::M68kInstrInfo::copyPhysReg(), llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), createPHIsForCMOVsInSinkBB(), createPHIsForSelects(), llvm::MachineFunction::DeleteMachineBasicBlock(), llvm::LexicalScopes::dominates(), llvm::ARMBaseInstrInfo::duplicate(), llvm::TargetInstrInfo::duplicate(), llvm::BPFRegisterInfo::eliminateFrameIndex(), llvm::MSP430RegisterInfo::eliminateFrameIndex(), llvm::WebAssemblyRegisterInfo::eliminateFrameIndex(), llvm::HexagonRegisterInfo::eliminateFrameIndex(), llvm::ThumbRegisterInfo::eliminateFrameIndex(), llvm::SystemZRegisterInfo::eliminateFrameIndex(), llvm::AArch64RegisterInfo::eliminateFrameIndex(), llvm::X86RegisterInfo::eliminateFrameIndex(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::ARMBaseRegisterInfo::eliminateFrameIndex(), emitAlignedDPRCS2Restores(), emitAlignedDPRCS2Spills(), llvm::SystemZ::emitBlockAfter(), llvm::AArch64FrameLowering::emitCalleeSavedFrameMoves(), llvm::X86FrameLowering::emitCalleeSavedFrameMoves(), llvm::AsmPrinter::emitCFIInstruction(), EmitCfiOffset(), EmitDefCfaOffset(), llvm::VETargetLowering::emitEHSjLjLongJmp(), llvm::PPCTargetLowering::emitEHSjLjLongJmp(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::MachineInstr::emitError(), llvm::AArch64TargetLowering::EmitF128CSEL(), emitFrameOffsetAdj(), emitIndirectDst(), emitIndirectSrc(), llvm::ThumbRegisterInfo::emitLoadConstPool(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), emitLoadM0FromVGPRLoop(), emitLoadSRsrcFromVGPRLoop(), llvm::PPCTargetLowering::emitProbedAlloca(), emitPrologueEpilogueSPUpdate(), llvm::VETargetLowering::emitSjLjDispatchBlock(), llvm::X86FrameLowering::emitSPUpdate(), emitThumb1LoadConstPool(), emitThumb2LoadConstPool(), emitThumbRegPlusImmInReg(), emitXBegin(), eraseFromParent(), llvm::MachineInstr::eraseFromParentAndMarkDBGValuesForRemoval(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::VEInstrInfo::expandGetStackTopPseudo(), expandLoadStackGuard(), llvm::ARMBaseInstrInfo::expandLoadStackGuardBase(), llvm::SIInstrInfo::expandMovDPP64(), ExpandMOVImmSExti8(), llvm::HexagonInstrInfo::expandPostRAPseudo(), llvm::SIInstrInfo::expandPostRAPseudo(), llvm::AArch64InstrInfo::expandPostRAPseudo(), expandXorFP(), extractRsrcPtr(), llvm::finalizeBundle(), llvm::X86RegisterInfo::findDeadCallerSavedReg(), findDeadCallerSavedReg(), findIncDecAfter(), findIncDecBefore(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::findPHICopyInsertPoint(), findScratchNonCalleeSaveRegister(), FixTail(), llvm::PPCInstrInfo::fixupIsDeadOrKill(), llvm::TargetInstrInfo::foldMemoryOperand(), forceReg(), llvm::RegScavenger::forward(), llvm::AArch64InstrInfo::genAlternativeCodeSequence(), llvm::SIInstrInfo::getAddNoCarry(), getBBAddrMapMetadata(), getBBFallenThrough(), llvm::MachineInstr::getDebugInstrNum(), getEHCatchretSymbol(), getEndSymbol(), getFallThrough(), llvm::PPCInstrInfo::getFMAPatterns(), getFoldableImm(), getFrameIndexMMO(), getFullName(), getImmedFromMO(), llvm::AArch64InstrInfo::getInstSizeInBytes(), llvm::ARMBaseInstrInfo::getInstSizeInBytes(), getLoadStoreOffsetSizeInBits(), getMCSymbolForMBB(), llvm::MipsInstrInfo::GetMemOperand(), llvm::SIInstrInfo::getMemOperandsWithOffsetWidth(), llvm::MachineInstr::getMF(), getMFIfAvailable(), getNextBlock(), llvm::RISCVInstrInfo::getOutliningType(), llvm::AArch64InstrInfo::getOutliningType(), getSchedRegions(), llvm::TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(), llvm::HexagonInstrInfo::getSize(), llvm::LoopVectorizationCostModel::getSmallestAndWidestTypes(), getSymbol(), GetSymbolRef(), llvm::MachineLoop::getTopBlock(), llvm::TargetInstrInfo::hasReassociableOperands(), llvm::TargetInstrInfo::hasReassociableSibling(), hoistAndMergeSGPRInits(), indirectCopyToAGPR(), INITIALIZE_PASS(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::VEInstrInfo::insertBranch(), llvm::ARMBaseInstrInfo::insertBranch(), insertCSRRestores(), insertCSRSaves(), llvm::SIInstrInfo::insertEQ(), llvm::RISCVInstrInfo::insertIndirectBranch(), llvm::SIInstrInfo::insertIndirectBranch(), llvm::SlotIndexes::insertMBBInMaps(), llvm::SIInstrInfo::insertNE(), llvm::SIInstrInfo::insertReturn(), InsertSEH(), llvm::AArch64InstrInfo::insertSelect(), llvm::SystemZInstrInfo::insertSelect(), llvm::SIInstrInfo::insertSelect(), llvm::X86InstrInfo::insertSelect(), llvm::PPCInstrInfo::insertSelect(), insertUndefLaneMask(), llvm::SIInstrInfo::insertVectorSelect(), llvm::AArch64InstrInfo::isAssociativeAndCommutative(), isCombineInstrCandidateFP(), isCVTAToLocalCombinationCandidate(), llvm::MachineInstr::isDereferenceableInvariantLoad(), isEntryBlock(), isFunctionEntryBlock(), llvm::LiveRangeCalc::isJointlyDominated(), llvm::SIInstrInfo::isLegalRegOperand(), isLibCallInTailPosition(), llvm::AArch64InstrInfo::isMBBSafeToOutlineFrom(), llvm::ARMBaseInstrInfo::isMBBSafeToOutlineFrom(), isNoReturnDef(), llvm::ARMBaseInstrInfo::isProfitableToIfCvt(), llvm::VLIWResourceModel::isResourceAvailable(), jumpTableFollowsTB(), llvm::SIInstrInfo::legalizeOpWithMove(), livein_begin(), llvm::MipsSEInstrInfo::loadImmediate(), llvm::XCoreInstrInfo::loadImmediate(), loadM0FromVGPR(), llvm::MipsSEInstrInfo::loadRegFromStack(), llvm::MSP430InstrInfo::loadRegFromStackSlot(), llvm::RISCVInstrInfo::loadRegFromStackSlot(), llvm::Thumb1InstrInfo::loadRegFromStackSlot(), llvm::Thumb2InstrInfo::loadRegFromStackSlot(), llvm::XCoreInstrInfo::loadRegFromStackSlot(), llvm::ARCInstrInfo::loadRegFromStackSlot(), llvm::SparcInstrInfo::loadRegFromStackSlot(), llvm::VEInstrInfo::loadRegFromStackSlot(), llvm::AArch64InstrInfo::loadRegFromStackSlot(), llvm::HexagonInstrInfo::loadRegFromStackSlot(), llvm::ARMBaseInstrInfo::loadRegFromStackSlot(), llvm::SIInstrInfo::loadRegFromStackSlot(), llvm::M68kInstrInfo::loadRegFromStackSlot(), llvm::X86InstrInfo::loadRegFromStackSlot(), llvm::PPCInstrInfo::loadRegFromStackSlotNoUpd(), llvm::PPCRegisterInfo::lowerACCRestore(), llvm::PPCRegisterInfo::lowerACCSpilling(), llvm::PPCRegisterInfo::lowerCRBitRestore(), llvm::PPCRegisterInfo::lowerCRBitSpilling(), llvm::PPCRegisterInfo::lowerCRRestore(), llvm::PPCRegisterInfo::lowerCRSpilling(), llvm::VETargetLowering::LowerCustomJumpTableEntry(), llvm::PPCRegisterInfo::lowerDynamicAlloc(), llvm::PPCRegisterInfo::lowerDynamicAreaOffset(), llvm::PPCRegisterInfo::lowerPrepareProbedAlloca(), lowerRISCVVMachineInstrToMCInst(), llvm::Mips16InstrInfo::makeFrame(), mapWasmLandingPadIndex(), matchSwap(), llvm::SIRegisterInfo::materializeFrameBaseRegister(), llvm::AArch64RegisterInfo::materializeFrameBaseRegister(), llvm::PPCRegisterInfo::materializeFrameBaseRegister(), llvm::ARMBaseRegisterInfo::materializeFrameBaseRegister(), llvm::SIInstrInfo::materializeImmediate(), maybeUpdateTerminator(), mergeOperations(), moveAfter(), moveBefore(), llvm::SIInstrInfo::moveToVALU(), llvm::RISCVInstrInfo::movImm(), llvm::PPCRegisterInfo::needsFrameBaseReg(), llvm::AArch64InstrInfo::optimizeCondBranch(), llvm::SystemZInstrInfo::prepareCompareSwapOperands(), llvm::PPCRegisterInfo::prepareDynamicAlloca(), llvm::VETargetLowering::prepareMBB(), llvm::VETargetLowering::prepareSymbol(), PrevCrossBBInst(), llvm::MIPrinter::print(), print(), llvm::ARMBaseInstrInfo::produceSameValue(), ProfitableToMerge(), propagateLocalCopies(), llvm::recomputeLivenessFlags(), llvm::ARMBaseInstrInfo::reMaterialize(), llvm::X86InstrInfo::reMaterialize(), llvm::TargetInstrInfo::reMaterialize(), removeFromParent(), replaceDominatedUses(), ReplaceFrameIndex(), llvm::Thumb2InstrInfo::ReplaceTailWithBranchTo(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), reportIllegalCopy(), rescheduleCanonically(), llvm::PPCRegisterInfo::resolveFrameIndex(), llvm::ARMBaseRegisterInfo::resolveFrameIndex(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), llvm::ARMFrameLowering::restoreCalleeSavedRegisters(), llvm::SystemZFrameLowering::restoreCalleeSavedRegisters(), llvm::XCoreFrameLowering::restoreCalleeSavedRegisters(), llvm::MSP430FrameLowering::restoreCalleeSavedRegisters(), llvm::ARCFrameLowering::restoreCalleeSavedRegisters(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), llvm::AArch64FrameLowering::restoreCalleeSavedRegisters(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), llvm::PPCFrameLowering::restoreCalleeSavedRegisters(), restoreCRs(), llvm::Mips16InstrInfo::restoreFrame(), llvm::X86FrameLowering::restoreWin32EHStackPointers(), llvm::ThumbRegisterInfo::rewriteFrameIndex(), llvm::Mips16RegisterInfo::saveScavengerRegister(), llvm::RegScavenger::scavengeRegisterBackwards(), scavengeVReg(), llvm::VLIWMachineScheduler::schedule(), setCallTargetReg(), llvm::AArch64InstrInfo::shouldClusterMemOps(), llvm::ARMBaseRegisterInfo::shouldCoalesce(), llvm::shouldOptForSize(), llvm::PPCInstrInfo::shouldReduceRegisterPressure(), shouldUseFrameHelper(), SkipPHIsAndLabels(), SkipPHIsLabelsAndDebug(), llvm::Mips16FrameLowering::spillCalleeSavedRegisters(), llvm::Thumb1FrameLowering::spillCalleeSavedRegisters(), llvm::ARMFrameLowering::spillCalleeSavedRegisters(), llvm::MipsSEFrameLowering::spillCalleeSavedRegisters(), llvm::SystemZFrameLowering::spillCalleeSavedRegisters(), llvm::XCoreFrameLowering::spillCalleeSavedRegisters(), llvm::MSP430FrameLowering::spillCalleeSavedRegisters(), llvm::ARCFrameLowering::spillCalleeSavedRegisters(), llvm::RISCVFrameLowering::spillCalleeSavedRegisters(), llvm::AArch64FrameLowering::spillCalleeSavedRegisters(), llvm::X86FrameLowering::spillCalleeSavedRegisters(), llvm::M68kFrameLowering::spillCalleeSavedRegisters(), llvm::PPCFrameLowering::spillCalleeSavedRegisters(), split(), splitAt(), splitBlock(), splitBlockForLoop(), SplitCriticalEdge(), splitEdge(), splitMBB(), llvm::MipsSEInstrInfo::storeRegToStack(), llvm::MSP430InstrInfo::storeRegToStackSlot(), llvm::Thumb1InstrInfo::storeRegToStackSlot(), llvm::RISCVInstrInfo::storeRegToStackSlot(), llvm::Thumb2InstrInfo::storeRegToStackSlot(), llvm::XCoreInstrInfo::storeRegToStackSlot(), llvm::ARCInstrInfo::storeRegToStackSlot(), llvm::SparcInstrInfo::storeRegToStackSlot(), llvm::VEInstrInfo::storeRegToStackSlot(), llvm::AArch64InstrInfo::storeRegToStackSlot(), llvm::HexagonInstrInfo::storeRegToStackSlot(), llvm::ARMBaseInstrInfo::storeRegToStackSlot(), llvm::SIInstrInfo::storeRegToStackSlot(), llvm::M68kInstrInfo::storeRegToStackSlot(), llvm::X86InstrInfo::storeRegToStackSlot(), llvm::PPCInstrInfo::storeRegToStackSlotNoUpd(), llvm::HexagonInstrInfo::translateInstrsForDup(), tryToFindRegisterToRename(), tryToFoldACImm(), unstackifyVRegsUsedInSplitBB(), updateLiveIn(), updateOperand(), UpdateOperandRegClass(), updateTerminator(), verifyCFIntrinsic(), verifyCTRBranch(), and llvm::SelectionDAGBuilder::visitSPDescriptorParent().

◆ getSectionID()

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

◆ getSectionIDNum()

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

◆ getSublistAccess()

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

Support for MachineInstr::getNextNode().

Definition at line 284 of file MachineBasicBlock.h.

◆ getSymbol()

MCSymbol * MachineBasicBlock::getSymbol ( ) const

Return the MCSymbol for this basic block.

Definition at line 59 of file MachineBasicBlock.cpp.

References llvm::MBBSectionID::ColdSectionID, llvm::MBBSectionID::ExceptionSectionID, llvm::MCContext::getAsmInfo(), llvm::MachineFunction::getContext(), llvm::MachineFunction::getFunctionNumber(), llvm::MachineFunction::getName(), getNumber(), llvm::MCContext::getOrCreateSymbol(), getParent(), llvm::MCAsmInfo::getPrivateLabelPrefix(), llvm::MachineFunction::hasBBSections(), isBeginSection(), llvm::MBBSectionID::Number, and llvm::cl::Prefix.

Referenced by llvm::DebugHandlerBase::beginBasicBlock(), llvm::AsmPrinter::emitBasicBlockStart(), llvm::AsmPrinter::emitBBAddrMapSection(), EmitGCCInlineAsmStr(), llvm::ARMAsmPrinter::emitInstruction(), llvm::ARMAsmPrinter::emitJumpTableAddrs(), llvm::AsmPrinter::emitJumpTableInfo(), llvm::ARMAsmPrinter::emitJumpTableInsts(), llvm::ARMAsmPrinter::emitJumpTableTBInst(), llvm::ARMAsmPrinter::emitMachineConstantPoolValue(), llvm::SystemZMCInstLower::getExpr(), llvm::TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(), llvm::M68kMCInstLower::GetSymbolFromOperand(), llvm::HexagonLowerToMC(), llvm::BPFMCInstLower::Lower(), llvm::LanaiMCInstLower::Lower(), llvm::MSP430MCInstLower::Lower(), llvm::VETargetLowering::LowerCustomJumpTableEntry(), llvm::M68kTargetLowering::LowerCustomJumpTableEntry(), llvm::X86TargetLowering::LowerCustomJumpTableEntry(), llvm::AArch64MCInstLower::lowerOperand(), LowerOperand(), llvm::ARMAsmPrinter::lowerOperand(), llvm::LowerPPCMachineOperandToMCOperand(), llvm::LowerRISCVMachineOperandToMCOperand(), LowerSymbolOperand(), llvm::WebAssemblyAsmPrinter::PrintAsmOperand(), llvm::AVRAsmPrinter::printOperand(), llvm::HexagonAsmPrinter::printOperand(), llvm::ARMAsmPrinter::printOperand(), and llvm::MipsAsmPrinter::printOperand().

◆ hasAddressTaken()

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

◆ hasEHPadSuccessor()

bool MachineBasicBlock::hasEHPadSuccessor ( ) const

Definition at line 282 of file MachineBasicBlock.cpp.

References E, I, succ_begin(), and succ_end().

Referenced by isLegalToHoistInto().

◆ hasLabelMustBeEmitted()

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

Test whether this block must have its label emitted.

Definition at line 218 of file MachineBasicBlock.h.

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

◆ hasSuccessorProbabilities()

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

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

Definition at line 615 of file MachineBasicBlock.h.

◆ 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 1337 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::RISCVInstrInfo::buildOutlinedFrame(), llvm::AArch64InstrInfo::buildOutlinedFrame(), llvm::X86InstrInfo::buildOutlinedFrame(), llvm::WebAssemblyDebugValueManager::clone(), llvm::MachineFunction::CloneMachineInstrBundle(), CombineCVTAToLocal(), llvm::SIInstrInfo::convertNonUniformIfRegion(), llvm::SIInstrInfo::convertNonUniformLoopRegion(), llvm::MSP430FrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::TargetLoweringBase::emitPatchPoint(), llvm::TargetInstrInfo::foldMemoryOperand(), FuseInst(), FuseTwoAddrInst(), llvm::RegBankSelect::InsertPoint::insert(), insertDeleteInstructions(), llvm::MachineIRBuilder::insertInstr(), llvm::RISCVInstrInfo::insertOutlinedCall(), llvm::AArch64InstrInfo::insertOutlinedCall(), llvm::ARMBaseInstrInfo::insertOutlinedCall(), llvm::X86InstrInfo::insertOutlinedCall(), llvm::PPCInstrInfo::loadRegFromStackSlotNoUpd(), moveAndDanglePseudoProbes(), moveInstsAfter(), llvm::PeelingModuloScheduleExpander::moveStageBetweenBlocks(), llvm::ARMBaseInstrInfo::optimizeCompareInstr(), llvm::X86InstrInfo::optimizeCompareInstr(), llvm::PeelSingleBlockLoop(), performSink(), ProcessSDDbgValues(), llvm::ARMBaseInstrInfo::reMaterialize(), llvm::X86InstrInfo::reMaterialize(), llvm::TargetInstrInfo::reMaterialize(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), restoreCRs(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::GCNScheduleDAGMILive::schedule(), llvm::GCNIterativeScheduler::scheduleRegion(), llvm::Thumb1FrameLowering::spillCalleeSavedRegisters(), 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 768 of file MachineBasicBlock.h.

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

◆ insert() [3/3]

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

Insert MI into the instruction list before I.

Definition at line 775 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 784 of file MachineBasicBlock.h.

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

Referenced by InsertSEH(), 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 794 of file MachineBasicBlock.h.

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

◆ instr_back() [1/2]

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

Definition at line 243 of file MachineBasicBlock.h.

◆ instr_back() [2/2]

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

Definition at line 245 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 253 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 255 of file MachineBasicBlock.h.

◆ instr_front() [1/2]

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

Definition at line 242 of file MachineBasicBlock.h.

◆ instr_front() [2/2]

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

Definition at line 244 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 257 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 259 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 264 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 467 of file MachineBasicBlock.h.

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

◆ isEHCatchretTarget()

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

Returns true if this is a target block of a catchret.

Definition at line 455 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 448 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 724 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

Returns true if this is the indirect dest of an INLINEASM_BR.

Definition at line 503 of file MachineBasicBlock.h.

Referenced by canSplitCriticalEdge(), and llvm::findPHICopyInsertPoint().

◆ 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 937 of file MachineBasicBlock.cpp.

References I, and MBB.

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

◆ isLegalToHoistInto()

bool MachineBasicBlock::isLegalToHoistInto ( ) const

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

Definition at line 307 of file MachineBasicBlock.cpp.

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

◆ isLiveIn()

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

◆ isPredecessor()

bool MachineBasicBlock::isPredecessor ( const MachineBasicBlock MBB) const

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

Definition at line 929 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 1625 of file MachineBasicBlock.cpp.

References assert(), getParent(), and llvm::MachineFunctionProperties::TracksLiveness.

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 404 of file MachineBasicBlock.h.

Referenced by liveins_dbg().

◆ livein_empty()

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

Definition at line 411 of file MachineBasicBlock.h.

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

◆ livein_end()

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

Definition at line 410 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 405 of file MachineBasicBlock.h.

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

◆ 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 299 of file MachineBasicBlock.cpp.

References successors().

Referenced by isLegalToHoistInto().

◆ moveAfter()

void MachineBasicBlock::moveAfter ( MachineBasicBlock NewBefore)

◆ moveAndDanglePseudoProbes()

void MachineBasicBlock::moveAndDanglePseudoProbes ( MachineBasicBlock ToMBB)

move all pseudo probes in this block to the end of /c ToMBB To and tag them dangling.

A block emptied (i.e., with all instructions moved out of it) won't be sampled at run time.

In such cases, AutoFDO will be informed of zero samples collected for the block. This is not accurate and could lead to misleading weights assigned for the block. A way to mitigate that is to treat such block as having unknown counts in the AutoFDO profile loader and allow the counts inference tool a chance to calculate a relatively reasonable weight for it. This can be done by moving all pseudo probes in the emptied block i.e, /c this, to before /c ToMBB and tag them dangling. Note that this is not needed for dead blocks which really have a zero weight. It's per transforms to decide whether to call this function or not.

Definition at line 913 of file MachineBasicBlock.cpp.

References llvm::Dangling, getFirstTerminator(), I, insert(), instrs(), and MI.

Referenced by salvageDebugInfoFromEmptyBlock().

◆ 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 632 of file MachineBasicBlock.cpp.

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

◆ 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 563 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 299 of file MachineBasicBlock.h.

References phis().

◆ pop_back()

void llvm::MachineBasicBlock::pop_back ( )
inline

Definition at line 755 of file MachineBasicBlock.h.

◆ pop_front()

void llvm::MachineBasicBlock::pop_front ( )
inline

Definition at line 754 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

Definition at line 317 of file MachineBasicBlock.h.

◆ 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

Definition at line 319 of file MachineBasicBlock.h.

◆ pred_rbegin() [1/2]

pred_reverse_iterator llvm::MachineBasicBlock::pred_rbegin ( )
inline

Definition at line 320 of file MachineBasicBlock.h.

Referenced by llvm::LiveVariables::MarkVirtRegAliveInBlock().

◆ pred_rbegin() [2/2]

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

Definition at line 322 of file MachineBasicBlock.h.

◆ pred_rend() [1/2]

pred_reverse_iterator llvm::MachineBasicBlock::pred_rend ( )
inline

Definition at line 324 of file MachineBasicBlock.h.

Referenced by llvm::LiveVariables::MarkVirtRegAliveInBlock().

◆ pred_rend() [2/2]

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

Definition at line 326 of file MachineBasicBlock.h.

◆ 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 352 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

◆ 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 477 of file MachineBasicBlock.cpp.

References Align, bb, llvm::CallingConv::Cold, getAlignment(), getBasicBlock(), llvm::ModuleSlotTracker::getLocalSlot(), getNumber(), getSectionID(), hasAddressTaken(), llvm::ModuleSlotTracker::incorporateFunction(), isEHFuncletEntry(), isEHPad(), llvm::MBBSectionID::Number, PrintNameAttributes, PrintNameIr, slot, llvm::MBBSectionID::Type, and llvm::Align::value().

Referenced by llvm::MIPrinter::print(), print(), and printAsOperand().

◆ push_back()

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

Definition at line 756 of file MachineBasicBlock.h.

References MI.

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

◆ 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 843 of file MachineBasicBlock.h.

References assert(), and I.

Referenced by llvm::X86InstrInfo::optimizeCompareInstr(), llvm::MachineInstr::removeFromParent(), llvm::GCNScheduleDAGMILive::schedule(), 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 1329 of file MachineBasicBlock.cpp.

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

Referenced by 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 1350 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 568 of file MachineBasicBlock.cpp.

References I.

◆ removeLiveIn() [2/2]

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

Remove the specified register from the live in set.

Definition at line 556 of file MachineBasicBlock.cpp.

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

Referenced by emitGPDisp(), llvm::SIMachineFunctionInfo::removeVGPRForSGPRSpill(), 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 783 of file MachineBasicBlock.cpp.

References llvm::find(), and I.

Referenced by llvm::VETargetLowering::emitSjLjDispatchBlock(), eraseDeadBBsAndChildren(), loadM0FromVGPR(), replaceSuccessor(), llvm::TargetInstrInfo::ReplaceTailWithBranchTo(), 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 790 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 279 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 1385 of file MachineBasicBlock.cpp.

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

Referenced by llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), llvm::PeelSingleBlockLoop(), SplitCriticalEdge(), and transferSuccessorsAndUpdatePHIs().

◆ replaceSuccessor()

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

Replace successor OLD with NEW and update probability info.

Definition at line 806 of file MachineBasicBlock.cpp.

References assert(), E, I, removeSuccessor(), succ_begin(), and succ_end().

Referenced by llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), llvm::PeelSingleBlockLoop(), ReplaceUsesOfBlockWith(), and splitEdge().

◆ 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 1364 of file MachineBasicBlock.cpp.

References assert(), llvm::numbers::e, i, I, instr_begin(), instr_end(), and replaceSuccessor().

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

◆ rfindDebugLoc() [1/2]

DebugLoc MachineBasicBlock::rfindDebugLoc ( reverse_instr_iterator  MBBI)

Has exact same behavior as findDebugLoc (it also searches from the first to the last MI of this MBB) except that this takes reverse iterator.

Definition at line 1406 of file MachineBasicBlock.cpp.

References instr_rbegin(), 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 906 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 from the last to the first MI of this MBB) except that this takes reverse iterator.

Definition at line 1424 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 921 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 524 of file MachineBasicBlock.h.

References getSectionID(), and MBB.

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

◆ setAlignment()

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

Set alignment of the basic block.

Definition at line 431 of file MachineBasicBlock.h.

References A.

Referenced by AlignBlocks().

◆ setHasAddressTaken()

void llvm::MachineBasicBlock::setHasAddressTaken ( )
inline

Set this block to reflect that it potentially is the target of an indirect branch.

Definition at line 215 of file MachineBasicBlock.h.

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

◆ setIrrLoopHeaderWeight()

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

Definition at line 982 of file MachineBasicBlock.h.

◆ setIsBeginSection()

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

Definition at line 478 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 470 of file MachineBasicBlock.h.

◆ setIsEHCatchretTarget()

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

Indicates if this is a target block of a catchret.

Definition at line 458 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 464 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 439 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 452 of file MachineBasicBlock.h.

◆ setIsEndSection()

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

Definition at line 480 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 508 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 222 of file MachineBasicBlock.h.

◆ setNumber()

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

Definition at line 970 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 492 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 1476 of file MachineBasicBlock.cpp.

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

Referenced by splitMBB().

◆ size()

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

◆ 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 209 of file MachineBasicBlock.cpp.

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

Referenced by addLiveIn(), copyDebugInfoToSuccessor(), and llvm::findPHICopyInsertPoint().

◆ SkipPHIsLabelsAndDebug()

MachineBasicBlock::iterator MachineBasicBlock::SkipPHIsLabelsAndDebug ( MachineBasicBlock::iterator  I,
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.

Definition at line 224 of file MachineBasicBlock.cpp.

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

◆ sortUniqueLiveIns()

void MachineBasicBlock::sortUniqueLiveIns ( )

Sorts and uniques the LiveIns vector.

It can be significantly faster to do this than repeatedly calling isLiveIn before calling addLiveIn for every LiveIn insertion.

Definition at line 580 of file MachineBasicBlock.cpp.

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

Referenced by llvm::ARMFrameLowering::adjustForSegmentedStacks(), llvm::SIFrameLowering::emitPrologue(), lowerShiftReservedVGPR(), llvm::SIMachineFunctionInfo::removeVGPRForSGPRSpill(), llvm::IRTranslator::runOnMachineFunction(), updateLiveIn(), and updateLiveness().

◆ 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 863 of file MachineBasicBlock.h.

References From, and Other.

Referenced by adaptForLdStOpt(), llvm::PPCTargetLowering::EmitAtomicBinary(), llvm::VETargetLowering::emitEHSjLjSetJmp(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::AArch64TargetLowering::EmitF128CSEL(), llvm::BPFTargetLowering::EmitInstrWithCustomInserter(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), llvm::AVRTargetLowering::EmitInstrWithCustomInserter(), llvm::MSP430TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), llvm::PPCTargetLowering::EmitPartwordAtomicBinary(), llvm::PPCTargetLowering::emitProbedAlloca(), emitReadCycleWidePseudo(), emitSelectPseudo(), llvm::MSP430TargetLowering::EmitShiftInstr(), emitXBegin(), llvm::AMDGPURegisterBankInfo::executeInWaterfallLoop(), llvm::VEInstrInfo::expandExtendStackPseudo(), llvm::SparcTargetLowering::expandSelectCC(), hoistAndMergeSGPRInits(), llvm::PPCFrameLowering::inlineStackProbe(), LowerFPToInt(), llvm::WebAssemblyDebugValueManager::move(), moveAndTeeForMultiUse(), llvm::MachineInstr::moveBefore(), moveForSingleUse(), llvm::ScheduleDAGMI::moveInstruction(), MoveVPNOTBeforeFirstUser(), performSink(), llvm::ScheduleDAGMI::placeDebugValues(), rescheduleCanonically(), rescheduleLexographically(), llvm::IRTranslator::runOnMachineFunction(), split(), 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 874 of file MachineBasicBlock.h.

References From, llvm::MachineInstrBundleIterator< Ty, IsReverse >::getInstrIterator(), and 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 990 of file MachineBasicBlock.cpp.

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

Referenced by splitBlock().

◆ SplitCriticalEdge()

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

Split the critical edge from this block to the given successor block, and return the newly created block, or null if splitting is not possible.

This function updates LiveVariables, MachineDominatorTree, and MachineLoopInfo, as applicable.

Definition at line 1031 of file MachineBasicBlock.cpp.

References addLiveIn(), llvm::LiveVariables::addNewBlock(), llvm::LiveRange::addSegment(), addSuccessor(), assert(), canSplitCriticalEdge(), Cond, llvm::SmallSet< T, N, C >::count(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::dbgs(), DL, llvm::numbers::e, E, end(), llvm::MachineFunction::end(), getFirstInstrTerminator(), getFirstTerminator(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::LiveIntervals::getInterval(), llvm::LiveIntervals::getMBBStartIdx(), llvm::ilist_node_with_parent< MachineBasicBlock, MachineFunction >::getNextNode(), llvm::MachineRegisterInfo::getNumVirtRegs(), getParent(), llvm::SlotIndex::getPrevSlot(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::LiveVariables::getVarInfo(), llvm::LiveRange::getVNInfoAt(), llvm::LiveIntervals::hasInterval(), i, I, llvm::Register::index2VirtReg(), llvm::SmallSet< T, N, C >::insert(), llvm::MachineFunction::insert(), llvm::HexagonInstrInfo::insertBranch(), llvm::LiveIntervals::insertMBBInMaps(), instr_begin(), instr_end(), instrs(), llvm::is_contained(), isLayoutSuccessor(), isLiveOut(), llvm::Register::isPhysicalRegister(), llvm::MachineOperand::isUndef(), llvm::Register::isVirtualRegister(), llvm::LiveVariables::VarInfo::Kills, llvm::LiveRange::liveAt(), liveins(), LLVM_DEBUG, MI, MRI, P, llvm::printMBBReference(), Reg, llvm::LiveVariables::VarInfo::removeKill(), llvm::LiveRange::removeSegment(), llvm::LiveIntervals::repairIntervalsInRange(), replacePhiUsesWith(), ReplaceUsesOfBlockWith(), llvm::MCID::Terminator, TII, TRI, and updateTerminator().

◆ 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 764 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

Definition at line 333 of file MachineBasicBlock.h.

◆ 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

Definition at line 335 of file MachineBasicBlock.h.

◆ succ_rbegin() [1/2]

succ_reverse_iterator llvm::MachineBasicBlock::succ_rbegin ( )
inline

Definition at line 336 of file MachineBasicBlock.h.

Referenced by llvm::VETargetLowering::emitSjLjDispatchBlock(), and splitMBB().

◆ succ_rbegin() [2/2]

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

Definition at line 338 of file MachineBasicBlock.h.

◆ succ_rend() [1/2]

succ_reverse_iterator llvm::MachineBasicBlock::succ_rend ( )
inline

Definition at line 340 of file MachineBasicBlock.h.

Referenced by llvm::VETargetLowering::emitSjLjDispatchBlock().

◆ succ_rend() [2/2]

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

Definition at line 342 of file MachineBasicBlock.h.

◆ succ_size()

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

◆ successors() [1/2]

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

◆ successors() [2/2]

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

Definition at line 358 of file MachineBasicBlock.h.

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

◆ 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 291 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 864 of file MachineBasicBlock.cpp.

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

Referenced by splitMBB().

◆ transferSuccessorsAndUpdatePHIs()

void MachineBasicBlock::transferSuccessorsAndUpdatePHIs ( MachineBasicBlock FromMBB)

◆ 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 640 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(), and TII.

Referenced by for(), maybeUpdateTerminator(), and SplitCriticalEdge().

◆ 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 731 of file MachineBasicBlock.cpp.

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

Friends And Related Function Documentation

◆ ilist_callback_traits< MachineBasicBlock >

friend struct ilist_callback_traits< MachineBasicBlock >
friend

Definition at line 1001 of file MachineBasicBlock.h.

◆ MachineBranchProbabilityInfo

friend class MachineBranchProbabilityInfo
friend

Definition at line 992 of file MachineBasicBlock.h.

◆ MachineFunction

friend class MachineFunction
friend

Definition at line 196 of file MachineBasicBlock.h.

◆ MIPrinter

friend class MIPrinter
friend

Definition at line 993 of file MachineBasicBlock.h.


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