LLVM  8.0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::BasicBlock Class Referencefinal

LLVM Basic Block Representation. More...

#include "llvm/IR/BasicBlock.h"

Inheritance diagram for llvm::BasicBlock:
Inheritance graph
[legend]
Collaboration diagram for llvm::BasicBlock:
Collaboration graph
[legend]

Classes

class  phi_iterator_impl
 Iterator to walk just the phi nodes in the basic block. More...
 

Public Types

using InstListType = SymbolTableList< Instruction >
 
using iterator = InstListType::iterator
 Instruction iterators... More...
 
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

 BasicBlock (const BasicBlock &)=delete
 
BasicBlockoperator= (const BasicBlock &)=delete
 
 ~BasicBlock ()
 
LLVMContextgetContext () const
 Get the context in which this basic block lives. More...
 
const FunctiongetParent () const
 Return the enclosing method, or null if none. More...
 
FunctiongetParent ()
 
const ModulegetModule () const
 Return the module owning the function this basic block belongs to, or nullptr if the function does not have a module. More...
 
ModulegetModule ()
 
const InstructiongetTerminator () const LLVM_READONLY
 Returns the terminator instruction if the block is well formed or null if the block is not well formed. More...
 
InstructiongetTerminator ()
 
const CallInstgetTerminatingDeoptimizeCall () 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. More...
 
CallInstgetTerminatingDeoptimizeCall ()
 
const CallInstgetTerminatingMustTailCall () const
 Returns the call instruction marked 'musttail' prior to the terminating return instruction of this basic block, if such a call is present. More...
 
CallInstgetTerminatingMustTailCall ()
 
const InstructiongetFirstNonPHI () const
 Returns a pointer to the first instruction in this block that is not a PHINode instruction. More...
 
InstructiongetFirstNonPHI ()
 
const InstructiongetFirstNonPHIOrDbg () const
 Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic. More...
 
InstructiongetFirstNonPHIOrDbg ()
 
const InstructiongetFirstNonPHIOrDbgOrLifetime () const
 Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic, or a lifetime intrinsic. More...
 
InstructiongetFirstNonPHIOrDbgOrLifetime ()
 
const_iterator getFirstInsertionPt () const
 Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI instruction. More...
 
iterator getFirstInsertionPt ()
 
iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > instructionsWithoutDebug () const
 Return a const iterator range over the instructions in the block, skipping any debug instructions. More...
 
iterator_range< filter_iterator< BasicBlock::iterator, std::function< bool(Instruction &)> > > instructionsWithoutDebug ()
 Return an iterator range over the instructions in the block, skipping any debug instructions. More...
 
void removeFromParent ()
 Unlink 'this' from the containing function, but do not delete it. More...
 
SymbolTableList< BasicBlock >::iterator eraseFromParent ()
 Unlink 'this' from the containing function and delete it. More...
 
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. More...
 
void moveAfter (BasicBlock *MovePos)
 Unlink this basic block from its current function and insert it right after MovePos in the function MovePos lives in. More...
 
void insertInto (Function *Parent, BasicBlock *InsertBefore=nullptr)
 Insert unlinked basic block into a function. More...
 
const BasicBlockgetSinglePredecessor () const
 Return the predecessor of this block if it has a single predecessor block. More...
 
BasicBlockgetSinglePredecessor ()
 
const BasicBlockgetUniquePredecessor () const
 Return the predecessor of this block if it has a unique predecessor block. More...
 
BasicBlockgetUniquePredecessor ()
 
bool hasNPredecessors (unsigned N) const
 Return true if this block has exactly N predecessors. More...
 
bool hasNPredecessorsOrMore (unsigned N) const
 Return true if this block has N predecessors or more. More...
 
const BasicBlockgetSingleSuccessor () const
 Return the successor of this block if it has a single successor. More...
 
BasicBlockgetSingleSuccessor ()
 
const BasicBlockgetUniqueSuccessor () const
 Return the successor of this block if it has a unique successor. More...
 
BasicBlockgetUniqueSuccessor ()
 
iterator begin ()
 Instruction iterator methods. More...
 
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 Instructionfront () const
 
Instructionfront ()
 
const Instructionback () const
 
Instructionback ()
 
iterator_range< const_phi_iteratorphis () const
 Returns a range that iterates over the phis in the basic block. More...
 
iterator_range< phi_iteratorphis ()
 
const InstListTypegetInstList () const
 Return the underlying instruction list container. More...
 
InstListTypegetInstList ()
 
ValueSymbolTablegetValueSymbolTable ()
 Returns a pointer to the symbol table if one exists. More...
 
void dropAllReferences ()
 Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining. More...
 
void removePredecessor (BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
 Notify the BasicBlock that the predecessor Pred is no longer able to reach it. More...
 
bool canSplitPredecessors () const
 
BasicBlocksplitBasicBlock (iterator I, const Twine &BBName="")
 Split the basic block into two basic blocks at the specified instruction. More...
 
BasicBlocksplitBasicBlock (Instruction *I, const Twine &BBName="")
 
bool hasAddressTaken () const
 Returns true if there are any uses of this basic block other than direct branches, switches, etc. More...
 
void replaceSuccessorsPhiUsesWith (BasicBlock *New)
 Update all phi nodes in this basic block's successors to refer to basic block New instead of to it. More...
 
bool isEHPad () const
 Return true if this basic block is an exception handling block. More...
 
bool isLandingPad () const
 Return true if this basic block is a landing pad. More...
 
const LandingPadInstgetLandingPadInst () const
 Return the landingpad instruction associated with the landing pad. More...
 
LandingPadInstgetLandingPadInst ()
 
bool isLegalToHoistInto () const
 Return true if it is legal to hoist instructions into this block. More...
 
Optional< uint64_t > getIrrLoopHeaderWeight () const
 
- Public Member Functions inherited from llvm::Value
 Value (const Value &)=delete
 
Valueoperator= (const Value &)=delete
 
void deleteValue ()
 Delete a pointer to a generic Value. More...
 
void dump () const
 Support for debugging, callable in GDB: V->dump() More...
 
TypegetType () const
 All values are typed, get the type of this value. More...
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 Return a constant reference to the value's name. More...
 
void setName (const Twine &Name)
 Change the name of the value. More...
 
void takeName (Value *V)
 Transfer the name from V to this value. More...
 
void replaceAllUsesWith (Value *V)
 Change all uses of this to point to a new Value. More...
 
void replaceNonMetadataUsesWith (Value *V)
 Change non-metadata uses of this to point to a new Value. More...
 
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. More...
 
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_iteratormaterialized_uses ()
 
iterator_range< const_use_iteratormaterialized_uses () const
 
iterator_range< use_iteratoruses ()
 
iterator_range< const_use_iteratoruses () 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
 
Useruser_back ()
 
const Useruser_back () const
 
iterator_range< user_iteratormaterialized_users ()
 
iterator_range< const_user_iteratormaterialized_users () const
 
iterator_range< user_iteratorusers ()
 
iterator_range< const_user_iteratorusers () const
 
bool hasOneUse () const
 Return true if there is exactly one user of this value. More...
 
bool hasNUses (unsigned N) const
 Return true if this Value has exactly N users. More...
 
bool hasNUsesOrMore (unsigned N) const
 Return true if this value has N users or more. More...
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 Check if this value is used in the specified basic block. More...
 
unsigned getNumUses () const
 This method computes the number of uses of this Value. More...
 
void addUse (Use &U)
 This method should only be used by the Use class. More...
 
unsigned getValueID () const
 Return an ID for the concrete type of this object. More...
 
unsigned getRawSubclassOptionalData () const
 Return the raw optional flags value contained in this value. More...
 
void clearSubclassOptionalData ()
 Clear the optional flags contained in this value. More...
 
bool hasSameSubclassOptionalData (const Value *V) const
 Check the optional flags for equality. More...
 
bool hasValueHandle () const
 Return true if there is a value handle associated with this value. More...
 
bool isUsedByMetadata () const
 Return true if there is metadata referencing this value. More...
 
bool isSwiftError () const
 Return true if this value is a swifterror value. More...
 
const ValuestripPointerCasts () const
 Strip off pointer casts, all-zero GEPs, and aliases. More...
 
ValuestripPointerCasts ()
 
const ValuestripPointerCastsAndInvariantGroups () const
 Strip off pointer casts, all-zero GEPs, aliases and invariant group info. More...
 
ValuestripPointerCastsAndInvariantGroups ()
 
const ValuestripPointerCastsNoFollowAliases () const
 Strip off pointer casts and all-zero GEPs. More...
 
ValuestripPointerCastsNoFollowAliases ()
 
const ValuestripInBoundsConstantOffsets () const
 Strip off pointer casts and all-constant inbounds GEPs. More...
 
ValuestripInBoundsConstantOffsets ()
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 Accumulate offsets from stripInBoundsConstantOffsets(). More...
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 
const ValuestripInBoundsOffsets () const
 Strip off pointer casts and inbounds GEPs. More...
 
ValuestripInBoundsOffsets ()
 
uint64_t getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull) const
 Returns the number of bytes known to be dereferenceable for the pointer value. More...
 
