LLVM: llvm::BasicBlock Class Reference (original) (raw)

LLVM Basic Block Representation. More...

#include "[llvm/IR/BasicBlock.h](IR%5F2BasicBlock%5F8h%5Fsource.html)"

Public Types
using InstListType
using iterator = InstListType::iterator
Instruction iterators...
using const_iterator = InstListType::const_iterator
using reverse_iterator = InstListType::reverse_iterator
using const_reverse_iterator = InstListType::const_reverse_iterator
using phi_iterator = phi_iterator_impl<>
using const_phi_iterator
Public Types inherited from llvm::Value
enum ValueTy
Concrete subclass of this. More...
using use_iterator = use_iterator_impl<Use>
using const_use_iterator = use_iterator_impl<const Use>
using user_iterator = user_iterator_impl<User>
using const_user_iterator = user_iterator_impl<const User>
Public Member Functions
LLVM_ABI DbgMarker * createMarker (Instruction *I)
Attach a DbgMarker to the given instruction.
LLVM_ABI DbgMarker * createMarker (InstListType::iterator It)
LLVM_ABI void convertToNewDbgValues ()
Convert variable location debugging information stored in dbg.value intrinsics into DbgMarkers / DbgRecords.
LLVM_ABI void convertFromNewDbgValues ()
Convert variable location debugging information stored in DbgMarkers and DbgRecords into the dbg.value intrinsic representation.
unsigned getNumber () const
LLVM_ABI void setTrailingDbgRecords (DbgMarker *M)
Record that the collection of DbgRecords in M "trails" after the last instruction of this block.
LLVM_ABI DbgMarker * getTrailingDbgRecords ()
Fetch the collection of DbgRecords that "trail" after the last instruction of this block, see setTrailingDbgRecords.
LLVM_ABI void deleteTrailingDbgRecords ()
Delete any trailing DbgRecords at the end of this block, see setTrailingDbgRecords.
LLVM_ABI void dumpDbgValues () const
LLVM_ABI DbgMarker * getMarker (InstListType::iterator It)
Return the DbgMarker for the position given by It, so that DbgRecords can be inserted there.
LLVM_ABI DbgMarker * getNextMarker (Instruction *I)
Return the DbgMarker for the position that comes after I.
LLVM_ABI void insertDbgRecordAfter (DbgRecord *DR, Instruction *I)
Insert a DbgRecord into a block at the position given by I.
LLVM_ABI void insertDbgRecordBefore (DbgRecord *DR, InstListType::iterator Here)
Insert a DbgRecord into a block at the position given by Here.
LLVM_ABI void flushTerminatorDbgRecords ()
Eject any debug-info trailing at the end of a block.
LLVM_ABI void reinsertInstInDbgRecords (Instruction *I, std::optional< DbgRecord::self_iterator > Pos)
In rare circumstances instructions can be speculatively removed from blocks, and then be re-inserted back into that position later.
BasicBlock (const BasicBlock &)=delete
BasicBlock & operator= (const BasicBlock &)=delete
LLVM_ABI ~BasicBlock ()
LLVM_ABI LLVMContext & getContext () const
Get the context in which this basic block lives.
const Function * getParent () const
Return the enclosing method, or null if none.
Function * getParent ()
LLVM_ABI const Module * getModule () const
Return the module owning the function this basic block belongs to, or nullptr if the function does not have a module.
Module * getModule ()
LLVM_ABI const DataLayout & getDataLayout () const
Get the data layout of the module this basic block belongs to.
const Instruction * getTerminator () const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well formed.
Instruction * getTerminator ()
LLVM_ABI const CallInst * getTerminatingDeoptimizeCall () const
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return instruction of this basic block, if such a call is present.
CallInst * getTerminatingDeoptimizeCall ()
LLVM_ABI const CallInst * getPostdominatingDeoptimizeCall () const
Returns the call instruction calling @llvm.experimental.deoptimize that is present either in current basic block or in block that is a unique successor to current block, if such call is present.
CallInst * getPostdominatingDeoptimizeCall ()
LLVM_ABI const CallInst * getTerminatingMustTailCall () const
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this basic block, if such a call is present.
CallInst * getTerminatingMustTailCall ()
LLVM_ABI LLVM_DEPRECATED ("Use iterators as instruction positions", "getFirstNonPHIIt") const Instruction *getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
LLVM_ABI LLVM_DEPRECATED ("Use iterators as instruction positions instead", "getFirstNonPHIIt") Instruction *getFirstNonPHI()
LLVM_ABI InstListType::const_iterator getFirstNonPHIIt () const
Returns an iterator to the first instruction in this block that is not a PHINode instruction.
InstListType::iterator getFirstNonPHIIt ()
LLVM_ABI InstListType::const_iterator getFirstNonPHIOrDbg (bool SkipPseudoOp=true) const
Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic, or any pseudo operation if SkipPseudoOp is true.
InstListType::iterator getFirstNonPHIOrDbg (bool SkipPseudoOp=true)
LLVM_ABI InstListType::const_iterator getFirstNonPHIOrDbgOrLifetime (bool SkipPseudoOp=true) const
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic, or a lifetime intrinsic, or any pseudo operation if SkipPseudoOp is true.
InstListType::iterator getFirstNonPHIOrDbgOrLifetime (bool SkipPseudoOp=true)
LLVM_ABI const_iterator getFirstInsertionPt () const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI instruction.
iterator getFirstInsertionPt ()
LLVM_ABI const_iterator getFirstNonPHIOrDbgOrAlloca () const
Returns an iterator to the first instruction in this block that is not a PHINode, a debug intrinsic, a static alloca or any pseudo operation.
iterator getFirstNonPHIOrDbgOrAlloca ()
LLVM_ABI const Instruction * getFirstMayFaultInst () const
Returns the first potential AsynchEH faulty instruction currently it checks for loads/stores (which may dereference a null pointer) and calls/invokes (which may propagate exceptions)
Instruction * getFirstMayFaultInst ()
LLVM_ABI iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > instructionsWithoutDebug (bool SkipPseudoOp=true) const
Return a const iterator range over the instructions in the block, skipping any debug instructions.
LLVM_ABI iterator_range< filter_iterator< BasicBlock::iterator, std::function< bool(Instruction &)> > > instructionsWithoutDebug (bool SkipPseudoOp=true)
Return an iterator range over the instructions in the block, skipping any debug instructions.
LLVM_ABI filter_iterator< BasicBlock::const_iterator, std::function< bool(constInstruction &)> >::difference_type sizeWithoutDebug () const
Return the size of the basic block ignoring debug instructions.
LLVM_ABI void removeFromParent ()
Unlink 'this' from the containing function, but do not delete it.
LLVM_ABI SymbolTableList< BasicBlock >::iterator eraseFromParent ()
Unlink 'this' from the containing function and delete it.
void moveBefore (BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives in, right before MovePos.
LLVM_ABI void moveBefore (SymbolTableList< BasicBlock >::iterator MovePos)
LLVM_ABI void moveAfter (BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function MovePos lives in.
LLVM_ABI void insertInto (Function *Parent, BasicBlock *InsertBefore=nullptr)
Insert unlinked basic block into a function.
LLVM_ABI const BasicBlock * getSinglePredecessor () const
Return the predecessor of this block if it has a single predecessor block.
BasicBlock * getSinglePredecessor ()
LLVM_ABI const BasicBlock * getUniquePredecessor () const
Return the predecessor of this block if it has a unique predecessor block.
BasicBlock * getUniquePredecessor ()
LLVM_ABI bool hasNPredecessors (unsigned N) const
Return true if this block has exactly N predecessors.
LLVM_ABI bool hasNPredecessorsOrMore (unsigned N) const
Return true if this block has N predecessors or more.
LLVM_ABI const BasicBlock * getSingleSuccessor () const
Return the successor of this block if it has a single successor.
BasicBlock * getSingleSuccessor ()
LLVM_ABI const BasicBlock * getUniqueSuccessor () const
Return the successor of this block if it has a unique successor.
BasicBlock * getUniqueSuccessor ()
LLVM_ABI void print (raw_ostream &OS, AssemblyAnnotationWriter *AAW=nullptr, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
Print the basic block to an output stream with an optional AssemblyAnnotationWriter.
iterator begin ()
Instruction iterator methods.
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
size_t size () const
bool empty () const
const Instruction & front () const
Instruction & front ()
const Instruction & back () const
Instruction & back ()
iterator_range< const_phi_iterator > phis () const
Returns a range that iterates over the phis in the basic block.
LLVM_ABI iterator_range< phi_iterator > phis ()
LLVM_ABI ValueSymbolTable * getValueSymbolTable ()
Returns a pointer to the symbol table if one exists.
LLVM_ABI void dropAllReferences ()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining.
LLVM_ABI void removePredecessor (BasicBlock *Pred, bool KeepOneInputPHIs=false)
Update PHI nodes in this BasicBlock before removal of predecessor Pred.
LLVM_ABI bool canSplitPredecessors () const
LLVM_ABI BasicBlock * splitBasicBlock (iterator I, const Twine &BBName="", bool Before=false)
Split the basic block into two basic blocks at the specified instruction.
BasicBlock * splitBasicBlock (Instruction *I, const Twine &BBName="", bool Before=false)
LLVM_ABI BasicBlock * splitBasicBlockBefore (iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction and insert the new basic blocks as the predecessor of the current block.
BasicBlock * splitBasicBlockBefore (Instruction *I, const Twine &BBName="")
void splice (BasicBlock::iterator ToIt, BasicBlock *FromBB)
Transfer all instructions from FromBB to this basic block at ToIt.
void splice (BasicBlock::iterator ToIt, BasicBlock *FromBB, BasicBlock::iterator FromIt)
Transfer one instruction from FromBB at FromIt to this basic block at ToIt.
LLVM_ABI void splice (BasicBlock::iterator ToIt, BasicBlock *FromBB, BasicBlock::iterator FromBeginIt, BasicBlock::iterator FromEndIt)
Transfer a range of instructions that belong to FromBB from FromBeginIt to FromEndIt, to this basic block at ToIt.
LLVM_ABI BasicBlock::iterator erase (BasicBlock::iterator FromIt, BasicBlock::iterator ToIt)
Erases a range of instructions from FromIt to (not including) ToIt.
bool hasAddressTaken () const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
LLVM_ABI void replacePhiUsesWith (BasicBlock *Old, BasicBlock *New)
Update all phi nodes in this basic block to refer to basic block New instead of basic block Old.
LLVM_ABI void replaceSuccessorsPhiUsesWith (BasicBlock *Old, BasicBlock *New)
Update all phi nodes in this basic block's successors to refer to basic block New instead of basic block Old.
LLVM_ABI void replaceSuccessorsPhiUsesWith (BasicBlock *New)
Update all phi nodes in this basic block's successors to refer to basic block New instead of to it.
bool isEHPad () const
Return true if this basic block is an exception handling block.
LLVM_ABI bool isLandingPad () const
Return true if this basic block is a landing pad.
LLVM_ABI const LandingPadInst * getLandingPadInst () const
Return the landingpad instruction associated with the landing pad.
LandingPadInst * getLandingPadInst ()
LLVM_ABI bool isLegalToHoistInto () const
Return true if it is legal to hoist instructions into this block.
LLVM_ABI bool isEntryBlock () const
Return true if this is the entry block of the containing function.
LLVM_ABI std::optional< uint64_t > getIrrLoopHeaderWeight () const
bool isInstrOrderValid () const
Returns true if the Order field of child Instructions is valid.
void invalidateOrders ()
Mark instruction ordering invalid. Done on every instruction insert.
LLVM_ABI void renumberInstructions ()
Renumber instructions and mark the ordering as valid.
LLVM_ABI_FOR_TEST void validateInstrOrdering () const
Asserts that instruction order numbers are marked invalid, or that they are in ascending order.
Public Member Functions inherited from llvm::Value
Value (const Value &)=delete
Value & operator= (const Value &)=delete
LLVM_ABI void deleteValue ()
Delete a pointer to a generic Value.
LLVM_ABI void dump () const
Support for debugging, callable in GDB: V->dump()
Type * getType () const
All values are typed, get the type of this value.
LLVM_ABI LLVMContext & getContext () const
All values hold a context through their type.
bool hasName () const
LLVM_ABI ValueName * getValueName () const
LLVM_ABI void setValueName (ValueName *VN)
LLVM_ABI StringRef getName () const
Return a constant reference to the value's name.
LLVM_ABI void setName (const Twine &Name)
Change the name of the value.
LLVM_ABI void takeName (Value *V)
Transfer the name from V to this value.
LLVM_ABI std::string getNameOrAsOperand () const
LLVM_ABI void replaceAllUsesWith (Value *V)
Change all uses of this to point to a new Value.
LLVM_ABI void replaceNonMetadataUsesWith (Value *V)
Change non-metadata uses of this to point to a new Value.
LLVM_ABI void replaceUsesWithIf (Value *New, llvm::function_ref< bool(Use &U)> ShouldReplace)
Go through the uses list for this definition and make each use point to "V" if the callback ShouldReplace returns true for the given Use.
LLVM_ABI void replaceUsesOutsideBlock (Value *V, BasicBlock *BB)
replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V" instead of "this" when the use is outside the block.
LLVM_ABI void assertModuleIsMaterializedImpl () const
void assertModuleIsMaterialized () const
bool hasUseList () const
Check if this Value has a use-list.
bool use_empty () const
bool materialized_use_empty () const
use_iterator materialized_use_begin ()
const_use_iterator materialized_use_begin () const
use_iterator use_begin ()
const_use_iterator use_begin () const
use_iterator use_end ()
const_use_iterator use_end () const
iterator_range< use_iterator > materialized_uses ()
iterator_range< const_use_iterator > materialized_uses () const
iterator_range< use_iterator > uses ()
iterator_range< const_use_iterator > uses () const
bool user_empty () const
user_iterator materialized_user_begin ()
const_user_iterator materialized_user_begin () const
user_iterator user_begin ()
const_user_iterator user_begin () const
user_iterator user_end ()
const_user_iterator user_end () const
User * user_back ()
const User * user_back () const
iterator_range< user_iterator > materialized_users ()
iterator_range< const_user_iterator > materialized_users () const
iterator_range< user_iterator > users ()
iterator_range< const_user_iterator > users () const
bool hasOneUse () const
Return true if there is exactly one use of this value.
LLVM_ABI bool hasNUses (unsigned N) const
Return true if this Value has exactly N uses.
LLVM_ABI bool hasNUsesOrMore (unsigned N) const
Return true if this value has N uses or more.
LLVM_ABI bool hasOneUser () const
Return true if there is exactly one user of this value.
LLVM_ABI Use * getSingleUndroppableUse ()
Return true if there is exactly one use of this value that cannot be dropped.
const Use * getSingleUndroppableUse () const
LLVM_ABI User * getUniqueUndroppableUser ()
Return true if there is exactly one unique user of this value that cannot be dropped (that user can have multiple uses of this value).
const User * getUniqueUndroppableUser () const
LLVM_ABI bool hasNUndroppableUses (unsigned N) const
Return true if there this value.
LLVM_ABI bool hasNUndroppableUsesOrMore (unsigned N) const
Return true if this value has N uses or more.
LLVM_ABI void dropDroppableUses (llvm::function_ref< bool(const Use *)> ShouldDrop=[](const Use *) { return true;})
Remove every uses that can safely be removed.
LLVM_ABI void dropDroppableUsesIn (User &Usr)
Remove every use of this value in User that can safely be removed.
LLVM_ABI bool isUsedInBasicBlock (const BasicBlock *BB) const
Check if this value is used in the specified basic block.
LLVM_ABI unsigned getNumUses () const
This method computes the number of uses of this Value.
void addUse (Use &U)
This method should only be used by the Use class.
unsigned getValueID () const
Return an ID for the concrete type of this object.
unsigned getRawSubclassOptionalData () const
Return the raw optional flags value contained in this value.
void clearSubclassOptionalData ()
Clear the optional flags contained in this value.
bool hasSameSubclassOptionalData (const Value *V) const
Check the optional flags for equality.
bool hasValueHandle () const
Return true if there is a value handle associated with this value.
bool isUsedByMetadata () const
Return true if there is metadata referencing this value.
LLVM_ABI bool isSwiftError () const
Return true if this value is a swifterror value.
LLVM_ABI const Value * stripPointerCasts () const
Strip off pointer casts, all-zero GEPs and address space casts.
Value * stripPointerCasts ()
LLVM_ABI const Value * stripPointerCastsAndAliases () const
Strip off pointer casts, all-zero GEPs, address space casts, and aliases.
Value * stripPointerCastsAndAliases ()
LLVM_ABI const Value * stripPointerCastsSameRepresentation () const
Strip off pointer casts, all-zero GEPs and address space casts but ensures the representation of the result stays the same.
Value * stripPointerCastsSameRepresentation ()
LLVM_ABI const Value * stripPointerCastsForAliasAnalysis () const
Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info.
Value * stripPointerCastsForAliasAnalysis ()
LLVM_ABI const Value * stripInBoundsConstantOffsets () const
Strip off pointer casts and all-constant inbounds GEPs.
Value * stripInBoundsConstantOffsets ()
LLVM_ABI const Value * stripAndAccumulateConstantOffsets (const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false, function_ref< bool(Value &Value, APInt &Offset)> ExternalAnalysis=nullptr, bool LookThroughIntToPtr=false) const
Accumulate the constant offset this value has compared to a base pointer.
Value * stripAndAccumulateConstantOffsets (const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false, function_ref< bool(Value &Value, APInt &Offset)> ExternalAnalysis=nullptr, bool LookThroughIntToPtr=false)
const Value * stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
This is a wrapper around stripAndAccumulateConstantOffsets with the in-bounds requirement set to false.
Value * stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
LLVM_ABI const Value * stripInBoundsOffsets (function_ref< void(const Value *)> Func=[](const Value *) {}) const
Strip off pointer casts and inbounds GEPs.
Value * stripInBoundsOffsets (function_ref< void(const Value *)> Func=[](const Value *) {})
LLVM_ABI std::optional< int64_t > getPointerOffsetFrom (const Value *Other, const DataLayout &DL) const
If this ptr is provably equal to Other plus a constant offset, return that offset in bytes.
LLVM_ABI bool canBeFreed () const
Return true if the memory object referred to by V can by freed in the scope for which the SSA value defining the allocation is statically defined.
LLVM_ABI uint64_t getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull, bool &CanBeFreed) const
Returns the number of bytes known to be dereferenceable for the pointer value.
LLVM_ABI Align getPointerAlignment (const DataLayout &DL) const
Returns an alignment of the pointer value.
LLVM_ABI const Value * DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
Translate PHI node to its predecessor from the given basic block.
Value * DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
void mutateType (Type *Ty)
Mutate the type of this Value to be of the specified type.
template
void sortUseList (Compare Cmp)
Sort the use-list.
LLVM_ABI void reverseUseList ()
Reverse the use-list.
LLVM_ABI void print (raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
LLVM_ABI void print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug=false) const
LLVM_ABI void printAsOperand (raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
LLVM_ABI void printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const
Public Member Functions inherited from llvm::ilist_node_with_parent< BasicBlock, Function >
BasicBlock * getPrevNode ()
BasicBlock * getNextNode ()
Get the next node, or nullptr for the list tail.
Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >
self_iterator getIterator ()
reverse_self_iterator getReverseIterator ()
std::enable_if_t< T::is_sentinel_tracking_explicit, bool > isSentinel () const
Check whether this is the sentinel node.
Public Member Functions inherited from llvm::ilist_detail::node_parent_access< ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >, ilist_detail::compute_node_options< BasicBlock, Options... >::type::parent_ty >
const ilist_detail::compute_node_options< BasicBlock, Options... >::type::parent_ty * getParent () const
void setParent (ilist_detail::compute_node_options< BasicBlock, Options... >::type::parent_ty *Parent)
Static Public Member Functions
static BasicBlock * Create (LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
static bool classof (const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast.
Static Public Member Functions inherited from llvm::Value
static LLVM_ABI void dropDroppableUse (Use &U)
Remove the droppable use U.
Friends
class Function
class BlockAddress
class SymbolTableListTraits< BasicBlock >
class llvm::SymbolTableListTraits< llvm::Instruction, ilist_iterator_bits< true >, ilist_parent< BasicBlock > >
class llvm::ilist_node_with_parent< llvm::Instruction, llvm::BasicBlock, ilist_iterator_bits< true >, ilist_parent< BasicBlock > >
void Instruction::removeFromParent ()
BasicBlock::iterator Instruction::eraseFromParent ()
BasicBlock::iterator Instruction::insertInto (BasicBlock *BB, BasicBlock::iterator It)
void Instruction::insertBefore (BasicBlock::iterator InsertPos)
void Instruction::insertAfter (Instruction *InsertPos)
void Instruction::insertAfter (BasicBlock::iterator InsertPos)
void Instruction::insertBefore (BasicBlock &BB, InstListType::iterator InsertPos)
void Instruction::moveBeforeImpl (BasicBlock &BB, InstListType::iterator I, bool Preserve)
iterator_range< DbgRecord::self_iterator > Instruction::cloneDebugInfoFrom (const Instruction *From, std::optional< DbgRecord::self_iterator > FromHere, bool InsertAtHead)
Additional Inherited Members
Static Public Attributes inherited from llvm::Value
static constexpr unsigned MaxAlignmentExponent = 32
The maximum alignment for instructions.
static constexpr uint64_t MaximumAlignment = 1ULL << MaxAlignmentExponent
Protected Types inherited from llvm::Value
enum : unsigned { NumUserOperandsBits = 27 }
The number of operands in the subclass. More...
Protected Types inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >
using self_iterator
using const_self_iterator
using reverse_self_iterator
using const_reverse_self_iterator
Protected Member Functions inherited from llvm::Value
LLVM_ABI Value (Type *Ty, unsigned scid)
LLVM_ABI ~Value ()
Value's destructor should be virtual by design, but that would require that Value and all of its subclasses have a vtable that effectively duplicates the information in the value ID.
LLVM_ABI void getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const
Appends all metadata attached to this value to MDs, sorting by KindID.
bool hasMetadata () const
Return true if this value has any metadata attached to it.
LLVM_ABI bool eraseMetadata (unsigned KindID)
Erase all metadata attachments with the given kind.
LLVM_ABI void eraseMetadataIf (function_ref< bool(unsigned, MDNode *)> Pred)
Erase all metadata attachments matching the given predicate.
LLVM_ABI void clearMetadata ()
Erase all metadata attached to this Value.
LLVM_ABI MDNode * getMetadataImpl (unsigned KindID) const
Get metadata for the given kind, if any.
unsigned short getSubclassDataFromValue () const
void setValueSubclassData (unsigned short D)
MDNode * getMetadata (unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
LLVM_ABI MDNode * getMetadata (StringRef Kind) const
LLVM_ABI void getMetadata (unsigned KindID, SmallVectorImpl< MDNode * > &MDs) const
Appends all attachments with the given ID to MDs in insertion order.
LLVM_ABI void getMetadata (StringRef Kind, SmallVectorImpl< MDNode * > &MDs) const
bool hasMetadata (unsigned KindID) const
Return true if this value has the given type of metadata attached.
bool hasMetadata (StringRef Kind) const
LLVM_ABI void setMetadata (unsigned KindID, MDNode *Node)
Set a particular kind of metadata attachment.
LLVM_ABI void setMetadata (StringRef Kind, MDNode *Node)
LLVM_ABI void addMetadata (unsigned KindID, MDNode &MD)
Add a metadata attachment.
LLVM_ABI void addMetadata (StringRef Kind, MDNode &MD)
Protected Member Functions inherited from llvm::ilist_node_with_parent< BasicBlock, Function >
ilist_node_with_parent ()=default
Protected Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >
ilist_node_impl ()=default
Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
Hold subclass data that can be dropped.
unsigned NumUserOperands: NumUserOperandsBits
unsigned IsUsedByMD: 1
unsigned HasName: 1
unsigned HasMetadata: 1
unsigned HasHungOffUses: 1
unsigned HasDescriptor: 1

LLVM Basic Block Representation.

This represents a single basic block in LLVM. A basic block is simply a container of instructions that execute sequentially. Basic blocks are Values because they are referenced by instructions such as branches and switch tables. The type of a BasicBlock is "Type::LabelTy" because the basic block represents a label to which a branch can jump.

A well formed basic block is formed of a list of non-terminating instructions followed by a single terminator instruction. Terminator instructions may not occur in the middle of basic blocks, and must terminate the blocks. The BasicBlock class allows malformed basic blocks to occur because it may be useful in the intermediate stage of constructing or modifying a program. However, the verifier will ensure that basic blocks are "well formed".

Definition at line 61 of file BasicBlock.h.

const_iterator

const_phi_iterator

Initial value:

Iterator to walk just the phi nodes in the basic block.

Definition at line 522 of file BasicBlock.h.

const_reverse_iterator

InstListType

Initial value:

List that automatically updates parent links and symbol tables.

Option to add a pointer to this list's owner in every node.

Definition at line 64 of file BasicBlock.h.

iterator

phi_iterator

reverse_iterator

~BasicBlock()

BasicBlock::~BasicBlock ( )

back() [1/2]

back() [2/2]

Instruction & llvm::sandboxir::BasicBlock::back ( ) const inline

Definition at line 484 of file BasicBlock.h.

Referenced by llvm::Function::back(), llvm::Function::back(), llvm::AAResults::canBasicBlockModify(), llvm::changeToInvokeAndSplitBasicBlock(), emptyAndDetachBlock(), llvm::FastISel::fastEmitBranch(), llvm::MergeBlockIntoPredecessor(), phiNodeRemapHelper(), restoreIPandDebugLoc(), llvm::SimplifyInstructionsInBlock(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().

begin() [1/2]

iterator llvm::BasicBlock::begin ( ) inline

Instruction iterator methods.

Definition at line 459 of file BasicBlock.h.

Referenced by llvm::calculateWasmEHInfo(), llvm::Interpreter::callFunction(), canLoopBeDeleted(), CanPropagatePredecessorsForPHIs(), canSplitCallSite(), llvm::CloneAndPruneIntoFromInst(), cloneInstructionInExitBlock(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::IRSimilarity::IRInstructionMapper::convertToUnsignedVec(), llvm::SSAUpdaterTraits< SSAUpdater >::CreateEmptyPHI(), createOutlinedFunction(), llvm::createPHIsForSplitLoopExit(), createRetBitCast(), createRetPHINode(), llvm::VPlan::createVPIRBasicBlock(), despeculateCountZeros(), llvm::PostDominatorTree::dominates(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), EliminateDuplicatePHINodesNaiveImpl(), EliminateDuplicatePHINodesSetBasedImpl(), ensureValueAvailableInSuccessor(), llvm::Evaluator::EvaluateFunction(), expandFPToI(), expandIToFP(), llvm::CodeExtractor::extractCodeRegion(), llvm::findAvailablePtrLoadStore(), findDependencies(), findDuplicateOutputBlock(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findOrCreatePHIInBlock(), llvm::SSAUpdaterTraits< SSAUpdater >::FindPredecessorBlocks(), foldCondBranchOnValueKnownInPredecessorImpl(), foldMemChr(), llvm::FoldSingleEntryPHINodes(), foldTwoEntryPHINode(), formLCSSAForInstructionsImpl(), generateUnsignedDivisionCode(), llvm::ScalarEvolution::getAddExpr(), llvm::MemoryDependenceResults::getDependency(), llvm::GetIfCondition(), llvm::sandboxir::getInsertPointAfterInstrs(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), getStrlenWithNull(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleInlinedEHPad(), llvm::hoistAllInstructionsInto(), llvm::InlineFunctionImpl(), InsertSafepointPoll(), insertSinCosCall(), insertSpills(), insertTrivialPHIs(), llvm::instrs(), isBlockValidForExtraction(), llvm::CodeExtractor::isEligible(), makeStatepointExplicitImpl(), markPointerAsAS(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), moveBBContents(), movePHIValuesToInsertedBlock(), llvm::InsertPHIStrategy::mutate(), normalizeForInvokeSafepoint(), optimizeBlock(), optimizeSQRT(), ProcessBlock(), programUndefinedIfUndefOrPoison(), promoteMemoryToRegister(), reconnectPhis(), rewritePHINodesForExitAndUnswitchedBlocks(), RewriteUsesOfClonedInstructions(), runPass(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scalarizeMaskedVectorHistogram(), scanInlinedCode(), SimplifyCondBranchToCondBranch(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), splice(), SplitBlockPredecessorsImpl(), splitCallSite(), llvm::SplitIndirectBrCriticalEdges(), llvm::SplitKnownCriticalEdge(), splitLoopBound(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadGuard(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), tryToMergeLandingPad(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), llvm::JumpThreadingPass::unfoldSelectInstr(), llvm::UnrollLoop(), unswitchTrivialSwitch(), UpdatePHINodes(), llvm::InstVisitor< UnrolledInstAnalyzer, bool >::visit(), llvm::Interpreter::visitIntrinsicInst(), and llvm::willNotFreeBetween().

begin() [2/2]

BasicBlock::iterator llvm::sandboxir::BasicBlock::begin ( ) const inline

canSplitPredecessors()

bool BasicBlock::canSplitPredecessors ( ) const

classof()

convertFromNewDbgValues()

void BasicBlock::convertFromNewDbgValues ( )

Convert variable location debugging information stored in DbgMarkers and DbgRecords into the dbg.value intrinsic representation.

Sets IsNewDbgInfoFormat = false.

Definition at line 89 of file BasicBlock.cpp.

convertToNewDbgValues()

void BasicBlock::convertToNewDbgValues ( )

Convert variable location debugging information stored in dbg.value intrinsics into DbgMarkers / DbgRecords.

Deletes all dbg.values in the process and sets IsNewDbgInfoFormat = true.

Definition at line 53 of file BasicBlock.cpp.

References llvm::cast(), llvm::cast_or_null(), F, and Function.

Create()

Creates a new BasicBlock.

If the Parent parameter is specified, the basic block is automatically inserted at either the end of the function (if InsertBefore is 0), or before the specified basic block.

Definition at line 206 of file BasicBlock.h.

References Create().

Referenced by addBoundsChecking(), assureFPCallStub(), llvm::CloneBasicBlock(), convertToGuardPredicates(), Create(), createAndInsertBasicBlocks(), llvm::MIRParserImpl::createDummyFunction(), createDummyReturnBlock(), CreateFailBB(), createFPFnStub(), createFrameHelperMachineFunction(), llvm::RandomIRBuilder::createFunctionDefinition(), createMemMoveLoopUnknownSize(), createMemSetLoop(), createOutlinedFunction(), llvm::createSanitizerCtor(), llvm::createSanitizerCtorAndInitFunctions(), llvm::Attributor::createShallowWrapper(), createThunk(), llvm::ThunkInserter< Derived, InsertedThunksTy >::createThunkFunction(), createUnreachableSwitchDefault(), createWrapper(), llvm::ehAwareSplitEdge(), llvm::orc::IRSpeculationLayer::emit(), llvm::emitAMDGPUPrintfCall(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), emitTargetTaskProxyFunction(), expandFPToI(), expandIToFP(), expandToSwitch(), findOrCreatePHIBlock(), llvm::SanitizerStatReport::finish(), foldMemChr(), generateReproducer(), generateUnsignedDivisionCode(), getStrlenWithNull(), injectPendingInvariantConditions(), insertLoopExpansion(), insertUniqueBackedgeBlock(), LLVMAppendBasicBlockInContext(), LLVMCreateBasicBlockInContext(), LLVMInsertBasicBlockInContext(), lowerFunnelShifts(), llvm::lowerGlobalIFuncUsersAsGlobalCtor(), lowerIntrinsicToFunction(), llvm::lowerUnaryVectorIntrinsicAsLoop(), makeFunctionBodyUnreachable(), llvm::orc::makeStub(), markAliveBlocks(), mergeComparisons(), mergeCompatibleInvokesImpl(), llvm::InsertCFGStrategy::mutate(), llvm::EscapeEnumerator::Next(), performBlockTailMerging(), populateReductionFunction(), processSwitch(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), rewritePHIsForCleanupPad(), runImpl(), runImpl(), SimplifyCondBranchToCondBranch(), simplifySwitchLookup(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), llvm::SplitCallBrEdge(), llvm::coro::AnyRetconABI::splitCoroutine(), llvm::coro::AsyncABI::splitCoroutine(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), and llvm::JumpThreadingPass::unfoldSelectInstr().

createMarker() [1/2]

createMarker() [2/2]

deleteTrailingDbgRecords()

void BasicBlock::deleteTrailingDbgRecords ( )

Delete any trailing DbgRecords at the end of this block, see setTrailingDbgRecords.

Definition at line 1132 of file BasicBlock.cpp.

dropAllReferences()

void BasicBlock::dropAllReferences ( )

Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining.

This allows one to 'delete' a whole class at a time, even though there may be circular references... first all references are dropped, and all use counts go to zero. Then everything is delete'd for real. Note that no operations are valid on an object that has "dropped all references", except operator delete.

Definition at line 432 of file BasicBlock.cpp.

dumpDbgValues()

void BasicBlock::dumpDbgValues ( ) const

empty()

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

end() [1/2]

iterator llvm::BasicBlock::end ( ) inline

Definition at line 472 of file BasicBlock.h.

Referenced by buildPartialInvariantUnswitchConditionalBranch(), llvm::changeToUnreachable(), llvm::MemorySSAUpdater::changeToUnreachable(), llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::ConvertDebugDeclareToDebugValue(), llvm::IRSimilarity::IRInstructionMapper::convertToUnsignedVec(), llvm::convertUsersOfConstantsToInstructions(), createSwitchStatement(), createTargetLoopWorkshareCall(), detectPopcountIdiom(), detectShiftUntilLessThanIdiom(), detectShiftUntilZeroIdiom(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), getConvergenceEntry(), getEndIterator(), getInsertPt(), getInsertPt(), getInstrBB(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), llvm::hoistAllInstructionsInto(), llvm::insertDebugValuesForPHIs(), llvm::DIBuilder::insertDeclare(), llvm::sandboxir::Instruction::insertInto(), llvm::sandboxir::InsertPosition::InsertPosition(), InsertSafepointPoll(), llvm::instrs(), llvm::SampleProfileProber::instrumentOneFunc(), isBlockValidForExtraction(), llvm::isInTailCallPosition(), llvm::MergeBlockIntoPredecessor(), mergeCompatibleInvokesImpl(), moveBBContents(), llvm::RandomIRBuilder::newSource(), optimizeBlock(), OptimizeExtractBits(), performBlockTailMerging(), llvm::PrepareToSplitEntryBlock(), ProcessBlock(), programUndefinedIfUndefOrPoison(), promoteMemoryToRegister(), reconnectPhis(), replaceArgumentUses(), restoreIPandDebugLoc(), RewriteUsesOfClonedInstructions(), llvm::IRBuilderBase::SetInsertPoint(), shouldInstrumentBlock(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifyUsingControlFlow(), SinkCast(), sinkCmpExpression(), SinkShiftAndTruncate(), skipPastPhiNodesAndDbg(), skipToNonAllocaInsertPt(), splice(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadGuard(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::JumpThreadingPass::unfoldSelectInstr(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), updateScopeLine(), llvm::InstVisitor< UnrolledInstAnalyzer, bool >::visit(), llvm::willNotFreeBetween(), and workshareLoopTargetCallback().

end() [2/2]

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

erase()

BasicBlock::iterator BasicBlock::erase ( BasicBlock::iterator FromIt,
BasicBlock::iterator ToIt )

eraseFromParent()

flushTerminatorDbgRecords()

void BasicBlock::flushTerminatorDbgRecords ( )

Eject any debug-info trailing at the end of a block.

DbgRecords can transiently be located "off the end" of a block if the blocks terminator is temporarily removed. Once a terminator is re-inserted this method will move such DbgRecords back to the right place (ahead of the terminator).

Definition at line 699 of file BasicBlock.cpp.

Referenced by llvm::changeToUnreachable().

front() [1/2]

front() [2/2]

Instruction & llvm::sandboxir::BasicBlock::front ( ) const inline

Definition at line 482 of file BasicBlock.h.

Referenced by calculateStateNumbersForInvokes(), llvm::AAResults::canBasicBlockModify(), llvm::CloneAndPruneFunctionInto(), llvm::CloneAndPruneIntoFromInst(), llvm::FastISel::fastEmitBranch(), findArgParts(), formLCSSAForInstructionsImpl(), llvm::Function::front(), llvm::Function::front(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::InstCombinerImpl::handlePotentiallyDeadBlocks(), insertCallAtFunctionEntryPoint(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), isPotentiallyReachable(), llvm::coro::isSuspendBlock(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeNestedCondBranch(), llvm::moveInstructionsToTheEnd(), movePHIValuesToInsertedBlock(), llvm::JumpThreadingPass::processBranchOnXOR(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::SSAUpdaterBulk::RewriteAllUses(), runSanitizeRealtimeBlocking(), llvm::SplitEdge(), splitLoopBound(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().

getContext()

Get the context in which this basic block lives.

Definition at line 131 of file BasicBlock.cpp.

References llvm::dyn_cast().

Referenced by addBasicBlockMetadata(), llvm::addStringMetadataToLoop(), llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), llvm::ConstantFoldTerminator(), llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoopKnownSize(), createMemMoveLoopUnknownSize(), createStringMetadata(), createUnreachableSwitchDefault(), llvm::ehAwareSplitEdge(), emptyAndDetachBlock(), findOrCreatePHIBlock(), llvm::BlockAddress::get(), llvm::sandboxir::BlockAddress::get(), llvm::DbgRecord::getContext(), llvm::DbgRecord::getContext(), llvm::VPlan::getContext(), insertLoopExpansion(), llvm::BPFCoreSharedInfo::insertPassThrough(), llvm::BlockAddress::lookup(), llvm::sandboxir::BlockAddress::lookup(), llvm::lowerUnaryVectorIntrinsicAsLoop(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeComparisons(), llvm::parseWidenableBranch(), llvm::JumpThreadingPass::processBranchOnXOR(), processSwitch(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), llvm::VPlanTransforms::replicateByVF(), rewritePHIsForCleanupPad(), llvm::Loop::setLoopAlreadyUnrolled(), llvm::Loop::setLoopMustProgress(), SimplifyCondBranchToCondBranch(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), llvm::SplitCallBrEdge(), SplitLandingPadPredecessorsImpl(), splitLoopBound(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::unfoldSelectInstr(), and llvm::LoopVersioning::versionLoop().

getDataLayout()

Get the data layout of the module this basic block belongs to.

Requires the basic block to have a parent module.

Definition at line 252 of file BasicBlock.cpp.

Referenced by computeAllocaDefaultAlign(), computeLoadStoreDefaultAlign(), computeUnlikelySuccessors(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), createWrapper(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::findAvailablePtrLoadStore(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::getStartAndEndForAccess(), getStrideFromAddRec(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processImpliedCondition(), llvm::promoteLoopAccessesToScalars(), reuseTableCompare(), llvm::simplifyCFG(), llvm::SimplifyInstructionsInBlock(), simplifyRecipe(), llvm::JumpThreadingPass::threadGuard(), and llvm::LoopVersioning::versionLoop().

getFirstInsertionPt() [1/2]

iterator llvm::BasicBlock::getFirstInsertionPt ( ) inline

getFirstInsertionPt() [2/2]

BasicBlock::const_iterator BasicBlock::getFirstInsertionPt ( ) const

Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI instruction.

In particular, it skips all PHIs and LandingPad instructions.

Definition at line 393 of file BasicBlock.cpp.

Referenced by cloneInstructionInExitBlock(), llvm::ConvertDebugDeclareToDebugValue(), llvm::convertUsersOfConstantsToInstructions(), llvm::ConvergenceControlInst::CreateAnchor(), llvm::ConvergenceControlInst::CreateEntry(), llvm::ConvergenceControlInst::CreateLoop(), llvm::RandomIRBuilder::createStackMemory(), DbgInserterHelper(), llvm::VPReductionPHIRecipe::execute(), llvm::RandomIRBuilder::findOrCreateSource(), fixScalarResumeValuesFromBypass(), foldDependentIVs(), foldGuardedFunnelShift(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), getFirstInsertionPt(), getInsertionRange(), getInsertPt(), getInsertPt(), getInstrBB(), llvm::coro::getSpillInsertionPt(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), llvm::objcarc::BundledRetainClaimRVs::insertAfterInvokes(), llvm::insertDebugValuesForPHIs(), insertSpills(), llvm::SampleProfileProber::instrumentOneFunc(), llvm::invertCondition(), makeStatepointExplicitImpl(), mergeConditionalStoreToAddress(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::InstDeleterIRStrategy::mutate(), llvm::ShuffleBlockStrategy::mutate(), llvm::RandomIRBuilder::newSource(), OptimizeExtractBits(), llvm::InstCombinerImpl::run(), setInsertionPoint(), shouldInstrumentBlock(), simplifyUsingControlFlow(), SinkCast(), sinkCmpExpression(), SinkInstruction(), sinkInstruction(), SinkShiftAndTruncate(), skipPastPhiNodesAndDbg(), llvm::SplitIndirectBrCriticalEdges(), SplitLandingPadPredecessorsImpl(), targetParallelCallback(), llvm::JumpThreadingPass::threadGuard(), llvm::InstCombinerImpl::tryToSinkInstruction(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().

getFirstMayFaultInst() [1/2]

Instruction * llvm::BasicBlock::getFirstMayFaultInst ( ) inline

getFirstMayFaultInst() [2/2]

Returns the first potential AsynchEH faulty instruction currently it checks for loads/stores (which may dereference a null pointer) and calls/invokes (which may propagate exceptions)

Definition at line 314 of file BasicBlock.cpp.

getFirstNonPHIIt() [1/2]

getFirstNonPHIIt() [2/2]

BasicBlock::const_iterator BasicBlock::getFirstNonPHIIt ( ) const

Returns an iterator to the first instruction in this block that is not a PHINode instruction.

When adding instructions to the beginning of the basic block, they should be added before the returned value, not before the first instruction, which might be PHI. Returns end() if there's no non-PHI instruction.

Avoid unwrapping the iterator to an Instruction* before inserting here, as important debug-info is preserved in the iterator.

Definition at line 337 of file BasicBlock.cpp.

Referenced by llvm::MachineFunction::addLandingPad(), llvm::calculateClrEHStateNumbers(), llvm::calculateCXXStateForAsynchEH(), llvm::calculateSEHStateForAsynchEH(), calculateStateNumbersForInvokes(), llvm::calculateWasmEHInfo(), canSplitPredecessors(), cloneInstructionInExitBlock(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::colorEHFunclets(), ConnectEpilog(), connectEpilogueVectorLoop(), ConnectProlog(), llvm::objcarc::createCallInstWithColors(), createMemMoveLoopKnownSize(), createOutlinedFunction(), llvm::createPHIsForSplitLoopExit(), detectPopcountIdiom(), detectShiftUntilLessThanIdiom(), detectShiftUntilZeroIdiom(), llvm::ehAwareSplitEdge(), llvm::VPIRPhi::execute(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findPHIForConditionForwarding(), findUnwindDestinations(), getConvergenceEntry(), getFirstNonPHIIt(), getSuccPad(), getUnwindDestTokenHelper(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), hoist(), llvm::InlineFunctionImpl(), llvm::insertDebugValuesForPHIs(), isEHPad(), LLVM_DEPRECATED(), markAliveBlocks(), moveLCSSAPhis(), populateEHOperandBundle(), preparePlanForEpilogueVectorLoop(), programUndefinedIfUndefOrPoison(), raiseUserConstantDataAllocasToEntryBlock(), relocationViaAlloca(), removeEmptyCleanup(), rewritePHIs(), llvm::InstCombinerImpl::run(), runMoveAutoInit(), llvm::SplitBlockAndInsertSimpleForLoop(), SplitLandingPadPredecessorsImpl(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and llvm::UnrollLoop().

getFirstNonPHIOrDbg() [1/2]

getFirstNonPHIOrDbg() [2/2]

BasicBlock::const_iterator BasicBlock::getFirstNonPHIOrDbg ( bool SkipPseudoOp = true ) const

getFirstNonPHIOrDbgOrAlloca() [1/2]

iterator llvm::BasicBlock::getFirstNonPHIOrDbgOrAlloca ( ) inline

getFirstNonPHIOrDbgOrAlloca() [2/2]

BasicBlock::const_iterator BasicBlock::getFirstNonPHIOrDbgOrAlloca ( ) const

getFirstNonPHIOrDbgOrLifetime() [1/2]

getFirstNonPHIOrDbgOrLifetime() [2/2]

BasicBlock::const_iterator BasicBlock::getFirstNonPHIOrDbgOrLifetime ( bool SkipPseudoOp = true ) const

getIrrLoopHeaderWeight()

std::optional< uint64_t > BasicBlock::getIrrLoopHeaderWeight ( ) const

getLandingPadInst() [1/2]

getLandingPadInst() [2/2]

getMarker()

getModule() [1/2]

Module * llvm::BasicBlock::getModule ( ) inline

getModule() [2/2]

Return the module owning the function this basic block belongs to, or nullptr if the function does not have a module.

Note: this is undefined behavior if the block does not have a parent.

Definition at line 248 of file BasicBlock.cpp.

Referenced by CanProveNotTakenFirstIteration(), llvm::RandomIRBuilder::connectToSink(), llvm::ConvergenceControlInst::CreateAnchor(), llvm::ConvergenceControlInst::CreateEntry(), llvm::ConvergenceControlInst::CreateLoop(), createOutlinedFunction(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), llvm::RISCVTargetLowering::getIRStackGuard(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::RandomIRBuilder::newSink(), llvm::RandomIRBuilder::newSource(), performBranchToCommonDestFolding(), print(), llvm::GCNTTIImpl::simplifyAMDGCNLaneIntrinsicDemanded(), and useTpOffset().

getNextMarker()

Return the DbgMarker for the position that comes after I.

See also

BasicBlock::getMarker, this can be nullptr, a DbgMarker, or TrailingDbgRecords if there is no next instruction.

Definition at line 1043 of file BasicBlock.cpp.

getNumber()

unsigned llvm::BasicBlock::getNumber ( ) const inline

getParent() [1/2]

Function * llvm::BasicBlock::getParent ( ) inline

getParent() [2/2]

Function * llvm::sandboxir::BasicBlock::getParent ( ) const inline

Return the enclosing method, or null if none.

Definition at line 213 of file BasicBlock.h.

References Function.

Referenced by addReplicateRegions(), llvm::CodeMetrics::analyzeBasicBlock(), calculateCXXStateNumbers(), calculateSEHStateNumbers(), llvm::CanInlineCallSite(), canProveExitOnFirstIteration(), CanWidenIV(), checkOverflow(), llvm::JumpThreadingPass::cloneInstructions(), llvm::cloneLoopWithPreheader(), llvm::colorEHFunclets(), CompareValueComplexity(), computeAllocaDefaultAlign(), llvm::LoopSafetyInfo::computeBlockColors(), computeLoadStoreDefaultAlign(), convertToRelLookupTable(), convertValue(), copyMustTailReturn(), llvm::coro::BaseCloner::create(), createAllocaInstAtEntry(), llvm::IRSimilarity::IRSimilarityCandidate::createCanonicalRelationFrom(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoopKnownSize(), createMemMoveLoopUnknownSize(), createMemSetLoop(), createUnreachableSwitchDefault(), DbgInserterHelper(), DoFlattenLoopPair(), llvm::ehAwareSplitEdge(), llvm::orc::IRSpeculationLayer::emit(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), llvm::HexagonTargetLowering::emitStoreConditional(), expandToSwitch(), llvm::CodeExtractor::extractCodeRegion(), llvm::CodeExtractor::findAllocas(), llvm::MustBeExecutedContextExplorer::findBackwardJoinPoint(), llvm::OutlinableRegion::findCorrespondingBlockIn(), llvm::MustBeExecutedContextExplorer::findForwardJoinPoint(), findOrCreatePHIBlock(), llvm::RandomIRBuilder::findOrCreateSource(), FlattenLoopPair(), llvm::InstCombinerImpl::foldAggregateConstructionIntoAggregateReuse(), llvm::foldBranchToCommonDest(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), foldMemChr(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::BlockAddress::get(), llvm::AddrLabelMap::getAddrLabelSymbolToEmit(), getAllocaPos(), llvm::memtag::getAndroidSlotPtr(), llvm::TargetLoweringBase::getDefaultSafeStackPointerLocation(), llvm::BlockCoverageInference::getDependencies(), llvm::MemoryDependenceResults::getDependency(), getDominatees(), getDominators(), llvm::IRSimilarity::IRSimilarityCandidate::getEndBB(), llvm::memtag::getFP(), llvm::BlockAddress::getFunction(), llvm::DbgRecord::getFunction(), llvm::DbgRecord::getFunction(), llvm::IRSimilarity::IRSimilarityCandidate::getFunction(), llvm::Trace::getFunction(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::TargetLoweringBase::getIRStackGuard(), llvm::X86TargetLowering::getIRStackGuard(), llvm::Loop::getLocStr(), getModuleFromDPI(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), getNumber(), llvm::sandboxir::Instruction::getParent(), llvm::memtag::getPC(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), slpvectorizer::BoUpSLP::getSpillCost(), llvm::IRSimilarity::IRSimilarityCandidate::getStartBB(), llvm::GCProjectionInst::getStatepoint(), HandleByValArgumentInit(), HandleInlinedEHPad(), HandleInlinedLandingPad(), llvm::InlineFunctionImpl(), insertBoundsCheck(), InsertCall(), insertLoopExpansion(), InsertSafepointPoll(), insertSpills(), InsertTrap(), llvm::invertCondition(), llvm::Attributor::isAssumedDead(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), isExplicitVecOuterLoop(), isFSqrtDivToFMulLegal(), llvm::isInTailCallPosition(), llvm::isPresplitCoroSuspendExitEdge(), LLVMInsertBasicBlockInContext(), LLVMInsertExistingBasicBlockAfterInsertBlock(), llvm::lowerUnaryVectorIntrinsicAsLoop(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), mergeComparisons(), mergeCompatibleInvokesImpl(), moveLCSSAPhis(), llvm::InsertCFGStrategy::mutate(), llvm::InsertFunctionStrategy::mutate(), llvm::InsertPHIStrategy::mutate(), llvm::RandomIRBuilder::newSink(), llvm::RandomIRBuilder::newSource(), nullifySetjmp(), placeSplitBlockCarefully(), preparePlanForEpilogueVectorLoop(), llvm::PrepareToSplitEntryBlock(), llvm::printBasicBlock(), printBBName(), printIRBlockReference(), llvm::JumpThreadingPass::processBlock(), processSwitch(), programUndefinedIfUndefOrPoison(), llvm::memtag::readRegister(), llvm::SCCPSolver::removeNonFeasibleEdges(), llvm::RemoveRedundantDbgInstrs(), removeUndefIntroducingPredecessor(), replaceConstantExprOp(), replaceExtractElements(), rewritePHIsForCleanupPad(), scanOneBB(), llvm::BlockCoverageInference::shouldInstrumentBlock(), llvm::shouldOptimizeForSize(), SimplifyCondBranchToCondBranch(), simplifySwitchLookup(), sinkLifetimeStartMarkers(), sinkLoopInvariantInstructions(), skipPastPhiNodesAndDbg(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockAndInsertSimpleForLoop(), SplitBlockPredecessorsImpl(), llvm::SplitCallBrEdge(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::SuspendCrossingInfo::SuspendCrossingInfo(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), llvm::JumpThreadingPass::unfoldSelectInstr(), UpdateAnalysisInformation(), llvm::AddrLabelMap::UpdateForDeletedBlock(), UseTlsOffset(), and validateAndCostRequiredSelects().

getPostdominatingDeoptimizeCall() [1/2]

CallInst * llvm::BasicBlock::getPostdominatingDeoptimizeCall ( ) inline

getPostdominatingDeoptimizeCall() [2/2]

const CallInst * BasicBlock::getPostdominatingDeoptimizeCall ( ) const

Returns the call instruction calling @llvm.experimental.deoptimize that is present either in current basic block or in block that is a unique successor to current block, if such call is present.

Otherwise, returns null.

Definition at line 302 of file BasicBlock.cpp.

getSinglePredecessor() [1/2]

BasicBlock * llvm::BasicBlock::getSinglePredecessor ( ) inline

getSinglePredecessor() [2/2]

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

Otherwise return a null pointer.

Definition at line 437 of file BasicBlock.cpp.

Referenced by CanGenerateTest(), CanPropagatePredecessorsForPHIs(), CanProveNotTakenFirstIteration(), llvm::CloneAndPruneIntoFromInst(), connectEpilogueVectorLoop(), llvm::TileInfo::CreateTiledLoops(), llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), llvm::EpilogueVectorizerMainLoop::createVectorizedLoopSkeleton(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::DominatorTree::dominates(), llvm::VPPredInstPHIRecipe::execute(), findDominatingValue(), findPHIForConditionForwarding(), FindWidenableTerminatorAboveLoop(), foldICmpWithDominatingICmp(), getDomPredecessorCondition(), llvm::GetIfCondition(), getOrderedBlocks(), handlePhiDef(), llvm::objcarc::BundledRetainClaimRVs::insertAfterInvokes(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), llvm::SuspendCrossingInfo::isDefinitionAcrossSuspend(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), loadCSE(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), mergeBlocksIntoPredecessors(), mergeCleanupPad(), mergeConditionalStores(), mergeConditionalStoreToAddress(), llvm::JumpThreadingPass::processGuards(), llvm::JumpThreadingPass::processImpliedCondition(), recordConditions(), llvm::InstCombinerImpl::replacedSelectWithOperand(), shouldInstrumentBlock(), SimplifyCondBranchToCondBranch(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), llvm::SplitEdge(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and llvm::willNotFreeBetween().

getSingleSuccessor() [1/2]

BasicBlock * llvm::BasicBlock::getSingleSuccessor ( ) inline

getSingleSuccessor() [2/2]

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

Otherwise return a null pointer.

This method is analogous to getSinglePredecessor above.

Definition at line 467 of file BasicBlock.cpp.

Referenced by llvm::LoopVectorizationCostModel::collectValuesToIgnore(), llvm::TileInfo::CreateTiledLoops(), ensureValueAvailableInSuccessor(), llvm::VPlan::execute(), FindWidenableTerminatorAboveLoop(), isProfitableToTransform(), llvm::orc::SpeculateQuery::isStraightLine(), llvm::MergeBlockSuccessorsIntoGivenBlocks(), mergeConditionalStores(), optimizeDivRem(), processPhi(), programUndefinedIfUndefOrPoison(), sinkLifetimeStartMarkers(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopRemainder().

getTerminatingDeoptimizeCall() [1/2]

CallInst * llvm::BasicBlock::getTerminatingDeoptimizeCall ( ) inline

getTerminatingDeoptimizeCall() [2/2]

const CallInst * BasicBlock::getTerminatingDeoptimizeCall ( ) const

getTerminatingMustTailCall() [1/2]

CallInst * llvm::BasicBlock::getTerminatingMustTailCall ( ) inline

getTerminatingMustTailCall() [2/2]

const CallInst * BasicBlock::getTerminatingMustTailCall ( ) const

getTerminator() [1/2]

Instruction * llvm::BasicBlock::getTerminator ( ) inline

getTerminator() [2/2]

Instruction * llvm::sandboxir::BasicBlock::getTerminator ( ) const inline

Returns the terminator instruction if the block is well formed or null if the block is not well formed.

Definition at line 233 of file BasicBlock.h.

References const, and LLVM_READONLY.

Referenced by addBasicBlockMetadata(), Prefetch::addInstruction(), addNoUndefAttrs(), llvm::CodeMetrics::analyzeBasicBlock(), analyzeLoopUnrollCost(), basicBlockCanReturn(), llvm::BranchProbabilityInfo::calculate(), llvm::calculateCXXStateForAsynchEH(), llvm::calculateSEHStateForAsynchEH(), canFoldTermCondOfLoop(), llvm::canPeelLastIteration(), canSplitLoopBound(), checkBasicSSA(), checkOverflow(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunctionBodyInto(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::colorEHFunclets(), llvm::FunctionComparator::compare(), ComputeNumSignBitsImpl(), ComputePostOrders(), computeUnlikelySuccessors(), ConnectEpilog(), connectEpilogueVectorLoop(), ConnectProlog(), llvm::VPBasicBlock::connectToPredecessors(), llvm::ConstantFoldTerminator(), copyMustTailReturn(), llvm::coro::BaseCloner::create(), createCondBranch(), createFoldedExitCond(), createInvariantCond(), llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), createMemMoveLoopKnownSize(), createMemMoveLoopUnknownSize(), createMemSetLoop(), llvm::createPHIsForSplitLoopExit(), createReplacement(), llvm::createSanitizerCtorAndInitFunctions(), llvm::InnerLoopVectorizer::createScalarPreheader(), createSwitchStatement(), llvm::VPlan::createVPIRBasicBlock(), despeculateCountZeros(), detectPopcountIdiom(), detectShiftUntilBitTestIdiom(), detectShiftUntilLessThanIdiom(), detectShiftUntilZeroIdiom(), detectShiftUntilZeroIdiom(), DoFlattenLoopPair(), dominatesMergePoint(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), llvm::ehAwareSplitEdge(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), emptyAndDetachBlock(), llvm::Evaluator::EvaluateFunction(), llvm::VPFirstOrderRecurrencePHIRecipe::execute(), llvm::VPlan::execute(), llvm::VPlanTransforms::expandSCEVs(), expandToSwitch(), findBasePointer(), llvm::orc::SpeculateQuery::findCalles(), findDominatingValue(), findLoopComponents(), FindLoopCounter(), llvm::DominatorTree::findNearestCommonDominator(), llvm::RandomIRBuilder::findOrCreateSource(), findPHIForConditionForwarding(), fixupDebugInfoPostExtraction(), FlattenLoopPair(), llvm::InstCombinerImpl::foldBinopWithPhiOperands(), foldCondBranchOnValueKnownInPredecessorImpl(), foldExit(), llvm::InstCombinerImpl::foldFreezeIntoRecurrence(), foldGuardedFunnelShift(), foldICmpWithDominatingICmp(), foldMemChr(), llvm::InstCombinerImpl::foldOpIntoPhi(), generateUnsignedDivisionCode(), genLoopLimit(), getBestDestForJumpOnUndef(), getBranchHint(), getBranchInsertPoint(), llvm::Loop::LoopBounds::getCanonicalPredicate(), getDomPredecessorCondition(), getEffectiveTerminator(), getEHPadFromPredecessor(), getEndIterator(), getExpectedExitLoopLatchBranch(), getFixupInsertPos(), llvm::DenseMapInfo< const SwitchSuccWrapper * >::getHashValue(), llvm::GetIfCondition(), getInsertPointForUses(), getInstrBB(), getJumpThreadDuplicationCost(), getKnownValueOnEdge(), llvm::Loop::getLoopGuardBranch(), llvm::RegionTraits< Function >::getNumSuccessors(), getOnlyLiveSuccessor(), getOuterLoopLatchCmp(), llvm::ProfileAnnotator::getOutgoingBranchWeights(), getOutliningBenefit(), getOutliningPenalty(), VectorSlice::getSlicedVal(), slpvectorizer::BoUpSLP::getSpillCost(), llvm::coro::getSpillInsertionPt(), llvm::GCProjectionInst::getStatepoint(), getStrlenWithNull(), llvm::GetSuccessorNumber(), getSuccState(), llvm::coro::BaseCloner::handleFinalSuspend(), handleNBranch(), handlePhiDef(), llvm::InstCombinerImpl::handleUnreachableFrom(), hasSideeffectFreeStaticResolution(), hoist(), hoistAdd(), llvm::hoistAllInstructionsInto(), hoistBOAssociation(), hoistGEP(), hoistMinMax(), hoistMulAddAssociation(), llvm::hoistRegion(), hoistSub(), injectPendingInvariantConditions(), llvm::InlineFunctionImpl(), insertBoundsCheck(), llvm::DIBuilder::insertDeclare(), insertLoopExpansion(), insertUniqueBackedgeBlock(), llvm::SampleProfileProber::instrumentOneFunc(), llvm::Attributor::isAssumedDead(), llvm::IsBlockFollowedByDeoptOrUnreachable(), isChainSelectCmpBranch(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(), llvm::isInlineViable(), llvm::isInTailCallPosition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isLoopDead(), isLoopExitTestBasedOn(), isNotUsedOrFoldableInLoop(), isPowerOfTwoRecurrence(), isSafePHIToSpeculate(), llvm::isSafeToMoveBefore(), llvm::isUniformLoop(), isUniformlyReached(), llvm::lowerUnaryVectorIntrinsicAsLoop(), llvm::Loop::makeLoopInvariant(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), mergeNestedCondBranch(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), moveBBContents(), llvm::moveInstructionsToTheEnd(), llvm::MemorySSAUpdater::moveToPlace(), needsLFTR(), llvm::RandomIRBuilder::newSource(), llvm::EscapeEnumerator::Next(), optimizeDivRem(), slpvectorizer::BoUpSLP::optimizeGatherSequence(), OptimizeNonTrivialIFuncs(), optimizeSQRT(), llvm::LoopStructure::parseLoopStructure(), llvm::peelLoop(), peelToTurnInvariantLoadsDereferenceable(), performBranchToCommonDestFolding(), llvm::InstCombinerImpl::prepareWorklist(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processBranchOnPHI(), llvm::JumpThreadingPass::processImpliedCondition(), llvm::JumpThreadingPass::processThreadableEdges(), llvm::promoteLoopAccessesToScalars(), llvm::OutlinableRegion::reattachCandidate(), llvm::HashRecognize::recognizeCRC(), recordCondition(), redirectToHub(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::MemorySSAUpdater::removeBlocks(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceBranchTargets(), replaceConstantExprOp(), replaceIfBranchTargets(), rewriteMaterializableInstructions(), rewriteMemOpOfSelect(), rewritePHIs(), llvm::InstCombinerImpl::run(), llvm::LoopConstrainer::run(), llvm::PlaceSafepointsPass::runImpl(), llvm::SLPVectorizerPass::runImpl(), RunTermFold(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scalarizeMaskedVectorHistogram(), separateNestedLoop(), llvm::SSPLayoutInfo::shouldEmitSDCheck(), shouldUnrollMultiExitLoop(), simplifyInstructionWithPHI(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), SinkCast(), sinkLastInstruction(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfElse(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockAndInsertSimpleForLoop(), SplitBlockPredecessorsImpl(), llvm::SplitCallBrEdge(), llvm::SplitEdge(), llvm::SplitIndirectBrCriticalEdges(), splitLoopBound(), llvm::succ_begin(), llvm::succ_begin(), llvm::succ_end(), llvm::succ_end(), swapBBContents(), threadBinOpOverPHI(), threadCmpOverPHI(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::JumpThreadingPass::tryThreadEdge(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::InstCombinerImpl::tryToSinkInstruction(), llvm::JumpThreadingPass::tryToUnfoldSelect(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), tryUnmergingGEPsAcrossIndirectBr(), turnGuardIntoBranch(), turnSelectIntoBranch(), turnToExplicitForm(), unifyLoopExits(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchAllTrivialConditions(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), unswitchTrivialSwitch(), updatePredecessorProfileMetadata(), llvm::LoopVersioning::versionLoop(), violatesLegacyMultiExitLoopCheck(), llvm::InstCombinerImpl::visitPHINode(), and workshareLoopTargetCallback().

getTrailingDbgRecords()

DbgMarker * BasicBlock::getTrailingDbgRecords ( )

Fetch the collection of DbgRecords that "trail" after the last instruction of this block, see setTrailingDbgRecords.

If there are none, returns nullptr.

Definition at line 1128 of file BasicBlock.cpp.

getUniquePredecessor() [1/2]

BasicBlock * llvm::BasicBlock::getUniquePredecessor ( ) inline

getUniquePredecessor() [2/2]

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

Otherwise return a null pointer.

Note that unique predecessor doesn't mean single edge, there can be multiple edges from the unique predecessor to this block (for example a switch statement with multiple cases having the same destination).

Definition at line 445 of file BasicBlock.cpp.

Referenced by areInnerLoopLatchPHIsSupported(), areOuterLoopExitPHIsSupported(), llvm::MustBeExecutedContextExplorer::findBackwardJoinPoint(), findLocationForEntrySafepoint(), llvm::Loop::getLoopGuardBranch(), IsAcceptableTarget(), makeStatepointExplicitImpl(), llvm::MergeBlockIntoPredecessor(), llvm::MergeBlockSuccessorsIntoGivenBlocks(), llvm::MemorySSAUpdater::moveAllAfterMergeBlocks(), normalizeForInvokeSafepoint(), optimizeDivRem(), reuseTableCompare(), llvm::InstCombinerImpl::run(), runMoveAutoInit(), llvm::LoopNest::skipEmptyBlockUntil(), llvm::InstCombinerImpl::tryToSinkInstruction(), and llvm::UnrollLoop().

getUniqueSuccessor() [1/2]

BasicBlock * llvm::BasicBlock::getUniqueSuccessor ( ) inline

getUniqueSuccessor() [2/2]

getValueSymbolTable()

Returns a pointer to the symbol table if one exists.

Definition at line 125 of file BasicBlock.cpp.

hasAddressTaken()

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

Returns true if there are any uses of this basic block other than direct branches, switches, etc.

to it.

Definition at line 690 of file BasicBlock.h.

References llvm::Value::SubclassOptionalData.

Referenced by llvm::CloneAndPruneIntoFromInst(), llvm::AsmPrinter::emitBasicBlockStart(), foldTwoEntryPHINode(), llvm::AddrLabelMap::getAddrLabelSymbolToEmit(), getOrderedBlocks(), hasAddressTakenAndUsed(), isBlockValidForExtraction(), llvm::isInlineViable(), llvm::BlockAddress::lookup(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), and llvm::IRTranslator::runOnMachineFunction().

hasNPredecessors()

hasNPredecessorsOrMore()

insertDbgRecordAfter()

insertDbgRecordBefore()

insertInto()

Insert unlinked basic block into a function.

Inserts an unlinked basic block into Parent. If InsertBefore is provided, inserts before that basic block, otherwise inserts at the end.

Precondition

getParent() is nullptr.

Definition at line 158 of file BasicBlock.cpp.

Referenced by moveFunctionAdaptingType().

instructionsWithoutDebug() [1/2]

Return an iterator range over the instructions in the block, skipping any debug instructions.

Skip and any pseudo operations as well if SkipPseudoOp is true.

Definition at line 216 of file BasicBlock.cpp.

instructionsWithoutDebug() [2/2]

invalidateOrders()

void llvm::BasicBlock::invalidateOrders ( ) inline

isEHPad()

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

Return true if this basic block is an exception handling block.

Definition at line 707 of file BasicBlock.h.

References getFirstNonPHIIt().

Referenced by calculateCXXStateNumbers(), calculateSEHStateNumbers(), llvm::calculateWasmEHInfo(), canSplitCallSite(), deleteLoopIfDead(), getPredState(), IsAcceptableTarget(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::InstModificationIRStrategy::mutate(), llvm::JumpThreadingPass::processBranchOnXOR(), llvm::SLPVectorizerPass::runImpl(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), and llvm::SplitKnownCriticalEdge().

isEntryBlock()

bool BasicBlock::isEntryBlock ( ) const

Return true if this is the entry block of the containing function.

This method can only be used on blocks that have a parent function.

Definition at line 549 of file BasicBlock.cpp.

Referenced by llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), llvm::isPotentiallyReachable(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::InstCombinerImpl::prepareWorklist(), llvm::printBasicBlock(), printBBName(), llvm::RemoveRedundantDbgInstrs(), removeRedundantDbgLocs(), removeUndefDbgAssignsFromEntryBlock(), removeUndefDbgLocsFromEntryBlock(), and UpdateAnalysisInformation().

isInstrOrderValid()

bool llvm::BasicBlock::isInstrOrderValid ( ) const inline

isLandingPad()

bool BasicBlock::isLandingPad ( ) const

isLegalToHoistInto()

bool BasicBlock::isLegalToHoistInto ( ) const

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

Definition at line 535 of file BasicBlock.cpp.

LLVM_DEPRECATED() [1/2]

LLVM_ABI llvm::BasicBlock::LLVM_DEPRECATED ( "Use iterators as instruction positions instead" ,
"getFirstNonPHIIt" )

LLVM_DEPRECATED() [2/2]

LLVM_ABI llvm::BasicBlock::LLVM_DEPRECATED ( "Use iterators as instruction positions" ,
"getFirstNonPHIIt" ) const

Returns a pointer to the first instruction in this block that is not a PHINode instruction.

When adding instructions to the beginning of the basic block, they should be added before the returned value, not before the first instruction, which might be PHI. Returns 0 is there's no non-PHI instruction.

Deprecated in favour of getFirstNonPHIIt, which returns an iterator that preserves some debugging information.

References const, and LLVM_ABI.

Referenced by LLVM_DEPRECATED().

moveAfter()

void BasicBlock::moveAfter ( BasicBlock * MovePos )

moveBefore() [1/2]

void llvm::BasicBlock::moveBefore ( BasicBlock * MovePos) inline

moveBefore() [2/2]

operator=()

phis() [1/2]

phis() [2/2]

Returns a range that iterates over the phis in the basic block.

Note that this cannot be used with basic blocks that have no terminator.

Definition at line 528 of file BasicBlock.h.

References phis().

Referenced by llvm::InstCombinerImpl::addDeadEdge(), addPHINodeEntriesForMappedBlock(), addPredecessorToBlock(), analyzeExitPHIsForOutputUses(), areInnerLoopExitPHIsSupported(), areInnerLoopLatchPHIsSupported(), areOuterLoopExitPHIsSupported(), CanRedirectPredsOfEmptyBBToSucc(), checkPHIs(), llvm::LoopVectorizationCostModel::collectValuesToIgnore(), ConnectEpilog(), connectEpilogueVectorLoop(), llvm::createPHIsForSplitLoopExit(), llvm::DeleteDeadPHIs(), deleteLoopIfDead(), llvm::EliminateDuplicatePHINodes(), llvm::EliminateNewDuplicatePHINodes(), findOrCreatePHIInBlock(), findPHIForConditionForwarding(), fixScalarResumeValuesFromBypass(), fixSuccessorPhis(), fixupPHINodeForNormalDest(), fixupPHINodeForUnwindDest(), forwardSwitchConditionToPHI(), llvm::DenseMapInfo< const SwitchSuccWrapper * >::getHashValue(), getRecurrences(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), incomingValuesAreCompatible(), introduceTooManyPhiEntries(), llvm::DenseMapInfo< const SwitchSuccWrapper * >::isEqual(), isExistingPhi(), isLoopDead(), isPredicatedOnPHI(), isSafeToHoistInvoke(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), phis(), removeEmptyCleanup(), removeUndefIntroducingPredecessor(), replaceTargetsFromPHINode(), rewritePHINodesForExitAndUnswitchedBlocks(), rewritePHINodesForUnswitchedExitBlock(), SimplifyCondBranchToCondBranch(), simplifyLCSSAPhis(), sinkCommonCodeFromPredecessors(), splitCallSite(), splitLoopBound(), tryWidenCondBranchToCondBranch(), llvm::UnrollLoop(), llvm::updatePhiNodes(), and validateAndCostRequiredSelects().

print()

rbegin() [1/2]

reverse_iterator llvm::BasicBlock::rbegin ( ) inline

rbegin() [2/2]

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

reinsertInstInDbgRecords()

In rare circumstances instructions can be speculatively removed from blocks, and then be re-inserted back into that position later.

When this happens in RemoveDIs debug-info mode, some special patching-up needs to occur: inserting into the middle of a sequence of dbg.value intrinsics does not have an equivalent with DbgRecords.

Definition at line 1055 of file BasicBlock.cpp.

removeFromParent()

removePredecessor()

void BasicBlock::removePredecessor ( BasicBlock * Pred,
bool KeepOneInputPHIs = false )

Update PHI nodes in this BasicBlock before removal of predecessor Pred.

Note that this function does not actually remove the predecessor.

If KeepOneInputPHIs is true then don't remove PHIs that are left with zero or one incoming values, and don't simplify PHIs with all incoming values the same.

Definition at line 494 of file BasicBlock.cpp.

Referenced by llvm::changeToCall(), llvm::ConstantFoldTerminator(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), foldCondBranchOnValueKnownInPredecessorImpl(), llvm::FoldReturnIntoUncondBranch(), HandleInlinedEHPad(), HandleInlinedLandingPad(), markAliveBlocks(), mergeNestedCondBranch(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processImpliedCondition(), processSwitch(), redirectTo(), removeEmptyCleanup(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeSwitchAfterSelectFold(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), simplifyOneLoop(), simplifySwitchLookup(), simplifySwitchOfCmpIntrinsic(), simplifySwitchWhenUMin(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), tryToMergeLandingPad(), tryWidenCondBranchToCondBranch(), llvm::UnrollLoop(), unswitchNontrivialInvariants(), and unswitchTrivialSwitch().

rend() [1/2]

reverse_iterator llvm::BasicBlock::rend ( ) inline

rend() [2/2]

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

renumberInstructions()

void BasicBlock::renumberInstructions ( )

Renumber instructions and mark the ordering as valid.

Definition at line 688 of file BasicBlock.cpp.

replacePhiUsesWith()

replaceSuccessorsPhiUsesWith() [1/2]

void BasicBlock::replaceSuccessorsPhiUsesWith ( BasicBlock * New )

Update all phi nodes in this basic block's successors to refer to basic block New instead of to it.

Definition at line 657 of file BasicBlock.cpp.

replaceSuccessorsPhiUsesWith() [2/2]

setTrailingDbgRecords()

void BasicBlock::setTrailingDbgRecords ( DbgMarker * M )

Record that the collection of DbgRecords in M "trails" after the last instruction of this block.

These are equivalent to dbg.value intrinsics that exist at the end of a basic block with no terminator (a transient state that occurs regularly).

Definition at line 1124 of file BasicBlock.cpp.

Referenced by llvm::DbgMarker::removeMarker().

size()

size_t llvm::BasicBlock::size ( ) const inline

Definition at line 480 of file BasicBlock.h.

Referenced by analyzeAndPruneOutputBlocks(), containsUnreachable(), createSwitchStatement(), emptyAndDetachBlock(), findDuplicateOutputBlock(), getCaseResults(), llvm::DenseMapInfo< const SwitchSuccWrapper * >::getHashValue(), slpvectorizer::BoUpSLP::getSpillCost(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::moveInstructionsToTheEnd(), replaceIfBranchTargets(), tryToMoveFreeBeforeNullTest(), and unswitchTrivialSwitch().

sizeWithoutDebug()

filter_iterator< BasicBlock::const_iterator, std::function< bool(constInstruction &)> >::difference_type BasicBlock::sizeWithoutDebug ( ) const

Return the size of the basic block ignoring debug instructions.

Definition at line 226 of file BasicBlock.cpp.

splice() [1/3]

void llvm::BasicBlock::splice ( BasicBlock::iterator ToIt, BasicBlock * FromBB ) inline

Transfer all instructions from FromBB to this basic block at ToIt.

Definition at line 662 of file BasicBlock.h.

References begin(), end(), and splice().

Referenced by llvm::hoistAllInstructionsInto(), llvm::InlineFunctionImpl(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), moveBBContents(), moveBBContents(), splice(), splice(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and workshareLoopTargetCallback().

splice() [2/3]

void BasicBlock::splice ( BasicBlock::iterator ToIt,
BasicBlock * FromBB,
BasicBlock::iterator FromBeginIt,
BasicBlock::iterator FromEndIt )

Transfer a range of instructions that belong to FromBB from FromBeginIt to FromEndIt, to this basic block at ToIt.

Definition at line 1003 of file BasicBlock.cpp.

splice() [3/3]

void llvm::BasicBlock::splice ( BasicBlock::iterator ToIt, BasicBlock * FromBB, BasicBlock::iterator FromIt ) inline

Transfer one instruction from FromBB at FromIt to this basic block at ToIt.

Definition at line 668 of file BasicBlock.h.

References splice().

splitBasicBlock() [1/2]

splitBasicBlock() [2/2]

Split the basic block into two basic blocks at the specified instruction.

If Before is true, splitBasicBlockBefore handles the block splitting. Otherwise, execution proceeds as described below.

Note that all instructions BEFORE the specified iterator stay as part of the original basic block, an unconditional branch is added to the original BB, and the rest of the instructions in the BB are moved to the new BB, including the old terminator. The newly formed basic block is returned. This function invalidates the specified iterator.

Note that this only works on well formed basic blocks (must have a terminator), and 'I' must not be the end of instruction list (which would cause a degenerate basic block to be formed, having a terminator inside of the basic block).

Also note that this doesn't preserve any passes. To split blocks while keeping loop information consistent, use the SplitBlock utility function.

Definition at line 555 of file BasicBlock.cpp.

Referenced by llvm::coro::BaseCloner::create(), createMemMoveLoopKnownSize(), createMemSetLoop(), despeculateCountZeros(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), expandFPToI(), expandIToFP(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), generateUnsignedDivisionCode(), getStrlenWithNull(), llvm::coro::BaseCloner::handleFinalSuspend(), handleNBranch(), llvm::InlineFunctionImpl(), insertBoundsCheck(), insertLoopExpansion(), insertSpills(), llvm::lowerUnaryVectorIntrinsicAsLoop(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfThenElse(), llvm::splitBlockBefore(), and SplitBlockImpl().

splitBasicBlockBefore() [1/2]

splitBasicBlockBefore() [2/2]

Split the basic block into two basic blocks at the specified instruction and insert the new basic blocks as the predecessor of the current block.

This function ensures all instructions AFTER and including the specified iterator I are part of the original basic block. All Instructions BEFORE the iterator I are moved to the new BB and an unconditional branch is added to the new BB. The new basic block is returned.

Note that this only works on well formed basic blocks (must have a terminator), and 'I' must not be the end of instruction list (which would cause a degenerate basic block to be formed, having a terminator inside of the basic block). 'I' cannot be a iterator for a PHINode with multiple incoming blocks.

Also note that this doesn't preserve any passes. To split blocks while keeping loop information consistent, use the SplitBlockBefore utility function.

Definition at line 589 of file BasicBlock.cpp.

Referenced by splitBasicBlockBefore().

validateInstrOrdering()

void BasicBlock::validateInstrOrdering ( ) const

Asserts that instruction order numbers are marked invalid, or that they are in ascending order.

In asserts builds, this checks the numbering.

This is constant time if the ordering is invalid, and linear in the number of instructions if the ordering is valid. Callers should be careful not to call this in ways that make common operations O(n^2). For example, it takes O(n) time to assign order numbers to instructions, so the order should be validated no more than once after each ordering to ensure that transforms have the same algorithmic complexity when asserts are enabled as when they are disabled.

In non-asserts builds, it is defined as a no-op inline function in BasicBlock.h.

Definition at line 1112 of file BasicBlock.cpp.

Referenced by invalidateOrders().

BlockAddress

Function

Instruction::cloneDebugInfoFrom

Instruction::eraseFromParent

Instruction::insertAfter [1/2]

Instruction::insertAfter [2/2]

Instruction::insertBefore [1/2]

Instruction::insertBefore [2/2]

Instruction::insertInto

Instruction::moveBeforeImpl

Instruction::removeFromParent

llvm::ilist_node_with_parent< llvm::Instruction, llvm::BasicBlock, ilist_iterator_bits< true >, ilist_parent< BasicBlock > >

llvm::SymbolTableListTraits< llvm::Instruction, ilist_iterator_bits< true >, ilist_parent< BasicBlock > >

SymbolTableListTraits< BasicBlock >


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