LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::BasicBlock Class Reference

#include <BasicBlock.h>

Inheritance diagram for llvm::BasicBlock:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef iplist< InstructionInstListType
typedef InstListType::iterator iterator
 Instruction iterators...
typedef InstListType::const_iterator const_iterator
typedef std::reverse_iterator<
const_iterator
const_reverse_iterator
typedef std::reverse_iterator<
iterator
reverse_iterator

Public Member Functions

 BasicBlock (const std::string &Name="", Function *Parent=0, BasicBlock *InsertBefore=0)
 ~BasicBlock ()
virtual void setName (const std::string &name, SymbolTable *ST=0)
const FunctiongetParent () const
FunctiongetParent ()
BasicBlockgetNext ()
const BasicBlockgetNext () const
BasicBlockgetPrev ()
const BasicBlockgetPrev () const
TerminatorInstgetTerminator ()
const TerminatorInst *const getTerminator () const
void removeFromParent ()
void eraseFromParent ()
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
InstListTypegetInstList ()
virtual void print (std::ostream &OS) const
void print (std::ostream &OS, AssemblyAnnotationWriter *AAW) const
void dropAllReferences ()
void removePredecessor (BasicBlock *Pred)
BasicBlocksplitBasicBlock (iterator I, const std::string &BBName="")

Static Public Member Functions

static bool classof (const BasicBlock *BB)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Value *V)

Friends

class SymbolTableListTraits< BasicBlock, Function, Function >

Detailed Description

Definition at line 48 of file BasicBlock.h.


Member Typedef Documentation

typedef InstListType::const_iterator llvm::BasicBlock::const_iterator
 

Definition at line 66 of file BasicBlock.h.

typedef std::reverse_iterator<const_iterator> llvm::BasicBlock::const_reverse_iterator
 

Definition at line 67 of file BasicBlock.h.

typedef iplist<Instruction> llvm::BasicBlock::InstListType
 

Definition at line 50 of file BasicBlock.h.

typedef InstListType::iterator llvm::BasicBlock::iterator
 

Instruction iterators...

Definition at line 65 of file BasicBlock.h.

typedef std::reverse_iterator<iterator> llvm::BasicBlock::reverse_iterator
 

Definition at line 68 of file BasicBlock.h.


Constructor & Destructor Documentation

BasicBlock::BasicBlock const std::string &  Name = "",
Function Parent = 0,
BasicBlock InsertBefore = 0
 

BasicBlock ctor - If the function parameter is specified, the basic block is automatically inserted at either the end of the function (if InsertBefore is null), or before the specified basic block.

Definition at line 63 of file BasicBlock.cpp.

References llvm::LeakDetector::addGarbageObject(), and llvm::Function::getBasicBlockList().

BasicBlock::~BasicBlock  ) 
 

Definition at line 82 of file BasicBlock.cpp.

References dropAllReferences(), and getParent().


Member Function Documentation

Instruction& llvm::BasicBlock::back  )  [inline]
 

Definition at line 129 of file BasicBlock.h.

const Instruction& llvm::BasicBlock::back  )  const [inline]
 

Definition at line 128 of file BasicBlock.h.

Referenced by llvm::AliasAnalysis::canBasicBlockModify(), llvm::ImmediateDominators::runOnFunction(), and llvm::SimplifyCFG().

const_iterator llvm::BasicBlock::begin  )  const [inline]
 

Definition at line 115 of file BasicBlock.h.

iterator llvm::BasicBlock::begin  )  [inline]
 

Instruction iterator methods

Definition at line 114 of file BasicBlock.h.

Referenced by llvm::AliasSetTracker::add(), AddPredecessorToBlock(), ApproximateLoopSize(), llvm::Interpreter::callFunction(), llvm::CloneBasicBlock(), llvm::CloneTrace(), llvm::DemoteRegToStack(), DominatesMergePoint(), dropAllReferences(), FindPHIToPartitionLoops(), llvm::Loop::getCanonicalInductionVariable(), HoistThenElseCodeToIf(), llvm::IncrementCounterInBlock(), llvm::InlineFunction(), llvm::insertBB(), InsertCodeToShowFunctionEntry(), InsertInstrumentationCall(), llvm::insertInTopBB(), llvm::InsertProfilingInitCall(), isBlockSimpleEnough(), isSafeToLoadUnconditionally(), MarkAliveBlocks(), PropagatePredecessorsForPHIs(), ReleasePtrSeqNumbers(), removePredecessor(), llvm::ProfilePaths::runOnFunction(), llvm::SimplifyCFG(), splitBasicBlock(), llvm::SplitCriticalEdge(), TraceValuesAtBBExit(), llvm::SelectionDAGBuilder::visitBB(), and llvm::Interpreter::visitCallSite().

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

Reimplemented from llvm::Value.

Definition at line 142 of file BasicBlock.h.

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

static bool llvm::BasicBlock::classof const BasicBlock BB  )  [inline, static]
 

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

