LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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:
Inheritance graph
[legend]
Collaboration diagram for llvm::BasicBlock:
Collaboration graph
[legend]

Public Types

typedef iplist< InstructionInstListType
 
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 {
  ArgumentVal, BasicBlockVal, FunctionVal, GlobalAliasVal,
  GlobalVariableVal, UndefValueVal, BlockAddressVal, ConstantExprVal,
  ConstantAggregateZeroVal, ConstantDataArrayVal, ConstantDataVectorVal, ConstantIntVal,
  ConstantFPVal, ConstantArrayVal, ConstantStructVal, ConstantVectorVal,
  ConstantPointerNullVal, MDNodeVal, MDStringVal, InlineAsmVal,
  PseudoSourceValueVal, FixedStackPseudoSourceValueVal, InstructionVal, ConstantFirstVal = FunctionVal,
  ConstantLastVal = ConstantPointerNullVal
}
 
typedef value_use_iterator< Useruse_iterator
 
typedef value_use_iterator
< const User
const_use_iterator
 

Public Member Functions

LLVMContextgetContext () const
 Get the context in which this basic block lives. More...
 
 ~BasicBlock ()
 
const FunctiongetParent () const
 Return the enclosing method, or null if none. More...
 
FunctiongetParent ()
 
TerminatorInstgetTerminator ()
 Returns the terminator instruction if the block is well formed or null if the block is not well formed. More...
 
const TerminatorInstgetTerminator () 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...
 
void 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...
 
BasicBlockgetSinglePredecessor ()
 Return this block if it has a single predecessor block. Otherwise return a null pointer. More...
 
const BasicBlockgetSinglePredecessor () const
 
BasicBlockgetUniquePredecessor ()
 Return this block if it has a unique predecessor block. Otherwise return a null pointer. More...
 
const BasicBlockgetUniquePredecessor () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
size_t size () const
 
bool empty () const
 
const Instructionfront () const
 
Instructionfront ()
 
const Instructionback () const
 
Instructionback ()
 
const InstListTypegetInstList () const
 Return the underlying instruction list container. 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...
 
BasicBlocksplitBasicBlock (iterator I, const Twine &BBName="")
 Split the basic block into two basic blocks at the specified instruction. More...
 
bool hasAddressTaken () const
 Returns true if there are any uses of this basic block other than direct branches, switches, etc. to it. 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 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
virtual ~Value ()
 
void dump () const
 dump - Support for debugging, callable in GDB: V->dump() More...
 
void print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const
 
TypegetType () const
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 
void setName (const Twine &Name)
 
void takeName (Value *V)
 
void replaceAllUsesWith (Value *V)
 
bool use_empty () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
Useruse_back ()
 
const Useruse_back () const
 
bool hasOneUse () const
 
bool hasNUses (unsigned N) const
 
bool hasNUsesOrMore (unsigned N) const
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 
unsigned getNumUses () const
 
void addUse (Use &U)
 
unsigned getValueID () const
 
unsigned getRawSubclassOptionalData () const
 
void clearSubclassOptionalData ()
 
bool hasSameSubclassOptionalData (const Value *V) const
 
void intersectOptionalDataWith (const Value *V)
 
bool hasValueHandle () const
 
ValuestripPointerCasts ()
 Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCasts () const
 
ValuestripPointerCastsNoFollowAliases ()
 Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCastsNoFollowAliases () const
 
ValuestripInBoundsConstantOffsets ()
 Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsConstantOffsets () const
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More...
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 
ValuestripInBoundsOffsets ()
 Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsOffsets () const
 
bool isDereferenceablePointer () const
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 
void mutateType (Type *Ty)
 
- Public Member Functions inherited from llvm::ilist_node< BasicBlock >
BasicBlockgetPrevNode ()
 Get the previous node, or 0 for the list head. More...
 
const BasicBlockgetPrevNode () const
 Get the previous node, or 0 for the list head. More...
 
BasicBlockgetNextNode ()
 Get the next node, or 0 for the list tail. More...
 
const BasicBlockgetNextNode () const
 Get the next node, or 0 for the list tail. More...
 

