LLVM  mainline
Public Types | Public Member Functions | Static Public Member Functions | Friends
llvm::BasicBlock Class Reference

LLVM Basic Block Representation. More...

#include <BasicBlock.h>

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

List of all members.

Public Types

typedef SymbolTableList
< Instruction
InstListType
typedef InstListType::iterator iterator
 Instruction iterators...
typedef
InstListType::const_iterator 
const_iterator
typedef
InstListType::reverse_iterator 
reverse_iterator
typedef
InstListType::const_reverse_iterator 
const_reverse_iterator

Public Member Functions

LLVMContextgetContext () const
 Get the context in which this basic block lives.
 ~BasicBlock () override
const FunctiongetParent () const
 Return the enclosing method, or null if none.
FunctiongetParent ()
const ModulegetModule () const
 Return the module owning the function this basic block belongs to, or nullptr it the function does not have a module.
ModulegetModule ()
TerminatorInstgetTerminator ()
 Returns the terminator instruction if the block is well formed or null if the block is not well formed.
const TerminatorInstgetTerminator () const
CallInstgetTerminatingMustTailCall ()
 Returns the call instruction marked 'musttail' prior to the terminating return instruction of this basic block, if such a call is present.
const CallInstgetTerminatingMustTailCall () const
InstructiongetFirstNonPHI ()
 Returns a pointer to the first instruction in this block that is not a PHINode instruction.
const InstructiongetFirstNonPHI () const
InstructiongetFirstNonPHIOrDbg ()
 Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic.
const InstructiongetFirstNonPHIOrDbg () const
InstructiongetFirstNonPHIOrDbgOrLifetime ()
 Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic, or a lifetime intrinsic.
const InstructiongetFirstNonPHIOrDbgOrLifetime () const
iterator getFirstInsertionPt ()
 Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI instruction.
const_iterator getFirstInsertionPt () const
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 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.
BasicBlockgetSinglePredecessor ()
 Return the predecessor of this block if it has a single predecessor block.
const BasicBlockgetSinglePredecessor () const
BasicBlockgetUniquePredecessor ()
 Return the predecessor of this block if it has a unique predecessor block.
const BasicBlockgetUniquePredecessor () const
BasicBlockgetSingleSuccessor ()
 Return the successor of this block if it has a single successor.
const BasicBlockgetSingleSuccessor () const
BasicBlockgetUniqueSuccessor ()
 Return the successor of this block if it has a unique successor.
const BasicBlockgetUniqueSuccessor () const
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 Instructionfront () const
Instructionfront ()
const Instructionback () const
Instructionback ()
const InstListTypegetInstList () const
 Return the underlying instruction list container.
InstListTypegetInstList ()
ValueSymbolTablegetValueSymbolTable ()
 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 DontDeleteUselessPHIs=false)
 Notify the BasicBlock that the predecessor Pred is no longer able to reach it.
bool canSplitPredecessors () const
BasicBlocksplitBasicBlock (iterator I, const Twine &BBName="")
 Split the basic block into two basic blocks at the specified instruction.
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.
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.
LandingPadInstgetLandingPadInst ()
 Return the landingpad instruction associated with the landing pad.
const LandingPadInstgetLandingPadInst () const

Static Public Member Functions

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

Friends

class BlockAddress
class SymbolTableListTraits< BasicBlock >

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 TerminatorInst instruction. TerminatorInst's 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 52 of file BasicBlock.h.


Member Typedef Documentation

Definition at line 82 of file BasicBlock.h.

Definition at line 84 of file BasicBlock.h.

Definition at line 56 of file BasicBlock.h.

Instruction iterators...

Definition at line 81 of file BasicBlock.h.

Definition at line 83 of file BasicBlock.h.


Constructor & Destructor Documentation

BasicBlock::~BasicBlock ( ) [override]

Member Function Documentation

Definition at line 234 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::back().

Instruction iterator methods.

Definition at line 219 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::begin().

