LLVM 19.0.0git
|
LLVM Basic Block Representation. More...
#include "llvm/IR/BasicBlock.h"
Classes | |
class | phi_iterator_impl |
Iterator to walk just the phi nodes in the basic block. More... | |
Public Types | |
using | InstListType = SymbolTableList< Instruction, ilist_iterator_bits< true > > |
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 = phi_iterator_impl< const PHINode, BasicBlock::const_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 | |
DPMarker * | createMarker (Instruction *I) |
Attach a DPMarker to the given instruction. | |
DPMarker * | createMarker (InstListType::iterator It) |
void | convertToNewDbgValues () |
Convert variable location debugging information stored in dbg.value intrinsics into DPMarkers / DbgRecords. | |
void | convertFromNewDbgValues () |
Convert variable location debugging information stored in DPMarkers and DbgRecords into the dbg.value intrinsic representation. | |
void | setIsNewDbgInfoFormat (bool NewFlag) |
Ensure the block is in "old" dbg.value format (NewFlag == false) or in the new format (NewFlag == true), converting to the desired format if necessary. | |
void | setTrailingDbgRecords (DPMarker *M) |
Record that the collection of DbgRecords in M "trails" after the last instruction of this block. | |
DPMarker * | getTrailingDbgRecords () |
Fetch the collection of DbgRecords that "trail" after the last instruction of this block, see setTrailingDbgRecords. | |
void | deleteTrailingDbgRecords () |
Delete any trailing DbgRecords at the end of this block, see setTrailingDbgRecords. | |
void | dumpDbgValues () const |
DPMarker * | getMarker (InstListType::iterator It) |
Return the DPMarker for the position given by It , so that DbgRecords can be inserted there. | |
DPMarker * | getNextMarker (Instruction *I) |
Return the DPMarker for the position that comes after I . | |
void | insertDbgRecordAfter (DbgRecord *DPV, Instruction *I) |
Insert a DbgRecord into a block at the position given by I . | |
void | insertDbgRecordBefore (DbgRecord *DPV, InstListType::iterator Here) |
Insert a DbgRecord into a block at the position given by Here . | |
void | flushTerminatorDbgRecords () |
Eject any debug-info trailing at the end of a block. | |
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 |
~BasicBlock () | |
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 () |
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 () |
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 () |
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 () |
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 () |
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 () |
const Instruction * | getFirstNonPHI () const |
Returns a pointer to the first instruction in this block that is not a PHINode instruction. | |
Instruction * | getFirstNonPHI () |
InstListType::const_iterator | getFirstNonPHIIt () const |
Iterator returning form of getFirstNonPHI. | |
InstListType::iterator | getFirstNonPHIIt () |
const Instruction * | 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. | |
Instruction * | getFirstNonPHIOrDbg (bool SkipPseudoOp=true) |
const Instruction * | 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. | |
Instruction * | getFirstNonPHIOrDbgOrLifetime (bool SkipPseudoOp=true) |
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 () |
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 () |
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 () |
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. | |
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. | |
filter_iterator< BasicBlock::const_iterator, std::function< bool(constInstruction &)> >::difference_type | sizeWithoutDebug () const |
Return the size of the basic block ignoring debug instructions. | |
void | removeFromParent () |
Unlink 'this' from the containing function, but do not delete it. | |
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 . | |
void | moveBefore (SymbolTableList< BasicBlock >::iterator MovePos) |
void | moveAfter (BasicBlock *MovePos) |
Unlink this basic block from its current function and insert it right after MovePos in the function MovePos lives in. | |
void | insertInto (Function *Parent, BasicBlock *InsertBefore=nullptr) |
Insert unlinked basic block into a function. | |
const BasicBlock * | getSinglePredecessor () const |
Return the predecessor of this block if it has a single predecessor block. | |
BasicBlock * | getSinglePredecessor () |
const BasicBlock * | getUniquePredecessor () const |
Return the predecessor of this block if it has a unique predecessor block. | |
BasicBlock * | getUniquePredecessor () |
bool | hasNPredecessors (unsigned N) const |
Return true if this block has exactly N predecessors. | |
bool | hasNPredecessorsOrMore (unsigned N) const |
Return true if this block has N predecessors or more. | |
const BasicBlock * | getSingleSuccessor () const |
Return the successor of this block if it has a single successor. | |
BasicBlock * | getSingleSuccessor () |
const BasicBlock * | getUniqueSuccessor () const |
Return the successor of this block if it has a unique successor. | |
BasicBlock * | getUniqueSuccessor () |
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. | |
iterator_range< phi_iterator > | phis () |
ValueSymbolTable * | getValueSymbolTable () |
Returns a pointer to the symbol table if one exists. | |
void | dropAllReferences () |
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining. | |
void | removePredecessor (BasicBlock *Pred, bool KeepOneInputPHIs=false) |
Update PHI nodes in this BasicBlock before removal of predecessor Pred . | |
bool | canSplitPredecessors () const |
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) |
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 . | |
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 . | |
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. | |
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 . | |
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 . | |
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. | |
bool | isLandingPad () const |
Return true if this basic block is a landing pad. | |
const LandingPadInst * | getLandingPadInst () const |
Return the landingpad instruction associated with the landing pad. | |
LandingPadInst * | getLandingPadInst () |
bool | isLegalToHoistInto () const |
Return true if it is legal to hoist instructions into this block. | |
bool | isEntryBlock () const |
Return true if this is the entry block of the containing function. | |
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. | |
void | renumberInstructions () |
Renumber instructions and mark the ordering as valid. | |
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 |
void | deleteValue () |
Delete a pointer to a generic Value. | |
void | dump () const |
Support for debugging, callable in GDB: V->dump() | |
Type * | getType () const |
All values are typed, get the type of this value. | |
LLVMContext & | getContext () const |
All values hold a context through their type. | |
bool | hasName () const |
ValueName * | getValueName () const |
void | setValueName (ValueName *VN) |
StringRef | getName () const |
Return a constant reference to the value's name. | |
void | setName (const Twine &Name) |
Change the name of the value. | |
void | takeName (Value *V) |
Transfer the name from V to this value. | |
std::string | getNameOrAsOperand () const |
void | replaceAllUsesWith (Value *V) |
Change all uses of this to point to a new Value. | |
void | replaceNonMetadataUsesWith (Value *V) |
Change non-metadata uses of this to point to a new Value. | |
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. | |
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. | |
void | assertModuleIsMaterializedImpl () const |
void | assertModuleIsMaterialized () const |
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. | |
bool | hasNUses (unsigned N) const |
Return true if this Value has exactly N uses. | |
bool | hasNUsesOrMore (unsigned N) const |
Return true if this value has N uses or more. | |
bool | hasOneUser () const |
Return true if there is exactly one user of this value. | |
Use * | getSingleUndroppableUse () |
Return true if there is exactly one use of this value that cannot be dropped. | |
const Use * | getSingleUndroppableUse () const |
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 |
bool | hasNUndroppableUses (unsigned N) const |
Return true if there this value. | |
bool | hasNUndroppableUsesOrMore (unsigned N) const |
Return true if this value has N uses or more. | |
void | dropDroppableUses (llvm::function_ref< bool(const Use *)> ShouldDrop=[](const Use *) { return true;}) |
Remove every uses that can safely be removed. | |
void | dropDroppableUsesIn (User &Usr) |
Remove every use of this value in User that can safely be removed. | |
bool | isUsedInBasicBlock (const BasicBlock *BB) const |
Check if this value is used in the specified basic block. | |
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. | |
bool | isSwiftError () const |
Return true if this value is a swifterror value. | |
const Value * | stripPointerCasts () const |
Strip off pointer casts, all-zero GEPs and address space casts. | |
Value * | stripPointerCasts () |
const Value * | stripPointerCastsAndAliases () const |
Strip off pointer casts, all-zero GEPs, address space casts, and aliases. | |
Value * | stripPointerCastsAndAliases () |
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 () |
const Value * | stripPointerCastsForAliasAnalysis () const |
Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info. | |
Value * | stripPointerCastsForAliasAnalysis () |
const Value * | stripInBoundsConstantOffsets () const |
Strip off pointer casts and all-constant inbounds GEPs. | |
Value * | stripInBoundsConstantOffsets () |
const Value * | stripAndAccumulateConstantOffsets (const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false, function_ref< bool(Value &Value, APInt &Offset)> ExternalAnalysis=nullptr) 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) |
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) |
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 *) {}) |
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. | |
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. | |
uint64_t | getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull, bool &CanBeFreed) const |
Returns the number of bytes known to be dereferenceable for the pointer value. | |
Align | getPointerAlignment (const DataLayout &DL) const |
Returns an alignment of the pointer value. | |
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<class Compare > | |
void | sortUseList (Compare Cmp) |
Sort the use-list. | |
void | reverseUseList () |
Reverse the use-list. | |
void | print (raw_ostream &O, bool IsForDebug=false) const |
Implement operator<< on Value. | |
void | print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug=false) const |
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. | |
void | printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const |
Public Member Functions inherited from llvm::ilist_node_with_parent< BasicBlock, Function > | |
BasicBlock * | getPrevNode () |
const BasicBlock * | getPrevNode () const |
Get the previous node, or nullptr for the list head. | |
BasicBlock * | getNextNode () |
Get the next node, or nullptr for the list tail. | |
const BasicBlock * | getNextNode () const |
Get the next node, or nullptr for the list tail. | |
Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type > | |
self_iterator | getIterator () |
const_self_iterator | getIterator () const |
reverse_self_iterator | getReverseIterator () |
const_reverse_self_iterator | getReverseIterator () const |
bool | isSentinel () const |
Check whether this is the sentinel node. | |
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 void | dropDroppableUse (Use &U) |
Remove the droppable use U . | |
Public Attributes | |
bool | IsNewDbgInfoFormat |
Flag recording whether or not this block stores debug-info in the form of intrinsic instructions (false) or non-instruction records (true). | |
Friends | |
class | BlockAddress |
class | SymbolTableListTraits< BasicBlock > |
class | llvm::SymbolTableListTraits< llvm::Instruction, ilist_iterator_bits< true > > |
class | llvm::ilist_node_with_parent< llvm::Instruction, llvm::BasicBlock, ilist_iterator_bits< true > > |
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::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< T, Options... >::type > | |
using | self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, false, false >::type |
using | const_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, false, true >::type |
using | reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, true, false >::type |
using | const_reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, true, true >::type |
Protected Member Functions inherited from llvm::Value | |
Value (Type *Ty, unsigned scid) | |
~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. | |
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. | |
bool | eraseMetadata (unsigned KindID) |
Erase all metadata attachments with the given kind. | |
void | eraseMetadataIf (function_ref< bool(unsigned, MDNode *)> Pred) |
Erase all metadata attachments matching the given predicate. | |
void | clearMetadata () |
Erase all metadata attached to this Value. | |
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. | |
MDNode * | getMetadata (StringRef Kind) const |
void | getMetadata (unsigned KindID, SmallVectorImpl< MDNode * > &MDs) const |
Appends all attachments with the given ID to MDs in insertion order. | |
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 |
void | setMetadata (unsigned KindID, MDNode *Node) |
Set a particular kind of metadata attachment. | |
void | setMetadata (StringRef Kind, MDNode *Node) |
void | addMetadata (unsigned KindID, MDNode &MD) |
Add a metadata attachment. | |
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< T, 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 59 of file BasicBlock.h.
Definition at line 165 of file BasicBlock.h.
using llvm::BasicBlock::const_phi_iterator = phi_iterator_impl<const PHINode, BasicBlock::const_iterator> |
Definition at line 492 of file BasicBlock.h.
Definition at line 167 of file BasicBlock.h.
Definition at line 62 of file BasicBlock.h.
Instruction iterators...
Definition at line 164 of file BasicBlock.h.
Definition at line 491 of file BasicBlock.h.
Definition at line 166 of file BasicBlock.h.
|
delete |
BasicBlock::~BasicBlock | ( | ) |
Definition at line 196 of file BasicBlock.cpp.
References assert(), llvm::iplist_impl< IntrusiveListT, TraitsT >::clear(), llvm::Constant::destroyConstant(), dropAllReferences(), getContext(), llvm::Type::getInt32Ty(), llvm::ConstantExpr::getIntToPtr(), getParent(), llvm::Value::getType(), hasAddressTaken(), llvm::Value::replaceAllUsesWith(), llvm::Value::use_empty(), llvm::Value::user_back(), and validateInstrOrdering().
|
inline |
Definition at line 455 of file BasicBlock.h.
|
inline |
Definition at line 454 of file BasicBlock.h.
Referenced by llvm::AAResults::canBasicBlockModify(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::CloneAndPruneIntoFromInst(), llvm::OpenMPIRBuilder::createTask(), findUnwindDestinations(), llvm::MergeBlockIntoPredecessor(), scanInlinedCode(), llvm::SimplifyInstructionsInBlock(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and llvm::UnrollAndJamLoop().
|
inline |
Instruction iterator methods.
Definition at line 429 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(), llvm::OpenMPIRBuilder::createParallel(), llvm::createPHIsForSplitLoopExit(), createRetBitCast(), createRetPHINode(), llvm::OpenMPIRBuilder::createSections(), llvm::OpenMPIRBuilder::createTask(), llvm::OpenMPIRBuilder::createTeams(), llvm::TileInfo::CreateTiledLoops(), despeculateCountZeros(), llvm::PostDominatorTree::dominates(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), EliminateDuplicatePHINodesNaiveImpl(), EliminateDuplicatePHINodesSetBasedImpl(), llvm::OpenMPIRBuilder::emitCancelationCheckImpl(), ensureValueAvailableInSuccessor(), llvm::Evaluator::EvaluateFunction(), llvm::CodeExtractor::extractCodeRegion(), llvm::findAvailablePtrLoadStore(), findDependencies(), findDuplicateOutputBlock(), findInitTrampolineFromBB(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findOrCreatePHIInBlock(), llvm::SSAUpdaterTraits< SSAUpdater >::FindPredecessorBlocks(), llvm::InnerLoopVectorizer::fixFixedOrderRecurrence(), llvm::InstCombinerImpl::foldBinopWithPhiOperands(), FoldCondBranchOnValueKnownInPredecessorImpl(), llvm::FoldSingleEntryPHINodes(), FoldTwoEntryPHINode(), llvm::formLCSSAForInstructions(), llvm::ScalarEvolution::getAddExpr(), llvm::CanonicalLoopInfo::getBodyIP(), llvm::MemoryDependenceResults::getDependency(), llvm::GetIfCondition(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), getStrlenWithNull(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleInlinedEHPad(), llvm::hoistAllInstructionsInto(), llvm::InlineFunction(), InsertSafepointPoll(), insertSinCosCall(), insertSpills(), insertTrivialPHIs(), llvm::instrs(), isBlockValidForExtraction(), llvm::isSafeToLoadUnconditionally(), llvm::Value::isUsedInBasicBlock(), makeStatepointExplicitImpl(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), moveBBContents(), movePHIValuesToInsertedBlock(), optimizeBlock(), optimizeSQRT(), phis(), ProcessBlock(), programUndefinedIfUndefOrPoison(), promoteMemoryToRegister(), reconnectPhis(), removePredecessor(), rewritePHINodesForExitAndUnswitchedBlocks(), RewriteUsesOfClonedInstructions(), runPass(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scanInlinedCode(), SimplifyCondBranchToCondBranch(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), llvm::sinkRegion(), sizeWithoutDebug(), splice(), splitBasicBlockBefore(), SplitBlockPredecessorsImpl(), splitCallSite(), llvm::OutlinableRegion::splitCandidate(), llvm::SplitIndirectBrCriticalEdges(), llvm::SplitKnownCriticalEdge(), llvm::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< SubClass, RetTy >::visit(), llvm::Interpreter::visitIntrinsicInst(), and workshareLoopTargetCallback().
|
inline |
Definition at line 437 of file BasicBlock.h.
bool BasicBlock::canSplitPredecessors | ( | ) | const |
Definition at line 525 of file BasicBlock.cpp.
References getFirstNonPHI(), and llvm::Instruction::isEHPad().
Referenced by canSplitCallSite(), canSplitPredecessors(), and SplitBlockPredecessorsImpl().
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition at line 540 of file BasicBlock.h.
void BasicBlock::convertFromNewDbgValues | ( | ) |
Convert variable location debugging information stored in DPMarkers and DbgRecords into the dbg.value intrinsic representation.
Sets IsNewDbgInfoFormat = false.
Definition at line 105 of file BasicBlock.cpp.
References assert(), llvm::DPMarker::eraseFromParent(), llvm::DPMarker::getDbgRecordRange(), getModule(), getTrailingDbgRecords(), llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), invalidateOrders(), and IsNewDbgInfoFormat.
Referenced by setIsNewDbgInfoFormat().
void BasicBlock::convertToNewDbgValues | ( | ) |
Convert variable location debugging information stored in dbg.value intrinsics into DPMarkers / DbgRecords.
Deletes all dbg.values in the process and sets IsNewDbgInfoFormat = true. Only takes effect if the UseNewDbgInfoFormat LLVM command line option is given.
Definition at line 68 of file BasicBlock.cpp.
References assert(), createMarker(), llvm::SmallVectorBase< Size_T >::empty(), I, llvm::DPMarker::insertDbgRecord(), IsNewDbgInfoFormat, llvm::make_early_inc_range(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by setIsNewDbgInfoFormat().
|
inlinestatic |
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 198 of file BasicBlock.h.
Referenced by addBoundsChecking(), assureFPCallStub(), buildUMulWithOverflowFunc(), llvm::CloneBasicBlock(), convertToGuardPredicates(), createAndInsertBasicBlocks(), llvm::OpenMPIRBuilder::createCopyinClauseBlocks(), llvm::MIRParserImpl::createDummyFunction(), CreateFailBB(), createFPFnStub(), createFrameHelperMachineFunction(), llvm::RandomIRBuilder::createFunctionDefinition(), llvm::OpenMPIRBuilder::createLoopSkeleton(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoop(), createMemSetLoop(), createOutlinedFunction(), llvm::OpenMPIRBuilder::createReductions(), llvm::createSanitizerCtor(), llvm::createSanitizerCtorAndInitFunctions(), llvm::OpenMPIRBuilder::createSections(), llvm::Attributor::createShallowWrapper(), llvm::OpenMPIRBuilder::createTargetInit(), llvm::ThunkInserter< Derived, InsertedThunksTy >::createThunkFunction(), createUnreachableSwitchDefault(), createWrapper(), llvm::ehAwareSplitEdge(), llvm::orc::IRSpeculationLayer::emit(), llvm::emitAMDGPUPrintfCall(), llvm::OpenMPIRBuilder::emitCancelationCheckImpl(), llvm::SITargetLowering::emitExpandAtomicRMW(), llvm::OpenMPIRBuilder::emitIfClause(), llvm::OpenMPIRBuilder::emitKernelLaunch(), expandFPToI(), expandIToFP(), expandToSwitch(), llvm::CodeExtractor::extractCodeRegion(), findOrCreatePHIBlock(), llvm::SanitizerStatReport::finish(), generateReproducer(), generateUnsignedDivisionCode(), getStrlenWithNull(), injectPendingInvariantConditions(), insertUniqueBackedgeBlock(), LLVMAppendBasicBlockInContext(), LLVMCreateBasicBlockInContext(), LLVMInsertBasicBlockInContext(), lowerFunnelShifts(), llvm::lowerGlobalIFuncUsersAsGlobalCtor(), lowerIntrinsicToFunction(), llvm::orc::makeStub(), markAliveBlocks(), MergeCompatibleInvokesImpl(), llvm::InsertCFGStrategy::mutate(), llvm::EscapeEnumerator::Next(), performBlockTailMerging(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), rewritePHIsForCleanupPad(), runImpl(), SimplifyCondBranchToCondBranch(), splitAsyncCoroutine(), splitBasicBlock(), splitBasicBlockBefore(), llvm::splitBB(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), splitRetconCoroutine(), SwitchToLookupTable(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), and llvm::JumpThreadingPass::unfoldSelectInstr().
DPMarker * BasicBlock::createMarker | ( | InstListType::iterator | It | ) |
Definition at line 55 of file BasicBlock.cpp.
References assert(), createMarker(), end(), getTrailingDbgRecords(), IsNewDbgInfoFormat, and setTrailingDbgRecords().
DPMarker * BasicBlock::createMarker | ( | Instruction * | I | ) |
Attach a DPMarker to the given instruction.
Enables the storage of any debug-info at this position in the program.
Definition at line 44 of file BasicBlock.cpp.
References assert(), I, IsNewDbgInfoFormat, and llvm::DPMarker::MarkedInstr.
Referenced by llvm::Instruction::adoptDbgRecords(), llvm::Instruction::cloneDebugInfoFrom(), llvm::JumpThreadingPass::cloneInstructions(), convertToNewDbgValues(), createMarker(), flushTerminatorDbgRecords(), insertDbgRecordAfter(), insertDbgRecordBefore(), and reinsertInstInDbgRecords().
void BasicBlock::deleteTrailingDbgRecords | ( | ) |
Delete any trailing DbgRecords at the end of this block, see setTrailingDbgRecords.
Definition at line 1143 of file BasicBlock.cpp.
References llvm::LLVMContextImpl::deleteTrailingDbgRecords(), getContext(), and llvm::LLVMContext::pImpl.
Referenced by llvm::Instruction::adoptDbgRecords(), and flushTerminatorDbgRecords().
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 434 of file BasicBlock.cpp.
References I.
Referenced by ~BasicBlock().
void BasicBlock::dumpDbgValues | ( | ) | const |
Definition at line 131 of file BasicBlock.cpp.
References llvm::dbgs().
|
inline |
Definition at line 451 of file BasicBlock.h.
Referenced by llvm::OpenMPIRBuilder::finalize(), phis(), and removePredecessor().
|
inline |
Definition at line 442 of file BasicBlock.h.
Referenced by llvm::Instruction::adoptDbgRecords(), buildPartialInvariantUnswitchConditionalBranch(), llvm::MemorySSAUpdater::changeToUnreachable(), llvm::changeToUnreachable(), llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::ConvertDebugDeclareToDebugValue(), llvm::IRSimilarity::IRInstructionMapper::convertToUnsignedVec(), llvm::convertUsersOfConstantsToInstructions(), llvm::BinaryOperator::Create(), llvm::UnaryOperator::Create(), createMarker(), llvm::OpenMPIRBuilder::createReductions(), createSwitchStatement(), createTargetLoopWorkshareCall(), createWrapper(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::OpenMPIRBuilder::emitCancelationCheckImpl(), llvm::SITargetLowering::emitExpandAtomicRMW(), llvm::CodeExtractor::extractCodeRegion(), findDependencies(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), llvm::FoldReturnIntoUncondBranch(), getFirstInsertionPt(), getFirstNonPHIIt(), getFirstNonPHIOrDbgOrAlloca(), llvm::Instruction::getInsertionPointAfterDef(), getInsertionRange(), getInsertPt(), getInstrBB(), getMarker(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::CanonicalLoopInfo::getPreheaderIP(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), llvm::hoistAllInstructionsInto(), llvm::DIBuilder::insertDbgAssign(), insertDbgRecordBefore(), llvm::insertDebugValuesForPHIs(), insertDPValuesForPHIs(), llvm::Instruction::insertInto(), InsertSafepointPoll(), llvm::instrs(), llvm::Instruction::Instruction(), instrumentOneFunc(), llvm::SampleProfileProber::instrumentOneFunc(), isBlockValidForExtraction(), llvm::isInTailCallPosition(), llvm::Value::isUsedInBasicBlock(), LLVMPositionBuilder(), llvm::MergeBlockIntoPredecessor(), MergeCompatibleInvokesImpl(), mergeConditionalStoreToAddress(), moveBBContents(), llvm::RandomIRBuilder::newSource(), optimizeBlock(), OptimizeExtractBits(), performBlockTailMerging(), llvm::PrepareToSplitEntryBlock(), ProcessBlock(), programUndefinedIfUndefOrPoison(), promoteMemoryToRegister(), reconnectPhis(), replaceArgumentUses(), RewriteUsesOfClonedInstructions(), llvm::IRBuilderBase::SetInsertPoint(), shouldInstrumentBlock(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifyUsingControlFlow(), SinkCast(), sinkCmpExpression(), llvm::sinkRegion(), SinkShiftAndTruncate(), sizeWithoutDebug(), splice(), llvm::spliceBB(), llvm::VPBasicBlock::splitAt(), splitBasicBlock(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadGuard(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::JumpThreadingPass::unfoldSelectInstr(), unswitchTrivialBranch(), llvm::slpvectorizer::BoUpSLP::vectorizeTree(), llvm::InstVisitor< SubClass, RetTy >::visit(), llvm::InstCombinerImpl::visitPHINode(), and workshareLoopTargetCallback().
|
inline |
Definition at line 443 of file BasicBlock.h.
BasicBlock::iterator BasicBlock::erase | ( | BasicBlock::iterator | FromIt, |
BasicBlock::iterator | ToIt | ||
) |
Erases a range of instructions from FromIt
to (not including) ToIt
.
\Returns ToIt
.
Definition at line 626 of file BasicBlock.cpp.
References I, llvm::make_early_inc_range(), and llvm::make_range().
Unlink 'this' from the containing function and delete it.
Definition at line 263 of file BasicBlock.cpp.
References llvm::iplist_impl< IntrusiveListT, TraitsT >::erase(), llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), and getParent().
Referenced by analyzeAndPruneOutputBlocks(), llvm::CloneAndPruneIntoFromInst(), createSwitchStatement(), llvm::OpenMPIRBuilder::emitBlock(), llvm::OpenMPIRBuilder::finalize(), llvm::InlineFunction(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::OutlinableRegion::reattachCandidate(), and simplifyOneLoop().
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.
References createMarker(), deleteTrailingDbgRecords(), llvm::DPMarker::eraseFromParent(), getTerminator(), getTrailingDbgRecords(), and IsNewDbgInfoFormat.
Referenced by llvm::changeToUnreachable(), llvm::Instruction::insertBefore(), and splice().
|
inline |
Definition at line 453 of file BasicBlock.h.
|
inline |
Definition at line 452 of file BasicBlock.h.
Referenced by llvm::CanonicalLoopInfo::assertOK(), calculateStateNumbersForInvokes(), llvm::AAResults::canBasicBlockModify(), llvm::CloneAndPruneFunctionInto(), llvm::CloneAndPruneIntoFromInst(), findArgParts(), llvm::formLCSSAForInstructions(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::InstCombinerImpl::handlePotentiallyDeadBlocks(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), isPotentiallyReachable(), isSuspendBlock(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), llvm::moveInstructionsToTheEnd(), movePHIValuesToInsertedBlock(), llvm::InsertPHIStrategy::mutate(), llvm::JumpThreadingPass::processBranchOnXOR(), llvm::removeAllNonTerminatorAndEHPadInstructions(), removePredecessor(), rewritePHIs(), sinkLastInstruction(), splitBlockIfNotFirst(), llvm::SplitEdge(), llvm::splitLoopBound(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().
LLVMContext & BasicBlock::getContext | ( | ) | const |
Get the context in which this basic block lives.
Definition at line 155 of file BasicBlock.cpp.
References llvm::Type::getContext(), and llvm::Value::getType().
Referenced by addBasicBlockMetadata(), llvm::addStringMetadataToLoop(), llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), llvm::ConstantFoldTerminator(), llvm::createMemCpyLoopKnownSize(), createStringMetadata(), llvm::OpenMPIRBuilder::createTargetInit(), createUnreachableSwitchDefault(), deleteTrailingDbgRecords(), llvm::ehAwareSplitEdge(), llvm::OpenMPIRBuilder::emitCancelationCheckImpl(), llvm::LoopVectorizationPlanner::executePlan(), llvm::CodeExtractor::extractCodeRegion(), findOrCreatePHIBlock(), llvm::DbgRecord::getContext(), getTrailingDbgRecords(), llvm::HardwareLoopInfo::HardwareLoopInfo(), llvm::BPFCoreSharedInfo::insertPassThrough(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::parseWidenableBranch(), llvm::LoopVersioning::prepareNoAliasMetadata(), llvm::JumpThreadingPass::processBranchOnXOR(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), rewritePHIsForCleanupPad(), llvm::LoopVectorizeHints::setAlreadyVectorized(), llvm::Loop::setLoopAlreadyUnrolled(), llvm::Loop::setLoopMustProgress(), setTrailingDbgRecords(), SimplifyCondBranchToCondBranch(), splitBasicBlock(), splitBasicBlockBefore(), llvm::splitBB(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), SplitLandingPadPredecessorsImpl(), llvm::splitLoopBound(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::unfoldSelectInstr(), llvm::LoopVersioning::versionLoop(), and ~BasicBlock().
|
inline |
Definition at line 305 of file BasicBlock.h.
References getFirstInsertionPt().
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 396 of file BasicBlock.cpp.
References end(), getFirstNonPHI(), and llvm::ilist_node_impl< OptionsT >::getIterator().
Referenced by cloneInstructionInExitBlock(), llvm::ConvertDebugDeclareToDebugValue(), llvm::convertUsersOfConstantsToInstructions(), llvm::OpenMPIRBuilder::createParallel(), llvm::RandomIRBuilder::createStackMemory(), llvm::OpenMPIRBuilder::createTargetInit(), DbgInserterHelper(), llvm::DemoteRegToStack(), llvm::VPWidenIntOrFpInductionRecipe::execute(), llvm::VPFirstOrderRecurrencePHIRecipe::execute(), llvm::VPReductionPHIRecipe::execute(), llvm::VPCanonicalIVPHIRecipe::execute(), llvm::CodeExtractor::extractCodeRegion(), llvm::SCEVExpander::findInsertPointAfter(), llvm::RandomIRBuilder::findOrCreateSource(), foldDependentIVs(), foldGuardedFunnelShift(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), getFirstInsertionPt(), llvm::Instruction::getInsertionPointAfterDef(), getInsertionRange(), getInsertPt(), getInstrBB(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), llvm::objcarc::BundledRetainClaimRVs::insertAfterInvokes(), llvm::insertDebugValuesForPHIs(), insertDPValuesForPHIs(), insertSpills(), instrumentOneFunc(), llvm::SampleProfileProber::instrumentOneFunc(), llvm::invertCondition(), makeStatepointExplicitImpl(), mergeConditionalStoreToAddress(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::ShuffleBlockStrategy::mutate(), llvm::InstDeleterIRStrategy::mutate(), llvm::RandomIRBuilder::newSource(), OptimizeExtractBits(), replaceExtractElements(), llvm::rewriteLoopExitValues(), llvm::InstCombinerImpl::run(), setInsertionPoint(), shouldInstrumentBlock(), simplifyRelocatesOffABase(), simplifyUsingControlFlow(), SinkCast(), sinkCmpExpression(), SinkInstruction(), sinkInstruction(), SinkShiftAndTruncate(), llvm::OutlinableRegion::splitCandidate(), llvm::SplitIndirectBrCriticalEdges(), SplitLandingPadPredecessorsImpl(), targetParallelCallback(), llvm::JumpThreadingPass::threadGuard(), llvm::InstCombinerImpl::tryToSinkInstruction(), llvm::ObjectSizeOffsetEvaluator::visitPHINode(), and llvm::InstCombinerImpl::visitPHINode().
|
inline |
Definition at line 323 of file BasicBlock.h.
References getFirstMayFaultInst().
const Instruction * BasicBlock::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)
Definition at line 338 of file BasicBlock.cpp.
References I.
Referenced by getFirstMayFaultInst().
|
inline |
Definition at line 264 of file BasicBlock.h.
References getFirstNonPHI().
const Instruction * BasicBlock::getFirstNonPHI | ( | ) | 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.
Definition at line 347 of file BasicBlock.cpp.
References I.
Referenced by llvm::MachineFunction::addLandingPad(), llvm::calculateClrEHStateNumbers(), llvm::calculateCXXStateForAsynchEH(), llvm::calculateSEHStateForAsynchEH(), calculateStateNumbersForInvokes(), llvm::calculateWasmEHInfo(), canSplitPredecessors(), canSplitPredecessors(), cloneInstructionInExitBlock(), llvm::colorEHFunclets(), llvm::EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(), llvm::createMemCpyLoopKnownSize(), createOutlinedFunction(), llvm::createPHIsForSplitLoopExit(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), llvm::ehAwareSplitEdge(), llvm::VPBasicBlock::execute(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findUnwindDestinations(), findWasmUnwindDestinations(), getFirstInsertionPt(), getFirstNonPHI(), getFirstNonPHIIt(), getFirstNonPHIOrDbgOrAlloca(), getLandingPadInst(), getSuccPad(), getUnwindDestTokenHelper(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), llvm::InlineFunction(), llvm::insertDebugValuesForPHIs(), insertDPValuesForPHIs(), isEHPad(), isLandingPad(), markAliveBlocks(), llvm::Instruction::mayThrow(), moveLCSSAPhis(), programUndefinedIfUndefOrPoison(), raiseUserConstantDataAllocasToEntryBlock(), relocationViaAlloca(), removeEmptyCleanup(), rewritePHIs(), runMoveAutoInit(), llvm::SplitBlockAndInsertSimpleForLoop(), and SplitLandingPadPredecessorsImpl().
|
inline |
Definition at line 272 of file BasicBlock.h.
References getFirstNonPHIIt().
BasicBlock::const_iterator BasicBlock::getFirstNonPHIIt | ( | ) | const |
Iterator returning form of getFirstNonPHI.
Installed as a placeholder for the RemoveDIs project that will eventually remove debug intrinsics.
Definition at line 354 of file BasicBlock.cpp.
References end(), getFirstNonPHI(), and I.
Referenced by CloneLoopBlocks(), ConnectEpilog(), ConnectProlog(), llvm::EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(), llvm::InnerLoopVectorizer::fixVectorizedLoop(), getFirstNonPHIIt(), hoist(), llvm::InstCombinerImpl::run(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().
|
inline |
Definition at line 283 of file BasicBlock.h.
References getFirstNonPHIOrDbg().
const Instruction * BasicBlock::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.
Definition at line 366 of file BasicBlock.cpp.
References I.
Referenced by llvm::ConstantFoldTerminator(), createOutlinedFunction(), llvm::OutlinableRegion::findCorrespondingBlockIn(), FindPHIForConditionForwarding(), getFirstNonPHIOrDbg(), initializeUniqueCases(), llvm::SimpleLoopSafetyInfo::isGuaranteedToExecute(), isPredicatedOnPHI(), llvm::moveInstructionsToTheBeginning(), NegateValue(), SplitBlockPredecessorsImpl(), and llvm::InstCombinerImpl::visitAllocaInst().
|
inline |
Definition at line 313 of file BasicBlock.h.
References getFirstNonPHIOrDbgOrAlloca().
BasicBlock::const_iterator BasicBlock::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.
Definition at line 410 of file BasicBlock.cpp.
References end(), End, getFirstNonPHI(), llvm::ilist_node_impl< OptionsT >::getIterator(), and isEntryBlock().
Referenced by llvm::InstCombinerImpl::freezeOtherUses(), getFirstNonPHIOrDbgOrAlloca(), getFreezeInsertPt(), and llvm::IRBuilderBase::SetInsertPointPastAllocas().
|
inline |
Definition at line 294 of file BasicBlock.h.
References getFirstNonPHIOrDbgOrLifetime().
const Instruction * BasicBlock::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.
Definition at line 380 of file BasicBlock.cpp.
References I.
Referenced by getFirstNonPHIOrDbgOrLifetime(), shouldInstrumentBlock(), simplifyTerminatorLeadingToRet(), and llvm::SplitKnownCriticalEdge().
std::optional< uint64_t > BasicBlock::getIrrLoopHeaderWeight | ( | ) | const |
Definition at line 667 of file BasicBlock.cpp.
References llvm::StringRef::equals(), llvm::Instruction::getMetadata(), llvm::MDString::getString(), and getTerminator().
|
inline |
Definition at line 666 of file BasicBlock.h.
References getLandingPadInst().
const LandingPadInst * BasicBlock::getLandingPadInst | ( | ) | const |
Return the landingpad instruction associated with the landing pad.
Definition at line 663 of file BasicBlock.cpp.
References getFirstNonPHI().
Referenced by getLandingPadInst(), makeStatepointExplicitImpl(), and SplitLandingPadPredecessorsImpl().
DPMarker * BasicBlock::getMarker | ( | InstListType::iterator | It | ) |
Return the DPMarker for the position given by It
, so that DbgRecords can be inserted there.
This will either be nullptr if not present, a DPMarker, or TrailingDbgRecords if It is end().
Definition at line 1058 of file BasicBlock.cpp.
References end(), and getTrailingDbgRecords().
Referenced by llvm::Instruction::adoptDbgRecords(), llvm::JumpThreadingPass::cloneInstructions(), llvm::formLCSSAForInstructions(), getNextMarker(), llvm::Instruction::insertBefore(), and RewriteUsesOfClonedInstructions().
|
inline |
Definition at line 213 of file BasicBlock.h.
References getModule().
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 276 of file BasicBlock.cpp.
References llvm::GlobalValue::getParent(), and getParent().
Referenced by callAppendArgs(), callAppendStringN(), callBufferedPrintfArgPush(), callBufferedPrintfStart(), callPrintfBegin(), CanProveNotTakenFirstIteration(), computeAllocaDefaultAlign(), computeLoadStoreDefaultAlign(), computeUnlikelySuccessors(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), convertFromNewDbgValues(), llvm::IRBuilderBase::CreateAlignedLoad(), llvm::IRBuilderBase::CreateAlignedStore(), llvm::IRBuilderBase::CreateAlloca(), createAllocaInstAtEntry(), llvm::IRBuilderBase::CreateAtomicCmpXchg(), llvm::IRBuilderBase::CreateAtomicRMW(), llvm::IRBuilderBase::CreateBinaryIntrinsic(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateNoAliasScopeDeclaration(), createOutlinedFunction(), llvm::IRBuilderBase::CreateStackSave(), llvm::IRBuilderBase::CreateUnaryIntrinsic(), createWrapper(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::emitAMDGPUPrintfCall(), llvm::VPWidenCallRecipe::execute(), llvm::VPVectorPointerRecipe::execute(), llvm::VPExpandSCEVRecipe::execute(), llvm::findAvailablePtrLoadStore(), getAllocaPos(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), getDependenceDistanceStrideAndSize(), getModule(), llvm::Instruction::getModule(), llvm::VectorBuilder::getModule(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::getPtrStride(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::RuntimePointerChecking::insert(), llvm::LoopStructure::parseLoopStructure(), performBranchToCommonDestFolding(), print(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processImpliedCondition(), processNonStringArg(), llvm::promoteLoopAccessesToScalars(), llvm::simplifyCFG(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::threadGuard(), and llvm::LoopVersioning::versionLoop().
DPMarker * BasicBlock::getNextMarker | ( | Instruction * | I | ) |
Return the DPMarker for the position that comes after I
.
Definition at line 1054 of file BasicBlock.cpp.
References getMarker(), and I.
Referenced by llvm::Instruction::getDbgReinsertionPosition(), reinsertInstInDbgRecords(), and llvm::DPMarker::removeMarker().
|
inline |
Definition at line 206 of file BasicBlock.h.
Return the enclosing method, or null if none.
Definition at line 205 of file BasicBlock.h.
Referenced by addNoRecurseAttrsTopDown(), addReplicateRegions(), AddReturnAttributes(), allSameBlock(), llvm::CodeMetrics::analyzeBasicBlock(), calculateCXXStateNumbers(), calculateSEHStateNumbers(), callIntrinsic(), canProveExitOnFirstIteration(), checkIfSupported(), llvm::JumpThreadingPass::cloneInstructions(), llvm::cloneLoopWithPreheader(), llvm::OpenMPIRBuilder::collapseLoops(), llvm::colorEHFunclets(), CompareValueComplexity(), computeAllocaDefaultAlign(), llvm::LoopSafetyInfo::computeBlockColors(), llvm::computeConstantRange(), llvm::computeKnownBitsFromContext(), computeKnownFPClassFromCond(), computeKnownFPClassFromContext(), computeLoadStoreDefaultAlign(), llvm::RandomIRBuilder::connectToSink(), convertToRelLookupTable(), copyMustTailReturn(), createAllocaInstAtEntry(), llvm::IRBuilderBase::CreateAssumption(), llvm::OpenMPIRBuilder::createCanonicalLoop(), llvm::IRSimilarity::IRSimilarityCandidate::createCanonicalRelationFrom(), llvm::OpenMPIRBuilder::createCopyinClauseBlocks(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(), llvm::IRBuilderBase::CreateFAddReduce(), createFFSIntrinsic(), llvm::IRBuilderBase::CreateFMulReduce(), llvm::IRBuilderBase::CreateFree(), llvm::IRBuilderBase::CreateGCGetPointerBase(), llvm::IRBuilderBase::CreateGCGetPointerOffset(), llvm::IRBuilderBase::CreateGCRelocate(), llvm::IRBuilderBase::CreateGCResult(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreateGlobalString(), llvm::IRBuilderBase::CreateInvariantStart(), llvm::IRBuilderBase::createIsFPClass(), llvm::IRBuilderBase::CreateLaunderInvariantGroup(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::IRBuilderBase::CreateMalloc(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoop(), llvm::IRBuilderBase::CreateMemSet(), llvm::IRBuilderBase::CreateMemSetInline(), createMemSetLoop(), llvm::IRBuilderBase::CreateMemTransferInst(), llvm::OpenMPIRBuilder::createParallel(), createPopcntIntrinsic(), llvm::IRBuilderBase::CreatePreserveArrayAccessIndex(), llvm::IRBuilderBase::CreatePreserveStructAccessIndex(), llvm::IRBuilderBase::CreatePreserveUnionAccessIndex(), llvm::OpenMPIRBuilder::createReductions(), llvm::IRBuilderBase::CreateStripInvariantGroup(), llvm::OpenMPIRBuilder::createTargetDeinit(), llvm::OpenMPIRBuilder::createTargetInit(), llvm::OpenMPIRBuilder::createTask(), llvm::OpenMPIRBuilder::createTeams(), createUnreachableSwitchDefault(), llvm::IRBuilderBase::CreateVectorReverse(), llvm::IRBuilderBase::CreateVectorSplice(), llvm::IRBuilderBase::CreateVScale(), diagnoseInvalidFormatString(), llvm::ehAwareSplitEdge(), llvm::orc::IRSpeculationLayer::emit(), llvm::emitAMDGPUPrintfCall(), llvm::AArch64TargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::ARMTargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::OpenMPIRBuilder::emitBlock(), llvm::OpenMPIRBuilder::emitCancelationCheckImpl(), llvm::SITargetLowering::emitExpandAtomicRMW(), llvm::OpenMPIRBuilder::emitIfClause(), llvm::OpenMPIRBuilder::emitKernelLaunch(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::HexagonTargetLowering::emitLoadLinked(), llvm::PPCTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::PPCTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), llvm::InnerLoopVectorizer::emitSCEVChecks(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::HexagonTargetLowering::emitStoreConditional(), llvm::PPCTargetLowering::emitTrailingFence(), eraseFromParent(), expandToSwitch(), llvm::CodeExtractor::extractCodeRegion(), llvm::CodeExtractor::findAllocas(), llvm::MustBeExecutedContextExplorer::findBackwardJoinPoint(), llvm::OutlinableRegion::findCorrespondingBlockIn(), llvm::findDevirtualizableCallsForTypeTest(), llvm::MustBeExecutedContextExplorer::findForwardJoinPoint(), findOrCreatePHIBlock(), llvm::RandomIRBuilder::findOrCreateSource(), llvm::InstCombinerImpl::foldAggregateConstructionIntoAggregateReuse(), llvm::InstCombinerImpl::foldBinopWithPhiOperands(), llvm::FoldBranchToCommonDest(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), llvm::formLCSSAForInstructions(), fpModeMatchesGlobalFPAtomicMode(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::AddrLabelMap::getAddrLabelSymbolToEmit(), getAllocaPos(), llvm::CallBase::getCaller(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), getDefaultInlineAdvice(), llvm::TargetLoweringBase::getDefaultSafeStackPointerLocation(), llvm::BlockCoverageInference::getDependencies(), llvm::MemoryDependenceResults::getDependency(), getDominatees(), getDominators(), llvm::IRSimilarity::IRSimilarityCandidate::getFunction(), llvm::DbgRecord::getFunction(), llvm::Trace::getFunction(), llvm::OpenMPIRBuilder::OutlineInfo::getFunction(), llvm::Instruction::getFunction(), getFunctionTypeFromAsyncSuspend(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::Instruction::getInsertionPointAfterDef(), llvm::TargetLoweringBase::getIRStackGuard(), llvm::X86TargetLowering::getIRStackGuard(), getModule(), getModuleFromDPI(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::OpenMPIRBuilder::getOrCreateSrcLocStr(), llvm::getPtrStride(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::GCProjectionInst::getStatepoint(), getValueSymbolTable(), getVarName(), HandleByValArgumentInit(), HandleInlinedEHPad(), HandleInlinedLandingPad(), handlePhiDef(), hostParallelCallback(), llvm::InlineFunction(), insertBoundsCheck(), InsertSafepointPoll(), insertSpills(), llvm::Instruction::Instruction(), llvm::invertCondition(), llvm::Attributor::isAssumedDead(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), llvm::LoopVectorizationLegality::isConsecutivePtr(), isEntryBlock(), isEqualImpl(), isExplicitVecOuterLoop(), llvm::isInTailCallPosition(), llvm::EarliestEscapeInfo::isNotCapturedBefore(), llvm::isPresplitCoroSuspendExitEdge(), isValidCandidateForColdCC(), LLVMInsertBasicBlockInContext(), LLVMInsertExistingBasicBlockAfterInsertBlock(), llvm::BlockAddress::lookup(), llvm::SelectionDAGBuilder::LowerCallTo(), llvm::ARMTargetLowering::makeDMB(), matchAddReduction(), llvm::SITargetLowering::mayBeEmittedAsTailCall(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), MergeCompatibleInvokesImpl(), moveAfter(), moveBefore(), moveLCSSAPhis(), llvm::InsertFunctionStrategy::mutate(), llvm::InsertCFGStrategy::mutate(), llvm::InsertPHIStrategy::mutate(), NegateValue(), llvm::RandomIRBuilder::newSink(), llvm::RandomIRBuilder::newSource(), nullifySetjmp(), placeSplitBlockCarefully(), llvm::PrepareToSplitEntryBlock(), print(), llvm::DPLabel::print(), llvm::DPValue::print(), printBBName(), llvm::EpilogueVectorizerMainLoop::printDebugTracesAtEnd(), llvm::EpilogueVectorizerEpilogueLoop::printDebugTracesAtEnd(), printIRBlockReference(), llvm::JumpThreadingPass::processBlock(), processUse(), programUndefinedIfUndefOrPoison(), llvm::AssumptionCache::registerAssumption(), removeFromParent(), llvm::SCCPSolver::removeNonFeasibleEdges(), llvm::RemoveRedundantDbgInstrs(), removeUndefIntroducingPredecessor(), replaceAllUsesOfWithIn(), replaceAsyncResumeFunction(), replaceConstantExprOp(), replaceExtractElements(), llvm::SSAUpdaterBulk::RewriteAllUses(), llvm::GCNTTIImpl::rewriteIntrinsicWithAddressSpace(), rewritePHIsForCleanupPad(), scanOneBB(), llvm::LoopVectorizationPlanner::selectEpilogueVectorizationFactor(), llvm::IRBuilderBase::setConstrainedFPFunctionAttr(), llvm::VPTransformState::setDebugLocFrom(), llvm::IRBuilderBase::SetInsertPoint(), llvm::setProfMetadata(), llvm::BlockCoverageInference::shouldInstrumentBlock(), SimplifyCondBranchToCondBranch(), simplifyRelocatesOffABase(), sinkAndCmp0Expression(), sinkLifetimeStartMarkers(), sinkLoopInvariantInstructions(), splitBasicBlock(), splitBasicBlockBefore(), llvm::splitBB(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), SwitchToLookupTable(), targetParallelCallback(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::OpenMPIRBuilder::tileLoops(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), llvm::JumpThreadingPass::unfoldSelectInstr(), UpdateAnalysisInformation(), llvm::AddrLabelMap::UpdateForDeletedBlock(), updateIDTMetaData(), useFuncSeen(), UseTlsOffset(), useTpOffset(), validateAndCostRequiredSelects(), llvm::slpvectorizer::BoUpSLP::vectorizeTree(), llvm::InstCombinerImpl::visitAllocaInst(), llvm::InstCombinerImpl::visitAnd(), llvm::InstCombinerImpl::visitOr(), llvm::InstCombinerImpl::visitXor(), and ~BasicBlock().
|
inline |
Definition at line 243 of file BasicBlock.h.
References getPostdominatingDeoptimizeCall().
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 326 of file BasicBlock.cpp.
References getTerminatingDeoptimizeCall(), getUniqueSuccessor(), and llvm::SmallPtrSetImpl< PtrType >::insert().
Referenced by canRotateDeoptimizingLatchExit(), and getPostdominatingDeoptimizeCall().
|
inline |
Definition at line 377 of file BasicBlock.h.
References getSinglePredecessor().
const BasicBlock * BasicBlock::getSinglePredecessor | ( | ) | const |
Return the predecessor of this block if it has a single predecessor block.
Otherwise return a null pointer.
Definition at line 439 of file BasicBlock.cpp.
References E, llvm::pred_begin(), and llvm::pred_end().
Referenced by addUsersInExitBlock(), llvm::CanonicalLoopInfo::assertOK(), CanGenerateTest(), CanPropagatePredecessorsForPHIs(), CanProveNotTakenFirstIteration(), llvm::CloneAndPruneIntoFromInst(), llvm::EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(), llvm::OpenMPIRBuilder::createSection(), llvm::TileInfo::CreateTiledLoops(), llvm::JumpThreadingPass::evaluateOnPredecessorEdge(), llvm::VPPredInstPHIRecipe::execute(), findDominatingValue(), FindPHIForConditionForwarding(), FindWidenableTerminatorAboveLoop(), foldICmpWithDominatingICmp(), getDomPredecessorCondition(), llvm::GetIfCondition(), getSinglePredecessor(), handlePhiDef(), llvm::objcarc::BundledRetainClaimRVs::insertAfterInvokes(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::isValidAssumeForContext(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), mergeBlocksIntoPredecessors(), mergeCleanupPad(), mergeConditionalStores(), mergeConditionalStoreToAddress(), optimizeBranch(), llvm::JumpThreadingPass::processGuards(), llvm::JumpThreadingPass::processImpliedCondition(), llvm::OutlinableRegion::reattachCandidate(), llvm::InstCombinerImpl::replacedSelectWithOperand(), shouldInstrumentBlock(), SimplifyCondBranchToCondBranch(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifySuspendPoint(), splitBasicBlockBefore(), splitBlockIfNotFirst(), llvm::SplitEdge(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and tryWidenCondBranchToCondBranch().
|
inline |
Definition at line 405 of file BasicBlock.h.
References getSingleSuccessor().
const BasicBlock * BasicBlock::getSingleSuccessor | ( | ) | const |
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 469 of file BasicBlock.cpp.
References E, llvm::succ_begin(), and llvm::succ_end().
Referenced by llvm::CanonicalLoopInfo::assertOK(), llvm::TileInfo::CreateTiledLoops(), ensureValueAvailableInSuccessor(), llvm::VPlan::execute(), FindWidenableTerminatorAboveLoop(), getSingleSuccessor(), llvm::isProfitableToTransform(), llvm::orc::SpeculateQuery::isStraightLine(), mergeBlocksIntoPredecessors(), llvm::MergeBlockSuccessorsIntoGivenBlocks(), mergeConditionalStores(), optimizeDivRem(), programUndefinedIfUndefOrPoison(), sinkLifetimeStartMarkers(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopRemainder().
|
inline |
Definition at line 234 of file BasicBlock.h.
References getTerminatingDeoptimizeCall().
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return instruction of this basic block, if such a call is present.
Otherwise, returns null.
Definition at line 311 of file BasicBlock.cpp.
References F.
Referenced by getPostdominatingDeoptimizeCall(), getTerminatingDeoptimizeCall(), llvm::InlineFunction(), llvm::IsBlockFollowedByDeoptOrUnreachable(), tryWidenCondBranchToCondBranch(), and violatesLegacyMultiExitLoopCheck().
|
inline |
Definition at line 252 of file BasicBlock.h.
References getTerminatingMustTailCall().
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this basic block, if such a call is present.
Otherwise, returns null.
Definition at line 280 of file BasicBlock.cpp.
References llvm::User::getOperand(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getPrevNode(), and llvm::ReturnInst::getReturnValue().
Referenced by getInsertionRange(), getTerminatingMustTailCall(), llvm::memtag::getUntagLocationIfFunctionExit(), llvm::InlineFunction(), and llvm::EscapeEnumerator::Next().
|
inline |
Definition at line 225 of file BasicBlock.h.
References getTerminator().
|
inline |
Returns the terminator instruction if the block is well formed or null if the block is not well formed.
Definition at line 220 of file BasicBlock.h.
Referenced by addBasicBlockMetadata(), Prefetch::addInstruction(), addNoUndefAttrs(), llvm::CodeMetrics::analyzeBasicBlock(), analyzeLoopUnrollCost(), llvm::OpenMPIRBuilder::applySimd(), llvm::CanonicalLoopInfo::assertOK(), basicBlockCanReturn(), llvm::PredicateInfoBuilder::buildPredicateInfo(), llvm::BranchProbabilityInfo::calculate(), llvm::calculateCXXStateForAsynchEH(), llvm::calculateSEHStateForAsynchEH(), canFoldTermCondOfLoop(), CanGenerateTest(), canRotateDeoptimizingLatchExit(), canSinkInstructions(), llvm::canSplitLoopBound(), checkBasicSSA(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunctionInto(), CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::colorEHFunclets(), llvm::FunctionComparator::compare(), llvm::InnerLoopVectorizer::completeLoopSkeleton(), ComputeNumSignBitsImpl(), ComputePostOrders(), computeUnlikelySuccessors(), ConnectEpilog(), ConnectProlog(), llvm::ConstantFoldTerminator(), copyMustTailReturn(), createAndCollectMergePhiForReduction(), llvm::OpenMPIRBuilder::createAtomicCompare(), llvm::OpenMPIRBuilder::createCopyinClauseBlocks(), llvm::EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(), createFoldedExitCond(), llvm::InnerLoopVectorizer::createInductionResumeValue(), createInvariantCond(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoop(), createMemSetLoop(), llvm::OpenMPIRBuilder::createParallel(), llvm::createPHIsForSplitLoopExit(), llvm::OpenMPIRBuilder::createReductions(), createReplacement(), llvm::createSanitizerCtorAndInitFunctions(), llvm::OpenMPIRBuilder::createSection(), createSwitchStatement(), llvm::OpenMPIRBuilder::createTargetInit(), llvm::InnerLoopVectorizer::createVectorLoopSkeleton(), despeculateCountZeros(), detectPopcountIdiom(), detectShiftUntilBitTestIdiom(), detectShiftUntilZeroIdiom(), DoFlattenLoopPair(), dominatesMergePoint(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), llvm::ehAwareSplitEdge(), llvm::OpenMPIRBuilder::emitBranch(), llvm::OpenMPIRBuilder::emitCancelationCheckImpl(), llvm::InnerLoopVectorizer::emitIterationCountCheck(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), llvm::EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(), llvm::Evaluator::EvaluateFunction(), llvm::VPWidenIntOrFpInductionRecipe::execute(), llvm::VPFirstOrderRecurrencePHIRecipe::execute(), llvm::VPReductionPHIRecipe::execute(), llvm::VPBranchOnMaskRecipe::execute(), llvm::VPWidenCanonicalIVRecipe::execute(), llvm::VPlan::execute(), llvm::VPBasicBlock::execute(), llvm::LoopVectorizationPlanner::executePlan(), expandToSwitch(), llvm::CodeExtractor::extractCodeRegion(), findBasePointer(), llvm::orc::SpeculateQuery::findCalles(), findLoopComponents(), FindLoopCounter(), llvm::DominatorTree::findNearestCommonDominator(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), llvm::RandomIRBuilder::findOrCreateSource(), FindPHIForConditionForwarding(), llvm::InnerLoopVectorizer::fixFixedOrderRecurrence(), llvm::InnerLoopVectorizer::fixupIVUsers(), FlattenLoopPair(), flushTerminatorDbgRecords(), llvm::InstCombinerImpl::foldBinopWithPhiOperands(), FoldCondBranchOnValueKnownInPredecessorImpl(), foldExit(), llvm::InstCombinerImpl::foldFreezeIntoRecurrence(), foldGuardedFunnelShift(), foldICmpWithDominatingICmp(), llvm::InstCombinerImpl::foldOpIntoPhi(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), llvm::InstCombinerImpl::foldPHIArgOpIntoPHI(), llvm::FoldReturnIntoUncondBranch(), generateUnsignedDivisionCode(), genLoopLimit(), llvm::VPTransformState::get(), getBestDestForJumpOnUndef(), getBranchHint(), getBranchInsertPoint(), llvm::Loop::LoopBounds::getCanonicalPredicate(), getDomPredecessorCondition(), getEHPadFromPredecessor(), getExpectedExitLoopLatchBranch(), llvm::GetIfCondition(), getInsertPointForUses(), getInstrBB(), getIrrLoopHeaderWeight(), getJumpThreadDuplicationCost(), llvm::Loop::getLoopGuardBranch(), llvm::MachineLoop::getLoopID(), llvm::RegionTraits< Function >::getNumSuccessors(), getOnlyLiveSuccessor(), llvm::InnerLoopVectorizer::getOrCreateVectorTripCount(), getOuterLoopLatchCmp(), getOutliningBenefit(), getOutliningPenalty(), VectorSlice::getSlicedVal(), llvm::GCProjectionInst::getStatepoint(), getStrlenWithNull(), llvm::GetSuccessorNumber(), getSuccState(), getTerminator(), handlePhiDef(), llvm::InstCombinerImpl::handleUnreachableFrom(), hasSideeffectFreeStaticResolution(), hoist(), hoistAdd(), llvm::hoistAllInstructionsInto(), hoistGEP(), hoistMinMax(), hoistMulAddAssociation(), llvm::hoistRegion(), hoistSub(), injectPendingInvariantConditions(), llvm::InlineFunction(), insertBoundsCheck(), llvm::DIBuilder::insertDeclare(), insertLifetimeMarkersSurroundingCall(), insertSpills(), insertUniqueBackedgeBlock(), llvm::SampleProfileProber::instrumentOneFunc(), llvm::Attributor::isAssumedDead(), llvm::IsBlockFollowedByDeoptOrUnreachable(), isChainSelectCmpBranch(), llvm::isInlineViable(), llvm::isInTailCallPosition(), isLegalToHoistInto(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isLoopDead(), isLoopExitTestBasedOn(), isNotUsedOrFoldableInLoop(), isPowerOfTwoRecurrence(), isSafePHIToSpeculate(), llvm::SCEVExpander::isSafeToExpandAt(), llvm::isSafeToMoveBefore(), llvm::isUniformLoop(), isUniformlyReached(), llvm::Loop::makeLoopInvariant(), llvm::gvn::AvailableValueInBlock::MaterializeAdjustedValue(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), moveBBContents(), llvm::moveInstructionsToTheEnd(), llvm::MemorySSAUpdater::moveToPlace(), llvm::ShuffleBlockStrategy::mutate(), needsLFTR(), llvm::RandomIRBuilder::newSource(), llvm::EscapeEnumerator::Next(), optimizeDivRem(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), optimizeSQRT(), llvm::LoopStructure::parseLoopStructure(), llvm::peelLoop(), peelToTurnInvariantLoadsDerefencebale(), performBranchToCommonDestFolding(), llvm::VPlan::prepareToExecute(), llvm::InstCombinerImpl::prepareWorklist(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processBranchOnPHI(), llvm::JumpThreadingPass::processBranchOnXOR(), llvm::JumpThreadingPass::processImpliedCondition(), llvm::JumpThreadingPass::processThreadableEdges(), llvm::promoteLoopAccessesToScalars(), llvm::OutlinableRegion::reattachCandidate(), redirectToHub(), ReduceLoopStrength(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::MemorySSAUpdater::removeBlocks(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceConstantExprOp(), replaceSuccessorsPhiUsesWith(), rewriteMaterializableInstructions(), rewriteMemOpOfSelect(), rewritePHIs(), llvm::LoopConstrainer::run(), llvm::InstCombinerImpl::run(), llvm::PlaceSafepointsPass::runImpl(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), separateNestedLoop(), llvm::SSPLayoutInfo::shouldEmitSDCheck(), simplifyInstructionWithPHI(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), SinkCast(), sinkLastInstruction(), llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), llvm::spliceBB(), splitBasicBlock(), splitBasicBlockBefore(), llvm::splitBB(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfElse(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockAndInsertSimpleForLoop(), SplitBlockPredecessorsImpl(), splitCallSite(), llvm::OutlinableRegion::splitCandidate(), llvm::SplitEdge(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::splitLoopBound(), llvm::succ_begin(), llvm::succ_end(), swapBBContents(), threadBinOpOverPHI(), threadCmpOverPHI(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::OpenMPIRBuilder::tileLoops(), llvm::JumpThreadingPass::tryThreadEdge(), TryToMergeLandingPad(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::InstCombinerImpl::tryToSinkInstruction(), llvm::JumpThreadingPass::tryToUnfoldSelect(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), tryUnmergingGEPsAcrossIndirectBr(), turnGuardIntoBranch(), turnSelectIntoBranch(), turnToExplicitForm(), llvm::JumpThreadingPass::unfoldSelectInstr(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchAllTrivialConditions(), unswitchTrivialBranch(), unswitchTrivialSwitch(), updatePredecessorProfileMetadata(), llvm::slpvectorizer::BoUpSLP::vectorizeTree(), llvm::LoopVersioning::versionLoop(), violatesLegacyMultiExitLoopCheck(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitPHINode(), and workshareLoopTargetCallback().
DPMarker * 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 1139 of file BasicBlock.cpp.
References getContext(), llvm::LLVMContextImpl::getTrailingDbgRecords(), and llvm::LLVMContext::pImpl.
Referenced by convertFromNewDbgValues(), createMarker(), flushTerminatorDbgRecords(), and getMarker().
|
inline |
Definition at line 389 of file BasicBlock.h.
References getUniquePredecessor().
const BasicBlock * BasicBlock::getUniquePredecessor | ( | ) | const |
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 447 of file BasicBlock.cpp.
References E, llvm::pred_begin(), and llvm::pred_end().
Referenced by areInnerLoopLatchPHIsSupported(), areOuterLoopExitPHIsSupported(), llvm::MustBeExecutedContextExplorer::findBackwardJoinPoint(), findLocationForEntrySafepoint(), llvm::Loop::getLoopGuardBranch(), getUniquePredecessor(), IsAcceptableTarget(), makeStatepointExplicitImpl(), llvm::MergeBlockIntoPredecessor(), llvm::MergeBlockSuccessorsIntoGivenBlocks(), normalizeForInvokeSafepoint(), optimizeDivRem(), reuseTableCompare(), llvm::InstCombinerImpl::run(), runMoveAutoInit(), llvm::LoopNest::skipEmptyBlockUntil(), llvm::InstCombinerImpl::tryToSinkInstruction(), and llvm::UnrollLoop().
|
inline |
Definition at line 415 of file BasicBlock.h.
References getUniqueSuccessor().
const BasicBlock * BasicBlock::getUniqueSuccessor | ( | ) | const |
Return the successor of this block if it has a unique successor.
Otherwise return a null pointer.
This method is analogous to getUniquePredecessor above.
Definition at line 477 of file BasicBlock.cpp.
References E, llvm::succ_begin(), and llvm::succ_end().
Referenced by llvm::OpenMPIRBuilder::finalize(), llvm::MustBeExecutedContextExplorer::findForwardJoinPoint(), getPostdominatingDeoptimizeCall(), getUniqueSuccessor(), IsBackEdge(), llvm::IsBlockFollowedByDeoptOrUnreachable(), llvm::MergeBlockIntoPredecessor(), llvm::OutlinableRegion::reattachCandidate(), llvm::LoopNest::skipEmptyBlockUntil(), and TryToMergeLandingPad().
ValueSymbolTable * BasicBlock::getValueSymbolTable | ( | ) |
Returns a pointer to the symbol table if one exists.
Definition at line 149 of file BasicBlock.cpp.
References F, and getParent().
|
inline |
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
to it.
Definition at line 639 of file BasicBlock.h.
Referenced by llvm::AsmPrinter::emitBasicBlockStart(), FoldTwoEntryPHINode(), llvm::AddrLabelMap::getAddrLabelSymbolToEmit(), hasAddressTakenAndUsed(), isBlockValidForExtraction(), llvm::isInlineViable(), llvm::BlockAddress::lookup(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::IRTranslator::runOnMachineFunction(), and ~BasicBlock().
Return true if this block has exactly N predecessors.
Definition at line 461 of file BasicBlock.cpp.
References llvm::hasNItems(), N, llvm::pred_begin(), and llvm::pred_end().
Referenced by ensureValueAvailableInSuccessor(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::JumpThreadingPass::processThreadableEdges(), llvm::OutlinableRegion::reattachCandidate(), and llvm::MemorySSAUpdater::wireOldPredecessorsToNewImmediatePredecessor().
Return true if this block has N predecessors or more.
Definition at line 465 of file BasicBlock.cpp.
References llvm::hasNItemsOrMore(), N, llvm::pred_begin(), and llvm::pred_end().
Referenced by CanRedirectPredsOfEmptyBBToSucc(), and llvm::OutlinableRegion::reattachCandidate().
void BasicBlock::insertDbgRecordAfter | ( | DbgRecord * | DPV, |
Instruction * | I | ||
) |
Insert a DbgRecord into a block at the position given by I
.
Definition at line 1037 of file BasicBlock.cpp.
References assert(), createMarker(), I, llvm::DPMarker::insertDbgRecord(), and IsNewDbgInfoFormat.
Referenced by llvm::ConvertDebugDeclareToDebugValue(), llvm::DPValue::createLinkedDPVAssign(), DbgInserterHelper(), and rewriteDebugUsers().
void BasicBlock::insertDbgRecordBefore | ( | DbgRecord * | DPV, |
InstListType::iterator | Here | ||
) |
Insert a DbgRecord into a block at the position given by Here
.
Definition at line 1046 of file BasicBlock.cpp.
References assert(), createMarker(), and end().
Referenced by DbgInserterHelper(), hoistLockstepIdenticalDPValues(), insertDPValuesForPHIs(), and insertNewDbgInst().
void BasicBlock::insertInto | ( | Function * | Parent, |
BasicBlock * | InsertBefore = nullptr |
||
) |
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.
nullptr
. Definition at line 184 of file BasicBlock.cpp.
References assert(), llvm::Function::end(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Function::insert(), llvm::Function::IsNewDbgInfoFormat, and setIsNewDbgInfoFormat().
Referenced by moveFunctionAdaptingType().
iterator_range< filter_iterator< BasicBlock::iterator, std::function< bool(Instruction &)> > > BasicBlock::instructionsWithoutDebug | ( | bool | SkipPseudoOp = true | ) |
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 244 of file BasicBlock.cpp.
References I, and llvm::make_filter_range().
iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > BasicBlock::instructionsWithoutDebug | ( | bool | SkipPseudoOp = true | ) | const |
Return a const iterator range over the instructions in the block, skipping any debug instructions.
Skip any pseudo operations as well if SkipPseudoOp
is true.
Definition at line 234 of file BasicBlock.cpp.
References I, and llvm::make_filter_range().
Referenced by BlockIsSimpleEnoughToThreadThrough(), llvm::orc::SpeculateQuery::findCalles(), getCaseResults(), getOutliningBenefit(), isSafeToSpeculateStore(), mergeConditionalStoreToAddress(), nextIRInstructionDataMatchesNextInst(), SimplifyCondBranchToCondBranch(), simplifyOneLoop(), sizeWithoutDebug(), and tryToMoveFreeBeforeNullTest().
|
inline |
Mark instruction ordering invalid. Done on every instruction insert.
Definition at line 686 of file BasicBlock.h.
References validateInstrOrdering().
Referenced by convertFromNewDbgValues(), and llvm::invalidateParentIListOrdering().
|
inline |
Return true if this basic block is an exception handling block.
Definition at line 656 of file BasicBlock.h.
References getFirstNonPHI(), and llvm::Instruction::isEHPad().
Referenced by calculateCXXStateNumbers(), calculateSEHStateNumbers(), llvm::calculateWasmEHInfo(), canSplitCallSite(), deleteLoopIfDead(), getPredState(), IsAcceptableTarget(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::IRMutationStrategy::mutate(), llvm::JumpThreadingPass::processBranchOnXOR(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), llvm::SplitEdge(), and llvm::SplitKnownCriticalEdge().
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 551 of file BasicBlock.cpp.
References assert(), F, and getParent().
Referenced by DPValuesRemoveUndefDbgAssignsFromEntryBlock(), getFirstNonPHIOrDbgOrAlloca(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), llvm::isPotentiallyReachable(), llvm::AllocaInst::isStaticAlloca(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::InstCombinerImpl::prepareWorklist(), printBBName(), llvm::RemoveRedundantDbgInstrs(), removeRedundantDbgLocs(), removeUndefDbgAssignsFromEntryBlock(), removeUndefDbgLocsFromEntryBlock(), and UpdateAnalysisInformation().
|
inline |
Returns true if the Order field of child Instructions is valid.
Definition at line 681 of file BasicBlock.h.
Referenced by llvm::Instruction::comesBefore(), and validateInstrOrdering().
bool BasicBlock::isLandingPad | ( | ) | const |
Return true if this basic block is a landing pad.
Being a `‘landing pad’' means that the basic block is the destination of the 'unwind' edge of an invoke instruction.
Definition at line 659 of file BasicBlock.cpp.
References getFirstNonPHI().
Referenced by llvm::createPHIsForSplitLoopExit(), MergeCompatibleInvokes(), SplitBlockPredecessorsImpl(), and SplitLandingPadPredecessorsImpl().
bool BasicBlock::isLegalToHoistInto | ( | ) | const |
Return true if it is legal to hoist instructions into this block.
Definition at line 537 of file BasicBlock.cpp.
References assert(), and getTerminator().
void BasicBlock::moveAfter | ( | BasicBlock * | MovePos | ) |
Unlink this basic block from its current function and insert it right after MovePos
in the function MovePos
lives in.
Definition at line 271 of file BasicBlock.cpp.
References llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::Function::splice().
Referenced by InsertStackProtectors(), llvm::MergeBasicBlockIntoOnlyPred(), placeSplitBlockCarefully(), llvm::JumpThreadingPass::threadEdge(), and llvm::JumpThreadingPass::threadThroughTwoBasicBlocks().
|
inline |
Unlink this basic block from its current function and insert it into the function that MovePos
lives in, right before MovePos
.
Definition at line 357 of file BasicBlock.h.
References llvm::ilist_node_impl< OptionsT >::getIterator(), and moveBefore().
Referenced by buildClonedLoopBlocks(), llvm::CloneAndPruneIntoFromInst(), and moveBefore().
void BasicBlock::moveBefore | ( | SymbolTableList< BasicBlock >::iterator | MovePos | ) |
Definition at line 267 of file BasicBlock.cpp.
References llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), getParent(), and llvm::Function::splice().
|
delete |
iterator_range< BasicBlock::phi_iterator > BasicBlock::phis | ( | ) |
Definition at line 491 of file BasicBlock.cpp.
|
inline |
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 498 of file BasicBlock.h.
References phis().
Referenced by llvm::InstCombinerImpl::addDeadEdge(), addPHINodeEntriesForMappedBlock(), AddPredecessorToBlock(), addUsersInExitBlock(), analyzeExitPHIsForOutputUses(), areInnerLoopExitPHIsSupported(), areInnerLoopLatchPHIsSupported(), areOuterLoopExitPHIsSupported(), CanRedirectPredsOfEmptyBBToSucc(), cleanupSinglePredPHIs(), ConnectEpilog(), llvm::EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(), llvm::createPHIsForSplitLoopExit(), llvm::DeleteDeadPHIs(), deleteLoopIfDead(), llvm::EliminateDuplicatePHINodes(), findOrCreatePHIInBlock(), FindPHIForConditionForwarding(), fixupPHINodeForNormalDest(), fixupPHINodeForUnwindDest(), ForwardSwitchConditionToPHI(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), IncomingValuesAreCompatible(), isExistingPhi(), isLoopDead(), isPredicatedOnPHI(), isSafeToHoistInvoke(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), phis(), removeEmptyCleanup(), removePredecessor(), removeUndefIntroducingPredecessor(), replaceTargetsFromPHINode(), rewritePHINodesForExitAndUnswitchedBlocks(), rewritePHINodesForUnswitchedExitBlock(), scanPHIsAndUpdateValueMap(), SimplifyCondBranchToCondBranch(), splitCallSite(), llvm::splitLoopBound(), tryWidenCondBranchToCondBranch(), llvm::updatePhiNodes(), and validateAndCostRequiredSelects().
void BasicBlock::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.
Definition at line 4800 of file AsmWriter.cpp.
References getModule(), getParent(), and OS.
Referenced by llvm::DOTGraphTraits< DOTFuncMSSAInfo * >::getNodeLabel().
|
inline |
Definition at line 445 of file BasicBlock.h.
Referenced by llvm::OpenMPIRBuilder::finalize(), and findLiveSetAtInst().
|
inline |
Definition at line 446 of file BasicBlock.h.
void BasicBlock::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.
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 1066 of file BasicBlock.cpp.
References llvm::DPMarker::absorbDebugValues(), assert(), createMarker(), getNextMarker(), I, llvm::make_range(), and llvm::DPMarker::StoredDbgRecords.
void BasicBlock::removeFromParent | ( | ) |
Unlink 'this' from the containing function, but do not delete it.
Definition at line 259 of file BasicBlock.cpp.
References llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::remove().
Referenced by llvm::DomTreeUpdater::callbackDeleteBB(), llvm::DomTreeUpdater::deleteBB(), and moveFunctionAdaptingType().
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 496 of file BasicBlock.cpp.
References assert(), begin(), empty(), front(), llvm::Value::hasNUsesOrMore(), llvm::is_contained(), llvm::make_early_inc_range(), phis(), and llvm::predecessors().
Referenced by llvm::changeToCall(), llvm::ConstantFoldTerminator(), FoldCondBranchOnValueKnownInPredecessorImpl(), llvm::FoldReturnIntoUncondBranch(), HandleInlinedEHPad(), HandleInlinedLandingPad(), markAliveBlocks(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processImpliedCondition(), processSwitch(), redirectTo(), removeEmptyCleanup(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeSwitchAfterSelectFold(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), simplifyOneLoop(), llvm::SplitKnownCriticalEdge(), SwitchToLookupTable(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), TryToMergeLandingPad(), tryWidenCondBranchToCondBranch(), llvm::UnrollLoop(), unswitchNontrivialInvariants(), and unswitchTrivialSwitch().
|
inline |
Definition at line 447 of file BasicBlock.h.
Referenced by eraseFromParentAndMove(), llvm::OpenMPIRBuilder::finalize(), llvm::FindAvailableLoadedValue(), findPotentialBlockers(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), inlineRetainOrClaimRVCalls(), removeTriviallyEmptyRange(), and splitCallSite().
|
inline |
Definition at line 448 of file BasicBlock.h.
void BasicBlock::renumberInstructions | ( | ) |
Renumber instructions and mark the ordering as valid.
Definition at line 686 of file BasicBlock.cpp.
References I.
Referenced by llvm::Instruction::comesBefore().
void BasicBlock::replacePhiUsesWith | ( | BasicBlock * | Old, |
BasicBlock * | New | ||
) |
Update all phi nodes in this basic block to refer to basic block New
instead of basic block Old
.
Definition at line 633 of file BasicBlock.cpp.
References I, and llvm::PHINode::replaceIncomingBlockWith().
Referenced by moveLCSSAPhis(), and splitBasicBlockBefore().
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 655 of file BasicBlock.cpp.
References replaceSuccessorsPhiUsesWith().
void BasicBlock::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
.
Definition at line 644 of file BasicBlock.cpp.
References getTerminator(), and llvm::successors().
Referenced by llvm::OutlinableRegion::reattachCandidate(), replaceSuccessorsPhiUsesWith(), and llvm::OutlinableRegion::splitCandidate().
void BasicBlock::setIsNewDbgInfoFormat | ( | bool | NewFlag | ) |
Ensure the block is in "old" dbg.value format (NewFlag
== false) or in the new format (NewFlag
== true), converting to the desired format if necessary.
Definition at line 142 of file BasicBlock.cpp.
References convertFromNewDbgValues(), convertToNewDbgValues(), and IsNewDbgInfoFormat.
Referenced by llvm::Function::insert(), and insertInto().
void BasicBlock::setTrailingDbgRecords | ( | DPMarker * | 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 1135 of file BasicBlock.cpp.
References getContext(), llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::setTrailingDbgRecords().
Referenced by createMarker(), and llvm::DPMarker::removeMarker().
|
inline |
Definition at line 450 of file BasicBlock.h.
Referenced by analyzeAndPruneOutputBlocks(), createSwitchStatement(), findDuplicateOutputBlock(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::moveInstructionsToTheEnd(), remapOperands(), tryToMoveFreeBeforeNullTest(), and unswitchTrivialSwitch().
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 254 of file BasicBlock.cpp.
References begin(), end(), and instructionsWithoutDebug().
Referenced by llvm::FastISel::fastEmitBranch().
|
inline |
Transfer all instructions from FromBB
to this basic block at ToIt
.
Definition at line 612 of file BasicBlock.h.
References begin(), end(), and splice().
Referenced by llvm::hoistAllInstructionsInto(), llvm::InlineFunction(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), moveBBContents(), splice(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and workshareLoopTargetCallback().
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 1009 of file BasicBlock.cpp.
References assert(), llvm::First, flushTerminatorDbgRecords(), IsNewDbgInfoFormat, llvm::Last, and llvm::iplist_impl< IntrusiveListT, TraitsT >::splice().
|
inline |
Transfer one instruction from FromBB
at FromIt
to this basic block at ToIt
.
Definition at line 618 of file BasicBlock.h.
References splice().
|
inline |
Definition at line 584 of file BasicBlock.h.
References Before, I, and splitBasicBlock().
BasicBlock * BasicBlock::splitBasicBlock | ( | iterator | I, |
const Twine & | BBName = "" , |
||
bool | Before = false |
||
) |
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 557 of file BasicBlock.cpp.
References assert(), Before, llvm::BranchInst::Create(), Create(), end(), getContext(), llvm::ilist_node_with_parent< BasicBlock, Function >::getNextNode(), getParent(), getTerminator(), I, llvm::Instruction::setDebugLoc(), and splitBasicBlockBefore().
Referenced by llvm::OpenMPIRBuilder::createAtomicCompare(), llvm::OpenMPIRBuilder::createCopyinClauseBlocks(), llvm::createMemCpyLoopKnownSize(), createMemSetLoop(), llvm::OpenMPIRBuilder::createParallel(), llvm::OpenMPIRBuilder::createReductions(), llvm::OpenMPIRBuilder::createTargetInit(), despeculateCountZeros(), llvm::SITargetLowering::emitExpandAtomicRMW(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), generateUnsignedDivisionCode(), getStrlenWithNull(), llvm::InlineFunction(), insertBoundsCheck(), insertSpills(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfThenElse(), llvm::splitBlockBefore(), splitBlockIfNotFirst(), SplitBlockImpl(), and llvm::OutlinableRegion::splitCandidate().
|
inline |
Definition at line 607 of file BasicBlock.h.
References I, and splitBasicBlockBefore().
BasicBlock * 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.
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 588 of file BasicBlock.cpp.
References assert(), begin(), llvm::BranchInst::Create(), Create(), getContext(), getParent(), getSinglePredecessor(), getTerminator(), I, llvm::predecessors(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), replacePhiUsesWith(), llvm::Instruction::replaceSuccessorWith(), and llvm::Instruction::setDebugLoc().
Referenced by splitBasicBlock(), and splitBasicBlockBefore().
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 1123 of file BasicBlock.cpp.
References assert(), llvm::Instruction::comesBefore(), I, and isInstrOrderValid().
Referenced by invalidateOrders(), and ~BasicBlock().
|
friend |
Definition at line 68 of file BasicBlock.h.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
Definition at line 172 of file BasicBlock.h.
|
friend |
Definition at line 172 of file BasicBlock.h.
|
friend |
Definition at line 68 of file BasicBlock.h.
bool llvm::BasicBlock::IsNewDbgInfoFormat |
Flag recording whether or not this block stores debug-info in the form of intrinsic instructions (false) or non-instruction records (true).
Definition at line 65 of file BasicBlock.h.
Referenced by llvm::CloneBasicBlock(), convertFromNewDbgValues(), convertToNewDbgValues(), createMarker(), emitDbgAssign(), llvm::CodeExtractor::extractCodeRegion(), flushTerminatorDbgRecords(), llvm::Instruction::handleMarkerRemoval(), llvm::Instruction::insertBefore(), insertDbgRecordAfter(), performBranchToCommonDestFolding(), removeRedundantDbgInstrsUsingBackwardScan(), removeRedundantDbgInstrsUsingForwardScan(), removeUndefDbgAssignsFromEntryBlock(), setIsNewDbgInfoFormat(), and splice().