Static Public Member Functions

static BasicBlockCreate (LLVMContext &Context, const Twine &Name="", Function *Parent=0, BasicBlock *InsertBefore=0)
 Creates a new BasicBlock. More...
 
static iplist< Instruction >
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, Function >
 

Additional Inherited Members

- Static Public Attributes inherited from llvm::Value
static const unsigned MaximumAlignment = 1u << 29
 
- Protected Member Functions inherited from llvm::Value
virtual void printCustom (raw_ostream &O) const
 
 Value (Type *Ty, unsigned scid)
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 
- Protected Member Functions inherited from llvm::ilist_node< BasicBlock >
 ilist_node ()
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 

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

Member Typedef Documentation

Definition at line 100 of file BasicBlock.h.

Definition at line 102 of file BasicBlock.h.

Definition at line 76 of file BasicBlock.h.

Instruction iterators...

Definition at line 99 of file BasicBlock.h.

Definition at line 101 of file BasicBlock.h.

Constructor & Destructor Documentation

BasicBlock::~BasicBlock ( )

Member Function Documentation

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

Definition at line 208 of file BasicBlock.h.

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

iterator llvm::BasicBlock::begin ( )
inline

Instruction iterator methods

Definition at line 193 of file BasicBlock.h.

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

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

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

Definition at line 194 of file BasicBlock.h.

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

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

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

Definition at line 226 of file BasicBlock.h.

References llvm::Value::BasicBlockVal, and llvm::Value::getValueID().

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

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

Referenced by ~BasicBlock().

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

Definition at line 204 of file BasicBlock.h.

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

Referenced by llvm::DeleteDeadBlock().

iterator llvm::BasicBlock::end ( )
inline

Definition at line 195 of file BasicBlock.h.

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

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

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

Definition at line 196 of file BasicBlock.h.

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

void BasicBlock::eraseFromParent ( )
const Instruction& llvm::BasicBlock::front ( ) const
inline
Instruction& llvm::BasicBlock::front ( )
inline

Definition at line 206 of file BasicBlock.h.

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

LLVMContext & BasicBlock::getContext ( ) const
BasicBlock::iterator BasicBlock::getFirstInsertionPt ( )

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

References getFirstNonPHI().

