LLVM API Documentation

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 iplist< InstructionInstListType
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 ()
const FunctiongetParent () const
 Return the enclosing method, or null if none.
FunctiongetParent ()
const DataLayoutgetDataLayout () const
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. Otherwise, returns null.
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.
void 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. Otherwise return a null pointer.
const BasicBlockgetSinglePredecessor () const
BasicBlockgetUniquePredecessor ()
 Return the predecessor of this block if it has a unique predecessor block. Otherwise return a null pointer.
const BasicBlockgetUniquePredecessor () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
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.
BasicBlocksplitBasicBlock (iterator I, const Twine &BBName="")
 Split the basic block into two basic blocks at the specified instruction.
bool hasAddressTaken () const
 Returns true if there are any uses of this basic block other than direct branches, switches, etc. to it.
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 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 iplist< Instruction >
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, Function >

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


Member Typedef Documentation

Definition at line 102 of file BasicBlock.h.

Definition at line 104 of file BasicBlock.h.

Definition at line 77 of file BasicBlock.h.

Instruction iterators...

Definition at line 101 of file BasicBlock.h.

Definition at line 103 of file BasicBlock.h.


Constructor & Destructor Documentation


Member Function Documentation

Definition at line 229 of file BasicBlock.h.

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

Instruction iterator methods

Definition at line 214 of file BasicBlock.h.

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