unsigned getPointerAlignment (const DataLayout &DL) const
 Returns an alignment of the pointer value. More...
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 Translate PHI node to its predecessor from the given basic block. More...
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 
void mutateType (Type *Ty)
 Mutate the type of this Value to be of the specified type. More...
 
template<class Compare >
void sortUseList (Compare Cmp)
 Sort the use-list. More...
 
void reverseUseList ()
 Reverse the use-list. More...
 
void print (raw_ostream &O, bool IsForDebug=false) const
 Implement operator<< on Value. More...
 
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. More...
 
void printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const
 
- Public Member Functions inherited from llvm::ilist_node_with_parent< BasicBlock, Function >
BasicBlockgetPrevNode ()
 
const BasicBlockgetPrevNode () const
 Get the previous node, or nullptr for the list head. More...
 
BasicBlockgetNextNode ()
 Get the next node, or nullptr for the list tail. More...
 
const BasicBlockgetNextNode () const
 Get the next node, or nullptr for the list tail. More...
 
- Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >
self_iterator getIterator ()
 
const_self_iterator getIterator () const
 
reverse_self_iterator getReverseIterator ()
 
const_reverse_self_iterator getReverseIterator () const
 
bool isSentinel () const
 Check whether this is the sentinel node. More...
 

Static Public Member Functions