Referenced by llvm::DemoteRegToStack(), llvm::InstCombiner::DoOneIteration(), GenerateARCBBEntranceAnnotation(), getFirstInsertionPt(), OptimizeCmpExpression(), OptimizeNoopCopyExpression(), llvm::SplitLandingPadPredecessors(), TryToSinkInstruction(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().

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

Definition at line 154 of file BasicBlock.h.

References getFirstInsertionPt().

Instruction * BasicBlock::getFirstNonPHI ( )

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

References begin().

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

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

Definition at line 131 of file BasicBlock.h.

References getFirstNonPHI().

Instruction * BasicBlock::getFirstNonPHIOrDbg ( )

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

Definition at line 140 of file BasicBlock.cpp.

References begin().

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

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

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

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

Referenced by getFirstNonPHIOrDbgOrLifetime().

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

Definition at line 145 of file BasicBlock.h.

References getFirstNonPHIOrDbgOrLifetime().

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

Definition at line 215 of file BasicBlock.h.

LandingPadInst * BasicBlock::getLandingPadInst ( )

Return the landingpad instruction associated with the landing pad.

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

Definition at line 366 of file BasicBlock.cpp.

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

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

const LandingPadInst * BasicBlock::getLandingPadInst ( ) const

Definition at line 369 of file BasicBlock.cpp.

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

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

Return the enclosing method, or null if none.

Definition at line 116 of file BasicBlock.h.

Referenced by llvm::CodeMetrics::analyzeBasicBlock(), CanTRE(), changeToUnreachable(), llvm::CloneBasicBlock(), CloneLoopBlocks(), llvm::ConstantFoldTerminator(), llvm::IRBuilderBase::CreateGlobalString(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), llvm::DominatorTree::dominates(), llvm::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::EmitStrNLen(), llvm::EmitUnaryFloatFnCall(), eraseFromParent(), llvm::CodeExtractor::extractCodeRegion(), FindPotentialTailCall(), FoldCondBranchOnPHI(), GenerateARCBBEntranceAnnotation(), GenerateARCBBTerminatorAnnotation(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::MMIAddrLabelMap::getAddrLabelSymbol(), getCommonReturnValue(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), llvm::MemoryDependenceAnalysis::getDependency(), llvm::Trace::getFunction(), getFunctionForValue(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), llvm::DOTGraphTraits< DomTreeNode * >::getNodeLabel(), llvm::DOTGraphTraits< RegionNode * >::getNodeLabel(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), llvm::JIT::getPointerToBasicBlock(), getValueSymbolTable(), HandleByValArgument(), HandleInlinedInvoke(), llvm::InlineFunction(), insertFastDiv(), isDynamicConstant(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), llvm::isInTailCallPosition(), llvm::isPotentiallyReachable(), llvm::AllocaInst::isStaticAlloca(), LLVMGetNextBasicBlock(), LLVMGetPreviousBasicBlock(), LLVMInsertBasicBlockInContext(), llvm::IntrinsicLowering::LowerToByteSwap(), moveAfter(), moveBefore(), NegateValue(), PerformHeapAllocSRoA(), PlaceSplitBlockCarefully(), llvm::AssemblyWriter::printBasicBlock(), PrintOps(), ProcessUAddIdiom(), ProcessUGT_ADDCST_ADD(), promoteSingleBlockAlloca(), removeFromParent(), ReplaceCallWith(), replaceConstantExprOp(), rewriteSingleStoreAlloca(), SimplifyCondBranchToCondBranch(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), SwitchToLookupTable(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), TryToSinkInstruction(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), UpdateCallGraphAfterInlining(), llvm::MMIAddrLabelMap::UpdateForDeletedBlock(), useFuncSeen(), ValueDominatesPHI(), llvm::DominatorTree::verifyAnalysis(), llvm::InstCombiner::visitAllocaInst(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFPTrunc(), and ~BasicBlock().

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

Definition at line 117 of file BasicBlock.h.

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

Definition at line 176 of file BasicBlock.h.

References getSinglePredecessor().

static iplist<Instruction> BasicBlock::* llvm::BasicBlock::getSublistAccess ( Instruction )
inlinestatic

Returns a pointer to a member of the instruction list.

Definition at line 218 of file BasicBlock.h.

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

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

Referenced by AddReachableCodeToWorklist(), llvm::CodeMetrics::analyzeBasicBlock(), BlockIsSimpleEnoughToThreadThrough(), llvm::CloneAndPruneFunctionInto(), llvm::CloneFunctionInto(), CloneLoopBlocks(), ConnectProlog(), llvm::ConstantFoldTerminator(), convertMemSetToLoop(), convertTransferToLoop(), createPHIsForSplitLoopExit(), llvm::DeleteDeadBlock(), DeleteInstructionInBlock(), llvm::DemotePHIToStack(), DominatesMergePoint(), FindMostPopularDest(), FindPHIForConditionForwarding(), FindUnconditionalPreds(), FoldBlockIntoPredecessor(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), GetBestDestForJumpOnUndef(), llvm::DOTGraphTraits< const Function * >::getEdgeSourceLabel(), getEdgeValueLocal(), llvm::Region::getExpandedRegion(), llvm::GetIfCondition(), getInsertPointForUses(), llvm::GetSuccessorNumber(), llvm::InlineFunction(), llvm::DIBuilder::insertDeclare(), llvm::InsertPreheaderForLoop(), llvm::SparseSolver::isEdgeFeasible(), llvm::isInTailCallPosition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isSafePHIToSpeculate(), llvm::BasicBlockEdge::isSingleEdge(), llvm::Loop::makeLoopInvariant(), markAliveBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeEmptyReturnBlocks(), PerformHeapAllocSRoA(), removeUndefIntroducingPredecessor(), replaceConstantExprOp(), replaceSuccessorsPhiUsesWith(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::IRBuilderBase::SetInsertPoint(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), SinkThenElseCodeToEnd(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), SpeculativelyExecuteBB(), splitBasicBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitCriticalEdge(), SplitCriticalSideEffectEdges(), llvm::SplitEdge(), llvm::SplitLandingPadPredecessors(), llvm::succ_begin(), llvm::succ_end(), tryToMakeAllocaBePromotable(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TryToSimplifyUncondBranchWithICmpInIt(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), and llvm::InstCombiner::visitCallInst().

const TerminatorInst * BasicBlock::getTerminator ( ) const
BasicBlock * BasicBlock::getUniquePredecessor ( )

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

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

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

Definition at line 196 of file BasicBlock.cpp.

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

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

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

Definition at line 186 of file BasicBlock.h.

References getUniquePredecessor().

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
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.

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

Definition at line 360 of file BasicBlock.cpp.

References getFirstNonPHI().

Referenced by ConnectProlog(), createPHIsForSplitLoopExit(), llvm::InsertPreheaderForLoop(), isBlockValidForExtraction(), llvm::SplitCriticalEdge(), and llvm::SplitLandingPadPredecessors().

void BasicBlock::moveAfter ( BasicBlock MovePos)

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

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

Definition at line 113 of file BasicBlock.cpp.

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

Referenced by PlaceSplitBlockCarefully().

void BasicBlock::moveBefore ( BasicBlock MovePos)

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

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

Definition at line 106 of file BasicBlock.cpp.

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

Referenced by insertFastDiv().

reverse_iterator llvm::BasicBlock::rbegin ( )
inline
const_reverse_iterator llvm::BasicBlock::rbegin ( ) const
inline

Definition at line 199 of file BasicBlock.h.

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

void BasicBlock::removeFromParent ( )

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

Definition at line 96 of file BasicBlock.cpp.

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

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

Notify the BasicBlock that the predecessor Pred is no longer able to reach it.

This is actually not used to update the Predecessor list, but is actually used to update the PHI nodes that reside in the block. Note that this should be called while the predecessor still refers to this block.

removePredecessor - This method is used to notify a BasicBlock that the specified Predecessor of the block is no longer able to reach it. This is actually not used to update the Predecessor list, but is actually used to update the PHI nodes that reside in the block. Note that this should be called while the predecessor still refers to this block.

Definition at line 216 of file BasicBlock.cpp.

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

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

reverse_iterator llvm::BasicBlock::rend ( )
inline
const_reverse_iterator llvm::BasicBlock::rend ( ) const
inline

Definition at line 201 of file BasicBlock.h.

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

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

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

size_t llvm::BasicBlock::size ( ) const
inline
BasicBlock * BasicBlock::splitBasicBlock ( iterator  I,
const Twine BBName = "" 
)

Split the basic block into two basic blocks at the specified instruction.

Note that all instructions BEFORE the specified iterator stay as part of the original basic block, an unconditional branch is added to the original BB, and the rest of the instructions in the BB are moved to the new BB, including the old terminator. The newly formed BasicBlock is returned. This function invalidates the specified iterator.

Note that this only works on well formed basic blocks (must have a terminator), and 'I' must not be the end of instruction list (which would cause a degenerate basic block to be formed, having a terminator inside of the basic block).

Also note that this doesn't preserve any passes. To split blocks while keeping loop information consistent, use the SplitBlock utility function.

splitBasicBlock - This splits a basic block into two at the specified instruction. Note that all instructions BEFORE the specified iterator stay as part of the original basic block, an unconditional branch is added to the new BB, and the rest of the instructions in the BB are moved to the new BB, including the old terminator. This invalidates the iterator.

Note that this only works on well formed basic blocks (must have a terminator), and 'I' must not be the end of instruction list (which would cause a degenerate basic block to be formed, having a terminator inside of the basic block).

Definition at line 298 of file BasicBlock.cpp.

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

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

Friends And Related Function Documentation

friend class BlockAddress
friend

Definition at line 74 of file BasicBlock.h.

friend class SymbolTableListTraits< BasicBlock, Function >
friend

Definition at line 82 of file BasicBlock.h.


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