LLVM  4.0.0
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::BasicBlock Class Reference

LLVM Basic Block Representation. More...

#include <BasicBlock.h>

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

Public Types

typedef SymbolTableList
< Instruction
InstListType
 
typedef InstListType::iterator iterator
 Instruction iterators... More...
 
typedef
InstListType::const_iterator 
const_iterator
 
typedef
InstListType::reverse_iterator 
reverse_iterator
 
typedef
InstListType::const_reverse_iterator 
const_reverse_iterator
 
- Public Types inherited from llvm::Value
enum  ValueTy
 Concrete subclass of this. More...
 
typedef use_iterator_impl< Useuse_iterator
 
typedef use_iterator_impl
< const Use
const_use_iterator
 
typedef user_iterator_impl< Useruser_iterator
 
typedef user_iterator_impl
< const User
const_user_iterator
 

Public Member Functions

 BasicBlock (const BasicBlock &)=delete
 
BasicBlockoperator= (const BasicBlock &)=delete
 
 ~BasicBlock () override
 
LLVMContextgetContext () const
 Get the context in which this basic block lives. More...
 
const FunctiongetParent () const
 Return the enclosing method, or null if none. More...
 
FunctiongetParent ()
 
const ModulegetModule () const
 Return the module owning the function this basic block belongs to, or nullptr it the function does not have a module. More...
 
ModulegetModule ()
 
TerminatorInstgetTerminator ()
 Returns the terminator instruction if the block is well formed or null if the block is not well formed. More...
 
const TerminatorInstgetTerminator () const
 
CallInstgetTerminatingDeoptimizeCall ()
 Returns the call instruction calling .experimental.deoptimize prior to the terminating return instruction of this basic block, if such a call is present. More...
 
const CallInstgetTerminatingDeoptimizeCall () const
 
CallInstgetTerminatingMustTailCall ()
 Returns the call instruction marked 'musttail' prior to the terminating return instruction of this basic block, if such a call is present. More...
 
const CallInstgetTerminatingMustTailCall () const
 
InstructiongetFirstNonPHI ()
 Returns a pointer to the first instruction in this block that is not a PHINode instruction. More...
 
const InstructiongetFirstNonPHI () const
 
InstructiongetFirstNonPHIOrDbg ()
 Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic. More...
 
const InstructiongetFirstNonPHIOrDbg () const
 
InstructiongetFirstNonPHIOrDbgOrLifetime ()
 Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic, or a lifetime intrinsic. More...
 
const InstructiongetFirstNonPHIOrDbgOrLifetime () const
 
iterator getFirstInsertionPt ()
 Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI instruction. More...
 
const_iterator getFirstInsertionPt () const
 
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...
 
BasicBlockgetSinglePredecessor ()
 Return the predecessor of this block if it has a single predecessor block. More...
 
const BasicBlockgetSinglePredecessor () const
 
BasicBlockgetUniquePredecessor ()
 Return the predecessor of this block if it has a unique predecessor block. More...
 
const BasicBlockgetUniquePredecessor () const
 
BasicBlockgetSingleSuccessor ()
 Return the successor of this block if it has a single successor. More...
 
const BasicBlockgetSingleSuccessor () const
 
BasicBlockgetUniqueSuccessor ()
 Return the successor of this block if it has a unique successor. More...
 
const BasicBlockgetUniqueSuccessor () const
 
iterator begin ()
 Instruction iterator methods. More...
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
size_t size () const
 
bool empty () const
 
const Instructionfront () const
 
Instructionfront ()
 
const Instructionback () const
 
Instructionback ()
 
const InstListTypegetInstList () const
 Return the underlying instruction list container. More...
 
InstListTypegetInstList ()
 
ValueSymbolTablegetValueSymbolTable ()
 Returns a pointer to the symbol table if one exists. More...
 
void dropAllReferences ()
 Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining. More...
 