Referenced by AddPHINodeEntriesForMappedBlock(), AddPredecessorToBlock(), AddReachableCodeToWorklist(), llvm::CodeMetrics::analyzeBasicBlock(), BlockIsSimpleEnoughToThreadThrough(), llvm::bypassSlowDivision(), llvm::Interpreter::callFunction(), canIfConvertPHINodes(), CanPropagatePredecessorsForPHIs(), checkCSEInPredecessor(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneBasicBlock(), CloneLoopBlocks(), llvm::computeLICMSafetyInfo(), containsSafePHI(), createPHIsForSplitLoopExit(), cse(), cxxDtorIsEmpty(), llvm::DeleteDeadPHIs(), llvm::DominatorTree::dominates(), dropAllReferences(), llvm::EliminateDuplicatePHINodes(), ensureValueAvailableInSuccessor(), llvm::expandAtomicRMWToCmpXchg(), llvm::CodeExtractor::extractCodeRegion(), llvm::FindAvailableLoadedValue(), llvm::objcarc::FindDependencies(), FindInitTrampolineFromBB(), llvm::CodeExtractor::findInputsOutputs(), FindLoopCounter(), FindPHIForConditionForwarding(), findPHIToPartitionLoops(), llvm::SSAUpdaterTraits< SSAUpdater >::FindPredecessorBlocks(), findRetainForStoreStrongContraction(), fixPhis(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldSingleEntryPHINodes(), FoldTwoEntryPHINode(), functionHasLines(), generateUnsignedDivisionCode(), llvm::Loop::getCanonicalInductionVariable(), GetCaseResults(), llvm::MemoryDependenceAnalysis::getDependency(), llvm::GetIfCondition(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::MemoryDependenceAnalysis::getSimplePointerDependencyFrom(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleCallsInBlockInlinedThroughInvoke(), HasNoDuplicateCall(), llvm::hoistRegion(), HoistThenElseCodeToIf(), llvm::InlineFunction(), insertFastDiv(), InsertRootInitializers(), InsertSafepointPoll(), insertSinCosCall(), isBlockValidForExtraction(), isExistingPhi(), llvm::isSafeToLoadUnconditionally(), isTrivialLoopExitBlockHelper(), llvm::Value::isUsedInBasicBlock(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetPreviousInstruction(), makeStatepointExplicitImpl(), markAliveBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeEmptyReturnBlocks(), NegateValue(), normalizeForInvokeSafepoint(), PushLoopPHIs(), relocationViaAlloca(), llvm::removeAllNonTerminatorAndEHPadInstructions(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), removeUndefIntroducingPredecessor(), ReplaceWithStatepoint(), RewriteUsesOfClonedInstructions(), rotateLoop(), scanInlinedCode(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), llvm::InstCombiner::SimplifyDivRemOfSelect(), llvm::SimplifyInstructionsInBlock(), llvm::simplifyLoopIVs(), simplifyLoopLatch(), simplifyOneLoop(), llvm::sinkRegion(), SinkThenElseCodeToEnd(), llvm::SparseSolver::Solve(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), splitVectorValues(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::UnrollLoop(), UpdatePHINodes(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().

Definition at line 220 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::begin().

Definition at line 336 of file BasicBlock.cpp.

References getFirstNonPHI(), and llvm::Instruction::isEHPad().

Referenced by llvm::SplitBlockPredecessors().

static bool llvm::BasicBlock::classof ( const Value V) [inline, static]

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

Definition at line 252 of file BasicBlock.h.

References llvm::Value::getValueID().

static BasicBlock* llvm::BasicBlock::Create ( LLVMContext Context,
const Twine Name = "",
Function Parent = nullptr,
BasicBlock InsertBefore = nullptr 
) [inline, static]

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

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

Referenced by ~BasicBlock().

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

Definition at line 230 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::empty().

Referenced by llvm::DeleteDeadBlock(), and simplifyLoopLatch().

Definition at line 221 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::end().

Referenced by AddReachableCodeToWorklist(), llvm::CodeMetrics::analyzeBasicBlock(), canIfConvertPHINodes(), llvm::changeToUnreachable(), checkCSEInPredecessor(), llvm::CloneBasicBlock(), llvm::computeLICMSafetyInfo(), cse(), cxxDtorIsEmpty(), detectPopcountIdiom(), dropAllReferences(), llvm::expandAtomicRMWToCmpXchg(), llvm::objcarc::FindDependencies(), llvm::CodeExtractor::findInputsOutputs(), findSafeStoreForStoreStrongContraction(), FoldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), functionHasLines(), GetCaseResults(), getFirstInsertionPt(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), HandleCallsInBlockInlinedThroughInvoke(), HasNoDuplicateCall(), llvm::hoistRegion(), insertFastDiv(), InsertSafepointPoll(), isBlockValidForExtraction(), llvm::isInTailCallPosition(), llvm::isKnownNotFullPoison(), llvm::isPotentiallyReachable(), isSafeAndProfitableToSinkLoad(), isTrivialLoopExitBlockHelper(), llvm::Value::isUsedInBasicBlock(), isValidAssumeForContext(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetNextInstruction(), LLVMPositionBuilder(), markAliveBlocks(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), OptimizeExtractBits(), llvm::OrderedBasicBlock::OrderedBasicBlock(), passingValueIsAlwaysUndefined(), llvm::PrepareToSplitEntryBlock(), relocationViaAlloca(), RewriteUsesOfClonedInstructions(), rotateLoop(), scanOneBB(), llvm::IRBuilderBase::SetInsertPoint(), llvm::SimplifyInstructionsInBlock(), SinkCast(), SinkCmpExpression(), llvm::sinkRegion(), SinkShiftAndTruncate(), SinkThenElseCodeToEnd(), llvm::SparseSolver::Solve(), SpeculativelyExecuteBB(), splitBasicBlock(), TryToSinkInstruction(), and llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit().

Definition at line 222 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::end().

Definition at line 232 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::front().

Definition at line 152 of file BasicBlock.h.

References getFirstInsertionPt().

Definition at line 129 of file BasicBlock.h.

References getFirstNonPHI().

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

Definition at line 172 of file BasicBlock.cpp.

References I.

Referenced by EliminateDeadSwitchCases(), FindPHIForConditionForwarding(), getFirstNonPHIOrDbg(), InitializeUniqueCases(), SimplifyCondBranchToTwoReturns(), SwitchToLookupTable(), TurnSwitchRangeIntoICmp(), and llvm::InstCombiner::visitAllocaInst().

Definition at line 136 of file BasicBlock.h.

References getFirstNonPHIOrDbg().

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

References I.

Referenced by getFirstNonPHIOrDbgOrLifetime().

Definition at line 143 of file BasicBlock.h.

References getFirstNonPHIOrDbgOrLifetime().

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

Referenced by llvm::changeToUnreachable(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneBasicBlock(), CloneInstructionInExitBlock(), llvm::BinaryOperator::Create(), createCallHelper(), createInvokeHelper(), createMalloc(), llvm::DeleteDeadBlock(), llvm::Instruction::eraseFromParent(), llvm::CodeExtractor::extractCodeRegion(), FoldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), HandleCallsInBlockInlinedThroughInvoke(), HoistThenElseCodeToIf(), llvm::InlineFunction(), llvm::Instruction::insertAfter(), llvm::Instruction::insertBefore(), insertFastDiv(), llvm::IRBuilderDefaultInserter< true >::InsertHelper(), llvm::InstCombiner::InsertNewInstBefore(), insertUniqueBackedgeBlock(), llvm::Instruction::Instruction(), LdStHasDebugValue(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), moveBBContents(), llvm::Instruction::moveBefore(), llvm::Instruction::removeFromParent(), removePredecessor(), llvm::ReplaceInstWithInst(), llvm::InstCombiner::run(), llvm::UnifyFunctionExitNodes::runOnFunction(), simplifyLoopLatch(), SinkThenElseCodeToEnd(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitLandingPadPredecessors(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::UnrollLoop(), and llvm::InstCombiner::visitGetElementPtrInst().

Definition at line 241 of file BasicBlock.h.

Return the landingpad instruction associated with the landing pad.

Definition at line 428 of file BasicBlock.cpp.

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

Referenced by makeStatepointExplicitImpl(), and llvm::SplitLandingPadPredecessors().

Definition at line 431 of file BasicBlock.cpp.

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

Definition at line 120 of file BasicBlock.cpp.

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

Return the enclosing method, or null if none.

Definition at line 99 of file BasicBlock.h.

Referenced by AddAlignmentAssumptions(), llvm::AddLandingPadInfo(), addNoRecurseAttrsTopDown(), llvm::CodeMetrics::analyzeBasicBlock(), calculateSEHStateNumbers(), callIntrinsic(), llvm::changeToUnreachable(), llvm::CloneBasicBlock(), CloneLoopBlocks(), llvm::cloneLoopWithPreheader(), llvm::CodeMetrics::collectEphemeralValues(), computeKnownBitsFromAssume(), llvm::computeLICMSafetyInfo(), llvm::SanitizerStatReport::create(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateGCRelocate(), llvm::IRBuilderBase::CreateGCResult(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreateGlobalString(), llvm::IRBuilder< true, TargetFolder >::CreateInvariantGroupBarrier(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), createPopcntIntrinsic(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::DominatorTree::dominates(), llvm::InstCombiner::dominatesAllUses(), llvm::AArch64TargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::ARMTargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::HexagonTargetLowering::emitLoadLinked(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::HexagonTargetLowering::emitStoreConditional(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), eraseFromParent(), llvm::expandAtomicRMWToCmpXchg(), llvm::CodeExtractor::extractCodeRegion(), FindPotentialTailCall(), FoldCondBranchOnPHI(), gatherUnrollingPreferences(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::MMIAddrLabelMap::getAddrLabelSymbolToEmit(), getCommonReturnValue(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), llvm::MemoryDependenceAnalysis::getDependency(), llvm::Trace::getFunction(), llvm::Instruction::getFunction(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), getModule(), llvm::DOTGraphTraits< DomTreeNode * >::getNodeLabel(), llvm::DOTGraphTraits< RegionNode * >::getNodeLabel(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::AArch64TargetLowering::getSafeStackPointerLocation(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), llvm::MemoryDependenceAnalysis::getSimplePointerDependencyFrom(), getValueSymbolTable(), HandleByValArgument(), HandleInlinedEHPad(), HandleInlinedLandingPad(), llvm::InlineFunction(), insertFastDiv(), InsertSafepointPoll(), insertSinCosCall(), isDynamicConstant(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), llvm::isInTailCallPosition(), isNotUsedInLoop(), llvm::isPotentiallyReachable(), llvm::RecurrenceDescriptor::isReductionPHI(), llvm::isSafeToSpeculativelyExecute(), llvm::AllocaInst::isStaticAlloca(), LLVMGetNextBasicBlock(), LLVMGetPreviousBasicBlock(), LLVMInsertBasicBlockInContext(), llvm::BlockAddress::lookup(), llvm::ARMTargetLowering::makeDMB(), llvm::HexagonTargetLowering::mayBeEmittedAsTailCall(), llvm::MergeBasicBlockIntoOnlyPred(), moveAfter(), moveBefore(), NegateValue(), parentFunctionOfValue(), PerformHeapAllocSRoA(), placeSplitBlockCarefully(), llvm::PrepareToSplitEntryBlock(), llvm::DivergenceAnalysis::print(), llvm::Value::print(), llvm::MIPrinter::printIRBlockReference(), llvm::AssumptionCache::registerAssumption(), removeFromParent(), replaceConstantExprOp(), replaceExtractElements(), scanOneBB(), SimplifyCondBranchToCondBranch(), simplifyRelocatesOffABase(), llvm::LoopPass::skipOptnoneFunction(), llvm::BasicBlockPass::skipOptnoneFunction(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), splitVectorValues(), SwitchToLookupTable(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TryToSinkInstruction(), tryToUnrollLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), UpdateCallGraphAfterInlining(), useFuncSeen(), ValueDominatesPHI(), llvm::vectorizeBasicBlock(), llvm::DominatorTree::verifyDomTree(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitLandingPadInst(), and ~BasicBlock().

Definition at line 100 of file BasicBlock.h.

Definition at line 183 of file BasicBlock.h.

References getSinglePredecessor().

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

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

Referenced by ensureValueAvailableInSuccessor(), getSingleSuccessor(), and mergeConditionalStores().

Definition at line 203 of file BasicBlock.h.

References getSingleSuccessor().

static InstListType BasicBlock::* llvm::BasicBlock::getSublistAccess ( Instruction ) [inline, static]

Returns a pointer to a member of the instruction list.

Definition at line 244 of file BasicBlock.h.

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

References llvm::iplist< NodeTy, Traits >::back(), llvm::dyn_cast(), llvm::iplist< NodeTy, Traits >::empty(), llvm::iplist< NodeTy, Traits >::front(), llvm::User::getOperand(), llvm::ilist_node_with_parent< NodeTy, ParentTy >::getPrevNode(), and llvm::ReturnInst::getReturnValue().

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

Definition at line 118 of file BasicBlock.h.

References getTerminatingMustTailCall().

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

Definition at line 124 of file BasicBlock.cpp.

References llvm::iplist< NodeTy, Traits >::back(), llvm::dyn_cast(), and llvm::iplist< NodeTy, Traits >::empty().

Referenced by AddReachableCodeToWorklist(), llvm::CodeMetrics::analyzeBasicBlock(), BlockIsSimpleEnoughToThreadThrough(), canExpandBackedgeTakenCount(), checkBasicSSA(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunctionInto(), CloneLoopBlocks(), llvm::colorEHFunclets(), computeKnownBitsFromDominatingCondition(), ConnectProlog(), llvm::ConstantFoldTerminator(), createPHIsForSplitLoopExit(), llvm::DeleteDeadBlock(), llvm::DemotePHIToStack(), despeculateCountZeros(), detectPopcountIdiom(), DominatesMergePoint(), EliminateDeadSwitchCases(), findBasePointer(), FindLoopCounter(), FindMostPopularDest(), FindPHIForConditionForwarding(), FindUnconditionalPreds(), FoldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), genLoopLimit(), GetBestDestForJumpOnUndef(), getBranchHint(), llvm::DOTGraphTraits< const Function * >::getEdgeSourceLabel(), getEdgeValueLocal(), getEHPadFromPredecessor(), llvm::GetIfCondition(), getInsertPointForUses(), getJumpThreadDuplicationCost(), llvm::Loop::getLoopID(), getLoopLatchExitBlock(), getLoopTest(), llvm::RegionTraits< Function >::getNumSuccessors(), llvm::Loop::getStartLoc(), llvm::GCRelocateInst::getStatepoint(), llvm::GetSuccessorNumber(), hoist(), llvm::hoistRegion(), llvm::InlineFunction(), llvm::DIBuilder::insertDeclare(), llvm::InsertPreheaderForLoop(), insertUniqueBackedgeBlock(), isChainSelectCmpBranch(), llvm::SparseSolver::isEdgeFeasible(), llvm::isInTailCallPosition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isNotUsedInLoop(), isSafePHIToSpeculate(), llvm::BasicBlockEdge::isSingleEdge(), llvm::Loop::makeLoopInvariant(), markAliveBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), mergeEmptyReturnBlocks(), moveBBContents(), PerformHeapAllocSRoA(), llvm::promoteLoopAccessesToScalars(), relocationViaAlloca(), llvm::removeAllNonTerminatorAndEHPadInstructions(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceConstantExprOp(), llvm::InstCombiner::replacedSelectWithOperand(), replaceSuccessorsPhiUsesWith(), rewriteLoopExitBlock(), rotateLoop(), llvm::UnifyFunctionExitNodes::runOnFunction(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), llvm::Loop::setLoopID(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), simplifyLoopLatch(), simplifyOneLoop(), SinkCast(), SinkThenElseCodeToEnd(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitCriticalEdge(), SplitCriticalSideEffectEdges(), llvm::SplitEdge(), llvm::SplitLandingPadPredecessors(), llvm::succ_begin(), llvm::succ_end(), tryToMakeAllocaBePromotable(), TryToMergeLandingPad(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), llvm::LoopVersioning::versionLoop(), and llvm::InstCombiner::visitCallInst().

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

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

Referenced by findLocationForEntrySafepoint(), llvm::GCRelocateInst::getStatepoint(), getUniquePredecessor(), isDynamicConstant(), makeStatepointExplicitImpl(), llvm::MergeBlockIntoPredecessor(), normalizeForInvokeSafepoint(), llvm::InstCombiner::replacedSelectWithOperand(), and reuseTableCompare().

Definition at line 194 of file BasicBlock.h.

References getUniquePredecessor().

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

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

Referenced by getUniqueSuccessor(), and TryToMergeLandingPad().

Definition at line 212 of file BasicBlock.h.

References getUniqueSuccessor().

Returns a pointer to the symbol table if one exists.

Definition at line 27 of file BasicBlock.cpp.

References F, and getParent().

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 llvm::Function::getBasicBlockList(), llvm::ilist_node< NodeTy >::getIterator(), llvm::iplist< NodeTy, Traits >::insert(), and llvm::iplist< NodeTy, Traits >::push_back().

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

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

Definition at line 306 of file BasicBlock.h.

References getFirstNonPHI(), and llvm::Instruction::isEHPad().

Referenced by calculateCXXStateNumbers(), calculateSEHStateNumbers(), isBlockValidForExtraction(), separateNestedLoop(), and llvm::SplitCriticalEdge().

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

References getFirstNonPHI().

Referenced by createPHIsForSplitLoopExit(), llvm::SplitBlockPredecessors(), and llvm::SplitLandingPadPredecessors().

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

References llvm::Function::getBasicBlockList(), llvm::ilist_node< BasicBlock >::getIterator(), llvm::ilist_node< NodeTy >::getIterator(), getParent(), and llvm::iplist< NodeTy, Traits >::splice().

Referenced by llvm::MergeBasicBlockIntoOnlyPred(), and placeSplitBlockCarefully().

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

References llvm::Function::getBasicBlockList(), llvm::ilist_node< BasicBlock >::getIterator(), llvm::ilist_node< NodeTy >::getIterator(), getParent(), and llvm::iplist< NodeTy, Traits >::splice().

Referenced by insertFastDiv(), and rotateLoop().

Definition at line 225 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::rbegin().

Unlink 'this' from the containing function, but do not delete it.

Definition at line 93 of file BasicBlock.cpp.

References llvm::Function::getBasicBlockList(), llvm::ilist_node< BasicBlock >::getIterator(), getParent(), and llvm::iplist< NodeTy, Traits >::remove().

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

Definition at line 227 of file BasicBlock.h.

References llvm::iplist< NodeTy, Traits >::rend().

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

Definition at line 401 of file BasicBlock.cpp.

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

Referenced by simplifyLoopLatch().

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

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

References begin(), Create(), llvm::dyn_cast(), E, end(), llvm::iplist< NodeTy, Traits >::end(), llvm::PHINode::getBasicBlockIndex(), getContext(), getInstList(), getParent(), getTerminator(), I, llvm::Instruction::setDebugLoc(), llvm::PHINode::setIncomingBlock(), llvm::iplist< NodeTy, Traits >::splice(), llvm::succ_begin(), llvm::succ_end(), and llvm::Successor.

Referenced by despeculateCountZeros(), llvm::expandAtomicRMWToCmpXchg(), generateUnsignedDivisionCode(), HandleCallsInBlockInlinedThroughInvoke(), llvm::InlineFunction(), insertFastDiv(), PerformHeapAllocSRoA(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), SimplifyBranchOnICmpChain(), splitBasicBlock(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), and llvm::SplitBlockAndInsertIfThenElse().

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

Definition at line 293 of file BasicBlock.h.

References llvm::ilist_node< NodeTy >::getIterator(), and splitBasicBlock().


Friends And Related Function Documentation

friend class BlockAddress [friend]

Definition at line 54 of file BasicBlock.h.

friend class SymbolTableListTraits< BasicBlock > [friend]

Definition at line 63 of file BasicBlock.h.


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