|
LLVM
5.0.0
|
LLVM Basic Block Representation. More...
#include "llvm/IR/BasicBlock.h"
Classes | |
| class | phi_iterator_impl |
| Iterator to walk just the phi nodes in the basic block. More... | |
Public Types | |
| using | InstListType = SymbolTableList< Instruction > |
| 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 | |
| BasicBlock & | operator= (const BasicBlock &)=delete |
| ~BasicBlock () | |
| LLVMContext & | getContext () const |
| Get the context in which this basic block lives. More... | |
| const Function * | getParent () const |
| Return the enclosing method, or null if none. More... | |
| Function * | getParent () |
| const Module * | getModule () const |
| Return the module owning the function this basic block belongs to, or nullptr it the function does not have a module. More... | |
| Module * | getModule () |
| const TerminatorInst * | getTerminator () const LLVM_READONLY |
| Returns the terminator instruction if the block is well formed or null if the block is not well formed. More... | |
| TerminatorInst * | getTerminator () |
| const CallInst * | getTerminatingDeoptimizeCall () const |
| Returns the call instruction calling .experimental.deoptimize prior to the terminating return instruction of this basic block, if such a call is present. More... | |
| CallInst * | getTerminatingDeoptimizeCall () |
| const CallInst * | getTerminatingMustTailCall () const |
| Returns the call instruction marked 'musttail' prior to the terminating return instruction of this basic block, if such a call is present. More... | |
| CallInst * | getTerminatingMustTailCall () |
| const Instruction * | getFirstNonPHI () const |
| Returns a pointer to the first instruction in this block that is not a PHINode instruction. More... | |
| Instruction * | getFirstNonPHI () |
| const Instruction * | getFirstNonPHIOrDbg () const |
| Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic. More... | |
| Instruction * | getFirstNonPHIOrDbg () |
| const Instruction * | getFirstNonPHIOrDbgOrLifetime () const |
| Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic, or a lifetime intrinsic. More... | |
| Instruction * | getFirstNonPHIOrDbgOrLifetime () |
| 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 () |
| 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 BasicBlock * | getSinglePredecessor () const |
| Return the predecessor of this block if it has a single predecessor block. More... | |
| BasicBlock * | getSinglePredecessor () |
| const BasicBlock * | getUniquePredecessor () const |
| Return the predecessor of this block if it has a unique predecessor block. More... | |
| BasicBlock * | getUniquePredecessor () |
| const BasicBlock * | getSingleSuccessor () const |
| Return the successor of this block if it has a single successor. More... | |
| BasicBlock * | getSingleSuccessor () |
| const BasicBlock * | getUniqueSuccessor () const |
| Return the successor of this block if it has a unique successor. More... | |
| BasicBlock * | getUniqueSuccessor () |
| 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 Instruction & | front () const |
| Instruction & | front () |
| const Instruction & | back () const |
| Instruction & | back () |
| iterator_range < const_phi_iterator > | phis () const |
| Returns a range that iterates over the phis in the basic block. More... | |
| iterator_range< phi_iterator > | phis () |
| const InstListType & | getInstList () const |
| Return the underlying instruction list container. More... | |
| InstListType & | getInstList () |
| ValueSymbolTable * | getValueSymbolTable () |
| 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 |
| BasicBlock * | splitBasicBlock (iterator I, const Twine &BBName="") |
| Split the basic block into two basic blocks at the specified instruction. More... | |
| BasicBlock * | splitBasicBlock (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 LandingPadInst * | getLandingPadInst () const |
| Return the landingpad instruction associated with the landing pad. More... | |
| LandingPadInst * | getLandingPadInst () |
| bool | isLegalToHoistInto () const |
| Return true if it is legal to hoist instructions into this block. More... | |
Public Member Functions inherited from llvm::Value | |
| Value (const Value &)=delete | |
| Value & | operator= (const Value &)=delete |
| void | deleteValue () |
| Delete a pointer to a generic Value. More... | |
| void | dump () const |
| Support for debugging, callable in GDB: V->dump() More... | |
| Type * | getType () const |
| All values are typed, get the type of this value. More... | |
| LLVMContext & | getContext () const |
| All values hold a context through their type. More... | |
| bool | hasName () const |
| ValueName * | getValueName () 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 |
| use_iterator | materialized_use_begin () |
| const_use_iterator | materialized_use_begin () const |
| use_iterator | use_begin () |
| const_use_iterator | use_begin () const |
| use_iterator | use_end () |
| const_use_iterator | use_end () const |
| iterator_range< use_iterator > | materialized_uses () |
| iterator_range < const_use_iterator > | materialized_uses () const |
| iterator_range< use_iterator > | uses () |
| iterator_range < const_use_iterator > | uses () const |
| bool | user_empty () const |
| user_iterator | materialized_user_begin () |
| const_user_iterator | materialized_user_begin () const |
| user_iterator | user_begin () |
| const_user_iterator | user_begin () const |
| user_iterator | user_end () |
| const_user_iterator | user_end () const |
| User * | user_back () |
| const User * | user_back () const |
| iterator_range< user_iterator > | materialized_users () |
| iterator_range < const_user_iterator > | materialized_users () const |
| iterator_range< user_iterator > | users () |
| iterator_range < const_user_iterator > | users () const |
| bool | hasOneUse () const |
| Return true if there is exactly one 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 Value * | stripPointerCasts () const |
| Strip off pointer casts, all-zero GEPs, and aliases. More... | |
| Value * | stripPointerCasts () |
| const Value * | stripPointerCastsAndBarriers () const |
| Strip off pointer casts, all-zero GEPs, aliases and barriers. More... | |
| Value * | stripPointerCastsAndBarriers () |
| const Value * | stripPointerCastsNoFollowAliases () const |
| Strip off pointer casts and all-zero GEPs. More... | |
| Value * | stripPointerCastsNoFollowAliases () |
| const Value * | stripInBoundsConstantOffsets () const |
| Strip off pointer casts and all-constant inbounds GEPs. More... | |
| Value * | stripInBoundsConstantOffsets () |
| const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
| Accumulate offsets from stripInBoundsConstantOffsets(). More... | |
| Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
| const Value * | stripInBoundsOffsets () const |
| Strip off pointer casts and inbounds GEPs. More... | |
| Value * | stripInBoundsOffsets () |
| unsigned | 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 Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
| Translate PHI node to its predecessor from the given basic block. More... | |
| Value * | DoPHITranslation (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 > | |
| BasicBlock * | getPrevNode () |
| const BasicBlock * | getPrevNode () const |
Get the previous node, or nullptr for the list head. More... | |
| BasicBlock * | getNextNode () |
Get the next node, or nullptr for the list tail. More... | |
| const BasicBlock * | getNextNode () 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 BasicBlock * | Create (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 > |
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 59 of file BasicBlock.h.
Definition at line 92 of file BasicBlock.h.
| using llvm::BasicBlock::const_phi_iterator = phi_iterator_impl<const PHINode, BasicBlock::const_iterator> |
Definition at line 303 of file BasicBlock.h.
Definition at line 94 of file BasicBlock.h.
Definition at line 62 of file BasicBlock.h.
Instruction iterators...
Definition at line 91 of file BasicBlock.h.
Definition at line 301 of file BasicBlock.h.
Definition at line 93 of file BasicBlock.h.
|
delete |
| BasicBlock::~BasicBlock | ( | ) |
Definition at line 64 of file BasicBlock.cpp.
References assert(), llvm::iplist_impl< IntrusiveListT, TraitsT >::clear(), llvm::Constant::destroyConstant(), dropAllReferences(), llvm::ConstantInt::get(), getContext(), llvm::Type::getInt32Ty(), llvm::ConstantExpr::getIntToPtr(), getParent(), llvm::Value::getType(), hasAddressTaken(), llvm::Value::replaceAllUsesWith(), llvm::Value::use_empty(), and llvm::Value::user_back().
|
inline |
Definition at line 266 of file BasicBlock.h.
Referenced by llvm::AAResults::canBasicBlockModify(), llvm::CloneAndPruneIntoFromInst(), ComputePostOrders(), llvm::DeleteDeadBlock(), findUnwindDestinations(), scanInlinedCode(), llvm::SimplifyInstructionsInBlock(), and llvm::UnrollLoop().
|
inline |
Definition at line 267 of file BasicBlock.h.
|
inline |
Instruction iterator methods.
Definition at line 252 of file BasicBlock.h.
Referenced by AddPHINodeEntriesForMappedBlock(), AddPredecessorToBlock(), AddReachableCodeToWorklist(), BlockIsSimpleEnoughToThreadThrough(), llvm::Interpreter::callFunction(), CanPropagatePredecessorsForPHIs(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneBasicBlock(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::computeLoopSafetyInfo(), containsSafePHI(), createPHIsForSplitLoopExit(), cse(), cxxDtorIsEmpty(), DeleteBasicBlock(), llvm::DeleteDeadPHIs(), deleteLoopIfDead(), llvm::DominatorTree::dominates(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), eliminateDeadStores(), llvm::EliminateDuplicatePHINodes(), eliminateRecursiveTailCall(), eliminateUnreachableBlock(), ensureValueAvailableInSuccessor(), llvm::Evaluator::EvaluateFunction(), llvm::CodeExtractor::extractCodeRegion(), llvm::FindAvailablePtrLoadStore(), llvm::objcarc::FindDependencies(), findIBRPredecessor(), findInitTrampolineFromBB(), FindPHIForConditionForwarding(), llvm::SSAUpdaterTraits< SSAUpdater >::FindPredecessorBlocks(), findRetainForStoreStrongContraction(), findTRECandidate(), fixPhis(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldSingleEntryPHINodes(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), llvm::Loop::getCanonicalInductionVariable(), GetCaseResults(), llvm::MemoryDependenceResults::getDependency(), llvm::GetIfCondition(), llvm::DOTGraphTraits< PGOUseFunc * >::getNodeLabel(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleCallsInBlockInlinedThroughInvoke(), handleEndBlock(), llvm::hoistRegion(), HoistThenElseCodeToIf(), llvm::InlineFunction(), InsertRootInitializers(), InsertSafepointPoll(), insertSinCosCall(), is_empty(), isLoopDead(), llvm::isSafeToLoadUnconditionally(), llvm::Value::isUsedInBasicBlock(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetPreviousInstruction(), makeStatepointExplicitImpl(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeEmptyReturnBlocks(), NegateValue(), normalizeForInvokeSafepoint(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), optimizeSQRT(), llvm::peelLoop(), ProcessBlock(), processInternalGlobal(), promoteMemoryToRegister(), PushLoopPHIs(), relocateInstructionBefore(), removeEmptyCleanup(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), removeUndefIntroducingPredecessor(), rewritePHINodesForExitAndUnswitchedBlocks(), RewriteUsesOfClonedInstructions(), llvm::InstrProfiling::run(), runOnBasicBlock(), scanInlinedCode(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), llvm::InstCombiner::SimplifyDivRemOfSelect(), llvm::SimplifyInstructionsInBlock(), SimplifyLoopInst(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), llvm::sinkRegion(), SpeculativelyExecuteBB(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::JumpThreadingPass::ThreadEdge(), llvm::JumpThreadingPass::ThreadGuard(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::JumpThreadingPass::TryToUnfoldSelectInCurrBB(), TurnSwitchRangeIntoICmp(), llvm::UnrollLoop(), UpdatePHINodes(), updatePhiNodes(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().
|
inline |
Definition at line 253 of file BasicBlock.h.
| bool BasicBlock::canSplitPredecessors | ( | ) | const |
Definition at line 346 of file BasicBlock.cpp.
References getFirstNonPHI(), and llvm::Instruction::isEHPad().
Referenced by llvm::SplitBlockPredecessors().
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition at line 329 of file BasicBlock.h.
References llvm::Value::getValueID().
|
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 101 of file BasicBlock.h.
References llvm::ISD::BasicBlock, and Name.
Referenced by assureFPCallStub(), llvm::CloneBasicBlock(), createDummyFunction(), createFPFnStub(), llvm::createMemCpyLoop(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemMoveLoop(), createMemSetLoop(), createResumeEntryBlock(), llvm::createSanitizerCtorAndInitFunctions(), CreateWrapper(), eliminateRecursiveTailCall(), llvm::CodeExtractor::extractCodeRegion(), llvm::SanitizerStatReport::finish(), FoldCondBranchOnPHI(), generateUnsignedDivisionCode(), INITIALIZE_PASS(), insertUniqueBackedgeBlock(), LLVMAppendBasicBlockInContext(), LLVMInsertBasicBlockInContext(), llvm::orc::makeStub(), llvm::EscapeEnumerator::Next(), optimizeSQRT(), PerformHeapAllocSRoA(), llvm::UnifyFunctionExitNodes::runOnFunction(), SimplifyCondBranchToCondBranch(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadEdge(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::JumpThreadingPass::TryToUnfoldSelect(), unifyReturnBlockSet(), and unswitchTrivialSwitch().
| 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 210 of file BasicBlock.cpp.
References llvm::User::dropAllReferences(), and I.
Referenced by llvm::Function::dropAllReferences(), eliminateUnreachableBlock(), and ~BasicBlock().
|
inline |
Definition at line 263 of file BasicBlock.h.
Referenced by llvm::DeleteDeadBlock(), and is_empty().
|
inline |
Definition at line 254 of file BasicBlock.h.
Referenced by AddReachableCodeToWorklist(), llvm::changeToUnreachable(), llvm::CloneBasicBlock(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::computeLoopSafetyInfo(), llvm::ConvertDebugDeclareToDebugValue(), cse(), cxxDtorIsEmpty(), DeleteBasicBlock(), detectCTLZIdiom(), detectPopcountIdiom(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), eliminateRecursiveTailCall(), llvm::objcarc::FindDependencies(), findSafeStoreForStoreStrongContraction(), first_use_of_in_block(), foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), GetCaseResults(), getFirstInsertionPt(), llvm::DOTGraphTraits< PGOUseFunc * >::getNodeLabel(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), HandleCallsInBlockInlinedThroughInvoke(), handleEndBlock(), llvm::hoistRegion(), InsertSafepointPoll(), llvm::isInTailCallPosition(), llvm::isPotentiallyReachable(), isSafeAndProfitableToSinkLoad(), llvm::Value::isUsedInBasicBlock(), llvm::isValidAssumeForContext(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetNextInstruction(), LLVMPositionBuilder(), memoryIsNotModifiedBetween(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), llvm::Instruction::moveBefore(), OptimizeExtractBits(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), llvm::OrderedBasicBlock::OrderedBasicBlock(), passingValueIsAlwaysUndefined(), llvm::PrepareToSplitEntryBlock(), ProcessBlock(), llvm::programUndefinedIfFullPoison(), promoteMemoryToRegister(), relocateInstructionBefore(), removeTriviallyEmptyRange(), RewriteUsesOfClonedInstructions(), llvm::InstrProfiling::run(), runOnBasicBlock(), scanOneBB(), llvm::IRBuilderBase::SetInsertPoint(), shouldInstrumentBlock(), llvm::SimplifyInstructionsInBlock(), SimplifyLoopInst(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), SinkCast(), SinkCmpExpression(), llvm::sinkRegion(), SinkShiftAndTruncate(), SpeculativelyExecuteBB(), splitBasicBlock(), TryToSinkInstruction(), llvm::JumpThreadingPass::TryToUnfoldSelect(), unswitchTrivialBranch(), and llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit().
|
inline |
Definition at line 255 of file BasicBlock.h.
| iplist< BasicBlock >::iterator BasicBlock::eraseFromParent | ( | ) |
Unlink 'this' from the containing function and delete it.
Definition at line 97 of file BasicBlock.cpp.
References llvm::iplist_impl< IntrusiveListT, TraitsT >::erase(), llvm::Function::getBasicBlockList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options...>::type >::getIterator(), and getParent().
Referenced by llvm::CloneAndPruneIntoFromInst(), DeleteBasicBlock(), llvm::DeleteDeadBlock(), foldBlockIntoPredecessor(), foldReturnAndProcessPred(), llvm::InlineFunction(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeEmptyReturnBlocks(), removeEmptyCleanup(), simplifyOneLoop(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().
|
inline |
Definition at line 264 of file BasicBlock.h.
Referenced by calculateStateNumbersForInvokes(), llvm::AAResults::canBasicBlockModify(), llvm::CloneAndPruneFunctionInto(), llvm::CloneAndPruneIntoFromInst(), CloneInstructionInExitBlock(), llvm::SSAUpdaterTraits< SSAUpdater >::CreateEmptyPHI(), createPHIsForSplitLoopExit(), CreatePrologue(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), despeculateCountZeros(), eliminateDeadStores(), EliminateDeadSwitchCases(), eliminateRecursiveTailCall(), ensureValueAvailableInSuccessor(), findLocationForEntrySafepoint(), findTRECandidate(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), INITIALIZE_PASS(), llvm::InlineFunction(), insertSpills(), isEmptyFunction(), isSafeToPromoteArgument(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeEmptyReturnBlocks(), phis(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), llvm::removeAllNonTerminatorAndEHPadInstructions(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), rewritePHIs(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), sinkLastInstruction(), splitBlockIfNotFirst(), llvm::SplitEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), and unswitchTrivialSwitch().
|
inline |
Definition at line 265 of file BasicBlock.h.
| LLVMContext & BasicBlock::getContext | ( | ) | const |
Get the context in which this basic block lives.
Definition at line 33 of file BasicBlock.cpp.
References llvm::Type::getContext(), and llvm::Value::getType().
Referenced by llvm::CloneBasicBlock(), llvm::ConstantFoldTerminator(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), ehAwareSplitEdge(), EliminateDeadSwitchCases(), emitCalloc(), llvm::emitFWrite(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemCpyChk(), llvm::emitStrLen(), llvm::emitStrNCmp(), llvm::CodeExtractor::extractCodeRegion(), FoldCondBranchOnPHI(), foldMallocMemset(), insertUniqueBackedgeBlock(), optimizeSQRT(), PerformHeapAllocSRoA(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), llvm::promoteIndirectCall(), RewriteUsesOfClonedInstructions(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), and ~BasicBlock().
| 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 200 of file BasicBlock.cpp.
References end(), getFirstNonPHI(), and llvm::ilist_node_impl< OptionsT >::getIterator().
Referenced by CloneInstructionInExitBlock(), llvm::ConvertDebugDeclareToDebugValue(), createDirectCallInst(), llvm::DemoteRegToStack(), findInsertPointAfter(), getFirstInsertionPt(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), insertSpills(), makeStatepointExplicitImpl(), mergeConditionalStoreToAddress(), OptimizeExtractBits(), llvm::promoteIndirectCall(), rematerializeLiveValues(), llvm::SCEVExpander::replaceCongruentIVs(), replaceExtractElements(), rewriteMaterializableInstructions(), llvm::InstCombiner::run(), setInsertionPoint(), shouldInstrumentBlock(), SinkCast(), SinkCmpExpression(), SinkShiftAndTruncate(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadGuard(), TryToSinkInstruction(), llvm::InstCombiner::visitGetElementPtrInst(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().
|
inline |
Definition at line 180 of file BasicBlock.h.
References getFirstInsertionPt(), and llvm::ilist_iterator< OptionsT, IsReverse, IsConst >::getNonConst().
| 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 171 of file BasicBlock.cpp.
References I.
Referenced by llvm::calculateClrEHStateNumbers(), calculateStateNumbersForInvokes(), canSplitPredecessors(), CloneLoopBlocks(), llvm::colorEHFunclets(), ConnectProlog(), llvm::createMemCpyLoopKnownSize(), createPHIsForSplitLoopExit(), detectCTLZIdiom(), detectPopcountIdiom(), ehAwareSplitEdge(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findUnwindDestinations(), fixPhis(), getFirstInsertionPt(), getFirstNonPHI(), getJumpThreadDuplicationCost(), getLandingPadInst(), llvm::InvokeInst::getLandingPadInst(), getSuccPad(), getUnwindDestTokenHelper(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), llvm::InlineFunction(), isEHPad(), isLandingPad(), markAliveBlocks(), llvm::programUndefinedIfFullPoison(), relocationViaAlloca(), removeEmptyCleanup(), rewritePHIs(), llvm::SplitLandingPadPredecessors(), and llvm::UnrollRuntimeLoopRemainder().
|
inline |
Definition at line 154 of file BasicBlock.h.
References getFirstNonPHI().
| const Instruction * BasicBlock::getFirstNonPHIOrDbg | ( | ) | const |
Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic.
Definition at line 178 of file BasicBlock.cpp.
References I.
Referenced by EliminateDeadSwitchCases(), eliminateTailRecursion(), FindPHIForConditionForwarding(), foldReturnAndProcessPred(), getFirstNonPHIOrDbg(), InitializeUniqueCases(), llvm::JumpThreadingPass::runImpl(), SimplifyCondBranchToTwoReturns(), llvm::SplitBlockPredecessors(), SwitchToLookupTable(), TurnSwitchRangeIntoICmp(), and llvm::InstCombiner::visitAllocaInst().
|
inline |
Definition at line 162 of file BasicBlock.h.
References getFirstNonPHIOrDbg().
| 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 185 of file BasicBlock.cpp.
References I.
Referenced by getFirstNonPHIOrDbgOrLifetime(), and insertDebugValues().
|
inline |
Definition at line 170 of file BasicBlock.h.
References getFirstNonPHIOrDbgOrLifetime().
|
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 317 of file BasicBlock.h.
Referenced by llvm::changeToInvokeAndSplitBasicBlock(), llvm::changeToUnreachable(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneBasicBlock(), CloneInstructionInExitBlock(), llvm::BinaryOperator::Create(), createCallHelper(), createDirectCallInst(), createInvokeHelper(), createMalloc(), llvm::DeleteDeadBlock(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateRecursiveTailCall(), eliminateUnreachableBlock(), llvm::Instruction::eraseFromParent(), llvm::CodeExtractor::extractCodeRegion(), foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), HoistThenElseCodeToIf(), llvm::InlineFunction(), llvm::Instruction::insertAfter(), llvm::Instruction::insertBefore(), insertCallRetPHI(), llvm::IRBuilderDefaultInserter::InsertHelper(), llvm::InstCombiner::InsertNewInstBefore(), insertUniqueBackedgeBlock(), llvm::Instruction::Instruction(), LdStHasDebugValue(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), moveBBContents(), llvm::Instruction::moveBefore(), llvm::promoteIndirectCall(), llvm::Instruction::removeFromParent(), removePredecessor(), llvm::ReplaceInstWithInst(), llvm::InstCombiner::run(), llvm::UnifyFunctionExitNodes::runOnFunction(), SimplifyFunction(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::TryToUnfoldSelect(), unifyReturnBlockSet(), llvm::UnrollLoop(), unswitchTrivialBranch(), and llvm::InstCombiner::visitGetElementPtrInst().
|
inline |
Definition at line 318 of file BasicBlock.h.
| const LandingPadInst * BasicBlock::getLandingPadInst | ( | ) | const |
Return the landingpad instruction associated with the landing pad.
Definition at line 447 of file BasicBlock.cpp.
References llvm::dyn_cast(), and getFirstNonPHI().
Referenced by getLandingPadInst(), makeStatepointExplicitImpl(), and llvm::SplitLandingPadPredecessors().
|
inline |
Definition at line 393 of file BasicBlock.h.
References getLandingPadInst().
Return the module owning the function this basic block belongs to, or nullptr it the function does not have a module.
Note: this is undefined behavior if the block does not have a parent.
Definition at line 116 of file BasicBlock.cpp.
References getParent(), and llvm::GlobalValue::getParent().
Referenced by llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), llvm::emitBinaryFloatFnCall(), emitCalloc(), llvm::emitFPutC(), llvm::emitFPutS(), llvm::emitFWrite(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemCpyChk(), llvm::emitPutChar(), llvm::emitPutS(), llvm::emitStrChr(), llvm::emitStrCpy(), llvm::emitStrLen(), llvm::emitStrNCmp(), llvm::emitStrNCpy(), llvm::emitUnaryFloatFnCall(), llvm::LazyValueInfo::eraseBlock(), llvm::FindAvailablePtrLoadStore(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), llvm::DemandedBits::getDemandedBits(), llvm::Instruction::getModule(), getModule(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), handleEndBlock(), isObjectDereferencedInBlock(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessImpliedCondition(), llvm::promoteLoopAccessesToScalars(), llvm::SimplifyCFG(), llvm::SimplifyInstructionsInBlock(), llvm::LazyValueInfo::threadEdge(), llvm::JumpThreadingPass::ThreadGuard(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), and llvm::LoopVersioning::versionLoop().
|
inline |
Definition at line 116 of file BasicBlock.h.
References getModule().
Return the enclosing method, or null if none.
Definition at line 108 of file BasicBlock.h.
Referenced by llvm::addLandingPadInfo(), addNoRecurseAttrsTopDown(), calculateSEHStateNumbers(), callIntrinsic(), llvm::changeToUnreachable(), llvm::CloneBasicBlock(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::CodeMetrics::collectEphemeralValues(), computeKnownBitsFromAssume(), llvm::SanitizerStatReport::create(), llvm::IRBuilder< TargetFolder >::CreateAlloca(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateBinaryIntrinsic(), createCTLZIntrinsic(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateFAddReduce(), llvm::IRBuilderBase::CreateFMulReduce(), llvm::IRBuilderBase::CreateGCRelocate(), llvm::IRBuilderBase::CreateGCResult(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreateGlobalString(), llvm::IRBuilder< TargetFolder >::CreateInvariantGroupBarrier(), llvm::IRBuilderBase::CreateInvariantStart(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), createMaskInstrs(), llvm::IRBuilderBase::CreateMemCpy(), llvm::createMemCpyLoop(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), llvm::IRBuilderBase::CreateMemMove(), createMemMoveLoop(), llvm::IRBuilderBase::CreateMemSet(), createMemSetLoop(), createPopcntIntrinsic(), DeleteBasicBlock(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::InstCombiner::dominatesAllUses(), ehAwareSplitEdge(), 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(), eraseFromParent(), llvm::AlignmentFromAssumptionsPass::extractAlignmentInfo(), llvm::CodeExtractor::extractCodeRegion(), llvm::findDevirtualizableCallsForTypeTest(), findTRECandidate(), FoldCondBranchOnPHI(), GatherDominatingDefs(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::MMIAddrLabelMap::getAddrLabelSymbolToEmit(), getCommonReturnValue(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), 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(), getModule(), llvm::DOTGraphTraits< DomTreeNode * >::getNodeLabel(), llvm::DOTGraphTraits< RegionNode * >::getNodeLabel(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), getReductionIntrinsic(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), getValueSymbolTable(), getVarName(), handleEndBlock(), HandleInlinedEHPad(), HandleInlinedLandingPad(), handlePhiDef(), llvm::InlineFunction(), insertCallRetCast(), insertDebugValues(), InsertSafepointPoll(), insertSinCosCall(), isDynamicConstant(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), llvm::isInTailCallPosition(), isNotUsedInLoop(), isPointerValueDeadOnEntryToFunction(), llvm::isPotentiallyReachable(), llvm::RecurrenceDescriptor::isReductionPHI(), llvm::AllocaInst::isStaticAlloca(), llvm::TargetLoweringBase::isSuitableForJumpTable(), LLVMGetNextBasicBlock(), LLVMGetPreviousBasicBlock(), LLVMInsertBasicBlockInContext(), llvm::BlockAddress::lookup(), llvm::CallLowering::lowerCall(), llvm::SelectionDAGBuilder::LowerCallTo(), llvm::ARMTargetLowering::makeDMB(), llvm::AMDGPUSubtarget::makeLIDRangeMetadata(), llvm::HexagonTargetLowering::mayBeEmittedAsTailCall(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), moveAfter(), moveBefore(), NegateValue(), optimizeSQRT(), llvm::peelLoop(), PerformHeapAllocSRoA(), placeSplitBlockCarefully(), llvm::PrepareToSplitEntryBlock(), llvm::DivergenceAnalysis::print(), llvm::Value::print(), llvm::MIPrinter::printIRBlockReference(), llvm::JumpThreadingPass::ProcessBlock(), llvm::promoteIndirectCall(), llvm::AssumptionCache::registerAssumption(), removeFromParent(), replaceAllUsesOfWithIn(), replaceConstantExprOp(), replaceExtractElements(), llvm::JumpThreadingPass::runImpl(), scanOneBB(), llvm::setProfMetadata(), llvm::AArch64TTIImpl::shouldConsiderAddressTypePromotion(), SimplifyCondBranchToCondBranch(), simplifyRelocatesOffABase(), sinkLoopInvariantInstructions(), llvm::BasicBlockPass::skipBasicBlock(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), SwitchToLookupTable(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TryToSinkInstruction(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), useFuncSeen(), UseTlsOffset(), ValueDominatesPHI(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitLandingPadInst(), and ~BasicBlock().
|
inline |
Definition at line 109 of file BasicBlock.h.
| 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 217 of file BasicBlock.cpp.
References E, llvm::pred_begin(), and llvm::pred_end().
Referenced by allPredecessorsComeFromSameSource(), CanPropagatePredecessorsForPHIs(), canSafelyUnrollMultiExitLoop(), llvm::CloneAndPruneIntoFromInst(), llvm::DeleteDeadBlock(), llvm::DominatorTree::dominates(), FindPHIForConditionForwarding(), foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), llvm::GetIfCondition(), getSinglePredecessor(), handlePhiDef(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isOnlyReachableViaThisEdge(), llvm::isValidAssumeForContext(), llvm::MergeBasicBlockIntoOnlyPred(), mergeCleanupPad(), mergeConditionalStores(), mergeConditionalStoreToAddress(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessImpliedCondition(), llvm::InstCombiner::replacedSelectWithOperand(), shouldInstrumentBlock(), simplifyLoopCFG(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), splitBlockIfNotFirst(), llvm::SplitEdge(), tryToMoveFreeBeforeNullTest(), and TryToSimplifyUncondBranchWithICmpInIt().
|
inline |
Definition at line 212 of file BasicBlock.h.
References getSinglePredecessor().
| 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 244 of file BasicBlock.cpp.
References E, SI, llvm::succ_begin(), and llvm::succ_end().
Referenced by ensureValueAvailableInSuccessor(), getSingleSuccessor(), insertCallRetPHI(), mergeConditionalStores(), llvm::programUndefinedIfFullPoison(), and simplifyLoopCFG().
|
inline |
Definition at line 234 of file BasicBlock.h.
References getSingleSuccessor().
|
inlinestatic |
Returns a pointer to a member of the instruction list.
Definition at line 321 of file BasicBlock.h.
Returns the call instruction calling .experimental.deoptimize prior to the terminating return instruction of this basic block, if such a call is present.
Otherwise, returns null.
Definition at line 156 of file BasicBlock.cpp.
References llvm::dyn_cast(), and F.
Referenced by getTerminatingDeoptimizeCall(), and llvm::InlineFunction().
|
inline |
Definition at line 133 of file BasicBlock.h.
References getTerminatingDeoptimizeCall().
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 125 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 getTerminatingMustTailCall(), and llvm::InlineFunction().
|
inline |
Definition at line 142 of file BasicBlock.h.
References getTerminatingMustTailCall().
| const TerminatorInst * 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 120 of file BasicBlock.cpp.
References llvm::dyn_cast().
Referenced by AddReachableCodeToWorklist(), BlockIsSimpleEnoughToThreadThrough(), llvm::BranchProbabilityInfo::calculate(), canSinkInstructions(), checkBasicSSA(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunctionInto(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::colorEHFunclets(), llvm::FunctionComparator::compare(), ConnectProlog(), llvm::ConstantFoldTerminator(), llvm::createMemCpyLoop(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemMoveLoop(), createMemSetLoop(), createPHIsForSplitLoopExit(), llvm::DeleteDeadBlock(), llvm::DemotePHIToStack(), despeculateCountZeros(), detectCTLZIdiom(), detectPopcountIdiom(), DominatesMergePoint(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), ehAwareSplitEdge(), eliminateDeadStores(), EliminateDeadSwitchCases(), eliminateTailRecursion(), llvm::Evaluator::EvaluateFunction(), findBasePointer(), findIBRPredecessor(), FindMostPopularDest(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), FindPHIForConditionForwarding(), findUnconditionalPreds(), foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), foldReturnAndProcessPred(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), GetBestDestForJumpOnUndef(), getBranchHint(), llvm::DOTGraphTraits< const Function * >::getEdgeAttributes(), llvm::DOTGraphTraits< const Function * >::getEdgeSourceLabel(), getEdgeValueLocal(), getEHPadFromPredecessor(), llvm::GetIfCondition(), getInsertPointForUses(), getJumpThreadDuplicationCost(), getLoopLatchExitBlock(), llvm::RegionTraits< Function >::getNumSuccessors(), llvm::GCProjectionInst::getStatepoint(), llvm::GetSuccessorNumber(), getSuccState(), getTerminator(), handleFinalSuspend(), handleFree(), handlePhiDef(), hasProfileData(), hoist(), llvm::InlineFunction(), insertCallRetCast(), llvm::DIBuilder::insertDeclare(), llvm::InsertPreheaderForLoop(), insertSpills(), insertUniqueBackedgeBlock(), is_empty(), IsAcceptableTarget(), isChainSelectCmpBranch(), llvm::SparseSolver::isEdgeFeasible(), llvm::isInTailCallPosition(), isLegalToHoistInto(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isLoopDead(), isNotUsedInLoop(), isSafePHIToSpeculate(), llvm::BasicBlockEdge::isSingleEdge(), isUniformlyReached(), llvm::Loop::makeLoopInvariant(), MemCmpExpansion::MemCmpExpansion(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), mergeEmptyReturnBlocks(), moveBBContents(), llvm::EscapeEnumerator::Next(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), optimizeSQRT(), llvm::peelLoop(), PerformHeapAllocSRoA(), prepareForSplit(), llvm::JumpThreadingPass::ProcessBlock(), ProcessBlock(), llvm::JumpThreadingPass::ProcessBranchOnPHI(), llvm::JumpThreadingPass::ProcessImpliedCondition(), llvm::JumpThreadingPass::ProcessThreadableEdges(), llvm::promoteLoopAccessesToScalars(), relocationViaAlloca(), llvm::removeAllNonTerminatorAndEHPadInstructions(), removeEmptyCleanup(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceConstantExprOp(), llvm::InstCombiner::replacedSelectWithOperand(), replaceFallthroughCoroEnd(), replaceSuccessorsPhiUsesWith(), llvm::JumpThreadingPass::runImpl(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), llvm::StackProtector::shouldEmitSDCheck(), shouldInstrumentBlock(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), SinkCast(), sinkLastInstruction(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), SpeculativelyExecuteBB(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitCriticalEdge(), SplitCriticalSideEffectEdges(), llvm::SplitEdge(), llvm::SplitLandingPadPredecessors(), llvm::succ_begin(), llvm::succ_end(), llvm::JumpThreadingPass::ThreadEdge(), TryToMergeLandingPad(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TryToSinkInstruction(), llvm::JumpThreadingPass::TryToUnfoldSelect(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchAllTrivialConditions(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::slpvectorizer::BoUpSLP::vectorizeTree(), llvm::LoopVersioning::versionLoop(), llvm::InstCombiner::visitCallInst(), and llvm::InstCombiner::visitPHINode().
|
inline |
Definition at line 124 of file BasicBlock.h.
References getTerminator().
| 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 230 of file BasicBlock.cpp.
References E, llvm::pred_begin(), and llvm::pred_end().
Referenced by findLocationForEntrySafepoint(), llvm::GCProjectionInst::getStatepoint(), getUniquePredecessor(), IsAcceptableTarget(), isDynamicConstant(), makeStatepointExplicitImpl(), llvm::MergeBlockIntoPredecessor(), normalizeForInvokeSafepoint(), reuseTableCompare(), and unswitchTrivialBranch().
|
inline |
Definition at line 224 of file BasicBlock.h.
References getUniquePredecessor().
| 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 252 of file BasicBlock.cpp.
References E, SI, llvm::succ_begin(), and llvm::succ_end().
Referenced by getUniqueSuccessor(), and TryToMergeLandingPad().
|
inline |
Definition at line 244 of file BasicBlock.h.
References getUniqueSuccessor().
| 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().
|
inline |
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
to it.
Definition at line 376 of file BasicBlock.h.
References llvm::Value::getSubclassDataFromValue().
Referenced by llvm::CloneFunctionInto(), llvm::AsmPrinter::EmitBasicBlockStart(), foldReturnAndProcessPred(), llvm::MMIAddrLabelMap::getAddrLabelSymbolToEmit(), hasAddressTakenAndUsed(), llvm::CodeExtractor::isBlockValidForExtraction(), llvm::BlockAddress::lookup(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::UnrollLoop(), and ~BasicBlock().
| void BasicBlock::insertInto | ( | Function * | Parent, |
| BasicBlock * | InsertBefore = nullptr |
||
| ) |
Insert unlinked basic block into a function.
Inserts an unlinked basic block into Parent. If InsertBefore is provided, inserts before that basic block, otherwise inserts at the end.
nullptr. Definition at line 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().
|
inline |
Return true if this basic block is an exception handling block.
Definition at line 383 of file BasicBlock.h.
References getFirstNonPHI(), and llvm::Instruction::isEHPad().
Referenced by calculateCXXStateNumbers(), calculateSEHStateNumbers(), findBestInsertionSet(), getPredState(), llvm::CodeExtractor::isBlockValidForExtraction(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), separateNestedLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), and llvm::SplitCriticalEdge().
| 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 442 of file BasicBlock.cpp.
References getFirstNonPHI().
Referenced by createPHIsForSplitLoopExit(), llvm::SplitBlockPredecessors(), and llvm::SplitLandingPadPredecessors().
| bool BasicBlock::isLegalToHoistInto | ( | ) | const |
Return true if it is legal to hoist instructions into this block.
Definition at line 358 of file BasicBlock.cpp.
References assert(), and getTerminator().
| void BasicBlock::moveAfter | ( | BasicBlock * | MovePos | ) |
Unlink this basic block from its current function and insert it right after MovePos in the function MovePos lives in.
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_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 llvm::MergeBasicBlockIntoOnlyPred(), placeSplitBlockCarefully(), and llvm::JumpThreadingPass::ThreadEdge().
| 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_impl< ilist_detail::compute_node_options< BasicBlock, Options...>::type >::getIterator(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::splice().
|
delete |
|
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 308 of file BasicBlock.h.
Referenced by splitBasicBlock().
| iterator_range< BasicBlock::phi_iterator > BasicBlock::phis | ( | ) |
Definition at line 266 of file BasicBlock.cpp.
References llvm::dyn_cast(), and front().
|
inline |
Definition at line 257 of file BasicBlock.h.
Referenced by findLiveSetAtInst(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), and sinkLoopInvariantInstructions().
|
inline |
Definition at line 258 of file BasicBlock.h.
| void BasicBlock::removeFromParent | ( | ) |
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_impl< ilist_detail::compute_node_options< BasicBlock, Options...>::type >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::remove().
| 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 276 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(), llvm::ConstantFoldTerminator(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), HandleInlinedLandingPad(), llvm::JumpThreadingPass::ProcessBlock(), llvm::RemovePredecessorAndSimplify(), RemoveSwitchAfterSelectConversion(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), SimplifyCondBranchToTwoReturns(), simplifyOneLoop(), SimplifyTerminatorOnSelect(), llvm::SplitCriticalEdge(), and SwitchToLookupTable().
|
inline |
Definition at line 259 of file BasicBlock.h.
Referenced by llvm::slpvectorizer::BoUpSLP::getSpillCost(), and sinkLoopInvariantInstructions().
|
inline |
Definition at line 260 of file BasicBlock.h.
| 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 420 of file BasicBlock.cpp.
References llvm::dyn_cast(), llvm::PHINode::getBasicBlockIndex(), getTerminator(), llvm::ARM_PROC::IE, llvm::PHINode::setIncomingBlock(), and llvm::TerminatorInst::successors().
|
inline |
Definition at line 262 of file BasicBlock.h.
Referenced by llvm::FastISel::fastEmitBranch(), isEmptyFunction(), and tryToMoveFreeBeforeNullTest().
| 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 382 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(), llvm::createMemCpyLoop(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemSetLoop(), createResumeEntryBlock(), despeculateCountZeros(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), handleFinalSuspend(), llvm::InlineFunction(), insertSpills(), MemCmpExpansion::MemCmpExpansion(), PerformHeapAllocSRoA(), replaceFallthroughCoroEnd(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), SimplifyBranchOnICmpChain(), SimplifyFunction(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), and splitBlockIfNotFirst().
|
inline |
Definition at line 370 of file BasicBlock.h.
References llvm::ilist_node_impl< OptionsT >::getIterator(), and splitBasicBlock().
|
friend |
Definition at line 65 of file BasicBlock.h.
|
friend |
Definition at line 66 of file BasicBlock.h.
1.8.6