Definition at line 141 of file BasicBlock.h.

void BasicBlock::dropAllReferences  ) 
 

dropAllReferences() - This function causes all the subinstructions to "let go" of all references that they 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 127 of file BasicBlock.cpp.

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

Referenced by ~BasicBlock().

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

Definition at line 125 of file BasicBlock.h.

Referenced by llvm::SimplifyCFG().

const_iterator llvm::BasicBlock::end  )  const [inline]
 

Definition at line 117 of file BasicBlock.h.

iterator llvm::BasicBlock::end  )  [inline]
 

Definition at line 116 of file BasicBlock.h.

Referenced by llvm::AliasSetTracker::add(), ApproximateLoopSize(), llvm::CloneBasicBlock(), ConvertMallocToType(), ConvertOperandToType(), dropAllReferences(), llvm::insertBB(), MarkAliveBlocks(), ReleasePtrSeqNumbers(), llvm::SimplifyCFG(), splitBasicBlock(), and llvm::SelectionDAGBuilder::visitBB().

void BasicBlock::eraseFromParent  ) 
 

eraseFromParent - This method unlinks 'this' from the containing function and deletes it.

Definition at line 112 of file BasicBlock.cpp.

References llvm::Function::getBasicBlockList(), and getParent().

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

Instruction& llvm::BasicBlock::front  )  [inline]
 

Definition at line 127 of file BasicBlock.h.

const Instruction& llvm::BasicBlock::front  )  const [inline]
 

Definition at line 126 of file BasicBlock.h.

Referenced by llvm::AliasAnalysis::canBasicBlockModify(), isBlockSimpleEnough(), PropagatePredecessorsForPHIs(), removePredecessor(), llvm::UnifyFunctionExitNodes::runOnFunction(), and llvm::SimplifyCFG().

InstListType& llvm::BasicBlock::getInstList  )  [inline]
 

Definition at line 135 of file BasicBlock.h.

const InstListType& llvm::BasicBlock::getInstList  )  const [inline]
 

getInstList() - Return the underlying instruction list container. You need to access it directly if you want to modify it currently.

Definition at line 134 of file BasicBlock.h.

Referenced by AssociativeOpt(), llvm::CloneBasicBlock(), llvm::CloneTrace(), llvm::ConstantFoldTerminator(), llvm::ConvertExpressionToType(), ConvertOperandToType(), llvm::BinaryOperator::create(), llvm::DecomposeArrayRef(), llvm::Instruction::eraseFromParent(), ErasePossiblyDeadInstructionTree(), FindPHIToPartitionLoops(), FoldValueComparisonIntoPredecessors(), llvm::getTriggerCode(), HandleCastToPointer(), HoistThenElseCodeToIf(), llvm::InlineFunction(), llvm::insertBB(), llvm::insertInTopBB(), llvm::Instruction::Instruction(), llvm::DefaultIntrinsicLowering::LowerIntrinsicCall(), llvm::BytecodeReader::ParseInstruction(), PeepholeOptimizeAddCast(), RecursiveDelete(), llvm::Instruction::removeFromParent(), llvm::PHINode::removeIncomingValue(), removePredecessor(), llvm::ReplaceInstWithInst(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::RunVMAsmParser(), llvm::SimplifyCFG(), and splitBasicBlock().

const BasicBlock* llvm::BasicBlock::getNext  )  const [inline]
 

Definition at line 88 of file BasicBlock.h.

References Next().

BasicBlock* llvm::BasicBlock::getNext  )  [inline]
 

Definition at line 87 of file BasicBlock.h.

References Next().

Referenced by ReleasePtrSeqNumbers(), splitBasicBlock(), and llvm::SplitCriticalEdge().

Function* llvm::BasicBlock::getParent  )  [inline]
 

Definition at line 84 of file BasicBlock.h.

const Function* llvm::BasicBlock::getParent  )  const [inline]
 

getParent - Return the enclosing method, or null if none

Definition at line 83 of file BasicBlock.h.

Referenced by AssociativeOpt(), llvm::ConstantFoldTerminator(), llvm::DemoteRegToStack(), llvm::MachineCodeForInstruction::destroy(), dyn_castFixedAlloca(), eraseFromParent(), FoldValueComparisonIntoPredecessors(), llvm::MachineCodeForInstruction::get(), getBlockAfter(), llvm::DSCallSite::getCaller(), llvm::CallSite::getCaller(), getCommonReturnValue(), getConstantEvolvingPHI(), llvm::ProfileInfo::getExecutionCount(), llvm::Trace::getFunction(), IdenticalComplexInst(), InlineCallIfPossible(), llvm::InlineFunction(), llvm::insertBB(), InsertCodeToShowFunctionExit(), InsertInstrumentationCall(), InsertPrintInst(), isDynamicConstant(), isIdenticalBinaryInst(), llvm::Instruction::print(), print(), removeFromParent(), ReplaceCallWith(), llvm::PeepholeOpts::runOnBasicBlock(), llvm::ProfilePaths::runOnFunction(), llvm::Inliner::runOnSCC(), llvm::BasicBlockPass::runPass(), llvm::Instruction::setName(), setName(), llvm::SimplifyCFG(), splitBasicBlock(), llvm::SplitCriticalEdge(), and ~BasicBlock().