Referenced by llvm::AliasSetTracker::add(), AddPHINodeEntriesForMappedBlock(), AddPredecessorToBlock(), AddReachableCodeToWorklist(), llvm::CodeMetrics::analyzeBasicBlock(), BlockIsSimpleEnoughToThreadThrough(), llvm::Interpreter::callFunction(), canIfConvertPHINodes(), CanPropagatePredecessorsForPHIs(), checkCSEInPredecessor(), llvm::CloneAndPruneFunctionInto(), llvm::CloneBasicBlock(), CloneLoopBlocks(), createPHIsForSplitLoopExit(), cse(), cxxDtorIsEmpty(), llvm::DeleteDeadPHIs(), DeleteInstructionInBlock(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::DominatorTree::dominates(), dropAllReferences(), llvm::EliminateDuplicatePHINodes(), llvm::CodeExtractor::extractCodeRegion(), llvm::FindAvailableLoadedValue(), llvm::objcarc::FindDependencies(), FindInitTrampolineFromBB(), llvm::CodeExtractor::findInputsOutputs(), FindLoopCounter(), FindPHIForConditionForwarding(), findPHIToPartitionLoops(), llvm::SSAUpdaterTraits< SSAUpdater >::FindPredecessorBlocks(), fixPhis(), fixupFPReturnAndCall(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldSingleEntryPHINodes(), FoldTwoEntryPHINode(), llvm::formLCSSA(), generateUnsignedDivisionCode(), llvm::Loop::getCanonicalInductionVariable(), GetCaseResults(), llvm::MemoryDependenceAnalysis::getDependency(), getFirstNonPHI(), getFirstNonPHIOrDbg(), getFirstNonPHIOrDbgOrLifetime(), llvm::GetIfCondition(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::SCEVExpander::getOrInsertCanonicalInductionVariable(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleCallsInBlockInlinedThroughInvoke(), HasNoDuplicateCall(), HoistThenElseCodeToIf(), llvm::InlineFunction(), insertFastDiv(), insertSinCosCall(), isBlockValidForExtraction(), isExistingPhi(), llvm::Loop::isLCSSAForm(), llvm::isSafeToLoadUnconditionally(), isTrivialLoopExitBlockHelper(), llvm::Value::isUsedInBasicBlock(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetPreviousInstruction(), markAliveBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeEmptyReturnBlocks(), NegateValue(), llvm::SparseSolver::Print(), llvm::AssemblyWriter::printBasicBlock(), processInstruction(), PushLoopPHIs(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), removeUndefIntroducingPredecessor(), llvm::SCEVExpander::replaceCongruentIVs(), replaceSuccessorsPhiUsesWith(), RewriteUsesOfClonedInstructions(), llvm::LoadAndStorePromoter::run(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), llvm::InstCombiner::SimplifyDivRemOfSelect(), llvm::SimplifyInstructionsInBlock(), llvm::simplifyLoopIVs(), simplifyOneLoop(), SinkThenElseCodeToEnd(), llvm::SparseSolver::Solve(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::UnrollLoop(), UpdatePHINodes(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().

Definition at line 215 of file BasicBlock.h.

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

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

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

Definition at line 247 of file BasicBlock.h.

References llvm::Value::BasicBlockVal, and 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 218 of file BasicBlock.cpp.

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

Referenced by ~BasicBlock().

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

Definition at line 225 of file BasicBlock.h.

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

Referenced by llvm::DeleteDeadBlock().

Definition at line 216 of file BasicBlock.h.

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

Referenced by llvm::AliasSetTracker::add(), AddReachableCodeToWorklist(), llvm::CodeMetrics::analyzeBasicBlock(), canIfConvertPHINodes(), changeToUnreachable(), checkCSEInPredecessor(), llvm::CloneBasicBlock(), cse(), cxxDtorIsEmpty(), dropAllReferences(), llvm::objcarc::FindDependencies(), llvm::CodeExtractor::findInputsOutputs(), fixupFPReturnAndCall(), FoldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), llvm::formLCSSA(), GetCaseResults(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), HandleCallsInBlockInlinedThroughInvoke(), HasNoDuplicateCall(), insertFastDiv(), isBlockValidForExtraction(), llvm::isInTailCallPosition(), llvm::Loop::isLCSSAForm(), llvm::isPotentiallyReachable(), isSafeAndProfitableToSinkLoad(), isTrivialLoopExitBlockHelper(), llvm::Value::isUsedInBasicBlock(), isValidAssumeForContext(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetNextInstruction(), LLVMPositionBuilder(), markAliveBlocks(), llvm::MergeBlockIntoPredecessor(), passingValueIsAlwaysUndefined(), llvm::SparseSolver::Print(), llvm::AssemblyWriter::printBasicBlock(), replaceSuccessorsPhiUsesWith(), RewriteUsesOfClonedInstructions(), llvm::LoadAndStorePromoter::run(), llvm::IRBuilderBase::SetInsertPoint(), llvm::SimplifyInstructionsInBlock(), SinkThenElseCodeToEnd(), llvm::SparseSolver::Solve(), SpeculativelyExecuteBB(), splitBasicBlock(), TryToSinkInstruction(), and llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit().

Definition at line 217 of file BasicBlock.h.

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

Definition at line 227 of file BasicBlock.h.

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

Definition at line 33 of file BasicBlock.cpp.

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

Referenced by llvm::Instruction::getDataLayout().

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

References getFirstNonPHI().

Referenced by llvm::DemoteRegToStack(), llvm::InstCombiner::DoOneIteration(), getFirstInsertionPt(), OptimizeCmpExpression(), OptimizeExtractBits(), llvm::SCEVExpander::replaceCongruentIVs(), SinkCast(), SinkShiftAndTruncate(), llvm::SplitLandingPadPredecessors(), TryToSinkInstruction(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().

Definition at line 167 of file BasicBlock.h.

References getFirstInsertionPt().

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

References begin().

Referenced by createPHIsForSplitLoopExit(), fixPhis(), getFirstInsertionPt(), getFirstNonPHI(), getJumpThreadDuplicationCost(), getLandingPadInst(), llvm::InvokeInst::getLandingPadInst(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::InsertPreheaderForLoop(), isLandingPad(), and llvm::InstCombiner::visitGetElementPtrInst().

Definition at line 144 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 182 of file BasicBlock.cpp.

References begin().

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

Definition at line 151 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 192 of file BasicBlock.cpp.

References begin(), llvm::dyn_cast(), and llvm::IntrinsicInst::getIntrinsicID().

Referenced by getFirstNonPHIOrDbgOrLifetime().

Definition at line 158 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 235 of file BasicBlock.h.

Referenced by changeToUnreachable(), llvm::CloneAndPruneFunctionInto(), llvm::CloneBasicBlock(), CloneLoopBlocks(), llvm::BinaryOperator::Create(), createCallHelper(), createMalloc(), llvm::DeleteDeadBlock(), DeleteInstructionInBlock(), llvm::InstCombiner::DoOneIteration(), 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(), llvm::Instruction::moveBefore(), llvm::Instruction::removeFromParent(), removePredecessor(), llvm::ReplaceInstWithInst(), llvm::UnifyFunctionExitNodes::runOnFunction(), SinkThenElseCodeToEnd(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitLandingPadPredecessors(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::UnrollLoop(), and llvm::InstCombiner::visitGetElementPtrInst().

Definition at line 236 of file BasicBlock.h.

Return the landingpad instruction associated with the landing pad.

getLandingPadInst() - Return the landingpad instruction associated with the landing pad.

Definition at line 408 of file BasicBlock.cpp.

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

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

Definition at line 411 of file BasicBlock.cpp.

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

Return the enclosing method, or null if none.

Definition at line 119 of file BasicBlock.h.

Referenced by llvm::CodeMetrics::analyzeBasicBlock(), changeToUnreachable(), llvm::CloneBasicBlock(), CloneLoopBlocks(), llvm::CodeMetrics::collectEphemeralValues(), llvm::ConstantFoldTerminator(), llvm::IRBuilderBase::CreateGlobalString(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::DominatorTree::dominates(), llvm::EmitBinaryFloatFnCall(), llvm::EmitFPutC(), llvm::EmitFPutS(), llvm::EmitFWrite(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::EmitMemChr(), llvm::EmitMemCmp(), llvm::EmitMemCpyChk(), llvm::EmitPutChar(), llvm::EmitPutS(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::EmitStrChr(), llvm::EmitStrCpy(), llvm::EmitStrLen(), llvm::EmitStrNCmp(), llvm::EmitStrNCpy(), llvm::EmitStrNLen(), llvm::EmitUnaryFloatFnCall(), eraseFromParent(), llvm::CodeExtractor::extractCodeRegion(), FindPotentialTailCall(), FoldCondBranchOnPHI(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::MMIAddrLabelMap::getAddrLabelSymbol(), getCommonReturnValue(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), getDataLayout(), llvm::MemoryDependenceAnalysis::getDependency(), llvm::Trace::getFunction(), getFunctionForValue(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), llvm::DOTGraphTraits< DomTreeNode * >::getNodeLabel(), llvm::DOTGraphTraits< RegionNode * >::getNodeLabel(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), getValueSymbolTable(), HandleByValArgument(), HandleInlinedInvoke(), llvm::InlineFunction(), insertFastDiv(), insertSinCosCall(), isDynamicConstant(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), llvm::isInTailCallPosition(), llvm::isPotentiallyReachable(), llvm::isSafeToSpeculativelyExecute(), llvm::AllocaInst::isStaticAlloca(), LLVMGetNextBasicBlock(), LLVMGetPreviousBasicBlock(), LLVMInsertBasicBlockInContext(), llvm::BlockAddress::lookup(), llvm::IntrinsicLowering::LowerToByteSwap(), makeDMB(), llvm::MergeBasicBlockIntoOnlyPred(), moveAfter(), moveBefore(), NegateValue(), parentFunctionOfValue(), PerformHeapAllocSRoA(), placeSplitBlockCarefully(), llvm::AssemblyWriter::printBasicBlock(), PrintOps(), ProcessUAddIdiom(), ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), promoteSingleBlockAlloca(), llvm::AssumptionTracker::registerAssumption(), removeFromParent(), ReplaceCallWith(), replaceConstantExprOp(), rewriteSingleStoreAlloca(), SimplifyCondBranchToCondBranch(), llvm::LoopPass::skipOptnoneFunction(), llvm::BasicBlockPass::skipOptnoneFunction(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), SwitchToLookupTable(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TryToSinkInstruction(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), UpdateCallGraphAfterInlining(), llvm::MMIAddrLabelMap::UpdateForDeletedBlock(), useFuncSeen(), ValueDominatesPHI(), llvm::DominatorTree::verifyDomTree(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFPTrunc(), and ~BasicBlock().

Definition at line 120 of file BasicBlock.h.

Return the predecessor of this block if it has a single predecessor block. Otherwise return a null pointer.

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

Definition at line 225 of file BasicBlock.cpp.

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

Referenced by CanPropagatePredecessorsForPHIs(), llvm::CloneAndPruneFunctionInto(), llvm::DeleteDeadBlock(), llvm::DemoteRegToStack(), llvm::DominatorTree::dominates(), FindPHIForConditionForwarding(), FoldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), llvm::GetIfCondition(), getSinglePredecessor(), isOnlyReachableViaThisEdge(), llvm::MergeBasicBlockIntoOnlyPred(), simplifyOneLoop(), llvm::SplitEdge(), tryToMoveFreeBeforeNullTest(), and TryToSimplifyUncondBranchWithICmpInIt().

Definition at line 196 of file BasicBlock.h.

References getSinglePredecessor().

static iplist<Instruction> BasicBlock::* llvm::BasicBlock::getSublistAccess ( Instruction ) [inline, static]

Returns a pointer to a member of the instruction list.

Definition at line 239 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 141 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< NodeTy >::getPrevNode(), and llvm::ReturnInst::getReturnValue().

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

Definition at line 133 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 131 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(), llvm::CloneAndPruneFunctionInto(), llvm::CloneFunctionInto(), CloneLoopBlocks(), ConnectProlog(), llvm::ConstantFoldTerminator(), convertMemSetToLoop(), convertTransferToLoop(), createPHIsForSplitLoopExit(), llvm::DeleteDeadBlock(), DeleteInstructionInBlock(), llvm::DemotePHIToStack(), DominatesMergePoint(), FindLoopCounter(), FindMostPopularDest(), FindPHIForConditionForwarding(), FindUnconditionalPreds(), FoldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), genLoopLimit(), GetBestDestForJumpOnUndef(), llvm::DOTGraphTraits< const Function * >::getEdgeSourceLabel(), getEdgeValueLocal(), llvm::GetIfCondition(), getInsertPointForUses(), llvm::Loop::getLoopID(), getLoopTest(), llvm::RegionTraits< Function >::getNumSuccessors(), llvm::Loop::getStartLoc(), llvm::GetSuccessorNumber(), llvm::InlineFunction(), llvm::DIBuilder::insertDeclare(), llvm::InsertPreheaderForLoop(), insertUniqueBackedgeBlock(), llvm::SparseSolver::isEdgeFeasible(), llvm::isInTailCallPosition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isSafePHIToSpeculate(), llvm::BasicBlockEdge::isSingleEdge(), llvm::Loop::makeLoopInvariant(), markAliveBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeEmptyReturnBlocks(), PerformHeapAllocSRoA(), removeUndefIntroducingPredecessor(), replaceConstantExprOp(), replaceSuccessorsPhiUsesWith(), rewriteLoopExitBlock(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::IRBuilderBase::SetInsertPoint(), llvm::Loop::setLoopID(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), simplifyOneLoop(), 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(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), and llvm::InstCombiner::visitCallInst().

Return the predecessor of this block if it has a unique predecessor block. Otherwise return a null pointer.

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

getUniquePredecessor - If this basic block has a unique predecessor block, return the block, otherwise return a null pointer. Note that unique predecessor doesn't mean single edge, there can be multiple edges from the unique predecessor to this block (for example a switch statement with multiple cases having the same destination).

Definition at line 238 of file BasicBlock.cpp.

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

Referenced by getUniquePredecessor(), isDynamicConstant(), and llvm::MergeBlockIntoPredecessor().

Definition at line 207 of file BasicBlock.h.

References getUniquePredecessor().

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

References llvm::Function::getBasicBlockList(), llvm::iplist< NodeTy, Traits >::insert(), and llvm::iplist< NodeTy, Traits >::push_back().

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.

isLandingPad - Return true if this basic block is a landing pad. I.e., it's the destination of the 'unwind' edge of an invoke instruction.

Definition at line 402 of file BasicBlock.cpp.

References getFirstNonPHI().

Referenced by ConnectProlog(), createPHIsForSplitLoopExit(), llvm::InsertPreheaderForLoop(), isBlockValidForExtraction(), rewriteLoopExitBlock(), separateNestedLoop(), llvm::SplitCriticalEdge(), 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.

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

Definition at line 124 of file BasicBlock.cpp.

References llvm::Function::getBasicBlockList(), getParent(), I, 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.

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

Definition at line 117 of file BasicBlock.cpp.

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

Referenced by insertFastDiv().

Definition at line 220 of file BasicBlock.h.

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

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

Definition at line 107 of file BasicBlock.cpp.

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

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

Notify the BasicBlock that the predecessor Pred 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.

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

References begin(), llvm::dyn_cast(), llvm::iplist< NodeTy, Traits >::empty(), llvm::Instruction::eraseFromParent(), front(), llvm::UndefValue::get(), llvm::PHINode::getIncomingBlock(), getInstList(), llvm::PHINode::getNumIncomingValues(), llvm::PHINode::hasConstantValue(), llvm::Value::hasNUsesOrMore(), llvm::iplist< NodeTy, Traits >::pop_front(), llvm::pred_begin(), llvm::pred_end(), llvm::PHINode::removeIncomingValue(), and llvm::Value::replaceAllUsesWith().

Referenced by changeToCall(), changeToUnreachable(), llvm::ConstantFoldTerminator(), llvm::DeleteDeadBlock(), EliminateDeadSwitchCases(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), HandleInlinedInvoke(), llvm::RemovePredecessorAndSimplify(), removeUndefIntroducingPredecessor(), SimplifyCondBranchToTwoReturns(), simplifyOneLoop(), SimplifyTerminatorOnSelect(), llvm::SplitCriticalEdge(), and SwitchToLookupTable().

Definition at line 222 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 379 of file BasicBlock.cpp.

References begin(), llvm::dyn_cast(), end(), llvm::PHINode::getBasicBlockIndex(), llvm::TerminatorInst::getNumSuccessors(), llvm::TerminatorInst::getSuccessor(), getTerminator(), llvm::ARM_PROC::IE, and llvm::PHINode::setIncomingBlock().

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

Split the basic block into two basic blocks 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.

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

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

Referenced by convertMemSetToLoop(), convertTransferToLoop(), generateUnsignedDivisionCode(), HandleCallsInBlockInlinedThroughInvoke(), llvm::InlineFunction(), PerformHeapAllocSRoA(), SimplifyBranchOnICmpChain(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), and llvm::SplitBlockAndInsertIfThenElse().


Friends And Related Function Documentation

friend class BlockAddress [friend]

Definition at line 75 of file BasicBlock.h.

friend class SymbolTableListTraits< BasicBlock, Function > [friend]

Definition at line 83 of file BasicBlock.h.


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