LLVM  4.0.0
BasicBlock.cpp
Go to the documentation of this file.
1 //===-- BasicBlock.cpp - Implement BasicBlock related methods -------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the BasicBlock class for the IR library.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "llvm/IR/BasicBlock.h"
16 #include "llvm/ADT/STLExtras.h"
17 #include "llvm/IR/CFG.h"
18 #include "llvm/IR/Constants.h"
19 #include "llvm/IR/Instructions.h"
20 #include "llvm/IR/IntrinsicInst.h"
21 #include "llvm/IR/LLVMContext.h"
22 #include "llvm/IR/Type.h"
23 #include <algorithm>
24 
25 using namespace llvm;
26 
28  if (Function *F = getParent())
29  return F->getValueSymbolTable();
30  return nullptr;
31 }
32 
34  return getType()->getContext();
35 }
36 
37 // Explicit instantiation of SymbolTableListTraits since some of the methods
38 // are not in the public header file...
40 
41 BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent,
42  BasicBlock *InsertBefore)
43  : Value(Type::getLabelTy(C), Value::BasicBlockVal), Parent(nullptr) {
44 
45  if (NewParent)
46  insertInto(NewParent, InsertBefore);
47  else
48  assert(!InsertBefore &&
49  "Cannot insert block before another block with no function!");
50 
51  setName(Name);
52 }
53 
54 void BasicBlock::insertInto(Function *NewParent, BasicBlock *InsertBefore) {
55  assert(NewParent && "Expected a parent");
56  assert(!Parent && "Already has a parent");
57 
58  if (InsertBefore)
59  NewParent->getBasicBlockList().insert(InsertBefore->getIterator(), this);
60  else
61  NewParent->getBasicBlockList().push_back(this);
62 }
63 
65  // If the address of the block is taken and it is being deleted (e.g. because
66  // it is dead), this means that there is either a dangling constant expr
67  // hanging off the block, or an undefined use of the block (source code
68  // expecting the address of a label to keep the block alive even though there
69  // is no indirect branch). Handle these cases by zapping the BlockAddress
70  // nodes. There are no other possible uses at this point.
71  if (hasAddressTaken()) {
72  assert(!use_empty() && "There should be at least one blockaddress!");
73  Constant *Replacement =
75  while (!use_empty()) {
76  BlockAddress *BA = cast<BlockAddress>(user_back());
78  BA->getType()));
79  BA->destroyConstant();
80  }
81  }
82 
83  assert(getParent() == nullptr && "BasicBlock still linked into the program!");
85  InstList.clear();
86 }
87 
88 void BasicBlock::setParent(Function *parent) {
89  // Set Parent=parent, updating instruction symtab entries as appropriate.
90  InstList.setSymTabObject(&Parent, parent);
91 }
92 
95 }
96 
99 }
100 
101 /// Unlink this basic block from its current function and
102 /// insert it into the function that MovePos lives in, right before MovePos.
104  MovePos->getParent()->getBasicBlockList().splice(
105  MovePos->getIterator(), getParent()->getBasicBlockList(), getIterator());
106 }
107 
108 /// Unlink this basic block from its current function and
109 /// insert it into the function that MovePos lives in, right after MovePos.
111  MovePos->getParent()->getBasicBlockList().splice(
112  ++MovePos->getIterator(), getParent()->getBasicBlockList(),
113  getIterator());
114 }
115 
117  return getParent()->getParent();
118 }
119 
121  return getParent()->getParent();
122 }
123 
125  if (InstList.empty()) return nullptr;
126  return dyn_cast<TerminatorInst>(&InstList.back());
127 }
128 
130  if (InstList.empty()) return nullptr;
131  return dyn_cast<TerminatorInst>(&InstList.back());
132 }
133 
135  if (InstList.empty())
136  return nullptr;
137  ReturnInst *RI = dyn_cast<ReturnInst>(&InstList.back());
138  if (!RI || RI == &InstList.front())
139  return nullptr;
140 
141  Instruction *Prev = RI->getPrevNode();
142  if (!Prev)
143  return nullptr;
144 
145  if (Value *RV = RI->getReturnValue()) {
146  if (RV != Prev)
147  return nullptr;
148 
149  // Look through the optional bitcast.
150  if (auto *BI = dyn_cast<BitCastInst>(Prev)) {
151  RV = BI->getOperand(0);
152  Prev = BI->getPrevNode();
153  if (!Prev || RV != Prev)
154  return nullptr;
155  }
156  }
157 
158  if (auto *CI = dyn_cast<CallInst>(Prev)) {
159  if (CI->isMustTailCall())
160  return CI;
161  }
162  return nullptr;
163 }
164 
166  if (InstList.empty())
167  return nullptr;
168  auto *RI = dyn_cast<ReturnInst>(&InstList.back());
169  if (!RI || RI == &InstList.front())
170  return nullptr;
171 
172  if (auto *CI = dyn_cast_or_null<CallInst>(RI->getPrevNode()))
173  if (Function *F = CI->getCalledFunction())
174  if (F->getIntrinsicID() == Intrinsic::experimental_deoptimize)
175  return CI;
176 
177  return nullptr;
178 }
179 
181  for (Instruction &I : *this)
182  if (!isa<PHINode>(I))
183  return &I;
184  return nullptr;
185 }
186 
188  for (Instruction &I : *this)
189  if (!isa<PHINode>(I) && !isa<DbgInfoIntrinsic>(I))
190  return &I;
191  return nullptr;
192 }
193 
195  for (Instruction &I : *this) {
196  if (isa<PHINode>(I) || isa<DbgInfoIntrinsic>(I))
197  continue;
198 
199  if (auto *II = dyn_cast<IntrinsicInst>(&I))
200  if (II->getIntrinsicID() == Intrinsic::lifetime_start ||
201  II->getIntrinsicID() == Intrinsic::lifetime_end)
202  continue;
203 
204  return &I;
205  }
206  return nullptr;
207 }
208 
210  Instruction *FirstNonPHI = getFirstNonPHI();
211  if (!FirstNonPHI)
212  return end();
213 
214  iterator InsertPt = FirstNonPHI->getIterator();
215  if (InsertPt->isEHPad()) ++InsertPt;
216  return InsertPt;
217 }
218 
220  for (Instruction &I : *this)
221  I.dropAllReferences();
222 }
223 
224 /// If this basic block has a single predecessor block,
225 /// return the block, otherwise return a null pointer.
227  pred_iterator PI = pred_begin(this), E = pred_end(this);
228  if (PI == E) return nullptr; // No preds.
229  BasicBlock *ThePred = *PI;
230  ++PI;
231  return (PI == E) ? ThePred : nullptr /*multiple preds*/;
232 }
233 
234 /// If this basic block has a unique predecessor block,
235 /// return the block, otherwise return a null pointer.
236 /// Note that unique predecessor doesn't mean single edge, there can be
237 /// multiple edges from the unique predecessor to this block (for example
238 /// a switch statement with multiple cases having the same destination).
240  pred_iterator PI = pred_begin(this), E = pred_end(this);
241  if (PI == E) return nullptr; // No preds.
242  BasicBlock *PredBB = *PI;
243  ++PI;
244  for (;PI != E; ++PI) {
245  if (*PI != PredBB)
246  return nullptr;
247  // The same predecessor appears multiple times in the predecessor list.
248  // This is OK.
249  }
250  return PredBB;
251 }
252 
254  succ_iterator SI = succ_begin(this), E = succ_end(this);
255  if (SI == E) return nullptr; // no successors
256  BasicBlock *TheSucc = *SI;
257  ++SI;
258  return (SI == E) ? TheSucc : nullptr /* multiple successors */;
259 }
260 
262  succ_iterator SI = succ_begin(this), E = succ_end(this);
263  if (SI == E) return nullptr; // No successors
264  BasicBlock *SuccBB = *SI;
265  ++SI;
266  for (;SI != E; ++SI) {
267  if (*SI != SuccBB)
268  return nullptr;
269  // The same successor appears multiple times in the successor list.
270  // This is OK.
271  }
272  return SuccBB;
273 }
274 
275 /// This method is used to notify a BasicBlock that the
276 /// specified Predecessor of the block is no longer able to reach it. This is
277 /// actually not used to update the Predecessor list, but is actually used to
278 /// update the PHI nodes that reside in the block. Note that this should be
279 /// called while the predecessor still refers to this block.
280 ///
282  bool DontDeleteUselessPHIs) {
283  assert((hasNUsesOrMore(16)||// Reduce cost of this assertion for complex CFGs.
284  find(pred_begin(this), pred_end(this), Pred) != pred_end(this)) &&
285  "removePredecessor: BB is not a predecessor!");
286 
287  if (InstList.empty()) return;
288  PHINode *APN = dyn_cast<PHINode>(&front());
289  if (!APN) return; // Quick exit.
290 
291  // If there are exactly two predecessors, then we want to nuke the PHI nodes
292  // altogether. However, we cannot do this, if this in this case:
293  //
294  // Loop:
295  // %x = phi [X, Loop]
296  // %x2 = add %x, 1 ;; This would become %x2 = add %x2, 1
297  // br Loop ;; %x2 does not dominate all uses
298  //
299  // This is because the PHI node input is actually taken from the predecessor
300  // basic block. The only case this can happen is with a self loop, so we
301  // check for this case explicitly now.
302  //
303  unsigned max_idx = APN->getNumIncomingValues();
304  assert(max_idx != 0 && "PHI Node in block with 0 predecessors!?!?!");
305  if (max_idx == 2) {
306  BasicBlock *Other = APN->getIncomingBlock(APN->getIncomingBlock(0) == Pred);
307 
308  // Disable PHI elimination!
309  if (this == Other) max_idx = 3;
310  }
311 
312  // <= Two predecessors BEFORE I remove one?
313  if (max_idx <= 2 && !DontDeleteUselessPHIs) {
314  // Yup, loop through and nuke the PHI nodes
315  while (PHINode *PN = dyn_cast<PHINode>(&front())) {
316  // Remove the predecessor first.
317  PN->removeIncomingValue(Pred, !DontDeleteUselessPHIs);
318 
319  // If the PHI _HAD_ two uses, replace PHI node with its now *single* value
320  if (max_idx == 2) {
321  if (PN->getIncomingValue(0) != PN)
322  PN->replaceAllUsesWith(PN->getIncomingValue(0));
323  else
324  // We are left with an infinite loop with no entries: kill the PHI.
325  PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
326  getInstList().pop_front(); // Remove the PHI node
327  }
328 
329  // If the PHI node already only had one entry, it got deleted by
330  // removeIncomingValue.
331  }
332  } else {
333  // Okay, now we know that we need to remove predecessor #pred_idx from all
334  // PHI nodes. Iterate over each PHI node fixing them up
335  PHINode *PN;
336  for (iterator II = begin(); (PN = dyn_cast<PHINode>(II)); ) {
337  ++II;
338  PN->removeIncomingValue(Pred, false);
339  // If all incoming values to the Phi are the same, we can replace the Phi
340  // with that value.
341  Value* PNV = nullptr;
342  if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue()))
343  if (PNV != PN) {
344  PN->replaceAllUsesWith(PNV);
345  PN->eraseFromParent();
346  }
347  }
348  }
349 }
350 
352  const Instruction *FirstNonPHI = getFirstNonPHI();
353  if (isa<LandingPadInst>(FirstNonPHI))
354  return true;
355  // This is perhaps a little conservative because constructs like
356  // CleanupBlockInst are pretty easy to split. However, SplitBlockPredecessors
357  // cannot handle such things just yet.
358  if (FirstNonPHI->isEHPad())
359  return false;
360  return true;
361 }
362 
363 /// This splits a basic block into two at the specified
364 /// instruction. Note that all instructions BEFORE the specified iterator stay
365 /// as part of the original basic block, an unconditional branch is added to
366 /// the new BB, and the rest of the instructions in the BB are moved to the new
367 /// BB, including the old terminator. This invalidates the iterator.
368 ///
369 /// Note that this only works on well formed basic blocks (must have a
370 /// terminator), and 'I' must not be the end of instruction list (which would
371 /// cause a degenerate basic block to be formed, having a terminator inside of
372 /// the basic block).
373 ///
375  assert(getTerminator() && "Can't use splitBasicBlock on degenerate BB!");
376  assert(I != InstList.end() &&
377  "Trying to get me to create degenerate basic block!");
378 
380  this->getNextNode());
381 
382  // Save DebugLoc of split point before invalidating iterator.
383  DebugLoc Loc = I->getDebugLoc();
384  // Move all of the specified instructions from the original basic block into
385  // the new basic block.
386  New->getInstList().splice(New->end(), this->getInstList(), I, end());
387 
388  // Add a branch instruction to the newly formed basic block.
389  BranchInst *BI = BranchInst::Create(New, this);
390  BI->setDebugLoc(Loc);
391 
392  // Now we must loop through all of the successors of the New block (which
393  // _were_ the successors of the 'this' block), and update any PHI nodes in
394  // successors. If there were PHI nodes in the successors, then they need to
395  // know that incoming branches will be from New, not from Old.
396  //
397  for (succ_iterator I = succ_begin(New), E = succ_end(New); I != E; ++I) {
398  // Loop over any phi nodes in the basic block, updating the BB field of
399  // incoming values...
400  BasicBlock *Successor = *I;
401  PHINode *PN;
402  for (BasicBlock::iterator II = Successor->begin();
403  (PN = dyn_cast<PHINode>(II)); ++II) {
404  int IDX = PN->getBasicBlockIndex(this);
405  while (IDX != -1) {
406  PN->setIncomingBlock((unsigned)IDX, New);
407  IDX = PN->getBasicBlockIndex(this);
408  }
409  }
410  }
411  return New;
412 }
413 
416  if (!TI)
417  // Cope with being called on a BasicBlock that doesn't have a terminator
418  // yet. Clang's CodeGenFunction::EmitReturnBlock() likes to do this.
419  return;
420  for (BasicBlock *Succ : TI->successors()) {
421  // N.B. Succ might not be a complete BasicBlock, so don't assume
422  // that it ends with a non-phi instruction.
423  for (iterator II = Succ->begin(), IE = Succ->end(); II != IE; ++II) {
424  PHINode *PN = dyn_cast<PHINode>(II);
425  if (!PN)
426  break;
427  int i;
428  while ((i = PN->getBasicBlockIndex(this)) >= 0)
429  PN->setIncomingBlock(i, New);
430  }
431  }
432 }
433 
434 /// Return true if this basic block is a landing pad. I.e., it's
435 /// the destination of the 'unwind' edge of an invoke instruction.
437  return isa<LandingPadInst>(getFirstNonPHI());
438 }
439 
440 /// Return the landingpad instruction associated with the landing pad.
443 }
446 }
Return a value (possibly void), from a function.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
Definition: Instruction.cpp:76
BasicBlock * getUniqueSuccessor()
Return the successor of this block if it has a unique successor.
Definition: BasicBlock.cpp:261
This class provides a symbol table of name/value pairs.
BasicBlock * getUniquePredecessor()
Return the predecessor of this block if it has a unique predecessor block.
Definition: BasicBlock.cpp:239
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
Notify the BasicBlock that the predecessor Pred is no longer able to reach it.
Definition: BasicBlock.cpp:281
void dropAllReferences()
Drop all references to operands.
Definition: User.h:269
BasicBlock * getNextNode()
Get the next node, or nullptr for the list tail.
Definition: ilist_node.h:274
iterator erase(iterator where)
Definition: ilist.h:280
size_t i
void insertInto(Function *Parent, BasicBlock *InsertBefore=nullptr)
Insert unlinked basic block into a function.
Definition: BasicBlock.cpp:54
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:52
CallInst * getTerminatingMustTailCall()
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this ba...
Definition: BasicBlock.cpp:134
This class represents a function call, abstracting a target machine's calling convention.
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition: Constants.cpp:1682
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:100
A debug info location.
Definition: DebugLoc.h:34
const Instruction & front() const
Definition: BasicBlock.h:240
iterator begin()
Instruction iterator methods.
Definition: BasicBlock.h:228
Instruction * getFirstNonPHIOrDbg()
Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic...
Definition: BasicBlock.cpp:187
The address of a basic block.
Definition: Constants.h:822
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Remove an incoming value.
Value * getReturnValue() const
Convenience accessor. Returns null if there is no return value.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr it the function does no...
Definition: BasicBlock.cpp:116
Instruction * getFirstNonPHI()
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
Definition: BasicBlock.cpp:180
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
Definition: BasicBlock.h:308
void setName(const Twine &Name)
Change the name of the value.
Definition: Value.cpp:257
ELFYAML::ELF_STO Other
Definition: ELFYAML.cpp:662
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
Definition: Interval.h:106
#define F(x, y, z)
Definition: MD5.cpp:51
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:128
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Definition: Value.cpp:401
bool canSplitPredecessors() const
Definition: BasicBlock.cpp:351
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
unsigned getNumIncomingValues() const
Return the number of incoming edges.
Interval::succ_iterator succ_end(Interval *I)
Definition: Interval.h:109
void replaceSuccessorsPhiUsesWith(BasicBlock *New)
Update all phi nodes in this basic block's successors to refer to basic block New instead of to it...
Definition: BasicBlock.cpp:414
succ_range successors()
Definition: InstrTypes.h:280
The landingpad instruction holds all of the information necessary to generate correct exception handl...
Subclasses of this class are all able to terminate a basic block.
Definition: InstrTypes.h:52
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
Definition: Instruction.h:256
LLVM Basic Block Representation.
Definition: BasicBlock.h:51
Value * hasConstantValue() const
If the specified PHI node always merges together the same value, return the value, otherwise return null.
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:48
Conditional or Unconditional Branch instruction.
This is an important base class in LLVM.
Definition: Constant.h:42
This file contains the declarations for the subclasses of Constant, which represent the different fla...
LandingPadInst * getLandingPadInst()
Return the landingpad instruction associated with the landing pad.
Definition: BasicBlock.cpp:441
Interval::pred_iterator pred_begin(Interval *I)
pred_begin/pred_end - define methods so that Intervals may be used just like BasicBlocks can with the...
Definition: Interval.h:116
void pop_front()
Definition: ilist.h:327
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
void setSymTabObject(TPtr *, TPtr)
setSymTabObject - This is called when (f.e.) the parent of a basic block changes. ...
void splice(iterator where, iplist_impl &L2)
Definition: ilist.h:342
const InstListType & getInstList() const
Return the underlying instruction list container.
Definition: BasicBlock.h:249
Value * getOperand(unsigned i) const
Definition: User.h:145
Interval::pred_iterator pred_end(Interval *I)
Definition: Interval.h:119
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Definition: BasicBlock.h:93
self_iterator getIterator()
Definition: ilist_node.h:81
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1337
Instruction * getFirstNonPHIOrDbgOrLifetime()
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic...
Definition: BasicBlock.cpp:194
CallInst * getTerminatingDeoptimizeCall()
Returns the call instruction calling .experimental.deoptimize prior to the terminating return instruc...
Definition: BasicBlock.cpp:165
void removeFromParent()
Unlink 'this' from the containing function, but do not delete it.
Definition: BasicBlock.cpp:93
Iterator for intrusive lists based on ilist_node.
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
Definition: BasicBlock.cpp:110
const BasicBlockListType & getBasicBlockList() const
Definition: Function.h:512
auto find(R &&Range, const T &Val) -> decltype(std::begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:757
void setIncomingBlock(unsigned i, BasicBlock *BB)
iterator end()
Definition: BasicBlock.h:230
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:230
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Definition: Constants.cpp:558
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
~BasicBlock() override
Definition: BasicBlock.cpp:64
void push_back(pointer val)
Definition: ilist.h:326
BasicBlock * getSingleSuccessor()
Return the successor of this block if it has a single successor.
Definition: BasicBlock.cpp:253
BasicBlock * getSinglePredecessor()
Return the predecessor of this block if it has a single predecessor block.
Definition: BasicBlock.cpp:226
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
Definition: Instruction.h:453
pointer remove(iterator &IT)
Definition: ilist.h:264
iterator insert(iterator where, pointer New)
Definition: ilist.h:241
static IntegerType * getInt32Ty(LLVMContext &C)
Definition: Type.cpp:169
void clear()
Definition: ilist.h:322
SymbolTableList< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
Definition: BasicBlock.cpp:97
ValueSymbolTable * getValueSymbolTable()
Returns a pointer to the symbol table if one exists.
Definition: BasicBlock.cpp:27
#define I(x, y, z)
Definition: MD5.cpp:54
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Definition: BasicBlock.cpp:124
bool isLandingPad() const
Return true if this basic block is a landing pad.
Definition: BasicBlock.cpp:436
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:287
void destroyConstant()
Called if some element of this constant is no longer valid.
Definition: Constants.cpp:288
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
Definition: BasicBlock.cpp:374
bool hasNUsesOrMore(unsigned N) const
Return true if this value has N users or more.
Definition: Value.cpp:107
bool use_empty() const
Definition: Value.h:299
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVMContext & getContext() const
Get the context in which this basic block lives.
Definition: BasicBlock.cpp:33
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:537
LLVM Value Representation.
Definition: Value.h:71
iterator getFirstInsertionPt()
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
Definition: BasicBlock.cpp:209
int getBasicBlockIndex(const BasicBlock *BB) const
Return the first index of the specified basic block in the value list for this PHI.
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
Definition: BasicBlock.cpp:103
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
Definition: BasicBlock.cpp:219
User * user_back()
Definition: Value.h:356