const BasicBlock* llvm::BasicBlock::getPrev  )  const [inline]
 

Definition at line 90 of file BasicBlock.h.

BasicBlock* llvm::BasicBlock::getPrev  )  [inline]
 

Definition at line 89 of file BasicBlock.h.

const TerminatorInst *const BasicBlock::getTerminator  )  const
 

Definition at line 122 of file BasicBlock.cpp.

TerminatorInst * BasicBlock::getTerminator  ) 
 

getTerminator() - If this is a well formed basic block, then this returns a pointer to the terminator instruction. If it is not, then you get a null pointer back.

Definition at line 117 of file BasicBlock.cpp.

Referenced by ApproximateLoopSize(), llvm::ChooseInstructionsForDelaySlots(), llvm::CloneFunctionInto(), llvm::ConstantFoldTerminator(), DominatesMergePoint(), FoldValueComparisonIntoPredecessors(), llvm::ProfileInfoLoader::getBlockCounts(), llvm::DOTGraphTraits< const Function * >::getEdgeSourceLabel(), GetIfCondition(), llvm::Loop::getTripCount(), llvm::InlineFunction(), llvm::insertBB(), InsertCodeToShowFunctionExit(), isBlockSimpleEnough(), llvm::BytecodeReader::ParseInstructionList(), llvm::ReplaceNopsWithUsefulInstr(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::SimplifyCFG(), splitBasicBlock(), llvm::SplitCriticalEdge(), llvm::succ_begin(), llvm::succ_end(), and TraceValuesAtBBExit().

void BasicBlock::print std::ostream &  OS,
AssemblyAnnotationWriter AAW
const
 

Definition at line 1207 of file AsmWriter.cpp.

References getParent(), and llvm::AssemblyWriter::write().

virtual void llvm::BasicBlock::print std::ostream &  OS  )  const [inline, virtual]
 

print - Implement operator<< on Value...

Implements llvm::Value.

Definition at line 137 of file BasicBlock.h.

const_reverse_iterator llvm::BasicBlock::rbegin  )  const [inline]
 

Definition at line 120 of file BasicBlock.h.

reverse_iterator llvm::BasicBlock::rbegin  )  [inline]
 

Definition at line 119 of file BasicBlock.h.

void BasicBlock::removeFromParent  ) 
 

removeFromParent - This method unlinks 'this' from the containing function, but does not delete it.

Definition at line 108 of file BasicBlock.cpp.

References llvm::Function::getBasicBlockList(), and getParent().

void BasicBlock::removePredecessor BasicBlock Pred  ) 
 

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

References begin(), front(), llvm::PHINode::getIncomingBlock(), getInstList(), llvm::Constant::getNullValue(), llvm::PHINode::getNumIncomingValues(), llvm::MVT::Other, llvm::pred_begin(), llvm::pred_end(), llvm::PHINode::removeIncomingValue(), and llvm::Value::replaceAllUsesWith().

Referenced by llvm::ConstantFoldTerminator(), FoldValueComparisonIntoPredecessors(), llvm::InlineFunction(), llvm::RemoveSuccessor(), and llvm::SimplifyCFG().

const_reverse_iterator llvm::BasicBlock::rend  )  const [inline]
 

Definition at line 122 of file BasicBlock.h.

reverse_iterator llvm::BasicBlock::rend  )  [inline]
 

Definition at line 121 of file BasicBlock.h.

void BasicBlock::setName const std::string &  name,
SymbolTable ST = 0
[virtual]
 

Reimplemented from llvm::Value.

Definition at line 99 of file BasicBlock.cpp.

References getParent(), llvm::Function::getSymbolTable(), llvm::Value::hasName(), llvm::SymbolTable::insert(), llvm::SymbolTable::remove(), and llvm::Value::setName().

Referenced by llvm::CloneBasicBlock(), getBBVal(), and llvm::SimplifyCFG().

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

Definition at line 124 of file BasicBlock.h.

Referenced by isBlockSimpleEnough().

BasicBlock * BasicBlock::splitBasicBlock iterator  I,
const std::string &  BBName = ""
 

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

Definition at line 204 of file BasicBlock.cpp.

References begin(), E, end(), llvm::PHINode::getBasicBlockIndex(), getInstList(), getNext(), getParent(), getTerminator(), llvm::PHINode::setIncomingBlock(), llvm::succ_begin(), and llvm::succ_end().

Referenced by llvm::InlineFunction().


Friends And Related Function Documentation

friend class SymbolTableListTraits< BasicBlock, Function, Function > [friend]
 

Definition at line 58 of file BasicBlock.h.


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