void removePredecessor (BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
 Notify the BasicBlock that the predecessor Pred is no longer able to reach it. More...
 
bool canSplitPredecessors () const
 
BasicBlocksplitBasicBlock (iterator I, const Twine &BBName="")
 Split the basic block into two basic blocks at the specified instruction. More...
 
BasicBlocksplitBasicBlock (Instruction *I, const Twine &BBName="")
 
bool hasAddressTaken () const
 Returns true if there are any uses of this basic block other than direct branches, switches, etc. More...
 
void replaceSuccessorsPhiUsesWith (BasicBlock *New)
 Update all phi nodes in this basic block's successors to refer to basic block New instead of to it. More...
 
bool isEHPad () const
 Return true if this basic block is an exception handling block. More...
 
bool isLandingPad () const
 Return true if this basic block is a landing pad. More...
 
LandingPadInstgetLandingPadInst ()
 Return the landingpad instruction associated with the landing pad. More...
 
const LandingPadInstgetLandingPadInst () const
 
- Public Member Functions inherited from llvm::Value
 Value (const Value &)=delete
 
void operator= (const Value &)=delete
 
virtual ~Value ()
 
void dump () const
 Support for debugging, callable in GDB: V->dump() More...
 
TypegetType () const
 All values are typed, get the type of this value. More...
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 Return a constant reference to the value's name. More...
 
void setName (const Twine &Name)
 Change the name of the value. More...
 
void takeName (Value *V)
 Transfer the name from V to this value. More...
 
void replaceAllUsesWith (Value *V)
 Change all uses of this to point to a new Value. More...
 
void replaceNonMetadataUsesWith (Value *V)
 Change non-metadata uses of this to point to a new Value. More...
 
void replaceUsesOutsideBlock (Value *V, BasicBlock *BB)
 replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V" instead of "this" when the use is outside the block. More...
 
void 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_iteratormaterialized_uses ()
 
iterator_range
< const_use_iterator
materialized_uses () const
 
iterator_range< use_iteratoruses ()
 
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
 
Useruser_back ()
 
const Useruser_back () const
 
iterator_range< user_iteratormaterialized_users ()
 
iterator_range
< const_user_iterator
materialized_users () const
 
iterator_range< user_iteratorusers ()
 
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...
 
ValuestripPointerCasts ()
 Strip off pointer casts, all-zero GEPs, and aliases. More...
 
const ValuestripPointerCasts () const
 
ValuestripPointerCastsNoFollowAliases ()
 Strip off pointer casts and all-zero GEPs. More...
 
const ValuestripPointerCastsNoFollowAliases () const
 
ValuestripInBoundsConstantOffsets ()
 Strip off pointer casts and all-constant inbounds GEPs. More...
 
const ValuestripInBoundsConstantOffsets () const
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 Accumulate offsets from stripInBoundsConstantOffsets(). More...
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 
ValuestripInBoundsOffsets ()
 Strip off pointer casts and inbounds GEPs. More...
 
const ValuestripInBoundsOffsets () const
 
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...
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 Translate PHI node to its predecessor from the given basic block. More...
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 
void mutateType (Type *Ty)
 Mutate the type of this Value to be of the specified type. More...
 
template<class Compare >
void sortUseList (Compare Cmp)
 Sort the use-list. More...
 
void reverseUseList ()
 Reverse the use-list. More...
 
void print (raw_ostream &O, bool IsForDebug=false) const
 Implement operator<< on Value. More...
 
void print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug=false) const
 
