LLVM
8.0.1
|
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 if the function does not have a module. More... | |
Module * | getModule () |
const Instruction * | getTerminator () const LLVM_READONLY |
Returns the terminator instruction if the block is well formed or null if the block is not well formed. More... | |
Instruction * | getTerminator () |
const CallInst * | getTerminatingDeoptimizeCall () const |
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return instruction of this basic block, if such a call is present. 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 () |
iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > | instructionsWithoutDebug () const |
Return a const iterator range over the instructions in the block, skipping any debug instructions. More... | |
iterator_range< filter_iterator< BasicBlock::iterator, std::function< bool(Instruction &)> > > | instructionsWithoutDebug () |
Return an iterator range over the instructions in the block, skipping any debug instructions. More... | |
void | removeFromParent () |
Unlink 'this' from the containing function, but do not delete it. More... | |
SymbolTableList< BasicBlock >::iterator | eraseFromParent () |
Unlink 'this' from the containing function and delete it. More... | |
void | moveBefore (BasicBlock *MovePos) |
Unlink this basic block from its current function and insert it into the function that MovePos lives in, right before MovePos . More... | |
void | moveAfter (BasicBlock *MovePos) |
Unlink this basic block from its current function and insert it right after MovePos in the function MovePos lives in. More... | |
void | insertInto (Function *Parent, BasicBlock *InsertBefore=nullptr) |
Insert unlinked basic block into a function. More... | |
const 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 () |
bool | hasNPredecessors (unsigned N) const |
Return true if this block has exactly N predecessors. More... | |
bool | hasNPredecessorsOrMore (unsigned N) const |
Return true if this block has N predecessors or more. More... | |
const 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... | |
Optional< uint64_t > | getIrrLoopHeaderWeight () const |
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 |
bool | materialized_use_empty () const |
use_iterator | materialized_use_begin () |
const_use_iterator | materialized_use_begin () const |
use_iterator | use_begin () |
const_use_iterator | use_begin () const |
use_iterator | use_end () |
const_use_iterator | use_end () const |
iterator_range< use_iterator > | materialized_uses () |
iterator_range< const_use_iterator > | materialized_uses () const |
iterator_range< use_iterator > | uses () |
iterator_range< const_use_iterator > | uses () const |
bool | user_empty () const |
user_iterator | materialized_user_begin () |
const_user_iterator | materialized_user_begin () const |
user_iterator | user_begin () |
const_user_iterator | user_begin () const |
user_iterator | user_end () |
const_user_iterator | user_end () const |
User * | user_back () |
const User * | user_back () const |
iterator_range< user_iterator > | materialized_users () |
iterator_range< const_user_iterator > | materialized_users () const |
iterator_range< user_iterator > | users () |
iterator_range< const_user_iterator > | users () const |
bool | hasOneUse () const |
Return true if there is exactly one 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 * | stripPointerCastsAndInvariantGroups () const |
Strip off pointer casts, all-zero GEPs, aliases and invariant group info. More... | |
Value * | stripPointerCastsAndInvariantGroups () |
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 () |
uint64_t | getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull) const |
Returns the number of bytes known to be dereferenceable for the pointer value. More... | |
unsigned | getPointerAlignment (const DataLayout &DL) const |
Returns an alignment of the pointer value. More... | |
const 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 terminator instruction. Terminator instructions may not occur in the middle of basic blocks, and must terminate the blocks. The BasicBlock class allows malformed basic blocks to occur because it may be useful in the intermediate stage of constructing or modifying a program. However, the verifier will ensure that basic blocks are "well formed".
Definition at line 58 of file BasicBlock.h.
using llvm::BasicBlock::const_iterator = InstListType::const_iterator |
Definition at line 91 of file BasicBlock.h.
using llvm::BasicBlock::const_phi_iterator = phi_iterator_impl<const PHINode, BasicBlock::const_iterator> |
Definition at line 320 of file BasicBlock.h.
Definition at line 93 of file BasicBlock.h.
Definition at line 61 of file BasicBlock.h.
using llvm::BasicBlock::iterator = InstListType::iterator |
Instruction iterators...
Definition at line 90 of file BasicBlock.h.
Definition at line 318 of file BasicBlock.h.
Definition at line 92 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::SymbolTableListTraits< ValueSubClass >::setSymTabObject(), llvm::Value::use_empty(), and llvm::Value::user_back().
|
inline |
Definition at line 283 of file BasicBlock.h.
Referenced by llvm::DomTreeUpdater::callbackDeleteBB(), llvm::AAResults::canBasicBlockModify(), CheckForCanReleaseCFGHazard(), llvm::CloneAndPruneIntoFromInst(), createCallInst(), createCast(), llvm::createObjCARCOptPass(), FindPredecessorAutoreleaseWithSafePath(), findUnwindDestinations(), llvm::SCEVExpander::getRelatedExistingExpansion(), intersect(), promoteSingleBlockAlloca(), llvm::SimplifyInstructionsInBlock(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::Solve(), llvm::UnrollAndJamLoop(), and llvm::UnrollLoop().
|
inline |
Definition at line 284 of file BasicBlock.h.
|
inline |
Instruction iterator methods.
Definition at line 269 of file BasicBlock.h.
Referenced by AddReachableCodeToWorklist(), llvm::MemorySSAUpdater::applyInsertUpdates(), asmClobbersCTR(), llvm::calculateWasmEHInfo(), llvm::Interpreter::callFunction(), CanPropagatePredecessorsForPHIs(), canSplitCallSite(), CheckForCanReleaseCFGHazard(), llvm::CloneAndPruneIntoFromInst(), CloneLoop(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::computePeelCount(), ComputePostOrders(), ConvertToSInt(), createCallInst(), createCast(), llvm::createCodeGenPreparePass(), llvm::createObjCARCOptPass(), llvm::createScalarizerPass(), llvm::createShadowStackGCLoweringPass(), cse(), cxxDtorIsEmpty(), DeleteBasicBlock(), despeculateCountZeros(), llvm::DominatorTree::dominates(), llvm::GVNExpression::Expression::dump(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), eliminateDeadStores(), llvm::EliminateDuplicatePHINodes(), eliminateRecursiveTailCall(), eliminateUnreachableBlock(), ensureValueAvailableInSuccessor(), llvm::Evaluator::EvaluateFunction(), llvm::CodeExtractor::extractCodeRegion(), llvm::FastISel::fastEmitZExtFromI1(), llvm::FindAvailablePtrLoadStore(), llvm::objcarc::FindDependencies(), findIBRPredecessor(), findInitTrampolineFromBB(), llvm::CodeExtractor::findInputsOutputs(), FindLoopCounter(), findPHIToPartitionLoops(), llvm::SSAUpdaterTraits< SSAUpdater >::FindPredecessorBlocks(), findRetainForStoreStrongContraction(), findTRECandidate(), llvm::InnerLoopVectorizer::fixFirstOrderRecurrence(), fixPhis(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldSingleEntryPHINodes(), FoldTwoEntryPHINode(), llvm::Loop::getCanonicalInductionVariable(), llvm::MemoryDependenceResults::getDependency(), llvm::GetIfCondition(), getInductionVariable(), GetLocation(), getMemSetPatternValue(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleCallsInBlockInlinedThroughInvoke(), handleEndBlock(), hasProfileData(), hasUsesOutsideLoop(), llvm::hoistAllInstructionsInto(), HoistThenElseCodeToIf(), INITIALIZE_PASS(), llvm::InlineFunction(), InsertRootInitializers(), InsertSafepointPoll(), insertSinCosCall(), instrumentMaskedLoadOrStore(), is_empty(), llvm::isGuaranteedToTransferExecutionToSuccessor(), IsIncrementNUW(), IsNonLocalValue(), isOnlyReachableViaThisEdge(), llvm::isSafeToLoadUnconditionally(), llvm::Value::isUsedInBasicBlock(), isZero(), llvm::IVUsers::IVUsers(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetPreviousInstruction(), llvm::log2(), makeBitReverse(), makeStatepointExplicitImpl(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::MarkBlockExecutable(), MarkBlocksLiveIn(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeEmptyReturnBlocks(), moveLCSSAPhis(), NegateValue(), normalizeForInvokeSafepoint(), operator new(), operator<<(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), optimizeSQRT(), llvm::OrderedBasicBlock::OrderedBasicBlock(), llvm::peelLoop(), performMaskedAtomicOp(), phis(), ProcessBlock(), processInternalGlobal(), promoteMemoryToRegister(), promoteSingleBlockAlloca(), PushLoopPHIs(), relocateInstructionBefore(), removeEmptyCleanup(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), removeUndefIntroducingPredecessor(), ReplaceUsesOfWith(), rewritePHINodesForExitAndUnswitchedBlocks(), RewriteUsesOfClonedInstructions(), runOnBasicBlock(), scalarizeMaskedScatter(), shouldKeepInEntry(), shouldRotateLoopExitingLatch(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), llvm::InstCombiner::simplifyDivRemOfSelectWithZeroOp(), SimplifyIndirectBrOnSelect(), llvm::SimplifyInstructionsInBlock(), llvm::simplifyLoopIVs(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), llvm::sinkRegion(), SpeculativelyExecuteBB(), llvm::SplitBlock(), llvm::SplitBlockPredecessors(), splitCallSite(), llvm::SplitCriticalEdge(), StackMallocSizeClass(), llvm::JumpThreadingPass::ThreadEdge(), llvm::JumpThreadingPass::ThreadGuard(), truncateIVUse(), tryToElideArgumentCopy(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::TryToUnfoldSelectInCurrBB(), tryToVectorizeHorReductionOrInstOperands(), TurnSwitchRangeIntoICmp(), llvm::JumpThreadingPass::UnfoldSelectInstr(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), unswitchNontrivialInvariants(), updateForIncomingValueLocation(), UpdatePHINodes(), updatePhiNodes(), llvm::LoopVersioning::versionLoop(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), llvm::Interpreter::visitIndirectBrInst(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().
|
inline |
Definition at line 270 of file BasicBlock.h.
bool BasicBlock::canSplitPredecessors | ( | ) | const |
Definition at line 372 of file BasicBlock.cpp.
References getFirstNonPHI(), and llvm::Instruction::isEHPad().
Referenced by canSplitCallSite(), canSplitPredecessors(), classof(), and llvm::SplitBlockPredecessors().
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition at line 346 of file BasicBlock.h.
References canSplitPredecessors(), dropAllReferences(), llvm::Value::getValueID(), I, removePredecessor(), and splitBasicBlock().
|
inlinestatic |
Creates a new BasicBlock.
If the Parent parameter is specified, the basic block is automatically inserted at either the end of the function (if InsertBefore is 0), or before the specified basic block.
Definition at line 100 of file BasicBlock.h.
References llvm::ISD::BasicBlock, and Name.
Referenced by addBoundsChecking(), assureFPCallStub(), llvm::CloneBasicBlock(), llvm::CloneFunction(), createDevirtTriggerFunc(), createDummyFunction(), llvm::createDwarfEHPass(), llvm::createEfficiencySanitizerPass(), createEmptyFunction(), createFPFnStub(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemMoveLoop(), createMemSetLoop(), CreatePrologue(), createResumeEntryBlock(), llvm::createSanitizerCtorAndInitFunctions(), CreateWrapper(), llvm::createX86RetpolineThunksPass(), llvm::VPBlockBase::deleteCFG(), ehAwareSplitEdge(), eliminateRecursiveTailCall(), llvm::CodeExtractor::extractCodeRegion(), llvm::CodeExtractor::findInputsOutputs(), llvm::SanitizerStatReport::finish(), FitWeights(), FoldCondBranchOnPHI(), FunctionNumber(), getSignature(), getTrueOrFalseValue(), INITIALIZE_PASS(), insertUniqueBackedgeBlock(), instrumentMaskedLoadOrStore(), isThunkProfitable(), LLVMAppendBasicBlockInContext(), LLVMCreateBasicBlockInContext(), LLVMInsertBasicBlockInContext(), llvm::orc::makeStub(), mayLoopAccessLocation(), needsRuntimeRegistrationOfSectionRange(), llvm::EscapeEnumerator::Next(), optimizeSQRT(), PerformHeapAllocSRoA(), performMaskedAtomicOp(), readWideAPInt(), ReplaceUsesOfWith(), llvm::WholeProgramDevirtPass::run(), llvm::UnifyFunctionExitNodes::runOnFunction(), scaleWeights(), selectJumpTableArmEncoding(), shouldKeepInEntry(), SimplifyCondBranchToCondBranch(), SimplifyIndirectBrOnSelect(), llvm::sinkRegion(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), SwitchToLookupTable(), llvm::JumpThreadingPass::ThreadEdge(), llvm::JumpThreadingPass::UnfoldSelectInstr(), and unifyReturnBlockSet().
void BasicBlock::dropAllReferences | ( | ) |
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining.
This allows one to 'delete' a whole class at a time, even though there may be circular references... first all references are dropped, and all use counts go to zero. Then everything is delete'd for real. Note that no operations are valid on an object that has "dropped all references", except operator delete.
Definition at line 227 of file BasicBlock.cpp.
References llvm::User::dropAllReferences(), and I.
Referenced by classof(), deleteDeadBlocksFromLoop(), llvm::Function::dropAllReferences(), eliminateUnreachableBlock(), and ~BasicBlock().
|
inline |
Definition at line 280 of file BasicBlock.h.
Referenced by llvm::DomTreeUpdater::callbackDeleteBB(), is_empty(), and phis().
|
inline |
Definition at line 271 of file BasicBlock.h.
Referenced by AddReachableCodeToWorklist(), asmClobbersCTR(), llvm::changeToUnreachable(), CheckForCanReleaseCFGHazard(), llvm::CloneFunction(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::ConvertDebugDeclareToDebugValue(), createCast(), cse(), cxxDtorIsEmpty(), DeleteBasicBlock(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), eliminateRecursiveTailCall(), llvm::objcarc::FindDependencies(), findSafeStoreForStoreStrongContraction(), first_use_of_in_block(), llvm::foldBlockIntoPredecessor(), getFirstInsertionPt(), getMemSetPatternValue(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), getTrueOrFalseValue(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), HandleCallsInBlockInlinedThroughInvoke(), handleEndBlock(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), hasProfileData(), llvm::hoistAllInstructionsInto(), INITIALIZE_PASS(), llvm::insertDebugValuesForPHIs(), InsertSafepointPoll(), instrumentOneFunc(), llvm::isGuaranteedToTransferExecutionToSuccessor(), llvm::isInTailCallPosition(), isOnlyReachableViaThisEdge(), llvm::isPotentiallyReachable(), isSafeAndProfitableToSinkLoad(), llvm::Value::isUsedInBasicBlock(), llvm::isValidAssumeForContext(), isZero(), LLVMGetFirstInstruction(), LLVMGetLastInstruction(), LLVMGetNextInstruction(), LLVMPositionBuilder(), makeBitReverse(), MarkBlocksLiveIn(), memoryIsNotModifiedBetween(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), llvm::Instruction::moveBefore(), llvm::InjectorIRStrategy::mutate(), llvm::RandomIRBuilder::newSource(), operator new(), OptimizeExtractBits(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), llvm::OrderedBasicBlock::OrderedBasicBlock(), passingValueIsAlwaysUndefined(), performMaskedAtomicOp(), llvm::PrepareToSplitEntryBlock(), ProcessBlock(), promoteMemoryToRegister(), propagateMetadata(), relocateInstructionBefore(), removeTriviallyEmptyRange(), ReplaceUsesOfWith(), RewriteUsesOfClonedInstructions(), runOnBasicBlock(), scalarizeMaskedScatter(), llvm::IRBuilderBase::SetInsertPoint(), shouldInstrumentBlock(), shouldRotateLoopExitingLatch(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), SinkCast(), SinkCmpExpression(), llvm::sinkRegion(), SinkShiftAndTruncate(), SpeculativelyExecuteBB(), splitBasicBlock(), TryToSinkInstruction(), tryToVectorizeHorReductionOrInstOperands(), unswitchTrivialBranch(), and llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit().
|
inline |
Definition at line 272 of file BasicBlock.h.
iplist< BasicBlock >::iterator BasicBlock::eraseFromParent | ( | ) |
Unlink 'this' from the containing function and delete it.
Definition at line 115 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(), createCast(), llvm::createCodeGenPreparePass(), DeleteBasicBlock(), deleteDeadBlocksFromLoop(), despeculateCountZeros(), llvm::foldBlockIntoPredecessor(), getFirstInsertionPt(), llvm::InlineFunction(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeEmptyReturnBlocks(), removeEmptyCleanup(), ReplaceUsesOfWith(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and unifyReturnBlockSet().
|
inline |
Definition at line 281 of file BasicBlock.h.
Referenced by calculateStateNumbersForInvokes(), llvm::AAResults::canBasicBlockModify(), llvm::CloneAndPruneFunctionInto(), llvm::CloneAndPruneIntoFromInst(), CloneInstructionInExitBlock(), CloneLoop(), llvm::SSAUpdaterTraits< SSAUpdater >::CreateEmptyPHI(), createFFSIntrinsic(), createPHIsForSplitLoopExit(), CreatePrologue(), createRetPHINode(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), despeculateCountZeros(), detectShiftUntilZeroIdiom(), llvm::GVNExpression::Expression::dump(), eliminateDeadStores(), eliminateDeadSwitchCases(), eliminateRecursiveTailCall(), ensureValueAvailableInSuccessor(), llvm::CodeExtractor::findInputsOutputs(), findLocationForEntrySafepoint(), findTRECandidate(), getOffsetFromIndices(), llvm::SCEVExpander::getOrInsertCanonicalInductionVariable(), GetRMWLibcall(), getSuccPad(), getSuccState(), getTrueOrFalseValue(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), INITIALIZE_PASS(), llvm::InlineFunction(), insertSpills(), insertTrivialPHIs(), instrumentMaskedLoadOrStore(), IsIncrementNUW(), isLoadConditional(), isOnlyReachableViaThisEdge(), isProfitableForVectorization(), isSafeToExecuteUnconditionally(), isSafeToPromoteArgument(), isZero(), MarkBlocksLiveIn(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeEmptyReturnBlocks(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), promoteSingleBlockAlloca(), llvm::removeAllNonTerminatorAndEHPadInstructions(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), rewritePHIs(), llvm::UnifyFunctionExitNodes::runOnFunction(), SimplifyIndirectBrOnSelect(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), llvm::SplitEdge(), StackMallocSizeClass(), truncateIVUse(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), unswitchTrivialSwitch(), llvm::SelectionDAGBuilder::UpdateSplitBlock(), llvm::LoopVersioning::versionLoop(), and llvm::InstCombiner::visitStoreInst().
|
inline |
Definition at line 282 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 assert(), llvm::ISD::BasicBlock, C, llvm::Type::getContext(), llvm::Type::getLabelTy(), llvm::Value::getType(), insertInto(), Name, llvm::Value::setName(), and llvm::Value::Value().
Referenced by AddRuntimeUnrollDisableMetaData(), allPredecessorsComeFromSameSource(), llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::DomTreeUpdater::callbackDeleteBB(), canTransformToMemCmp(), llvm::CloneBasicBlock(), llvm::CloneFunction(), CloneLoop(), llvm::ConstantFoldTerminator(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createStringMetadata(), llvm::VPBlockBase::deleteCFG(), DisableAllLoopOptsOnLoop(), ehAwareSplitEdge(), llvm::emitCalloc(), llvm::emitFReadUnlocked(), llvm::emitFWrite(), llvm::emitFWriteUnlocked(), llvm::emitMalloc(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemCpyChk(), llvm::emitStrLen(), llvm::emitStrNCmp(), EqualityPropUnSafe(), eraseDeadBBsAndChildren(), llvm::CodeExtractor::extractCodeRegion(), llvm::CodeExtractor::findInputsOutputs(), FitWeights(), llvm::AMDGPULibCalls::fold(), FoldCondBranchOnPHI(), llvm::InvokeInst::getLandingPadInst(), insertCall(), insertUniqueBackedgeBlock(), isOnlyReachableViaThisEdge(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::MemorySSA::moveTo(), optimizeSQRT(), patchAndReplaceAllUsesWith(), PerformHeapAllocSRoA(), llvm::LoopVersioning::prepareNoAliasMetadata(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), llvm::IRCEPass::run(), scaleWeights(), setBranchWeights(), llvm::Loop::setLoopAlreadyUnrolled(), SimplifyIndirectBrOnSelect(), llvm::sinkRegion(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::UnfoldSelectInstr(), llvm::UnreachableInst::UnreachableInst(), updatePredecessorProfileMetadata(), and ~BasicBlock().
BasicBlock::const_iterator BasicBlock::getFirstInsertionPt | ( | ) | const |
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI instruction.
In particular, it skips all PHIs and LandingPad instructions.
Definition at line 217 of file BasicBlock.cpp.
References end(), getFirstNonPHI(), and llvm::ilist_node_impl< OptionsT >::getIterator().
Referenced by cheapToScalarize(), CloneInstructionInExitBlock(), llvm::ConvertDebugDeclareToDebugValue(), ConvertToSInt(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::DemoteRegToStack(), llvm::GVNExpression::Expression::dump(), eraseDeadBBsAndChildren(), llvm::VPlan::execute(), llvm::SCEVExpander::expandCodeFor(), findInsertPointAfter(), llvm::InnerLoopVectorizer::fixFirstOrderRecurrence(), llvm::InnerLoopVectorizer::fixReduction(), foldGuardedRotateToFunnelShift(), getFirstInsertionPt(), getFirstNonPHIOrDbgOrLifetime(), getNarrowIntrinsic(), GetPointerOperand(), getRetComponentType(), getScalarIntrinsicDeclaration(), getSignature(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), hasSameExtUse(), hasUsesOutsideLoop(), llvm::insertDebugValuesForPHIs(), insertSpills(), instrumentMaskedLoadOrStore(), instrumentOneFunc(), makeBitReverse(), makeStatepointExplicitImpl(), MarkBlocksLiveIn(), mergeConditionalStoreToAddress(), llvm::InjectorIRStrategy::mutate(), llvm::InstDeleterIRStrategy::mutate(), llvm::RandomIRBuilder::newSink(), llvm::RandomIRBuilder::newSource(), OptimizeExtractBits(), false::LibCallsShrinkWrap::perform(), rematerializeLiveValues(), llvm::SCEVExpander::replaceCongruentIVs(), replaceExtractElements(), rewriteMaterializableInstructions(), llvm::InstCombiner::run(), setInsertionPoint(), shouldInstrumentBlock(), simplifyRelocatesOffABase(), SinkCast(), SinkCmpExpression(), SinkShiftAndTruncate(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadGuard(), truncateIVUse(), TryToSinkInstruction(), llvm::sroa::AllocaSliceRewriter::visit(), llvm::InstCombiner::visitGetElementPtrInst(), llvm::ObjectSizeOffsetEvaluator::visitPHINode(), llvm::InstCombiner::visitStoreInst(), and llvm::InnerLoopVectorizer::widenPHIInstruction().
|
inline |
Definition at line 179 of file BasicBlock.h.
References eraseFromParent(), getFirstInsertionPt(), getSinglePredecessor(), insertInto(), instructionsWithoutDebug(), moveAfter(), moveBefore(), and removeFromParent().
const Instruction * BasicBlock::getFirstNonPHI | ( | ) | const |
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
When adding instructions to the beginning of the basic block, they should be added before the returned value, not before the first instruction, which might be PHI. Returns 0 is there's no non-PHI instruction.
Definition at line 190 of file BasicBlock.cpp.
References I.
Referenced by llvm::MachineFunction::addLandingPad(), llvm::calculateClrEHStateNumbers(), calculateStateNumbersForInvokes(), llvm::calculateWasmEHInfo(), canSplitPredecessors(), canSplitPredecessors(), CloneLoopBlocks(), llvm::colorEHFunclets(), ConnectEpilog(), ConnectProlog(), createCallInst(), llvm::createMemCpyLoopKnownSize(), createPHIsForSplitLoopExit(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), ehAwareSplitEdge(), eraseDeadBBsAndChildren(), llvm::CodeExtractor::findInputsOutputs(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findUnwindDestinations(), fixPhis(), getFirstInsertionPt(), getFirstNonPHI(), getJumpThreadDuplicationCost(), getLandingPadInst(), getParentPad(), GetPointerOperand(), getSignature(), getSuccPad(), getSuccState(), getTerminatingMustTailCall(), getUnwindDestTokenHelper(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), hoist(), llvm::InlineFunction(), llvm::insertDebugValuesForPHIs(), inversePermutation(), isAtomic(), isEHPad(), isLandingPad(), isProfitableForVectorization(), isWrapperOnlyCall(), mapWasmLandingPadIndex(), markAliveBlocks(), mayUsePostIncMode(), moveLCSSAPhis(), relocationViaAlloca(), removeEmptyCleanup(), replaceAllUsesOfWithIn(), rewritePHIs(), SimplifyBranchOnICmpChain(), llvm::SplitLandingPadPredecessors(), TypeSizeToSizeIndex(), and llvm::UnrollRuntimeLoopRemainder().
|
inline |
Definition at line 153 of file BasicBlock.h.
References getFirstNonPHI(), and getFirstNonPHIOrDbg().
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 197 of file BasicBlock.cpp.
References I.
Referenced by llvm::createCodeGenPreparePass(), doCallSiteSplitting(), eliminateDeadSwitchCases(), eliminateTailRecursion(), FindPHIForConditionForwarding(), foldReturnAndProcessPred(), getFirstNonPHI(), getFirstNonPHIOrDbg(), InitializeUniqueCases(), llvm::SimpleLoopSafetyInfo::isGuaranteedToExecute(), isIgnorableInst(), isPredicatedOnPHI(), mergeCleanupPad(), scaleCaseProbality(), SimplifyCondBranchToTwoReturns(), llvm::SplitBlockPredecessors(), SwitchToLookupTable(), TryToMergeLandingPad(), TurnSwitchRangeIntoICmp(), and llvm::InstCombiner::visitAllocaInst().
|
inline |
Definition at line 161 of file BasicBlock.h.
References getFirstNonPHIOrDbg(), and getFirstNonPHIOrDbgOrLifetime().
const Instruction * BasicBlock::getFirstNonPHIOrDbgOrLifetime | ( | ) | const |
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic, or a lifetime intrinsic.
Definition at line 204 of file BasicBlock.cpp.
References I, and llvm::Instruction::isLifetimeStartOrEnd().
Referenced by getFirstNonPHIOrDbg(), getFirstNonPHIOrDbgOrLifetime(), simplifyTerminatorLeadingToRet(), and SortCallTargets().
|
inline |
Definition at line 169 of file BasicBlock.h.
References getFirstInsertionPt(), and 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 334 of file BasicBlock.h.
Referenced by assertBranchOrSelectConditionHoisted(), llvm::DomTreeUpdater::callbackDeleteBB(), callsiteIsHot(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::changeToUnreachable(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneBasicBlock(), llvm::CloneFunction(), CloneInstructionInExitBlock(), llvm::BinaryOperator::Create(), llvm::UnaryOperator::Create(), createCallHelper(), createInvokeHelper(), createMalloc(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateRecursiveTailCall(), eliminateUnreachableBlock(), llvm::Instruction::eraseFromParent(), llvm::CodeExtractor::findInputsOutputs(), llvm::foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), FunctionNumber(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), llvm::hoistAllInstructionsInto(), HoistThenElseCodeToIf(), llvm::InlineFunction(), llvm::Instruction::insertAfter(), llvm::Instruction::insertBefore(), llvm::IRBuilderDefaultInserter::InsertHelper(), llvm::InstCombiner::InsertNewInstBefore(), insertUniqueBackedgeBlock(), llvm::Instruction::Instruction(), LdStHasDebugValue(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), moveBBContents(), llvm::Instruction::moveBefore(), false::LibCallsShrinkWrap::perform(), llvm::Instruction::removeFromParent(), removePredecessor(), llvm::ReplaceInstWithInst(), ReplaceUsesOfWith(), llvm::InstCombiner::run(), llvm::UnifyFunctionExitNodes::runOnFunction(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), unifyReturnBlockSet(), llvm::UnrollLoop(), unswitchTrivialBranch(), updateForIncomingValueLocation(), and llvm::InstCombiner::visitGetElementPtrInst().
|
inline |
Definition at line 335 of file BasicBlock.h.
Optional< uint64_t > BasicBlock::getIrrLoopHeaderWeight | ( | ) | const |
Definition at line 477 of file BasicBlock.cpp.
References llvm::StringRef::equals(), llvm::Instruction::getMetadata(), llvm::MDString::getString(), getTerminator(), and llvm::LLVMContext::MD_irr_loop.
Referenced by getLandingPadInst().
const LandingPadInst * BasicBlock::getLandingPadInst | ( | ) | const |
Return the landingpad instruction associated with the landing pad.
Definition at line 473 of file BasicBlock.cpp.
References llvm::dyn_cast(), and getFirstNonPHI().
Referenced by CloneLoop(), getLandingPadInst(), getParentPad(), isEHPad(), makeStatepointExplicitImpl(), MarkBlocksLiveIn(), and llvm::SplitLandingPadPredecessors().
|
inline |
Definition at line 409 of file BasicBlock.h.
References assert(), D, DEFINE_SIMPLE_CONVERSION_FUNCTIONS, getIrrLoopHeaderWeight(), getLandingPadInst(), llvm::Value::getSubclassDataFromValue(), isLegalToHoistInto(), llvm::Value::setValueSubclassData(), and llvm::skipDebugIntrinsics().
Return the module owning the function this basic block belongs to, or nullptr if the function does not have a module.
Note: this is undefined behavior if the block does not have a parent.
Definition at line 134 of file BasicBlock.cpp.
References getParent(), and llvm::GlobalValue::getParent().
Referenced by llvm::LoopAccessInfo::addRuntimeChecks(), CanProveNotTakenFirstIteration(), llvm::CloneFunction(), llvm::IRBuilderBase::CreateBinaryIntrinsic(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateUnaryIntrinsic(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), llvm::emitBinaryFloatFnCall(), llvm::emitCalloc(), llvm::emitFGetCUnlocked(), llvm::emitFGetSUnlocked(), llvm::emitFPutC(), llvm::emitFPutCUnlocked(), llvm::emitFPutS(), llvm::emitFPutSUnlocked(), llvm::emitFReadUnlocked(), llvm::emitFWrite(), llvm::emitFWriteUnlocked(), llvm::emitMalloc(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemCpyChk(), llvm::emitPutChar(), llvm::emitPutS(), llvm::InnerLoopVectorizer::emitSCEVChecks(), llvm::emitStrChr(), llvm::emitStrCpy(), llvm::emitStrLen(), llvm::emitStrNCmp(), llvm::emitStrNCpy(), emitUnaryFloatFnCallHelper(), llvm::LazyValueInfo::eraseBlock(), llvm::FindAvailablePtrLoadStore(), FindLoopCounter(), findPHIToPartitionLoops(), llvm::InnerLoopVectorizer::fixupIVUsers(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), getEdgeValueLocal(), llvm::Instruction::getModule(), getModule(), llvm::InnerLoopVectorizer::getOrCreateTripCount(), getParent(), GetPointerOperand(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::getPtrStride(), getSignature(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), handleEndBlock(), isIgnorableInst(), isLoadConditional(), isObjectDereferencedInBlock(), mayLoopAccessLocation(), mayUsePostIncMode(), llvm::MemoryDepChecker::Dependence::print(), llvm::printLoop(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessImpliedCondition(), llvm::promoteLoopAccessesToScalars(), ReduceLoopStrength(), ReplaceUsesOfWith(), llvm::LoopRotatePass::run(), llvm::IndVarSimplifyPass::run(), llvm::LoopIdiomRecognizePass::run(), llvm::simplifyCFG(), llvm::SimplifyInstructionsInBlock(), llvm::simplifyLoopAfterUnroll(), simplifyLoopInst(), simplifyOneLoop(), llvm::LazyValueInfo::threadEdge(), llvm::JumpThreadingPass::ThreadGuard(), tryToVectorizeHorReductionOrInstOperands(), llvm::UnrollRuntimeLoopRemainder(), llvm::LoopVersioning::versionLoop(), llvm::InnerLoopVectorizer::widenIntOrFpInduction(), and llvm::InnerLoopVectorizer::widenPHIInstruction().
|
inline |
Definition at line 115 of file BasicBlock.h.
References getModule(), getTerminator(), and LLVM_READONLY.
Return the enclosing method, or null if none.
Definition at line 107 of file BasicBlock.h.
Referenced by addNoRecurseAttrsTopDown(), allPredecessorsComeFromSameSource(), asmClobbersCTR(), calculateSEHStateNumbers(), callIntrinsic(), callsiteIsHot(), canFoldIVIncExpr(), castToIncrementInst(), CC_MipsO32_FP64(), llvm::changeToUnreachable(), llvm::CloneFunction(), CloneLoop(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::cloneLoopWithPreheader(), llvm::CodeMetrics::collectEphemeralValues(), combineADDToADDZE(), CompareValueComplexity(), llvm::LoopSafetyInfo::computeBlockColors(), computeKnownBitsFromAssume(), llvm::computePeelCount(), llvm::computeUnrollCount(), llvm::ConstantFoldTerminator(), copyMustTailReturn(), llvm::SanitizerStatReport::create(), llvm::createArgumentPromotionPass(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(), llvm::IRBuilderBase::CreateFAddReduce(), createFFSIntrinsic(), llvm::IRBuilderBase::CreateFMulReduce(), llvm::IRBuilderBase::CreateGCRelocate(), llvm::IRBuilderBase::CreateGCResult(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreateGlobalString(), llvm::createHWAddressSanitizerPass(), llvm::IRBuilderBase::CreateInvariantStart(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::IRBuilderBase::CreateMaskedStore(), createMaskInstrs(), llvm::IRBuilderBase::CreateMemCpy(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), llvm::IRBuilderBase::CreateMemMove(), createMemMoveLoop(), llvm::IRBuilderBase::CreateMemSet(), createMemSetLoop(), createPopcntIntrinsic(), llvm::createScalarizerPass(), DeleteBasicBlock(), llvm::VPBlockBase::deleteCFG(), deleteDeadInstruction(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), despeculateCountZeros(), DisableAllLoopOptsOnLoop(), llvm::InstCombiner::dominatesAllUses(), ehAwareSplitEdge(), eliminateDeadStores(), eliminateRecursiveTailCall(), llvm::AArch64TargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::ARMTargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::HexagonTargetLowering::emitLoadLinked(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::HexagonTargetLowering::emitStoreConditional(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::PPCTargetLowering::emitTrailingFence(), enableCallSafepoints(), llvm::LazyValueInfo::enableDT(), EqualityPropUnSafe(), eraseFromParent(), llvm::AlignmentFromAssumptionsPass::extractAlignmentInfo(), llvm::CodeExtractor::extractCodeRegion(), llvm::findDevirtualizableCallsForTypeTest(), llvm::CodeExtractor::findInputsOutputs(), FindLIVLoopCondition(), findTRECandidate(), findUnwindDestinations(), FitWeights(), llvm::AMDGPULibCalls::fold(), FoldCondBranchOnPHI(), FoldTwoEntryPHINode(), llvm::formLCSSAForInstructions(), llvm::gatherUnrollingPreferences(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::MMIAddrLabelMap::getAddrLabelSymbolToEmit(), llvm::CallBase::getCaller(), getCommonReturnValue(), getComparePred(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), getDebugLocString(), llvm::TargetLoweringBase::getDefaultSafeStackPointerLocation(), llvm::MemoryDependenceResults::getDependency(), getDescription(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getEstimatedNumberOfCaseClusters(), llvm::Trace::getFunction(), llvm::Instruction::getFunction(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::TargetLoweringBase::getIRStackGuard(), llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), GetLocation(), getModule(), llvm::DOTGraphTraits< BoUpSLP * >::getNodeAttributes(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), getOnlyLiveSuccessor(), getParameterABIAttributes(), llvm::CallSiteBase<>::getParent(), getParentPad(), GetPointerOperand(), getPointerOperands(), llvm::getPtrStride(), getReductionIntrinsic(), llvm::SCEVExpander::getRelatedExistingExpansion(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), getSignature(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), getSubprogram(), getSuccPad(), llvm::HexagonTargetLowering::getTgtMemIntrinsic(), getTrueOrFalseValue(), llvm::ARMTTIImpl::getUnrollingPreferences(), getValueSymbolTable(), getVarName(), handleEndBlock(), HandleInlinedEHPad(), HandleInlinedLandingPad(), handlePhiDef(), hasProfileData(), hasSameExtUse(), INITIALIZE_PASS(), llvm::InlineFunction(), llvm::DivergenceAnalysis::inRegion(), insertCall(), llvm::insertDebugValuesForPHIs(), InsertSafepointPoll(), insertSinCosCall(), instrumentMaskedLoadOrStore(), llvm::isAllocaPromotable(), isAlwaysFoldable(), isCallPromotable(), isDynamicConstant(), isExplicitVecOuterLoop(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), isIgnorableInst(), llvm::isInTailCallPosition(), isLoadConditional(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), IsNonLocalValue(), isNotUsedOrFreeInLoop(), isNoWrap(), isObjectDereferencedInBlock(), isOnlyReachableViaThisEdge(), isPointerValueDeadOnEntryToFunction(), llvm::isPotentiallyReachable(), isPromotedInstructionLegal(), llvm::RecurrenceDescriptor::isReductionPHI(), isReportingError(), llvm::AllocaInst::isStaticAlloca(), llvm::TargetLoweringBase::isSuitableForJumpTable(), llvm::LoopVectorizationLegality::isUniform(), llvm::AMDGPULibCalls::isUnsafeMath(), isValidCandidateForColdCC(), isZero(), LLVMGetNextBasicBlock(), LLVMGetPreviousBasicBlock(), LLVMInsertBasicBlockInContext(), llvm::BlockAddress::lookup(), llvm::CallLowering::lowerCall(), llvm::SelectionDAGBuilder::LowerCallTo(), LowerInterruptReturn(), llvm::ARMTargetLowering::makeDMB(), llvm::AMDGPUSubtarget::makeLIDRangeMetadata(), llvm::HexagonTargetLowering::mayBeEmittedAsTailCall(), llvm::SITargetLowering::mayBeEmittedAsTailCall(), maybePrintComdat(), mayLoopAccessLocation(), mayUsePostIncMode(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), mergeCleanupPad(), moveAfter(), moveBefore(), needsRuntimeRegistrationOfSectionRange(), NegateValue(), optimizeSQRT(), llvm::peelLoop(), PerformHeapAllocSRoA(), performMaskedAtomicOp(), placeSplitBlockCarefully(), populateWorklist(), llvm::PrepareToSplitEntryBlock(), llvm::LegacyDivergenceAnalysis::print(), llvm::MemoryDepChecker::Dependence::print(), llvm::Value::print(), printIRBlockReference(), llvm::JumpThreadingPass::ProcessBlock(), llvm::LoopVectorizePass::processLoop(), processLoopInVPlanNativePath(), promoteSingleBlockAlloca(), ReduceLoopStrength(), llvm::AssumptionCache::registerAssumption(), removeFromParent(), RemoveInstInputs(), removeUndefIntroducingPredecessor(), replaceAllUsesOfWithIn(), replaceConstantExprOp(), replaceExtractElements(), ReplaceUsesOfWith(), reportLoadElim(), RetagMask(), llvm::SSAUpdaterBulk::RewriteAllUses(), RewriteUsesOfClonedInstructions(), llvm::LoopAccessInfoPrinterPass::run(), llvm::IRCEPass::run(), llvm::LoopRotatePass::run(), llvm::IndVarSimplifyPass::run(), llvm::LoopDataPrefetchPass::run(), llvm::SimpleLoopUnswitchPass::run(), llvm::IVUsersWrapperPass::runOnLoop(), scaleWeights(), llvm::setProfMetadata(), llvm::AArch64TTIImpl::shouldConsiderAddressTypePromotion(), shouldConvert(), llvm::CaptureTracker::shouldExplore(), shouldGuaranteeTCO(), ShrinkDemandedConstant(), SimplifyCondBranchToCondBranch(), SimplifyIndirectBrOnSelect(), simplifyLoopInst(), simplifyRelocatesOffABase(), sinkLoopInvariantInstructions(), llvm::sinkRegion(), llvm::BasicBlockPass::skipBasicBlock(), llvm::LoopPass::skipLoop(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::fuzzerop::splitBlockDescriptor(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), SwitchToLookupTable(), llvm::JumpThreadingPass::ThreadEdge(), tryToElideArgumentCopy(), TryToMergeLandingPad(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), llvm::JumpThreadingPass::UnfoldSelectInstr(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchBestCondition(), UpdateAnalysisInformation(), updateOperand(), useFuncSeen(), UseTlsOffset(), versionCallSite(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitLandingPadInst(), llvm::InnerLoopVectorizer::widenInstruction(), and ~BasicBlock().
|
inline |
Definition at line 108 of file BasicBlock.h.
References getModule().
const BasicBlock * BasicBlock::getSinglePredecessor | ( | ) | const |
Return the predecessor of this block if it has a single predecessor block.
If this basic block has a single predecessor block, return the block, otherwise return a null pointer.
Otherwise return a null pointer.
Definition at line 234 of file BasicBlock.cpp.
References E, llvm::pred_begin(), and llvm::pred_end().
Referenced by allPredecessorsComeFromSameSource(), assertBranchOrSelectConditionHoisted(), CanPropagatePredecessorsForPHIs(), CanProveNotTakenFirstIteration(), canSafelyUnrollMultiExitLoop(), llvm::CloneAndPruneIntoFromInst(), llvm::collectCmpOps(), createCallInst(), llvm::createCodeGenPreparePass(), detectShiftUntilZeroIdiom(), llvm::DominatorTree::dominates(), llvm::VPPredInstPHIRecipe::execute(), llvm::VPlan::execute(), FindPHIForConditionForwarding(), llvm::foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), getFirstInsertionPt(), llvm::GetIfCondition(), getSinglePredecessor(), handlePhiDef(), llvm::isImpliedByDomCondition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isOnlyReachableViaThisEdge(), llvm::isValidAssumeForContext(), llvm::MergeBasicBlockIntoOnlyPred(), mergeBlocksIntoPredecessors(), mergeCleanupPad(), mergeConditionalStores(), mergeConditionalStoreToAddress(), llvm::MemorySSAUpdater::moveAllAfterMergeBlocks(), false::LibCallsShrinkWrap::perform(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessGuards(), llvm::JumpThreadingPass::ProcessImpliedCondition(), processUGT_ADDCST_ADD(), recordConditions(), ReduceSwitchRange(), removeUndefIntroducingPredecessor(), replaceAllUsesOfWithIn(), llvm::InstCombiner::replacedSelectWithOperand(), ReplaceUsesOfWith(), reportMayClobberedLoad(), llvm::SpeculativeExecutionPass::runImpl(), shouldInstrumentBlock(), shouldRotateLoopExitingLatch(), SimplifyIndirectBrOnSelect(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), simplifySuspendPoint(), llvm::SplitEdge(), and tryToMoveFreeBeforeNullTest().
|
inline |
Definition at line 223 of file BasicBlock.h.
References getSinglePredecessor(), and getUniquePredecessor().
const BasicBlock * BasicBlock::getSingleSuccessor | ( | ) | const |
Return the successor of this block if it has a single successor.
Otherwise return a null pointer.
This method is analogous to getSinglePredecessor above.
Definition at line 269 of file BasicBlock.cpp.
References E, SI, llvm::succ_begin(), and llvm::succ_end().
Referenced by llvm::createCodeGenPreparePass(), ensureValueAvailableInSuccessor(), llvm::VPlan::execute(), getSingleSuccessor(), getUniquePredecessor(), mergeBlocksIntoPredecessors(), mergeConditionalStores(), false::LibCallsShrinkWrap::perform(), llvm::SpeculativeExecutionPass::runImpl(), and llvm::sinkRegion().
|
inline |
Definition at line 251 of file BasicBlock.h.
References getSingleSuccessor(), and getUniqueSuccessor().
|
inlinestatic |
Returns a pointer to a member of the instruction list.
Definition at line 338 of file BasicBlock.h.
References getValueSymbolTable().
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return instruction of this basic block, if such a call is present.
Otherwise, returns null.
Definition at line 175 of file BasicBlock.cpp.
References llvm::dyn_cast(), llvm::Intrinsic::experimental_deoptimize, and F().
Referenced by findUnwindDestinations(), getTerminatingDeoptimizeCall(), getTerminator(), and llvm::InlineFunction().
|
inline |
Definition at line 132 of file BasicBlock.h.
References getTerminatingDeoptimizeCall(), and getTerminatingMustTailCall().
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this basic block, if such a call is present.
Otherwise, returns null.
Definition at line 144 of file BasicBlock.cpp.
References llvm::dyn_cast(), llvm::User::getOperand(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getPrevNode(), and llvm::ReturnInst::getReturnValue().
Referenced by getTerminatingDeoptimizeCall(), getTerminatingMustTailCall(), and llvm::InlineFunction().
|
inline |
Definition at line 141 of file BasicBlock.h.
References getFirstNonPHI(), and getTerminatingMustTailCall().
const Instruction * BasicBlock::getTerminator | ( | ) | const |
Returns the terminator instruction if the block is well formed or null if the block is not well formed.
Definition at line 138 of file BasicBlock.cpp.
Referenced by AddReachableCodeToWorklist(), allPredecessorsComeFromSameSource(), asmClobbersCTR(), assertBranchOrSelectConditionHoisted(), llvm::LoopVectorizationLegality::blockNeedsPredication(), BrPHIToSelect(), llvm::CFGMST< Edge, BBInfo >::buildEdges(), llvm::calculateWasmEHInfo(), canExpandBackedgeTakenCount(), canFoldIVIncExpr(), llvm::LoopVectorizationLegality::canFoldTailByMasking(), canRenameComdat(), canSinkInstructions(), canSplitPredecessors(), llvm::changeToUnreachable(), checkBasicSSA(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunction(), llvm::CloneFunctionInto(), CloneLoop(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::collectCmpOps(), llvm::LoopVectorizationPlanner::collectTriviallyDeadInstructions(), llvm::colorEHFunclets(), llvm::FunctionComparator::compare(), ComputePostOrders(), llvm::ComputeSpeculationCost(), computeUnlikelySuccessors(), ConnectEpilog(), ConnectProlog(), llvm::ConstantFoldTerminator(), containsSafePHI(), ConvertToSInt(), copyMustTailReturn(), createCallInst(), createCast(), llvm::createCodeGenPreparePass(), llvm::VPRecipeBuilder::createEdgeMask(), createFFSIntrinsic(), CreateGCRelocates(), llvm::createLICMPass(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemMoveLoop(), createMemSetLoop(), llvm::createObjCARCOptPass(), createPHIsForSplitLoopExit(), CreatePrologue(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::VPBlockBase::deleteCFG(), llvm::DemotePHIToStack(), despeculateCountZeros(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), doCallSiteSplitting(), DominatesMergePoint(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), ehAwareSplitEdge(), eliminateDeadStores(), eliminateDeadSwitchCases(), eliminateTailRecursion(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), llvm::InnerLoopVectorizer::emitMinimumIterationCountCheck(), llvm::InnerLoopVectorizer::emitSCEVChecks(), enableCallSafepoints(), EvaluateConstantChrecAtConstant(), llvm::Evaluator::EvaluateFunction(), llvm::VPBranchOnMaskRecipe::execute(), llvm::VPBasicBlock::execute(), llvm::VPlan::execute(), llvm::CodeExtractor::extractCodeRegion(), llvm::FastISel::fastEmitZExtFromI1(), findBasePointer(), findIBRPredecessor(), llvm::CodeExtractor::findInputsOutputs(), findInsertPointAfter(), FindLoopCounter(), FindMostPopularDest(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), FindPHIForConditionForwarding(), findUnconditionalPreds(), FitWeights(), llvm::InnerLoopVectorizer::fixFirstOrderRecurrence(), llvm::InnerLoopVectorizer::fixLCSSAPHIs(), llvm::InnerLoopVectorizer::fixReduction(), llvm::InnerLoopVectorizer::fixupIVUsers(), llvm::foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), foldGuardedRotateToFunnelShift(), foldOperationIntoPhiValue(), foldReturnAndProcessPred(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), llvm::ScalarEvolution::forgetValue(), genLoopLimit(), GetBestDestForJumpOnUndef(), getBranchHint(), getBranchInsertPoint(), llvm::InnerLoopVectorizer::getBroadcastInstrs(), getConstantValue(), getEdgeValueLocal(), getEHPadFromPredecessor(), llvm::GetIfCondition(), getInductionVariable(), getInsertPointForUses(), getIrrLoopHeaderWeight(), getJumpThreadDuplicationCost(), llvm::getLoopEstimatedTripCount(), getLoopTest(), getModule(), getNumBytes(), llvm::RegionTraits< Function >::getNumSuccessors(), getOnlyLiveSuccessor(), llvm::InnerLoopVectorizer::getOrCreateTripCount(), llvm::InnerLoopVectorizer::getOrCreateVectorTripCount(), getParentPad(), GetPointerOperand(), getSignature(), llvm::GetSuccessorNumber(), getSuccPad(), getSuccState(), getTerminator(), getTrueOrFalseValue(), handleFinalSuspend(), handleFree(), handlePhiDef(), hasOnlyUniformBranches(), hasProfileData(), hasZeroSignBit(), hoist(), llvm::hoistAllInstructionsInto(), llvm::SCEVExpander::hoistIVInc(), llvm::hoistRegion(), INITIALIZE_PASS(), llvm::InlineFunction(), insertBoundsCheck(), llvm::DIBuilder::insertDeclare(), llvm::InsertPreheaderForLoop(), insertSpills(), insertUniqueBackedgeBlock(), inversePermutation(), is_empty(), IsAcceptableTarget(), isAlwaysFoldable(), isChainSelectCmpBranch(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(), isIgnorableInst(), llvm::isImpliedByDomCondition(), IsIncrementNUW(), llvm::isInTailCallPosition(), isLegalToHoistInto(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isLoopDead(), isLoopInvariant(), isNotUsedOrFreeInLoop(), isOnlyReachableViaThisEdge(), isPromotedInstructionLegal(), isSafeAndProfitableToSinkLoad(), isSafePHIToSpeculate(), llvm::BasicBlockEdge::isSingleEdge(), isUnconditionalBranch(), llvm::isUniformLoop(), isUniformlyReached(), makeBitReverse(), llvm::Loop::makeLoopInvariant(), MarkBlocksLiveIn(), matchPair(), mayLoopAccessLocation(), mayUsePostIncMode(), llvm::LoopVectorizationCostModel::memoryInstructionCanBeWidened(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeConditionalStoreToAddress(), mergeEmptyReturnBlocks(), moveBBContents(), moveLCSSAPhis(), llvm::EscapeEnumerator::Next(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), optimizeSQRT(), patchAndReplaceAllUsesWith(), llvm::peelLoop(), PerformHeapAllocSRoA(), llvm::PHITransAddr::PHITranslateWithInsertion(), prepareForSplit(), llvm::JumpThreadingPass::ProcessBlock(), ProcessBlock(), llvm::JumpThreadingPass::ProcessBranchOnPHI(), llvm::JumpThreadingPass::ProcessImpliedCondition(), llvm::JumpThreadingPass::ProcessThreadableEdges(), processUGT_ADDCST_ADD(), llvm::promoteLoopAccessesToScalars(), llvm::GVNHoist::rank(), recordCondition(), relocationViaAlloca(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::MemorySSAUpdater::removeBlocks(), removeEmptyCleanup(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceAllUsesOfWithIn(), replaceConstantExprOp(), llvm::InstCombiner::replacedSelectWithOperand(), replaceSuccessorsPhiUsesWith(), reportMayClobberedLoad(), llvm::IRCEPass::run(), llvm::LoopPredicationPass::run(), llvm::SpeculativeExecutionPass::runImpl(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scaleWeights(), setBranchWeights(), shouldConvert(), llvm::StackProtector::shouldEmitSDCheck(), llvm::CaptureTracker::shouldExplore(), shouldInstrumentBlock(), shouldRotateLoopExitingLatch(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), SimplifyIndirectBrOnSelect(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), SinkCast(), llvm::sinkRegion(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), SpeculativelyExecuteBB(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::fuzzerop::splitBlockDescriptor(), splitCallSite(), llvm::SplitCriticalEdge(), SplitCriticalSideEffectEdges(), llvm::SplitEdge(), llvm::SplitIndirectBrCriticalEdges(), llvm::SplitLandingPadPredecessors(), llvm::succ_begin(), llvm::succ_end(), llvm::JumpThreadingPass::ThreadEdge(), truncateIVUse(), tryToElideArgumentCopy(), TryToMergeLandingPad(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSinkInstruction(), llvm::JumpThreadingPass::TryToUnfoldSelect(), tryUnmergingGEPsAcrossIndirectBr(), turnGuardIntoBranch(), turnToExplicitForm(), llvm::JumpThreadingPass::UnfoldSelectInstr(), unifyReturnBlockSet(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchAllTrivialConditions(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::MemorySSAUpdater::updateForClonedBlockIntoPred(), updatePredecessorProfileMetadata(), llvm::LoopVersioning::versionLoop(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitPHINode(), llvm::InstCombiner::visitStoreInst(), and llvm::InnerLoopVectorizer::widenIntOrFpInduction().
|
inline |
Definition at line 123 of file BasicBlock.h.
References getTerminatingDeoptimizeCall(), and 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 247 of file BasicBlock.cpp.
References E, llvm::pred_begin(), and llvm::pred_end().
Referenced by areLoopExitPHIsSupported(), llvm::createCodeGenPreparePass(), findLocationForEntrySafepoint(), getSinglePredecessor(), getUniquePredecessor(), IsAcceptableTarget(), isDynamicConstant(), isZero(), makeStatepointExplicitImpl(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), normalizeForInvokeSafepoint(), and reuseTableCompare().
|
inline |
Definition at line 235 of file BasicBlock.h.
References getSingleSuccessor(), getUniquePredecessor(), hasNPredecessors(), hasNPredecessorsOrMore(), and N.
const BasicBlock * BasicBlock::getUniqueSuccessor | ( | ) | const |
Return the successor of this block if it has a unique successor.
Otherwise return a null pointer.
This method is analogous to getUniquePredecessor above.
Definition at line 277 of file BasicBlock.cpp.
References E, SI, llvm::succ_begin(), and llvm::succ_end().
Referenced by getSingleSuccessor(), getUniqueSuccessor(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), and TryToMergeLandingPad().
|
inline |
Definition at line 261 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().
Referenced by getSublistAccess().
|
inline |
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
to it.
Definition at line 392 of file BasicBlock.h.
References llvm::Value::getSubclassDataFromValue(), and replaceSuccessorsPhiUsesWith().
Referenced by llvm::CloneFunction(), llvm::CloneFunctionInto(), llvm::createCodeGenPreparePass(), despeculateCountZeros(), llvm::AsmPrinter::EmitBasicBlockStart(), foldReturnAndProcessPred(), llvm::MMIAddrLabelMap::getAddrLabelSymbolToEmit(), getSuccPad(), hasAddressTakenAndUsed(), isBlockValidForExtraction(), llvm::isSafeToUnrollAndJam(), llvm::BlockAddress::lookup(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::GVNHoist::rank(), ReduceSwitchRange(), llvm::IRTranslator::runOnMachineFunction(), llvm::UnrollLoop(), and ~BasicBlock().
Return true if this block has exactly N predecessors.
Definition at line 261 of file BasicBlock.cpp.
References llvm::hasNItems(), llvm::pred_begin(), and llvm::pred_end().
Referenced by ensureValueAvailableInSuccessor(), getUniquePredecessor(), llvm::InstCombiner::visitStoreInst(), and llvm::MemorySSAUpdater::wireOldPredecessorsToNewImmediatePredecessor().
Return true if this block has N predecessors or more.
Definition at line 265 of file BasicBlock.cpp.
References llvm::hasNItemsOrMore(), llvm::pred_begin(), and llvm::pred_end().
Referenced by getUniquePredecessor(), and TryToMergeLandingPad().
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().
Referenced by getContext(), and getFirstInsertionPt().
iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > BasicBlock::instructionsWithoutDebug | ( | ) | const |
Return a const iterator range over the instructions in the block, skipping any debug instructions.
Definition at line 95 of file BasicBlock.cpp.
References I, and llvm::make_filter_range().
Referenced by allPredecessorsComeFromSameSource(), areLoopExitPHIsSupported(), BlockIsSimpleEnoughToThreadThrough(), containsSafePHI(), llvm::FoldBranchToCommonDest(), GetCaseResults(), getFirstInsertionPt(), hasProfileData(), isSafeToSpeculateStore(), llvm::LegacyDivergenceAnalysis::print(), ReduceSwitchRange(), and simplifyOneLoop().
iterator_range< filter_iterator< BasicBlock::iterator, std::function< bool(Instruction &)> > > BasicBlock::instructionsWithoutDebug | ( | ) |
Return an iterator range over the instructions in the block, skipping any debug instructions.
Definition at line 104 of file BasicBlock.cpp.
References I, and llvm::make_filter_range().
|
inline |
Return true if this basic block is an exception handling block.
Definition at line 399 of file BasicBlock.h.
References getFirstNonPHI(), getLandingPadInst(), llvm::Instruction::isEHPad(), and isLandingPad().
Referenced by calculateCXXStateNumbers(), calculateSEHStateNumbers(), llvm::calculateWasmEHInfo(), canSplitCallSite(), eraseDeadBBsAndChildren(), getParameterABIAttributes(), getPredState(), llvm::JumpThreadingPass::ProcessBranchOnXOR(), llvm::GVNHoist::rank(), separateNestedLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), llvm::fuzzerop::splitBlockDescriptor(), 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 468 of file BasicBlock.cpp.
References getFirstNonPHI().
Referenced by createPHIsForSplitLoopExit(), isEHPad(), mayUsePostIncMode(), llvm::SplitBlockPredecessors(), llvm::SplitLandingPadPredecessors(), and llvm::JumpThreadingPass::ThreadEdge().
bool BasicBlock::isLegalToHoistInto | ( | ) | const |
Return true if it is legal to hoist instructions into this block.
Definition at line 384 of file BasicBlock.cpp.
References assert(), and getTerminator().
Referenced by getLandingPadInst().
void BasicBlock::moveAfter | ( | BasicBlock * | MovePos | ) |
Unlink this basic block from its current function and insert it right after MovePos
in the function MovePos
lives in.
Unlink this basic block from its current function and insert it into the function that MovePos lives in, right after MovePos.
Definition at line 128 of file BasicBlock.cpp.
References llvm::Function::getBasicBlockList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >::getIterator(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::splice().
Referenced by CreatePrologue(), getFirstInsertionPt(), llvm::MergeBasicBlockIntoOnlyPred(), placeSplitBlockCarefully(), and llvm::JumpThreadingPass::ThreadEdge().
void BasicBlock::moveBefore | ( | BasicBlock * | MovePos | ) |
Unlink this basic block from its current function and insert it into the function that MovePos
lives in, right before MovePos
.
Unlink this basic block from its current function and insert it into the function that MovePos lives in, right before MovePos.
Definition at line 121 of file BasicBlock.cpp.
References llvm::Function::getBasicBlockList(), llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options... >::type >::getIterator(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::splice().
Referenced by buildClonedLoopBlocks(), getFirstInsertionPt(), mayUsePostIncMode(), shouldRotateLoopExitingLatch(), and llvm::sinkRegion().
|
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 325 of file BasicBlock.h.
Referenced by AddPHINodeEntriesForMappedBlock(), AddPredecessorToBlock(), areLoopExitPHIsSupported(), assertBranchOrSelectConditionHoisted(), llvm::canIfConvertPHINodes(), ConnectEpilog(), containsSafePHI(), ConvertToSInt(), llvm::createCodeGenPreparePass(), createPHIsForSplitLoopExit(), llvm::DeleteDeadPHIs(), deleteLoopIfDead(), llvm::GVNExpression::Expression::dump(), llvm::FastISel::fastEmitZExtFromI1(), findInnerReductionPhi(), FindPHIForConditionForwarding(), llvm::InnerLoopVectorizer::fixCrossIterationPHIs(), llvm::InnerLoopVectorizer::fixLCSSAPHIs(), llvm::InnerLoopVectorizer::fixReduction(), fixupPHINodeForNormalDest(), fixupPHINodeForUnwindDest(), ForwardSwitchConditionToPHI(), getOtherIncomingValue(), GetPointerOperand(), getSuccPad(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::DivergenceAnalysis::inRegion(), isEpilogProfitable(), isExistingPhi(), IsIncrementNUW(), isKnownTypeIdMember(), isLoopDead(), isProfitableChain(), llvm::LoopVectorizationLegality::isUniform(), MatchReductions(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), processHeaderPhiOperands(), PushLoopPHIs(), removeUndefIntroducingPredecessor(), replaceAllUsesOfWithIn(), llvm::SCEVExpander::replaceCongruentIVs(), rewritePHINodesForExitAndUnswitchedBlocks(), rewritePHINodesForUnswitchedExitBlock(), scaleWeights(), scanPHIsAndUpdateValueMap(), shouldRotateLoopExitingLatch(), SimplifyCondBranchToCondBranch(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::fuzzerop::splitBlockDescriptor(), splitCallSite(), tryToElideArgumentCopy(), llvm::UnrollAndJamLoop(), and updateIncomingBlock().
iterator_range< BasicBlock::phi_iterator > BasicBlock::phis | ( | ) |
Definition at line 291 of file BasicBlock.cpp.
References begin(), llvm::dyn_cast(), empty(), and P.
|
inline |
Definition at line 274 of file BasicBlock.h.
Referenced by findLiveSetAtInst(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), isIgnorableInst(), patchAndReplaceAllUsesWith(), shouldRotateLoopExitingLatch(), and sinkLoopInvariantInstructions().
|
inline |
Definition at line 275 of file BasicBlock.h.
void BasicBlock::removeFromParent | ( | ) |
Unlink 'this' from the containing function, but do not delete it.
Definition at line 111 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().
Referenced by llvm::DomTreeUpdater::callbackDeleteBB(), llvm::DomTreeUpdater::deleteBB(), getFirstInsertionPt(), and unifyReturnBlockSet().
void BasicBlock::removePredecessor | ( | BasicBlock * | Pred, |
bool | DontDeleteUselessPHIs = false |
||
) |
Notify the BasicBlock that the predecessor Pred
is no longer able to reach it.
This method is used to notify a BasicBlock that the specified Predecessor of the block is no longer able to reach it.
This is actually not used to update the Predecessor list, but is actually used to update the PHI nodes that reside in the block. Note that this should be called while the predecessor still refers to this block.
Definition at line 302 of file BasicBlock.cpp.
References assert(), begin(), llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), llvm::find(), front(), llvm::UndefValue::get(), llvm::PHINode::getIncomingBlock(), getInstList(), llvm::PHINode::getNumIncomingValues(), llvm::PHINode::hasConstantValue(), llvm::Value::hasNUsesOrMore(), Other, llvm::iplist_impl< IntrusiveListT, TraitsT >::pop_front(), llvm::pred_begin(), llvm::pred_end(), llvm::PHINode::removeIncomingValue(), and llvm::Value::replaceAllUsesWith().
Referenced by changeToCall(), classof(), llvm::ConstantFoldTerminator(), FitWeights(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), HandleInlinedLandingPad(), markAliveBlocks(), mergeCleanupPad(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessImpliedCondition(), processSwitch(), ReduceSwitchRange(), llvm::RemovePredecessorAndSimplify(), RemoveSwitchAfterSelectConversion(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), setBranchWeights(), shouldRotateLoopExitingLatch(), SimplifyCondBranchToTwoReturns(), SimplifyTerminatorOnSelect(), llvm::SplitCriticalEdge(), SwitchToLookupTable(), llvm::JumpThreadingPass::ThreadEdge(), and unswitchTrivialSwitch().
|
inline |
Definition at line 276 of file BasicBlock.h.
Referenced by llvm::slpvectorizer::BoUpSLP::getSpillCost(), isIgnorableInst(), isObjectDereferencedInBlock(), patchAndReplaceAllUsesWith(), shouldRotateLoopExitingLatch(), sinkLoopInvariantInstructions(), and splitCallSite().
|
inline |
Definition at line 277 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 446 of file BasicBlock.cpp.
References llvm::dyn_cast(), llvm::PHINode::getBasicBlockIndex(), getTerminator(), llvm::ARM_PROC::IE, llvm::PHINode::setIncomingBlock(), and llvm::successors().
Referenced by hasAddressTaken().
|
inline |
Definition at line 279 of file BasicBlock.h.
Referenced by detectShiftUntilZeroIdiom(), FitWeights(), getSignature(), isThunkProfitable(), llvm::SpeculativeExecutionPass::runImpl(), 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 408 of file BasicBlock.cpp.
References assert(), Create(), llvm::BranchInst::Create(), E, end(), getContext(), getInstList(), llvm::ilist_node_with_parent< BasicBlock, Function >::getNextNode(), getParent(), getTerminator(), I, phis(), llvm::Instruction::setDebugLoc(), llvm::succ_begin(), llvm::succ_end(), and llvm::Successor.
Referenced by llvm::changeToInvokeAndSplitBasicBlock(), classof(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), createMemSetLoop(), CreatePrologue(), createResumeEntryBlock(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), despeculateCountZeros(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), llvm::InnerLoopVectorizer::emitMinimumIterationCountCheck(), llvm::InnerLoopVectorizer::emitSCEVChecks(), llvm::VPlan::execute(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), getOnlyLiveSuccessor(), getTrueOrFalseValue(), handleFinalSuspend(), INITIALIZE_PASS(), llvm::InlineFunction(), insertBoundsCheck(), insertSpills(), isKnownTypeIdMember(), PerformHeapAllocSRoA(), performMaskedAtomicOp(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), shouldKeepInEntry(), SimplifyBranchOnICmpChain(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), and llvm::fuzzerop::splitBlockDescriptor().
|
inline |
Definition at line 386 of file BasicBlock.h.
References llvm::ilist_node_impl< OptionsT >::getIterator(), and splitBasicBlock().
|
friend |
Definition at line 64 of file BasicBlock.h.
|
friend |
Definition at line 65 of file BasicBlock.h.