static BasicBlockCreate (LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
 Creates a new BasicBlock. More...
 
static InstListType BasicBlock::* getSublistAccess (Instruction *)
 Returns a pointer to a member of the instruction list. More...
 
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast. More...
 

Friends

class BlockAddress
 
class SymbolTableListTraits< BasicBlock >
 

Additional Inherited Members

- Static Public Attributes inherited from llvm::Value
static const unsigned MaxAlignmentExponent = 29
 The maximum alignment for instructions. More...
 
static const unsigned MaximumAlignment = 1u << MaxAlignmentExponent
 
- Protected Types inherited from llvm::Value
enum  : unsigned { NumUserOperandsBits = 28 }
 The number of operands in the subclass. More...
 
- Protected Types inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >
using self_iterator = ilist_iterator< ilist_detail::compute_node_options< BasicBlock, Options... >::type, false, false >
 
using const_self_iterator = ilist_iterator< ilist_detail::compute_node_options< BasicBlock, Options... >::type, false, true >
 
using reverse_self_iterator = ilist_iterator< ilist_detail::compute_node_options< BasicBlock, Options... >::type, true, false >
 
using const_reverse_self_iterator = ilist_iterator< ilist_detail::compute_node_options< BasicBlock, Options... >::type, true, true >
 
- 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. More...
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 
- Protected Member Functions inherited from llvm::ilist_node_with_parent< BasicBlock, Function >
 ilist_node_with_parent ()=default
 
- Protected Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >
 ilist_node_impl ()=default
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 Hold subclass data that can be dropped. More...
 
unsigned NumUserOperands: NumUserOperandsBits
 
unsigned IsUsedByMD: 1
 
unsigned HasName: 1
 
unsigned HasHungOffUses: 1
 
unsigned HasDescriptor: 1
 

Detailed Description

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 58 of file BasicBlock.h.

Member Typedef Documentation

◆ const_iterator

using llvm::BasicBlock::const_iterator = InstListType::const_iterator

Definition at line 91 of file BasicBlock.h.

◆ const_phi_iterator

Definition at line 320 of file BasicBlock.h.

◆ const_reverse_iterator

Definition at line 93 of file BasicBlock.h.

◆ InstListType

Definition at line 61 of file BasicBlock.h.

◆ iterator

using llvm::BasicBlock::iterator = InstListType::iterator

Instruction iterators...

Definition at line 90 of file BasicBlock.h.

◆ phi_iterator

Definition at line 318 of file BasicBlock.h.

◆ reverse_iterator

Definition at line 92 of file BasicBlock.h.

Constructor & Destructor Documentation

◆ BasicBlock()

llvm::BasicBlock::BasicBlock ( const BasicBlock )
delete

◆ ~BasicBlock()

BasicBlock::~BasicBlock ( )

Member Function Documentation

◆ back() [1/2]

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

◆ back() [2/2]

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

Definition at line 284 of file BasicBlock.h.

◆ begin() [1/2]

iterator llvm::BasicBlock::begin ( )
inline

Instruction iterator methods.

Definition at line 269 of file BasicBlock.h.

Referenced by AddReachableCodeToWorklist(), llvm::MemorySSAUpdater::applyInsertUpdates(), asmClobbersCTR(), llvm::calculateWasmEHInfo(), llvm::Interpreter::callFunction(), CanPropagatePredecessorsForPHIs(), canSplitCallSite(), CheckForCanReleaseCFGHazard(), llvm::CloneAndPruneIntoFromInst(), CloneLoop(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::computePeelCount(), ComputePostOrders(), ConvertToSInt(), createCallInst(), createCast(), llvm::createCodeGenPreparePass(), llvm::createObjCARCOptPass(), llvm::createScalarizerPass(), llvm::createShadowStackGCLoweringPass(), cse(), cxxDtorIsEmpty(), DeleteBasicBlock(), despeculateCountZeros(), llvm::DominatorTree::dominates(), llvm::GVNExpression::Expression::dump(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), eliminateDeadStores(), llvm::EliminateDuplicatePHINodes(), eliminateRecursiveTailCall(), eliminateUnreachableBlock(), ensureValueAvailableInSuccessor(), llvm::Evaluator::EvaluateFunction(), llvm::CodeExtractor::extractCodeRegion(), llvm::FastISel::fastEmitZExtFromI1(), llvm::FindAvailablePtrLoadStore(), llvm::objcarc::FindDependencies(), findIBRPredecessor(), findInitTrampolineFromBB(), llvm::CodeExtractor::findInputsOutputs(), FindLoopCounter(), findPHIToPartitionLoops(), llvm::SSAUpdaterTraits< SSAUpdater >::FindPredecessorBlocks(), findRetainForStoreStrongContraction(), findTRECandidate(), llvm::InnerLoopVectorizer::fixFirstOrderRecurrence(), fixPhis(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldSingleEntryPHINodes(), FoldTwoEntryPHINode(), llvm::Loop::getCanonicalInductionVariable(), llvm::MemoryDependenceResults::getDependency(), llvm::GetIfCondition(), getInductionVariable(), GetLocation(), getMemSetPatternValue(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleCallsInBlockInlinedThroughInvoke(), handleEndBlock(), hasProfileData(), hasUsesOutsideLoop(), llvm::hoistAllInstructionsInto(), HoistThenElseCodeToIf(), INITIALIZE_PASS(), llvm::InlineFunction(), InsertRootInitializers(), InsertSafepointPoll(), insertSinCosCall(), instrumentMaskedLoadOrStore(), is_empty(), llvm::isGuaranteedToTransferExecutionToSuccessor(), IsIncrementNUW(), IsNonLocalValue(), isOnlyReachableViaThisEdge(), llvm::isSafeToLoadUnconditionally(), llvm::Value::isUsedInBasicBlock(), isZero(), llvm::IVUsers::IVUsers(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetPreviousInstruction(), llvm::log2(), makeBitReverse(), makeStatepointExplicitImpl(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::MarkBlockExecutable(), MarkBlocksLiveIn(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeEmptyReturnBlocks(), moveLCSSAPhis(), NegateValue(), normalizeForInvokeSafepoint(), operator new(), operator<<(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), optimizeSQRT(), llvm::OrderedBasicBlock::OrderedBasicBlock(), llvm::peelLoop(), performMaskedAtomicOp(), phis(), ProcessBlock(), processInternalGlobal(), promoteMemoryToRegister(), promoteSingleBlockAlloca(), PushLoopPHIs(), relocateInstructionBefore(), removeEmptyCleanup(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), removeUndefIntroducingPredecessor(), ReplaceUsesOfWith(), rewritePHINodesForExitAndUnswitchedBlocks(), RewriteUsesOfClonedInstructions(), runOnBasicBlock(), scalarizeMaskedScatter(), shouldKeepInEntry(), shouldRotateLoopExitingLatch(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), llvm::InstCombiner::simplifyDivRemOfSelectWithZeroOp(), SimplifyIndirectBrOnSelect(), llvm::SimplifyInstructionsInBlock(), llvm::simplifyLoopIVs(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), llvm::sinkRegion(), SpeculativelyExecuteBB(), llvm::SplitBlock(), llvm::SplitBlockPredecessors(), splitCallSite(), llvm::SplitCriticalEdge(), StackMallocSizeClass(), llvm::JumpThreadingPass::ThreadEdge(), llvm::JumpThreadingPass::ThreadGuard(), truncateIVUse(), tryToElideArgumentCopy(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::TryToUnfoldSelectInCurrBB(), tryToVectorizeHorReductionOrInstOperands(), TurnSwitchRangeIntoICmp(), llvm::JumpThreadingPass::UnfoldSelectInstr(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), unswitchNontrivialInvariants(), updateForIncomingValueLocation(), UpdatePHINodes(), updatePhiNodes(), llvm::LoopVersioning::versionLoop(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), llvm::Interpreter::visitIndirectBrInst(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().

◆ begin() [2/2]

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

Definition at line 270 of file BasicBlock.h.

◆ canSplitPredecessors()

bool BasicBlock::canSplitPredecessors ( ) const

◆ classof()

static bool llvm::BasicBlock::classof ( const Value V)
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast.

Definition at line 346 of file BasicBlock.h.

References canSplitPredecessors(), dropAllReferences(), llvm::Value::getValueID(), I, removePredecessor(), and splitBasicBlock().

◆ Create()

static BasicBlock* llvm::BasicBlock::Create ( LLVMContext Context,
const Twine Name = "",
Function Parent = nullptr,
BasicBlock InsertBefore = nullptr 
)
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 100 of file BasicBlock.h.

References llvm::ISD::BasicBlock, and Name.

Referenced by addBoundsChecking(), assureFPCallStub(), llvm::CloneBasicBlock(), llvm::CloneFunction(), createDevirtTriggerFunc(), createDummyFunction(), llvm::createDwarfEHPass(), llvm::createEfficiencySanitizerPass(), createEmptyFunction(), createFPFnStub(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemMoveLoop(), createMemSetLoop(), CreatePrologue(), createResumeEntryBlock(), llvm::createSanitizerCtorAndInitFunctions(), CreateWrapper(), llvm::createX86RetpolineThunksPass(), llvm::VPBlockBase::deleteCFG(), ehAwareSplitEdge(), eliminateRecursiveTailCall(), llvm::CodeExtractor::extractCodeRegion(), llvm::CodeExtractor::findInputsOutputs(), llvm::SanitizerStatReport::finish(), FitWeights(), FoldCondBranchOnPHI(), FunctionNumber(), getSignature(), getTrueOrFalseValue(), INITIALIZE_PASS(), insertUniqueBackedgeBlock(), instrumentMaskedLoadOrStore(), isThunkProfitable(), LLVMAppendBasicBlockInContext(), LLVMCreateBasicBlockInContext(), LLVMInsertBasicBlockInContext(), llvm::orc::makeStub(), mayLoopAccessLocation(), needsRuntimeRegistrationOfSectionRange(), llvm::EscapeEnumerator::Next(), optimizeSQRT(), PerformHeapAllocSRoA(), performMaskedAtomicOp(), readWideAPInt(), ReplaceUsesOfWith(), llvm::WholeProgramDevirtPass::run(), llvm::UnifyFunctionExitNodes::runOnFunction(), scaleWeights(), selectJumpTableArmEncoding(), shouldKeepInEntry(), SimplifyCondBranchToCondBranch(), SimplifyIndirectBrOnSelect(), llvm::sinkRegion(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), SwitchToLookupTable(), llvm::JumpThreadingPass::ThreadEdge(), llvm::JumpThreadingPass::UnfoldSelectInstr(), and unifyReturnBlockSet().

◆ dropAllReferences()

void BasicBlock::dropAllReferences ( )

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

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

Definition at line 227 of file BasicBlock.cpp.

References llvm::User::dropAllReferences(), and I.

Referenced by classof(), deleteDeadBlocksFromLoop(), llvm::Function::dropAllReferences(), eliminateUnreachableBlock(), and ~BasicBlock().

◆ empty()

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

Definition at line 280 of file BasicBlock.h.

Referenced by llvm::DomTreeUpdater::callbackDeleteBB(), is_empty(), and phis().

◆ end() [1/2]

iterator llvm::BasicBlock::end ( )
inline

Definition at line 271 of file BasicBlock.h.

Referenced by AddReachableCodeToWorklist(), asmClobbersCTR(), llvm::changeToUnreachable(), CheckForCanReleaseCFGHazard(), llvm::CloneFunction(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::ConvertDebugDeclareToDebugValue(), createCast(), cse(), cxxDtorIsEmpty(), DeleteBasicBlock(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), eliminateRecursiveTailCall(), llvm::objcarc::FindDependencies(), findSafeStoreForStoreStrongContraction(), first_use_of_in_block(), llvm::foldBlockIntoPredecessor(), getFirstInsertionPt(), getMemSetPatternValue(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), getTrueOrFalseValue(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), HandleCallsInBlockInlinedThroughInvoke(), handleEndBlock(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), hasProfileData(), llvm::hoistAllInstructionsInto(), INITIALIZE_PASS(), llvm::insertDebugValuesForPHIs(), InsertSafepointPoll(), instrumentOneFunc(), llvm::isGuaranteedToTransferExecutionToSuccessor(), llvm::isInTailCallPosition(), isOnlyReachableViaThisEdge(), llvm::isPotentiallyReachable(), isSafeAndProfitableToSinkLoad(), llvm::Value::isUsedInBasicBlock(), llvm::isValidAssumeForContext(), isZero(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetNextInstruction(), LLVMPositionBuilder(), makeBitReverse(), MarkBlocksLiveIn(), memoryIsNotModifiedBetween(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), llvm::Instruction::moveBefore(), llvm::InjectorIRStrategy::mutate(), llvm::RandomIRBuilder::newSource(), operator new(), OptimizeExtractBits(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), llvm::OrderedBasicBlock::OrderedBasicBlock(), passingValueIsAlwaysUndefined(), performMaskedAtomicOp(), llvm::PrepareToSplitEntryBlock(), ProcessBlock(), promoteMemoryToRegister(), propagateMetadata(), relocateInstructionBefore(), removeTriviallyEmptyRange(), ReplaceUsesOfWith(), RewriteUsesOfClonedInstructions(), runOnBasicBlock(), scalarizeMaskedScatter(), llvm::IRBuilderBase::SetInsertPoint(), shouldInstrumentBlock(), shouldRotateLoopExitingLatch(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), SinkCast(), SinkCmpExpression(), llvm::sinkRegion(), SinkShiftAndTruncate(), SpeculativelyExecuteBB(), splitBasicBlock(), TryToSinkInstruction(), tryToVectorizeHorReductionOrInstOperands(), unswitchTrivialBranch(), and llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit().

◆ end() [2/2]

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

Definition at line 272 of file BasicBlock.h.

◆ eraseFromParent()

iplist< BasicBlock >::iterator BasicBlock::eraseFromParent ( )

◆ front() [1/2]

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

Definition at line 281 of file BasicBlock.h.

Referenced by calculateStateNumbersForInvokes(), llvm::AAResults::canBasicBlockModify(), llvm::CloneAndPruneFunctionInto(), llvm::CloneAndPruneIntoFromInst(), CloneInstructionInExitBlock(), CloneLoop(), llvm::SSAUpdaterTraits< SSAUpdater >::CreateEmptyPHI(), createFFSIntrinsic(), createPHIsForSplitLoopExit(), CreatePrologue(), createRetPHINode(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), despeculateCountZeros(), detectShiftUntilZeroIdiom(), llvm::GVNExpression::Expression::dump(), eliminateDeadStores(), eliminateDeadSwitchCases(), eliminateRecursiveTailCall(), ensureValueAvailableInSuccessor(), llvm::CodeExtractor::findInputsOutputs(), findLocationForEntrySafepoint(), findTRECandidate(), getOffsetFromIndices(), llvm::SCEVExpander::getOrInsertCanonicalInductionVariable(), GetRMWLibcall(), getSuccPad(), getSuccState(), getTrueOrFalseValue(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), INITIALIZE_PASS(), llvm::InlineFunction(), insertSpills(), insertTrivialPHIs(), instrumentMaskedLoadOrStore(), IsIncrementNUW(), isLoadConditional(), isOnlyReachableViaThisEdge(), isProfitableForVectorization(), isSafeToExecuteUnconditionally(), isSafeToPromoteArgument(), isZero(), MarkBlocksLiveIn(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeEmptyReturnBlocks(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), promoteSingleBlockAlloca(), llvm::removeAllNonTerminatorAndEHPadInstructions(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), rewritePHIs(), llvm::UnifyFunctionExitNodes::runOnFunction(), SimplifyIndirectBrOnSelect(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), llvm::SplitEdge(), StackMallocSizeClass(), truncateIVUse(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), unswitchTrivialSwitch(), llvm::SelectionDAGBuilder::UpdateSplitBlock(), llvm::LoopVersioning::versionLoop(), and llvm::InstCombiner::visitStoreInst().

◆ front() [2/2]

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

Definition at line 282 of file BasicBlock.h.

◆ getContext()

LLVMContext & BasicBlock::getContext ( ) const

Get the context in which this basic block lives.

Definition at line 33 of file BasicBlock.cpp.

References assert(), llvm::ISD::BasicBlock, C, llvm::Type::getContext(), llvm::Type::getLabelTy(), llvm::Value::getType(), insertInto(), Name, llvm::Value::setName(), and llvm::Value::Value().

Referenced by AddRuntimeUnrollDisableMetaData(), allPredecessorsComeFromSameSource(), llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::DomTreeUpdater::callbackDeleteBB(), canTransformToMemCmp(), llvm::CloneBasicBlock(), llvm::CloneFunction(), CloneLoop(), llvm::ConstantFoldTerminator(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createStringMetadata(), llvm::VPBlockBase::deleteCFG(), DisableAllLoopOptsOnLoop(), ehAwareSplitEdge(), llvm::emitCalloc(), llvm::emitFReadUnlocked(), llvm::emitFWrite(), llvm::emitFWriteUnlocked(), llvm::emitMalloc(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemCpyChk(), llvm::emitStrLen(), llvm::emitStrNCmp(), EqualityPropUnSafe(), eraseDeadBBsAndChildren(), llvm::CodeExtractor::extractCodeRegion(), llvm::CodeExtractor::findInputsOutputs(), FitWeights(), llvm::AMDGPULibCalls::fold(), FoldCondBranchOnPHI(), llvm::InvokeInst::getLandingPadInst(), insertCall(), insertUniqueBackedgeBlock(), isOnlyReachableViaThisEdge(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::MemorySSA::moveTo(), optimizeSQRT(), patchAndReplaceAllUsesWith(), PerformHeapAllocSRoA(), llvm::LoopVersioning::prepareNoAliasMetadata(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), llvm::IRCEPass::run(), scaleWeights(), setBranchWeights(), llvm::Loop::setLoopAlreadyUnrolled(), SimplifyIndirectBrOnSelect(), llvm::sinkRegion(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::UnfoldSelectInstr(), llvm::UnreachableInst::UnreachableInst(), updatePredecessorProfileMetadata(), and ~BasicBlock().

◆ getFirstInsertionPt() [1/2]

BasicBlock::const_iterator BasicBlock::getFirstInsertionPt ( ) const

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

In particular, it skips all PHIs and LandingPad instructions.

Definition at line 217 of file BasicBlock.cpp.

References end(), getFirstNonPHI(), and llvm::ilist_node_impl< OptionsT >::getIterator().

Referenced by cheapToScalarize(), CloneInstructionInExitBlock(), llvm::ConvertDebugDeclareToDebugValue(), ConvertToSInt(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::DemoteRegToStack(), llvm::GVNExpression::Expression::dump(), eraseDeadBBsAndChildren(), llvm::VPlan::execute(), llvm::SCEVExpander::expandCodeFor(), findInsertPointAfter(), llvm::InnerLoopVectorizer::fixFirstOrderRecurrence(), llvm::InnerLoopVectorizer::fixReduction(), foldGuardedRotateToFunnelShift(), getFirstInsertionPt(), getFirstNonPHIOrDbgOrLifetime(), getNarrowIntrinsic(), GetPointerOperand(), getRetComponentType(), getScalarIntrinsicDeclaration(), getSignature(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), hasSameExtUse(), hasUsesOutsideLoop(), llvm::insertDebugValuesForPHIs(), insertSpills(), instrumentMaskedLoadOrStore(), instrumentOneFunc(), makeBitReverse(), makeStatepointExplicitImpl(), MarkBlocksLiveIn(), mergeConditionalStoreToAddress(), llvm::InjectorIRStrategy::mutate(), llvm::InstDeleterIRStrategy::mutate(), llvm::RandomIRBuilder::newSink(), llvm::RandomIRBuilder::newSource(), OptimizeExtractBits(), false::LibCallsShrinkWrap::perform(), rematerializeLiveValues(), llvm::SCEVExpander::replaceCongruentIVs(), replaceExtractElements(), rewriteMaterializableInstructions(), llvm::InstCombiner::run(), setInsertionPoint(), shouldInstrumentBlock(), simplifyRelocatesOffABase(), SinkCast(), SinkCmpExpression(), SinkShiftAndTruncate(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadGuard(), truncateIVUse(), TryToSinkInstruction(), llvm::sroa::AllocaSliceRewriter::visit(), llvm::InstCombiner::visitGetElementPtrInst(), llvm::ObjectSizeOffsetEvaluator::visitPHINode(), llvm::InstCombiner::visitStoreInst(), and llvm::InnerLoopVectorizer::widenPHIInstruction().

◆ getFirstInsertionPt() [2/2]

iterator llvm::BasicBlock::getFirstInsertionPt ( )
inline

◆ getFirstNonPHI() [1/2]

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 190 of file BasicBlock.cpp.

References I.

Referenced by llvm::MachineFunction::addLandingPad(), llvm::calculateClrEHStateNumbers(), calculateStateNumbersForInvokes(), llvm::calculateWasmEHInfo(), canSplitPredecessors(), canSplitPredecessors(), CloneLoopBlocks(), llvm::colorEHFunclets(), ConnectEpilog(), ConnectProlog(), createCallInst(), llvm::createMemCpyLoopKnownSize(), createPHIsForSplitLoopExit(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), ehAwareSplitEdge(), eraseDeadBBsAndChildren(), llvm::CodeExtractor::findInputsOutputs(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findUnwindDestinations(), fixPhis(), getFirstInsertionPt(), getFirstNonPHI(), getJumpThreadDuplicationCost(), getLandingPadInst(), getParentPad(), GetPointerOperand(), getSignature(), getSuccPad(), getSuccState(), getTerminatingMustTailCall(), getUnwindDestTokenHelper(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), hoist(), llvm::InlineFunction(), llvm::insertDebugValuesForPHIs(), inversePermutation(), isAtomic(), isEHPad(), isLandingPad(), isProfitableForVectorization(), isWrapperOnlyCall(), mapWasmLandingPadIndex(), markAliveBlocks(), mayUsePostIncMode(), moveLCSSAPhis(), relocationViaAlloca(), removeEmptyCleanup(), replaceAllUsesOfWithIn(), rewritePHIs(), SimplifyBranchOnICmpChain(), llvm::SplitLandingPadPredecessors(), TypeSizeToSizeIndex(), and llvm::UnrollRuntimeLoopRemainder().

◆ getFirstNonPHI() [2/2]

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

Definition at line 153 of file BasicBlock.h.

References getFirstNonPHI(), and getFirstNonPHIOrDbg().

◆ getFirstNonPHIOrDbg() [1/2]

const Instruction * BasicBlock::getFirstNonPHIOrDbg ( ) const

◆ getFirstNonPHIOrDbg() [2/2]

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

Definition at line 161 of file BasicBlock.h.

References getFirstNonPHIOrDbg(), and getFirstNonPHIOrDbgOrLifetime().

◆ getFirstNonPHIOrDbgOrLifetime() [1/2]

const Instruction * BasicBlock::getFirstNonPHIOrDbgOrLifetime ( ) const

Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic, or a lifetime intrinsic.

Definition at line 204 of file BasicBlock.cpp.

References I, and llvm::Instruction::isLifetimeStartOrEnd().

Referenced by getFirstNonPHIOrDbg(), getFirstNonPHIOrDbgOrLifetime(), simplifyTerminatorLeadingToRet(), and SortCallTargets().

◆ getFirstNonPHIOrDbgOrLifetime() [2/2]

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

Definition at line 169 of file BasicBlock.h.

References getFirstInsertionPt(), and getFirstNonPHIOrDbgOrLifetime().

◆ getInstList() [1/2]

const InstListType& llvm::BasicBlock::getInstList ( ) const
inline

Return the underlying instruction list container.

Currently you need to access the underlying instruction list container directly if you want to modify it.

Definition at line 334 of file BasicBlock.h.

Referenced by assertBranchOrSelectConditionHoisted(), llvm::DomTreeUpdater::callbackDeleteBB(), callsiteIsHot(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::changeToUnreachable(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneBasicBlock(), llvm::CloneFunction(), CloneInstructionInExitBlock(), llvm::BinaryOperator::Create(), llvm::UnaryOperator::Create(), createCallHelper(), createInvokeHelper(), createMalloc(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateRecursiveTailCall(), eliminateUnreachableBlock(), llvm::Instruction::eraseFromParent(), llvm::CodeExtractor::findInputsOutputs(), llvm::foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), FunctionNumber(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), llvm::hoistAllInstructionsInto(), HoistThenElseCodeToIf(), llvm::InlineFunction(), llvm::Instruction::insertAfter(), llvm::Instruction::insertBefore(), llvm::IRBuilderDefaultInserter::InsertHelper(), llvm::InstCombiner::InsertNewInstBefore(), insertUniqueBackedgeBlock(), llvm::Instruction::Instruction(), LdStHasDebugValue(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), moveBBContents(), llvm::Instruction::moveBefore(), false::LibCallsShrinkWrap::perform(), llvm::Instruction::removeFromParent(), removePredecessor(), llvm::ReplaceInstWithInst(), ReplaceUsesOfWith(), llvm::InstCombiner::run(), llvm::UnifyFunctionExitNodes::runOnFunction(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), unifyReturnBlockSet(), llvm::UnrollLoop(), unswitchTrivialBranch(), updateForIncomingValueLocation(), and llvm::InstCombiner::visitGetElementPtrInst().

◆ getInstList() [2/2]

InstListType& llvm::BasicBlock::getInstList ( )
inline

Definition at line 335 of file BasicBlock.h.

◆ getIrrLoopHeaderWeight()

Optional< uint64_t > BasicBlock::getIrrLoopHeaderWeight ( ) const

◆ getLandingPadInst() [1/2]

const LandingPadInst * BasicBlock::getLandingPadInst ( ) const

Return the landingpad instruction associated with the landing pad.

Definition at line 473 of file BasicBlock.cpp.

References llvm::dyn_cast(), and getFirstNonPHI().

Referenced by CloneLoop(), getLandingPadInst(), getParentPad(), isEHPad(), makeStatepointExplicitImpl(), MarkBlocksLiveIn(), and llvm::SplitLandingPadPredecessors().

◆ getLandingPadInst() [2/2]

LandingPadInst* llvm::BasicBlock::getLandingPadInst ( )
inline

◆ getModule() [1/2]

const Module * BasicBlock::getModule ( ) const

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 134 of file BasicBlock.cpp.

References getParent(), and llvm::GlobalValue::getParent().

Referenced by llvm::LoopAccessInfo::addRuntimeChecks(), CanProveNotTakenFirstIteration(), llvm::CloneFunction(), llvm::IRBuilderBase::CreateBinaryIntrinsic(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateUnaryIntrinsic(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), llvm::emitBinaryFloatFnCall(), llvm::emitCalloc(), llvm::emitFGetCUnlocked(), llvm::emitFGetSUnlocked(), llvm::emitFPutC(), llvm::emitFPutCUnlocked(), llvm::emitFPutS(), llvm::emitFPutSUnlocked(), llvm::emitFReadUnlocked(), llvm::emitFWrite(), llvm::emitFWriteUnlocked(), llvm::emitMalloc(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemCpyChk(), llvm::emitPutChar(), llvm::emitPutS(), llvm::InnerLoopVectorizer::emitSCEVChecks(), llvm::emitStrChr(), llvm::emitStrCpy(), llvm::emitStrLen(), llvm::emitStrNCmp(), llvm::emitStrNCpy(), emitUnaryFloatFnCallHelper(), llvm::LazyValueInfo::eraseBlock(), llvm::FindAvailablePtrLoadStore(), FindLoopCounter(), findPHIToPartitionLoops(), llvm::InnerLoopVectorizer::fixupIVUsers(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), getEdgeValueLocal(), llvm::Instruction::getModule(), getModule(), llvm::InnerLoopVectorizer::getOrCreateTripCount(), getParent(), GetPointerOperand(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::getPtrStride(), getSignature(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), handleEndBlock(), isIgnorableInst(), isLoadConditional(), isObjectDereferencedInBlock(), mayLoopAccessLocation(), mayUsePostIncMode(), llvm::MemoryDepChecker::Dependence::print(), llvm::printLoop(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessImpliedCondition(), llvm::promoteLoopAccessesToScalars(), ReduceLoopStrength(), ReplaceUsesOfWith(), llvm::LoopRotatePass::run(), llvm::IndVarSimplifyPass::run(), llvm::LoopIdiomRecognizePass::run(), llvm::simplifyCFG(), llvm::SimplifyInstructionsInBlock(), llvm::simplifyLoopAfterUnroll(), simplifyLoopInst(), simplifyOneLoop(), llvm::LazyValueInfo::threadEdge(), llvm::JumpThreadingPass::ThreadGuard(), tryToVectorizeHorReductionOrInstOperands(), llvm::UnrollRuntimeLoopRemainder(), llvm::LoopVersioning::versionLoop(), llvm::InnerLoopVectorizer::widenIntOrFpInduction(), and llvm::InnerLoopVectorizer::widenPHIInstruction().

◆ getModule() [2/2]

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

Definition at line 115 of file BasicBlock.h.

References getModule(), getTerminator(), and LLVM_READONLY.

◆ getParent() [1/2]

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

Return the enclosing method, or null if none.

Definition at line 107 of file BasicBlock.h.

Referenced by addNoRecurseAttrsTopDown(), allPredecessorsComeFromSameSource(), asmClobbersCTR(), calculateSEHStateNumbers(), callIntrinsic(), callsiteIsHot(), canFoldIVIncExpr(), castToIncrementInst(), CC_MipsO32_FP64(), llvm::changeToUnreachable(), llvm::CloneFunction(), CloneLoop(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::cloneLoopWithPreheader(), llvm::CodeMetrics::collectEphemeralValues(), combineADDToADDZE(), CompareValueComplexity(), llvm::LoopSafetyInfo::computeBlockColors(), computeKnownBitsFromAssume(), llvm::computePeelCount(), llvm::computeUnrollCount(), llvm::ConstantFoldTerminator(), copyMustTailReturn(), llvm::SanitizerStatReport::create(), llvm::createArgumentPromotionPass(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(), llvm::IRBuilderBase::CreateFAddReduce(), createFFSIntrinsic(), llvm::IRBuilderBase::CreateFMulReduce(), llvm::IRBuilderBase::CreateGCRelocate(), llvm::IRBuilderBase::CreateGCResult(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreateGlobalString(), llvm::createHWAddressSanitizerPass(), llvm::IRBuilderBase::CreateInvariantStart(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::IRBuilderBase::CreateMaskedStore(), createMaskInstrs(), llvm::IRBuilderBase::CreateMemCpy(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), llvm::IRBuilderBase::CreateMemMove(), createMemMoveLoop(), llvm::IRBuilderBase::CreateMemSet(), createMemSetLoop(), createPopcntIntrinsic(), llvm::createScalarizerPass(), DeleteBasicBlock(), llvm::VPBlockBase::deleteCFG(), deleteDeadInstruction(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), despeculateCountZeros(), DisableAllLoopOptsOnLoop(), llvm::InstCombiner::dominatesAllUses(), ehAwareSplitEdge(), eliminateDeadStores(), eliminateRecursiveTailCall(), llvm::AArch64TargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::ARMTargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::HexagonTargetLowering::emitLoadLinked(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::HexagonTargetLowering::emitStoreConditional(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::PPCTargetLowering::emitTrailingFence(), enableCallSafepoints(), llvm::LazyValueInfo::enableDT(), EqualityPropUnSafe(), eraseFromParent(), llvm::AlignmentFromAssumptionsPass::extractAlignmentInfo(), llvm::CodeExtractor::extractCodeRegion(), llvm::findDevirtualizableCallsForTypeTest(), llvm::CodeExtractor::findInputsOutputs(), FindLIVLoopCondition(), findTRECandidate(), findUnwindDestinations(), FitWeights(), llvm::AMDGPULibCalls::fold(), FoldCondBranchOnPHI(), FoldTwoEntryPHINode(), llvm::formLCSSAForInstructions(), llvm::gatherUnrollingPreferences(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::MMIAddrLabelMap::getAddrLabelSymbolToEmit(), llvm::CallBase::getCaller(), getCommonReturnValue(), getComparePred(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), getDebugLocString(), llvm::TargetLoweringBase::getDefaultSafeStackPointerLocation(), llvm::MemoryDependenceResults::getDependency(), getDescription(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getEstimatedNumberOfCaseClusters(), llvm::Trace::getFunction(), llvm::Instruction::getFunction(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::TargetLoweringBase::getIRStackGuard(), llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), GetLocation(), getModule(), llvm::DOTGraphTraits< BoUpSLP * >::getNodeAttributes(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), getOnlyLiveSuccessor(), getParameterABIAttributes(), llvm::CallSiteBase<>::getParent(), getParentPad(), GetPointerOperand(), getPointerOperands(), llvm::getPtrStride(), getReductionIntrinsic(), llvm::SCEVExpander::getRelatedExistingExpansion(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), getSignature(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), getSubprogram(), getSuccPad(), llvm::HexagonTargetLowering::getTgtMemIntrinsic(), getTrueOrFalseValue(), llvm::ARMTTIImpl::getUnrollingPreferences(), getValueSymbolTable(), getVarName(), handleEndBlock(), HandleInlinedEHPad(), HandleInlinedLandingPad(), handlePhiDef(), hasProfileData(), hasSameExtUse(), INITIALIZE_PASS(), llvm::InlineFunction(), llvm::DivergenceAnalysis::inRegion(), insertCall(), llvm::insertDebugValuesForPHIs(), InsertSafepointPoll(), insertSinCosCall(), instrumentMaskedLoadOrStore(), llvm::isAllocaPromotable(), isAlwaysFoldable(), isCallPromotable(), isDynamicConstant(), isExplicitVecOuterLoop(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), isIgnorableInst(), llvm::isInTailCallPosition(), isLoadConditional(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), IsNonLocalValue(), isNotUsedOrFreeInLoop(), isNoWrap(), isObjectDereferencedInBlock(), isOnlyReachableViaThisEdge(), isPointerValueDeadOnEntryToFunction(), llvm::isPotentiallyReachable(), isPromotedInstructionLegal(), llvm::RecurrenceDescriptor::isReductionPHI(), isReportingError(), llvm::AllocaInst::isStaticAlloca(), llvm::TargetLoweringBase::isSuitableForJumpTable(), llvm::LoopVectorizationLegality::isUniform(), llvm::AMDGPULibCalls::isUnsafeMath(), isValidCandidateForColdCC(), isZero(), LLVMGetNextBasicBlock(), LLVMGetPreviousBasicBlock(), LLVMInsertBasicBlockInContext(), llvm::BlockAddress::lookup(), llvm::CallLowering::lowerCall(), llvm::SelectionDAGBuilder::LowerCallTo(), LowerInterruptReturn(), llvm::ARMTargetLowering::makeDMB(), llvm::AMDGPUSubtarget::makeLIDRangeMetadata(), llvm::HexagonTargetLowering::mayBeEmittedAsTailCall(), llvm::SITargetLowering::mayBeEmittedAsTailCall(), maybePrintComdat(), mayLoopAccessLocation(), mayUsePostIncMode(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), mergeCleanupPad(), moveAfter(), moveBefore(), needsRuntimeRegistrationOfSectionRange(), NegateValue(), optimizeSQRT(), llvm::peelLoop(), PerformHeapAllocSRoA(), performMaskedAtomicOp(), placeSplitBlockCarefully(), populateWorklist(), llvm::PrepareToSplitEntryBlock(), llvm::LegacyDivergenceAnalysis::print(), llvm::MemoryDepChecker::Dependence::print(), llvm::Value::print(), printIRBlockReference(), llvm::JumpThreadingPass::ProcessBlock(), llvm::LoopVectorizePass::processLoop(), processLoopInVPlanNativePath(), promoteSingleBlockAlloca(), ReduceLoopStrength(), llvm::AssumptionCache::registerAssumption(), removeFromParent(), RemoveInstInputs(), removeUndefIntroducingPredecessor(), replaceAllUsesOfWithIn(), replaceConstantExprOp(), replaceExtractElements(), ReplaceUsesOfWith(), reportLoadElim(), RetagMask(), llvm::SSAUpdaterBulk::RewriteAllUses(), RewriteUsesOfClonedInstructions(), llvm::LoopAccessInfoPrinterPass::run(), llvm::IRCEPass::run(), llvm::LoopRotatePass::run(), llvm::IndVarSimplifyPass::run(), llvm::LoopDataPrefetchPass::run(), llvm::SimpleLoopUnswitchPass::run(), llvm::IVUsersWrapperPass::runOnLoop(), scaleWeights(), llvm::setProfMetadata(), llvm::AArch64TTIImpl::shouldConsiderAddressTypePromotion(), shouldConvert(), llvm::CaptureTracker::shouldExplore(), shouldGuaranteeTCO(), ShrinkDemandedConstant(), SimplifyCondBranchToCondBranch(), SimplifyIndirectBrOnSelect(), simplifyLoopInst(), simplifyRelocatesOffABase(), sinkLoopInvariantInstructions(), llvm::sinkRegion(), llvm::BasicBlockPass::skipBasicBlock(), llvm::LoopPass::skipLoop(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::fuzzerop::splitBlockDescriptor(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), SwitchToLookupTable(), llvm::JumpThreadingPass::ThreadEdge(), tryToElideArgumentCopy(), TryToMergeLandingPad(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), llvm::JumpThreadingPass::UnfoldSelectInstr(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchBestCondition(), UpdateAnalysisInformation(), updateOperand(), useFuncSeen(), UseTlsOffset(), versionCallSite(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitLandingPadInst(), llvm::InnerLoopVectorizer::widenInstruction(), and ~BasicBlock().

◆ getParent() [2/2]

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

Definition at line 108 of file BasicBlock.h.

References getModule().

◆ getSinglePredecessor() [1/2]

const BasicBlock * BasicBlock::getSinglePredecessor ( ) const

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

If this basic block has a single predecessor block, return the block, otherwise return a null pointer.

Otherwise return a null pointer.

Definition at line 234 of file BasicBlock.cpp.

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

Referenced by allPredecessorsComeFromSameSource(), assertBranchOrSelectConditionHoisted(), CanPropagatePredecessorsForPHIs(), CanProveNotTakenFirstIteration(), canSafelyUnrollMultiExitLoop(), llvm::CloneAndPruneIntoFromInst(), llvm::collectCmpOps(), createCallInst(), llvm::createCodeGenPreparePass(), detectShiftUntilZeroIdiom(), llvm::DominatorTree::dominates(), llvm::VPPredInstPHIRecipe::execute(), llvm::VPlan::execute(), FindPHIForConditionForwarding(), llvm::foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), getFirstInsertionPt(), llvm::GetIfCondition(), getSinglePredecessor(), handlePhiDef(), llvm::isImpliedByDomCondition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isOnlyReachableViaThisEdge(), llvm::isValidAssumeForContext(), llvm::MergeBasicBlockIntoOnlyPred(), mergeBlocksIntoPredecessors(), mergeCleanupPad(), mergeConditionalStores(), mergeConditionalStoreToAddress(), llvm::MemorySSAUpdater::moveAllAfterMergeBlocks(), false::LibCallsShrinkWrap::perform(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessGuards(), llvm::JumpThreadingPass::ProcessImpliedCondition(), processUGT_ADDCST_ADD(), recordConditions(), ReduceSwitchRange(), removeUndefIntroducingPredecessor(), replaceAllUsesOfWithIn(), llvm::InstCombiner::replacedSelectWithOperand(), ReplaceUsesOfWith(), reportMayClobberedLoad(), llvm::SpeculativeExecutionPass::runImpl(), shouldInstrumentBlock(), shouldRotateLoopExitingLatch(), SimplifyIndirectBrOnSelect(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), simplifySuspendPoint(), llvm::SplitEdge(), and tryToMoveFreeBeforeNullTest().

◆ getSinglePredecessor() [2/2]

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

Definition at line 223 of file BasicBlock.h.

References getSinglePredecessor(), and getUniquePredecessor().

◆ getSingleSuccessor() [1/2]

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 269 of file BasicBlock.cpp.

References E, SI, llvm::succ_begin(), and llvm::succ_end().

Referenced by llvm::createCodeGenPreparePass(), ensureValueAvailableInSuccessor(), llvm::VPlan::execute(), getSingleSuccessor(), getUniquePredecessor(), mergeBlocksIntoPredecessors(), mergeConditionalStores(), false::LibCallsShrinkWrap::perform(), llvm::SpeculativeExecutionPass::runImpl(), and llvm::sinkRegion().

◆ getSingleSuccessor() [2/2]

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

Definition at line 251 of file BasicBlock.h.

References getSingleSuccessor(), and getUniqueSuccessor().

◆ getSublistAccess()

static InstListType BasicBlock::* llvm::BasicBlock::getSublistAccess ( Instruction )
inlinestatic

Returns a pointer to a member of the instruction list.

Definition at line 338 of file BasicBlock.h.

References getValueSymbolTable().

◆ getTerminatingDeoptimizeCall() [1/2]

const CallInst * BasicBlock::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.

Otherwise, returns null.

Definition at line 175 of file BasicBlock.cpp.

References llvm::dyn_cast(), llvm::Intrinsic::experimental_deoptimize, and F().

Referenced by findUnwindDestinations(), getTerminatingDeoptimizeCall(), getTerminator(), and llvm::InlineFunction().

◆ getTerminatingDeoptimizeCall() [2/2]

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

Definition at line 132 of file BasicBlock.h.

References getTerminatingDeoptimizeCall(), and getTerminatingMustTailCall().

◆ getTerminatingMustTailCall() [1/2]

const CallInst * BasicBlock::getTerminatingMustTailCall ( ) const

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 144 of file BasicBlock.cpp.

References llvm::dyn_cast(), llvm::User::getOperand(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getPrevNode(), and llvm::ReturnInst::getReturnValue().

Referenced by getTerminatingDeoptimizeCall(), getTerminatingMustTailCall(), and llvm::InlineFunction().

◆ getTerminatingMustTailCall() [2/2]

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

Definition at line 141 of file BasicBlock.h.

References getFirstNonPHI(), and getTerminatingMustTailCall().

◆ getTerminator() [1/2]

const Instruction * BasicBlock::getTerminator ( ) const

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

Definition at line 138 of file BasicBlock.cpp.

Referenced by AddReachableCodeToWorklist(), allPredecessorsComeFromSameSource(), asmClobbersCTR(), assertBranchOrSelectConditionHoisted(), llvm::LoopVectorizationLegality::blockNeedsPredication(), BrPHIToSelect(), llvm::CFGMST< Edge, BBInfo >::buildEdges(), llvm::calculateWasmEHInfo(), canExpandBackedgeTakenCount(), canFoldIVIncExpr(), llvm::LoopVectorizationLegality::canFoldTailByMasking(), canRenameComdat(), canSinkInstructions(), canSplitPredecessors(), llvm::changeToUnreachable(), checkBasicSSA(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunction(), llvm::CloneFunctionInto(), CloneLoop(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::collectCmpOps(), llvm::LoopVectorizationPlanner::collectTriviallyDeadInstructions(), llvm::colorEHFunclets(), llvm::FunctionComparator::compare(), ComputePostOrders(), llvm::ComputeSpeculationCost(), computeUnlikelySuccessors(), ConnectEpilog(), ConnectProlog(), llvm::ConstantFoldTerminator(), containsSafePHI(), ConvertToSInt(), copyMustTailReturn(), createCallInst(), createCast(), llvm::createCodeGenPreparePass(), llvm::VPRecipeBuilder::createEdgeMask(), createFFSIntrinsic(), CreateGCRelocates(), llvm::createLICMPass(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemMoveLoop(), createMemSetLoop(), llvm::createObjCARCOptPass(), createPHIsForSplitLoopExit(), CreatePrologue(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::VPBlockBase::deleteCFG(), llvm::DemotePHIToStack(), despeculateCountZeros(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), doCallSiteSplitting(), DominatesMergePoint(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), ehAwareSplitEdge(), eliminateDeadStores(), eliminateDeadSwitchCases(), eliminateTailRecursion(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), llvm::InnerLoopVectorizer::emitMinimumIterationCountCheck(), llvm::InnerLoopVectorizer::emitSCEVChecks(), enableCallSafepoints(), EvaluateConstantChrecAtConstant(), llvm::Evaluator::EvaluateFunction(), llvm::VPBranchOnMaskRecipe::execute(), llvm::VPBasicBlock::execute(), llvm::VPlan::execute(), llvm::CodeExtractor::extractCodeRegion(), llvm::FastISel::fastEmitZExtFromI1(), findBasePointer(), findIBRPredecessor(), llvm::CodeExtractor::findInputsOutputs(), findInsertPointAfter(), FindLoopCounter(), FindMostPopularDest(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), FindPHIForConditionForwarding(), findUnconditionalPreds(), FitWeights(), llvm::InnerLoopVectorizer::fixFirstOrderRecurrence(), llvm::InnerLoopVectorizer::fixLCSSAPHIs(), llvm::InnerLoopVectorizer::fixReduction(), llvm::InnerLoopVectorizer::fixupIVUsers(), llvm::foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), foldGuardedRotateToFunnelShift(), foldOperationIntoPhiValue(), foldReturnAndProcessPred(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), llvm::ScalarEvolution::forgetValue(), genLoopLimit(), GetBestDestForJumpOnUndef(), getBranchHint(), getBranchInsertPoint(), llvm::InnerLoopVectorizer::getBroadcastInstrs(), getConstantValue(), getEdgeValueLocal(), getEHPadFromPredecessor(), llvm::GetIfCondition(), getInductionVariable(), getInsertPointForUses(), getIrrLoopHeaderWeight(), getJumpThreadDuplicationCost(), llvm::getLoopEstimatedTripCount(), getLoopTest(), getModule(), getNumBytes(), llvm::RegionTraits< Function >::getNumSuccessors(), getOnlyLiveSuccessor(), llvm::InnerLoopVectorizer::getOrCreateTripCount(), llvm::InnerLoopVectorizer::getOrCreateVectorTripCount(), getParentPad(), GetPointerOperand(), getSignature(), llvm::GetSuccessorNumber(), getSuccPad(), getSuccState(), getTerminator(), getTrueOrFalseValue(), handleFinalSuspend(), handleFree(), handlePhiDef(), hasOnlyUniformBranches(), hasProfileData(), hasZeroSignBit(), hoist(), llvm::hoistAllInstructionsInto(), llvm::SCEVExpander::hoistIVInc(), llvm::hoistRegion(), INITIALIZE_PASS(), llvm::InlineFunction(), insertBoundsCheck(), llvm::DIBuilder::insertDeclare(), llvm::InsertPreheaderForLoop(), insertSpills(), insertUniqueBackedgeBlock(), inversePermutation(), is_empty(), IsAcceptableTarget(), isAlwaysFoldable(), isChainSelectCmpBranch(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(), isIgnorableInst(), llvm::isImpliedByDomCondition(), IsIncrementNUW(), llvm::isInTailCallPosition(), isLegalToHoistInto(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isLoopDead(), isLoopInvariant(), isNotUsedOrFreeInLoop(), isOnlyReachableViaThisEdge(), isPromotedInstructionLegal(), isSafeAndProfitableToSinkLoad(), isSafePHIToSpeculate(), llvm::BasicBlockEdge::isSingleEdge(), isUnconditionalBranch(), llvm::isUniformLoop(), isUniformlyReached(), makeBitReverse(), llvm::Loop::makeLoopInvariant(), MarkBlocksLiveIn(), matchPair(), mayLoopAccessLocation(), mayUsePostIncMode(), llvm::LoopVectorizationCostModel::memoryInstructionCanBeWidened(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeConditionalStoreToAddress(), mergeEmptyReturnBlocks(), moveBBContents(), moveLCSSAPhis(), llvm::EscapeEnumerator::Next(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), optimizeSQRT(), patchAndReplaceAllUsesWith(), llvm::peelLoop(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateWithInsertion(), prepareForSplit(), llvm::JumpThreadingPass::ProcessBlock(), ProcessBlock(), llvm::JumpThreadingPass::ProcessBranchOnPHI(), llvm::JumpThreadingPass::ProcessImpliedCondition(), llvm::JumpThreadingPass::ProcessThreadableEdges(), processUGT_ADDCST_ADD(), llvm::promoteLoopAccessesToScalars(), llvm::GVNHoist::rank(), recordCondition(), relocationViaAlloca(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::MemorySSAUpdater::removeBlocks(), removeEmptyCleanup(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceAllUsesOfWithIn(), replaceConstantExprOp(), llvm::InstCombiner::replacedSelectWithOperand(), replaceSuccessorsPhiUsesWith(), reportMayClobberedLoad(), llvm::IRCEPass::run(), llvm::LoopPredicationPass::run(), llvm::SpeculativeExecutionPass::runImpl(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scaleWeights(), setBranchWeights(), shouldConvert(), llvm::StackProtector::shouldEmitSDCheck(), llvm::CaptureTracker::shouldExplore(), shouldInstrumentBlock(), shouldRotateLoopExitingLatch(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), SimplifyIndirectBrOnSelect(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), SinkCast(), llvm::sinkRegion(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), SpeculativelyExecuteBB(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::fuzzerop::splitBlockDescriptor(), splitCallSite(), llvm::SplitCriticalEdge(), SplitCriticalSideEffectEdges(), llvm::SplitEdge(), llvm::SplitIndirectBrCriticalEdges(), llvm::SplitLandingPadPredecessors(), llvm::succ_begin(), llvm::succ_end(), llvm::JumpThreadingPass::ThreadEdge(), truncateIVUse(), tryToElideArgumentCopy(), TryToMergeLandingPad(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSinkInstruction(), llvm::JumpThreadingPass::TryToUnfoldSelect(), tryUnmergingGEPsAcrossIndirectBr(), turnGuardIntoBranch(), turnToExplicitForm(), llvm::JumpThreadingPass::UnfoldSelectInstr(), unifyReturnBlockSet(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchAllTrivialConditions(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::MemorySSAUpdater::updateForClonedBlockIntoPred(), updatePredecessorProfileMetadata(), llvm::LoopVersioning::versionLoop(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitPHINode(), llvm::InstCombiner::visitStoreInst(), and llvm::InnerLoopVectorizer::widenIntOrFpInduction().

◆ getTerminator() [2/2]

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

Definition at line 123 of file BasicBlock.h.

References getTerminatingDeoptimizeCall(), and getTerminator().

◆ getUniquePredecessor() [1/2]

const BasicBlock * BasicBlock::getUniquePredecessor ( ) const

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

If this basic block has a unique predecessor block, return the block, otherwise return a null pointer.

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).

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 247 of file BasicBlock.cpp.

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

Referenced by areLoopExitPHIsSupported(), llvm::createCodeGenPreparePass(), findLocationForEntrySafepoint(), getSinglePredecessor(), getUniquePredecessor(), IsAcceptableTarget(), isDynamicConstant(), isZero(), makeStatepointExplicitImpl(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), normalizeForInvokeSafepoint(), and reuseTableCompare().

◆ getUniquePredecessor() [2/2]

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

◆ getUniqueSuccessor() [1/2]

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 277 of file BasicBlock.cpp.

References E, SI, llvm::succ_begin(), and llvm::succ_end().

Referenced by getSingleSuccessor(), getUniqueSuccessor(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), and TryToMergeLandingPad().

◆ getUniqueSuccessor() [2/2]

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

Definition at line 261 of file BasicBlock.h.

References getUniqueSuccessor().

◆ getValueSymbolTable()

ValueSymbolTable * BasicBlock::getValueSymbolTable ( )

Returns a pointer to the symbol table if one exists.

Definition at line 27 of file BasicBlock.cpp.

References F(), and getParent().

Referenced by getSublistAccess().

◆ hasAddressTaken()

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

◆ hasNPredecessors()

bool BasicBlock::hasNPredecessors ( unsigned  N) const

◆ hasNPredecessorsOrMore()

bool BasicBlock::hasNPredecessorsOrMore ( unsigned  N) const

Return true if this block has N predecessors or more.

Definition at line 265 of file BasicBlock.cpp.

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

Referenced by getUniquePredecessor(), and TryToMergeLandingPad().

◆ insertInto()

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.

Precondition
getParent() is nullptr.

Definition at line 54 of file BasicBlock.cpp.

References assert(), llvm::Function::getBasicBlockList(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::push_back().

Referenced by getContext(), and getFirstInsertionPt().

◆ instructionsWithoutDebug() [1/2]

iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > BasicBlock::instructionsWithoutDebug ( ) const

◆ instructionsWithoutDebug() [2/2]

iterator_range< filter_iterator< BasicBlock::iterator, std::function< bool(Instruction &)> > > BasicBlock::instructionsWithoutDebug ( )

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

Definition at line 104 of file BasicBlock.cpp.

References I, and llvm::make_filter_range().

◆ isEHPad()

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

◆ isLandingPad()

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.

I.e., it's the destination of the 'unwind' edge of an invoke instruction.

Definition at line 468 of file BasicBlock.cpp.

References getFirstNonPHI().

Referenced by createPHIsForSplitLoopExit(), isEHPad(), mayUsePostIncMode(), llvm::SplitBlockPredecessors(), llvm::SplitLandingPadPredecessors(), and llvm::JumpThreadingPass::ThreadEdge().

◆ isLegalToHoistInto()

bool BasicBlock::isLegalToHoistInto ( ) const

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

Definition at line 384 of file BasicBlock.cpp.

References assert(), and getTerminator().

Referenced by getLandingPadInst().

◆ moveAfter()

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.

Unlink this basic block from its current function and insert it into the function that MovePos lives in, right after MovePos.

Definition at line 128 of file BasicBlock.cpp.

References llvm::Function::getBasicBlockList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >::getIterator(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::splice().

Referenced by CreatePrologue(), getFirstInsertionPt(), llvm::MergeBasicBlockIntoOnlyPred(), placeSplitBlockCarefully(), and llvm::JumpThreadingPass::ThreadEdge().

◆ moveBefore()

void BasicBlock::moveBefore ( BasicBlock MovePos)

Unlink this basic block from its current function and insert it into the function that MovePos lives in, right before MovePos.

Unlink this basic block from its current function and insert it into the function that MovePos lives in, right before MovePos.

Definition at line 121 of file BasicBlock.cpp.

References llvm::Function::getBasicBlockList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >::getIterator(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::splice().

Referenced by buildClonedLoopBlocks(), getFirstInsertionPt(), mayUsePostIncMode(), shouldRotateLoopExitingLatch(), and llvm::sinkRegion().

◆ operator=()

BasicBlock& llvm::BasicBlock::operator= ( const BasicBlock )
delete

◆ phis() [1/2]

iterator_range<const_phi_iterator> llvm::BasicBlock::phis ( ) const
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 325 of file BasicBlock.h.

Referenced by AddPHINodeEntriesForMappedBlock(), AddPredecessorToBlock(), areLoopExitPHIsSupported(), assertBranchOrSelectConditionHoisted(), llvm::canIfConvertPHINodes(), ConnectEpilog(), containsSafePHI(), ConvertToSInt(), llvm::createCodeGenPreparePass(), createPHIsForSplitLoopExit(), llvm::DeleteDeadPHIs(), deleteLoopIfDead(), llvm::GVNExpression::Expression::dump(), llvm::FastISel::fastEmitZExtFromI1(), findInnerReductionPhi(), FindPHIForConditionForwarding(), llvm::InnerLoopVectorizer::fixCrossIterationPHIs(), llvm::InnerLoopVectorizer::fixLCSSAPHIs(), llvm::InnerLoopVectorizer::fixReduction(), fixupPHINodeForNormalDest(), fixupPHINodeForUnwindDest(), ForwardSwitchConditionToPHI(), getOtherIncomingValue(), GetPointerOperand(), getSuccPad(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::DivergenceAnalysis::inRegion(), isEpilogProfitable(), isExistingPhi(), IsIncrementNUW(), isKnownTypeIdMember(), isLoopDead(), isProfitableChain(), llvm::LoopVectorizationLegality::isUniform(), MatchReductions(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), processHeaderPhiOperands(), PushLoopPHIs(), removeUndefIntroducingPredecessor(), replaceAllUsesOfWithIn(), llvm::SCEVExpander::replaceCongruentIVs(), rewritePHINodesForExitAndUnswitchedBlocks(), rewritePHINodesForUnswitchedExitBlock(), scaleWeights(), scanPHIsAndUpdateValueMap(), shouldRotateLoopExitingLatch(), SimplifyCondBranchToCondBranch(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::fuzzerop::splitBlockDescriptor(), splitCallSite(), tryToElideArgumentCopy(), llvm::UnrollAndJamLoop(), and updateIncomingBlock().

◆ phis() [2/2]

iterator_range< BasicBlock::phi_iterator > BasicBlock::phis ( )

Definition at line 291 of file BasicBlock.cpp.

References begin(), llvm::dyn_cast(), empty(), and P.

◆ rbegin() [1/2]

reverse_iterator llvm::BasicBlock::rbegin ( )
inline

◆ rbegin() [2/2]

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

Definition at line 275 of file BasicBlock.h.

◆ removeFromParent()

void BasicBlock::removeFromParent ( )

◆ removePredecessor()

void BasicBlock::removePredecessor ( BasicBlock Pred,
bool  DontDeleteUselessPHIs = false 
)

Notify the BasicBlock that the predecessor Pred is no longer able to reach it.

This method is used to notify a BasicBlock that the specified Predecessor of the block is no longer able to reach it.

This is actually not used to update the Predecessor list, but is actually used to update the PHI nodes that reside in the block. Note that this should be called while the predecessor still refers to this block.

Definition at line 302 of file BasicBlock.cpp.

References assert(), begin(), llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), llvm::find(), front(), llvm::UndefValue::get(), llvm::PHINode::getIncomingBlock(), getInstList(), llvm::PHINode::getNumIncomingValues(), llvm::PHINode::hasConstantValue(), llvm::Value::hasNUsesOrMore(), Other, llvm::iplist_impl< IntrusiveListT, TraitsT >::pop_front(), llvm::pred_begin(), llvm::pred_end(), llvm::PHINode::removeIncomingValue(), and llvm::Value::replaceAllUsesWith().

Referenced by changeToCall(), classof(), llvm::ConstantFoldTerminator(), FitWeights(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), HandleInlinedLandingPad(), markAliveBlocks(), mergeCleanupPad(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessImpliedCondition(), processSwitch(), ReduceSwitchRange(), llvm::RemovePredecessorAndSimplify(), RemoveSwitchAfterSelectConversion(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), setBranchWeights(), shouldRotateLoopExitingLatch(), SimplifyCondBranchToTwoReturns(), SimplifyTerminatorOnSelect(), llvm::SplitCriticalEdge(), SwitchToLookupTable(), llvm::JumpThreadingPass::ThreadEdge(), and unswitchTrivialSwitch().

◆ rend() [1/2]

reverse_iterator llvm::BasicBlock::rend ( )
inline

◆ rend() [2/2]

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

Definition at line 277 of file BasicBlock.h.

◆ replaceSuccessorsPhiUsesWith()

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 446 of file BasicBlock.cpp.

References llvm::dyn_cast(), llvm::PHINode::getBasicBlockIndex(), getTerminator(), llvm::ARM_PROC::IE, llvm::PHINode::setIncomingBlock(), and llvm::successors().

Referenced by hasAddressTaken().

◆ size()

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

◆ splitBasicBlock() [1/2]

BasicBlock * BasicBlock::splitBasicBlock ( iterator  I,
const Twine BBName = "" 
)

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

This splits a basic block into two at the specified instruction.

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 BasicBlock 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.

Note that all instructions BEFORE the specified iterator stay as part of the original basic block, an unconditional branch is added to the new BB, and the rest of the instructions in the BB are moved to the new BB, including the old terminator. This invalidates the 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).

Definition at line 408 of file BasicBlock.cpp.

References assert(), Create(), llvm::BranchInst::Create(), E, end(), getContext(), getInstList(), llvm::ilist_node_with_parent< BasicBlock, Function >::getNextNode(), getParent(), getTerminator(), I, phis(), llvm::Instruction::setDebugLoc(), llvm::succ_begin(), llvm::succ_end(), and llvm::Successor.

Referenced by llvm::changeToInvokeAndSplitBasicBlock(), classof(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemSetLoop(), CreatePrologue(), createResumeEntryBlock(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), despeculateCountZeros(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), llvm::InnerLoopVectorizer::emitMinimumIterationCountCheck(), llvm::InnerLoopVectorizer::emitSCEVChecks(), llvm::VPlan::execute(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), getOnlyLiveSuccessor(), getTrueOrFalseValue(), handleFinalSuspend(), INITIALIZE_PASS(), llvm::InlineFunction(), insertBoundsCheck(), insertSpills(), isKnownTypeIdMember(), PerformHeapAllocSRoA(), performMaskedAtomicOp(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), shouldKeepInEntry(), SimplifyBranchOnICmpChain(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), and llvm::fuzzerop::splitBlockDescriptor().

◆ splitBasicBlock() [2/2]

BasicBlock* llvm::BasicBlock::splitBasicBlock ( Instruction I,
const Twine BBName = "" 
)
inline

Friends And Related Function Documentation

◆ BlockAddress

friend class BlockAddress
friend

Definition at line 64 of file BasicBlock.h.

◆ SymbolTableListTraits< BasicBlock >

friend class SymbolTableListTraits< BasicBlock >
friend

Definition at line 65 of file BasicBlock.h.


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