void printAsOperand (raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
 Print the name of this Value out to the specified raw_ostream. More...
 
void printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const
 
- Public Member Functions inherited from llvm::ilist_node_with_parent< BasicBlock, Function >
BasicBlockgetPrevNode ()
 
const BasicBlockgetPrevNode () const
 Get the previous node, or nullptr for the list head. More...
 
BasicBlockgetNextNode ()
 Get the next node, or nullptr for the list tail. More...
 
const BasicBlockgetNextNode () const
 Get the next node, or nullptr for the list tail. More...
 
- Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< BasicBlock, Options...>::type >
self_iterator getIterator ()
 
const_self_iterator getIterator () const
 
reverse_self_iterator getReverseIterator ()
 
const_reverse_self_iterator getReverseIterator () const
 
bool isSentinel () const
 Check whether this is the sentinel node. More...
 

Static Public Member Functions

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

Friends

class BlockAddress
 
class SymbolTableListTraits< BasicBlock >
 

Additional Inherited Members

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

Detailed Description

LLVM Basic Block Representation.

This represents a single basic block in LLVM. A basic block is simply a container of instructions that execute sequentially. Basic blocks are Values because they are referenced by instructions such as branches and switch tables. The type of a BasicBlock is "Type::LabelTy" because the basic block represents a label to which a branch can jump.

A well formed basic block is formed of a list of non-terminating instructions followed by a single 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 51 of file BasicBlock.h.

Member Typedef Documentation

Definition at line 84 of file BasicBlock.h.

Definition at line 86 of file BasicBlock.h.

Definition at line 54 of file BasicBlock.h.

Instruction iterators...

Definition at line 83 of file BasicBlock.h.

Definition at line 85 of file BasicBlock.h.

Constructor & Destructor Documentation

llvm::BasicBlock::BasicBlock ( const BasicBlock )
delete
BasicBlock::~BasicBlock ( )
override

Member Function Documentation

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

Definition at line 243 of file BasicBlock.h.

iterator llvm::BasicBlock::begin ( )
inline

Instruction iterator methods.

Definition at line 228 of file BasicBlock.h.

Referenced by AddPHINodeEntriesForMappedBlock(), AddPredecessorToBlock(), AddReachableCodeToWorklist(), BlockIsSimpleEnoughToThreadThrough(), llvm::bypassSlowDivision(), llvm::Interpreter::callFunction(), CanPropagatePredecessorsForPHIs(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneBasicBlock(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::computeLoopSafetyInfo(), containsSafePHI(), createPHIsForSplitLoopExit(), cse(), cxxDtorIsEmpty(), DeleteBasicBlock(), llvm::DeleteDeadPHIs(), llvm::DominatorTree::dominates(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), llvm::EliminateDuplicatePHINodes(), eliminateRecursiveTailCall(), eliminateUnreachableBlock(), ensureValueAvailableInSuccessor(), llvm::Evaluator::EvaluateFunction(), llvm::CodeExtractor::extractCodeRegion(), llvm::FindAvailableLoadedValue(), llvm::objcarc::FindDependencies(), 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::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleCallsInBlockInlinedThroughInvoke(), handleEndBlock(), llvm::hoistRegion(), HoistThenElseCodeToIf(), llvm::InlineFunction(), insertFastDiv(), InsertRootInitializers(), InsertSafepointPoll(), insertSinCosCall(), is_empty(), llvm::CodeExtractor::isBlockValidForExtraction(), 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(), removeEmptyCleanup(), removePredecessor(), llvm::RemovePredecessorAndSimplify(), removeUndefIntroducingPredecessor(), RewriteUsesOfClonedInstructions(), llvm::LoopDeletionPass::runImpl(), runOnBasicBlock(), scanInlinedCode(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), llvm::InstCombiner::SimplifyDivRemOfSelect(), llvm::SimplifyInstructionsInBlock(), SimplifyLoopInst(), simplifyOneLoop(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), llvm::sinkRegion(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::JumpThreadingPass::TryToUnfoldSelectInCurrBB(), TurnSwitchRangeIntoICmp(), llvm::UnrollLoop(), UpdatePHINodes(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), llvm::InstCombiner::visitPHINode(), and llvm::InstCombiner::visitStoreInst().

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

Definition at line 229 of file BasicBlock.h.

bool BasicBlock::canSplitPredecessors ( ) const

Definition at line 351 of file BasicBlock.cpp.

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

Referenced by llvm::SplitBlockPredecessors().

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

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

Definition at line 261 of file BasicBlock.h.

References llvm::Value::getValueID().

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

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

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

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

Definition at line 239 of file BasicBlock.h.

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

iterator llvm::BasicBlock::end ( )
inline

Definition at line 230 of file BasicBlock.h.

Referenced by AddReachableCodeToWorklist(), llvm::changeToUnreachable(), llvm::CloneBasicBlock(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::computeLoopSafetyInfo(), llvm::ConvertDebugDeclareToDebugValue(), cse(), cxxDtorIsEmpty(), DeleteBasicBlock(), detectPopcountIdiom(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), eliminateRecursiveTailCall(), llvm::objcarc::FindDependencies(), findSafeStoreForStoreStrongContraction(), first_use_of_in_block(), foldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), GetCaseResults(), getFirstInsertionPt(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getUnrollingPreferences(), HandleCallsInBlockInlinedThroughInvoke(), handleEndBlock(), llvm::hoistRegion(), insertFastDiv(), InsertSafepointPoll(), llvm::CodeExtractor::isBlockValidForExtraction(), llvm::isInTailCallPosition(), llvm::isKnownNotFullPoison(), 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(), promoteMemoryToRegister(), removeTriviallyEmptyRange(), RewriteUsesOfClonedInstructions(), runOnBasicBlock(), scanOneBB(), llvm::IRBuilderBase::SetInsertPoint(), llvm::SimplifyInstructionsInBlock(), SimplifyLoopInst(), SinkCast(), SinkCmpExpression(), llvm::sinkRegion(), SinkShiftAndTruncate(), SpeculativelyExecuteBB(), splitBasicBlock(), TryToSinkInstruction(), llvm::JumpThreadingPass::TryToUnfoldSelect(), llvm::UnrollLoop(), and llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit().

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

Definition at line 231 of file BasicBlock.h.

iplist< BasicBlock >::iterator BasicBlock::eraseFromParent ( )
const Instruction& llvm::BasicBlock::front ( ) const
inline
Instruction& llvm::BasicBlock::front ( )
inline

Definition at line 241 of file BasicBlock.h.

LLVMContext & BasicBlock::getContext ( ) const
BasicBlock::iterator BasicBlock::getFirstInsertionPt ( )
const_iterator llvm::BasicBlock::getFirstInsertionPt ( ) const
inline

Definition at line 161 of file BasicBlock.h.

References getFirstInsertionPt().

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

Definition at line 138 of file BasicBlock.h.

References getFirstNonPHI().

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

Definition at line 145 of file BasicBlock.h.

References getFirstNonPHIOrDbg().

Instruction * BasicBlock::getFirstNonPHIOrDbgOrLifetime ( )

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

References I.

Referenced by getFirstNonPHIOrDbgOrLifetime().

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

Definition at line 152 of file BasicBlock.h.

References getFirstNonPHIOrDbgOrLifetime().

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

Return the underlying instruction list container.

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

Definition at line 249 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(), insertFastDiv(), llvm::IRBuilderDefaultInserter::InsertHelper(), llvm::InstCombiner::InsertNewInstBefore(), insertUniqueBackedgeBlock(), llvm::Instruction::Instruction(), LdStHasDebugValue(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), moveBBContents(), llvm::Instruction::moveBefore(), llvm::Instruction::removeFromParent(), removePredecessor(), llvm::ReplaceInstWithInst(), llvm::InstCombiner::run(), llvm::UnifyFunctionExitNodes::runOnFunction(), SimplifyFunction(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitLandingPadPredecessors(), llvm::JumpThreadingPass::ThreadEdge(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::TryToUnfoldSelect(), llvm::UnrollLoop(), and llvm::InstCombiner::visitGetElementPtrInst().

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

Definition at line 250 of file BasicBlock.h.

LandingPadInst * BasicBlock::getLandingPadInst ( )

Return the landingpad instruction associated with the landing pad.

Definition at line 441 of file BasicBlock.cpp.

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

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

const LandingPadInst * BasicBlock::getLandingPadInst ( ) const

Definition at line 444 of file BasicBlock.cpp.

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

const Module * BasicBlock::getModule ( ) const

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::FindAvailableLoadedValue(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::DemandedBits::getDemandedBits(), llvm::Instruction::getModule(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), handleEndBlock(), isObjectDereferencedInBlock(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessImpliedCondition(), processPHI(), llvm::promoteLoopAccessesToScalars(), llvm::SimplifyCFG(), llvm::SimplifyInstructionsInBlock(), llvm::LazyValueInfo::threadEdge(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), and llvm::LoopVersioning::versionLoop().

Module * BasicBlock::getModule ( )

Definition at line 120 of file BasicBlock.cpp.

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

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

Return the enclosing method, or null if none.

Definition at line 100 of file BasicBlock.h.

Referenced by AddAlignmentAssumptions(), llvm::addLandingPadInfo(), addNoRecurseAttrsTopDown(), areJTsAllowed(), calculateSEHStateNumbers(), callIntrinsic(), llvm::changeToUnreachable(), llvm::CloneBasicBlock(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::CodeMetrics::collectEphemeralValues(), computeKnownBitsFromAssume(), llvm::SanitizerStatReport::create(), llvm::IRBuilderBase::CreateAssumption(), 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::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), createPopcntIntrinsic(), DeleteBasicBlock(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::DominatorTree::dominates(), llvm::InstCombiner::dominatesAllUses(), 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(), eraseFromParent(), llvm::AlignmentFromAssumptionsPass::extractAlignmentInfo(), llvm::CodeExtractor::extractCodeRegion(), llvm::findDevirtualizableCallsForTypeTest(), findTRECandidate(), FoldCondBranchOnPHI(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::MMIAddrLabelMap::getAddrLabelSymbolToEmit(), getCommonReturnValue(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), llvm::TargetLoweringBase::getDefaultSafeStackPointerLocation(), llvm::MemoryDependenceResults::getDependency(), getDescription(), llvm::Trace::getFunction(), llvm::Instruction::getFunction(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::AArch64TargetLowering::getIRStackGuard(), llvm::TargetLoweringBase::getIRStackGuard(), llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), getModule(), llvm::DOTGraphTraits< DomTreeNode * >::getNodeLabel(), llvm::DOTGraphTraits< RegionNode * >::getNodeLabel(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::AArch64TargetLowering::getSafeStackPointerLocation(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), getValueSymbolTable(), getVarName(), HandleByValArgument(), handleEndBlock(), HandleInlinedEHPad(), HandleInlinedLandingPad(), llvm::InlineFunction(), insertCallRetCast(), insertFastDiv(), InsertSafepointPoll(), insertSinCosCall(), isDynamicConstant(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), llvm::isInTailCallPosition(), isNotUsedInLoop(), isPointerValueDeadOnEntryToFunction(), llvm::isPotentiallyReachable(), llvm::RecurrenceDescriptor::isReductionPHI(), llvm::AllocaInst::isStaticAlloca(), LLVMGetNextBasicBlock(), LLVMGetPreviousBasicBlock(), LLVMInsertBasicBlockInContext(), llvm::BlockAddress::lookup(), llvm::CallLowering::lowerCall(), llvm::SelectionDAGBuilder::LowerCallTo(), llvm::ARMTargetLowering::makeDMB(), 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::AssumptionCache::registerAssumption(), removeFromParent(), replaceConstantExprOp(), replaceExtractElements(), llvm::JumpThreadingPass::runImpl(), scanOneBB(), 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(), UpdateCallGraphAfterInlining(), useFuncSeen(), Spill::userBlock(), ValueDominatesPHI(), llvm::vectorizeBasicBlock(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitLandingPadInst(), and ~BasicBlock().

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

Definition at line 101 of file BasicBlock.h.

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

Definition at line 192 of file BasicBlock.h.

References getSinglePredecessor().

BasicBlock * BasicBlock::getSingleSuccessor ( )

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

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

Referenced by ensureValueAvailableInSuccessor(), getSingleSuccessor(), insertCallRetPHI(), llvm::isKnownNotFullPoison(), mergeConditionalStores(), and simplifyLoopCFG().

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

Definition at line 212 of file BasicBlock.h.

References getSingleSuccessor().

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

Returns a pointer to a member of the instruction list.

Definition at line 253 of file BasicBlock.h.

CallInst * BasicBlock::getTerminatingDeoptimizeCall ( )

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

References llvm::dyn_cast(), and F.

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

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

Definition at line 119 of file BasicBlock.h.

References getTerminatingDeoptimizeCall().

CallInst * BasicBlock::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 134 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().

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

Definition at line 127 of file BasicBlock.h.

References getTerminatingMustTailCall().

TerminatorInst * BasicBlock::getTerminator ( )

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

Definition at line 124 of file BasicBlock.cpp.

References llvm::dyn_cast().

Referenced by AddReachableCodeToWorklist(), BlockIsSimpleEnoughToThreadThrough(), canSinkInstructions(), checkBasicSSA(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunctionInto(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::colorEHFunclets(), llvm::FunctionComparator::compare(), ConnectProlog(), llvm::ConstantFoldTerminator(), createPHIsForSplitLoopExit(), llvm::DeleteDeadBlock(), llvm::DemotePHIToStack(), despeculateCountZeros(), detectPopcountIdiom(), DominatesMergePoint(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), EliminateDeadSwitchCases(), eliminateTailRecursion(), llvm::Evaluator::EvaluateFunction(), findBasePointer(), FindMostPopularDest(), 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(), handleFinalSuspend(), handleFree(), hoist(), llvm::InlineFunction(), insertCallRetCast(), llvm::DIBuilder::insertDeclare(), llvm::InsertPreheaderForLoop(), insertUniqueBackedgeBlock(), is_empty(), IsAcceptableTarget(), isChainSelectCmpBranch(), llvm::SparseSolver::isEdgeFeasible(), llvm::ProfileSummaryInfo::isHotBB(), llvm::isInTailCallPosition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isNotUsedInLoop(), isSafePHIToSpeculate(), llvm::BasicBlockEdge::isSingleEdge(), llvm::Loop::makeLoopInvariant(), 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(), rewriteLoopExitBlock(), 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(), 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(), llvm::slpvectorizer::BoUpSLP::vectorizeTree(), llvm::LoopVersioning::versionLoop(), llvm::InstCombiner::visitCallInst(), and llvm::InstCombiner::visitPHINode().

const TerminatorInst * BasicBlock::getTerminator ( ) const

Definition at line 129 of file BasicBlock.cpp.

References llvm::dyn_cast().

BasicBlock * BasicBlock::getUniquePredecessor ( )

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 239 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(), llvm::InstCombiner::replacedSelectWithOperand(), and reuseTableCompare().

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

Definition at line 203 of file BasicBlock.h.

References getUniquePredecessor().

BasicBlock * BasicBlock::getUniqueSuccessor ( )

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

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

Referenced by getUniqueSuccessor(), and TryToMergeLandingPad().

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

Definition at line 221 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().

bool llvm::BasicBlock::hasAddressTaken ( ) const
inline
void BasicBlock::insertInto ( Function Parent,
BasicBlock InsertBefore = nullptr 
)

Insert unlinked basic block into a function.

Inserts an unlinked basic block into Parent. If InsertBefore is provided, inserts before that basic block, otherwise inserts at the end.

Precondition
getParent() is nullptr.

Definition at line 54 of file BasicBlock.cpp.

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

bool llvm::BasicBlock::isEHPad ( ) const
inline
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 436 of file BasicBlock.cpp.

References getFirstNonPHI().

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

void BasicBlock::moveAfter ( BasicBlock MovePos)

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

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

Definition at line 110 of file BasicBlock.cpp.

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

Referenced by insertFastDiv().

BasicBlock& llvm::BasicBlock::operator= ( const BasicBlock )
delete
reverse_iterator llvm::BasicBlock::rbegin ( )
inline
const_reverse_iterator llvm::BasicBlock::rbegin ( ) const
inline

Definition at line 234 of file BasicBlock.h.

void BasicBlock::removeFromParent ( )
void BasicBlock::removePredecessor ( BasicBlock Pred,
bool  DontDeleteUselessPHIs = false 
)
reverse_iterator llvm::BasicBlock::rend ( )
inline
const_reverse_iterator llvm::BasicBlock::rend ( ) const
inline

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

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

size_t llvm::BasicBlock::size ( ) const
inline
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 374 of file BasicBlock.cpp.

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

Referenced by llvm::changeToInvokeAndSplitBasicBlock(), createResumeEntryBlock(), despeculateCountZeros(), handleFinalSuspend(), llvm::InlineFunction(), insertFastDiv(), insertSpills(), PerformHeapAllocSRoA(), replaceFallthroughCoroEnd(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), SimplifyBranchOnICmpChain(), SimplifyFunction(), splitBasicBlock(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), and splitBlockIfNotFirst().

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

Friends And Related Function Documentation

friend class BlockAddress
friend

Definition at line 57 of file BasicBlock.h.

friend class SymbolTableListTraits< BasicBlock >
friend

Definition at line 58 of file BasicBlock.h.


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