29 return &
F->getValueSymbolTable();
51 "Cannot insert block before another block with no function!");
53 }
else if (NewParent) {
69 assert(!
use_empty() &&
"There should be at least one blockaddress!");
80 assert(
getParent() == 0 &&
"BasicBlock still linked into the program!");
85 void BasicBlock::setParent(
Function *parent) {
90 InstList.setSymTabObject(&Parent, parent);
121 if (InstList.
empty())
return 0;
126 if (InstList.
empty())
return 0;
136 while (isa<PHINode>(i)) ++i;
146 while (isa<PHINode>(i) || isa<DbgInfoIntrinsic>(i)) ++i;
157 if (isa<PHINode>(i) || isa<DbgInfoIntrinsic>(i))
172 if (isa<LandingPadInst>(InsertPt)) ++InsertPt;
178 I->dropAllReferences();
185 if (PI == E)
return 0;
188 return (PI == E) ? ThePred : 0 ;
198 if (PI == E)
return 0;
201 for (;PI != E; ++PI) {
217 bool DontDeleteUselessPHIs) {
220 "removePredecessor: BB is not a predecessor!");
222 if (InstList.
empty())
return;
239 assert(max_idx != 0 &&
"PHI Node in block with 0 predecessors!?!?!");
244 if (
this == Other) max_idx = 3;
248 if (max_idx <= 2 && !DontDeleteUselessPHIs) {
252 PN->removeIncomingValue(Pred, !DontDeleteUselessPHIs);
256 if (PN->getIncomingValue(0) != PN)
257 PN->replaceAllUsesWith(PN->getIncomingValue(0));
299 assert(
getTerminator() &&
"Can't use splitBasicBlock on degenerate BB!");
300 assert(I != InstList.
end() &&
301 "Trying to get me to create degenerate basic block!");
304 .getNodePtrUnchecked();
BasicBlock * getUniquePredecessor()
Return this block if it has a unique predecessor block. Otherwise return a null pointer.
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
Notify the BasicBlock that the predecessor Pred is no longer able to reach it.
Intrinsic::ID getIntrinsicID() const
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const Function * getParent() const
Return the enclosing method, or null if none.
const Instruction & front() const
Instruction * getFirstNonPHIOrDbg()
Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic...
static void removeGarbageObject(void *Object)
void push_back(NodeTy *val)
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Instruction * getFirstNonPHI()
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=0)
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc. to it.
void setName(const Twine &Name)
Interval::succ_iterator succ_begin(Interval *I)
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
void replaceAllUsesWith(Value *V)
static Constant * getIntToPtr(Constant *C, Type *Ty)
Interval::succ_iterator succ_end(Interval *I)
unsigned getNumIncomingValues() const
unsigned getNumSuccessors() const
void replaceSuccessorsPhiUsesWith(BasicBlock *New)
Update all phi nodes in this basic block's successors to refer to basic block New instead of to it...
LLVM Basic Block Representation.
Value * hasConstantValue() const
BasicBlock * getSuccessor(unsigned idx) const
LLVM Constant Representation.
LandingPadInst * getLandingPadInst()
Return the landingpad instruction associated with the landing pad.
Interval::pred_iterator pred_begin(Interval *I)
BasicBlock * getIncomingBlock(unsigned i) const
ItTy next(ItTy it, Dist n)
const InstListType & getInstList() const
Return the underlying instruction list container.
iterator insert(iterator where, NodeTy *New)
Interval::pred_iterator pred_end(Interval *I)
static UndefValue * get(Type *T)
Instruction * getFirstNonPHIOrDbgOrLifetime()
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic...
iterator erase(iterator where)
void removeFromParent()
Unlink 'this' from the containing function, but do not delete it.
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
const BasicBlockListType & getBasicBlockList() const
void setIncomingBlock(unsigned i, BasicBlock *BB)
void eraseFromParent()
Unlink 'this' from the containing function and delete it.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
void splice(iterator where, iplist &L2)
static void addGarbageObject(void *Object)
BasicBlock * getSinglePredecessor()
Return this block if it has a single predecessor block. Otherwise return a null pointer.
static IntegerType * getInt32Ty(LLVMContext &C)
ValueSymbolTable * getValueSymbolTable()
Returns a pointer to the symbol table if one exists.
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
bool isLandingPad() const
Return true if this basic block is a landing pad.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=0, BasicBlock *InsertBefore=0)
Creates a new BasicBlock.
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
virtual void destroyConstant()
bool hasNUsesOrMore(unsigned N) const
LLVMContext & getContext() const
Get the context in which this basic block lives.
LLVM Value Representation.
iterator getFirstInsertionPt()
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
NodeTy * remove(iterator &IT)
int getBasicBlockIndex(const BasicBlock *BB) const
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...