LLVM  6.0.0svn
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 
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  if (InstList.empty()) return nullptr;
122  return dyn_cast<TerminatorInst>(&InstList.back());
123 }
124 
126  if (InstList.empty())
127  return nullptr;
128  const ReturnInst *RI = dyn_cast<ReturnInst>(&InstList.back());
129  if (!RI || RI == &InstList.front())
130  return nullptr;
131 
132  const Instruction *Prev = RI->getPrevNode();
133  if (!Prev)
134  return nullptr;
135 
136  if (Value *RV = RI->getReturnValue()) {
137  if (RV != Prev)
138  return nullptr;
139 
140  // Look through the optional bitcast.
141  if (auto *BI = dyn_cast<BitCastInst>(Prev)) {
142  RV = BI->getOperand(0);
143  Prev = BI->getPrevNode();
144  if (!Prev || RV != Prev)
145  return nullptr;
146  }
147  }
148 
149  if (auto *CI = dyn_cast<CallInst>(Prev)) {
150  if (CI->isMustTailCall())
151  return CI;
152  }
153  return nullptr;
154 }
155 
157  if (InstList.empty())
158  return nullptr;
159  auto *RI = dyn_cast<ReturnInst>(&InstList.back());
160  if (!RI || RI == &InstList.front())
161  return nullptr;
162 
163  if (auto *CI = dyn_cast_or_null<CallInst>(RI->getPrevNode()))
164  if (Function *F = CI->getCalledFunction())
165  if (F->getIntrinsicID() == Intrinsic::experimental_deoptimize)
166  return CI;
167 
168  return nullptr;
169 }
170 
172  for (const Instruction &I : *this)
173  if (!isa<PHINode>(I))
174  return &I;
175  return nullptr;
176 }
177 
179  for (const Instruction &I : *this)
180  if (!isa<PHINode>(I) && !isa<DbgInfoIntrinsic>(I))
181  return &I;
182  return nullptr;
183 }
184 
186  for (const Instruction &I : *this) {
187  if (isa<PHINode>(I) || isa<DbgInfoIntrinsic>(I))
188  continue;
189 
190  if (auto *II = dyn_cast<IntrinsicInst>(&I))
191  if (II->getIntrinsicID() == Intrinsic::lifetime_start ||
192  II->getIntrinsicID() == Intrinsic::lifetime_end)
193  continue;
194 
195  return &I;
196  }
197  return nullptr;
198 }
199 
201  const Instruction *FirstNonPHI = getFirstNonPHI();
202  if (!FirstNonPHI)
203  return end();
204 
205  const_iterator InsertPt = FirstNonPHI->getIterator();
206  if (InsertPt->isEHPad()) ++InsertPt;
207  return InsertPt;
208 }
209 
211  for (Instruction &I : *this)
212  I.dropAllReferences();
213 }
214 
215 /// If this basic block has a single predecessor block,
216 /// return the block, otherwise return a null pointer.
218  const_pred_iterator PI = pred_begin(this), E = pred_end(this);
219  if (PI == E) return nullptr; // No preds.
220  const BasicBlock *ThePred = *PI;
221  ++PI;
222  return (PI == E) ? ThePred : nullptr /*multiple preds*/;
223 }
224 
225 /// If this basic block has a unique predecessor block,
226 /// return the block, otherwise return a null pointer.
227 /// Note that unique predecessor doesn't mean single edge, there can be
228 /// multiple edges from the unique predecessor to this block (for example
229 /// a switch statement with multiple cases having the same destination).
231  const_pred_iterator PI = pred_begin(this), E = pred_end(this);
232  if (PI == E) return nullptr; // No preds.
233  const BasicBlock *PredBB = *PI;
234  ++PI;
235  for (;PI != E; ++PI) {
236  if (*PI != PredBB)
237  return nullptr;
238  // The same predecessor appears multiple times in the predecessor list.
239  // This is OK.
240  }
241  return PredBB;
242 }
243 
245  succ_const_iterator SI = succ_begin(this), E = succ_end(this);
246  if (SI == E) return nullptr; // no successors
247  const BasicBlock *TheSucc = *SI;
248  ++SI;
249  return (SI == E) ? TheSucc : nullptr /* multiple successors */;
250 }
251 
253  succ_const_iterator SI = succ_begin(this), E = succ_end(this);
254  if (SI == E) return nullptr; // No successors
255  const BasicBlock *SuccBB = *SI;
256  ++SI;
257  for (;SI != E; ++SI) {
258  if (*SI != SuccBB)
259  return nullptr;
260  // The same successor appears multiple times in the successor list.
261  // This is OK.
262  }
263  return SuccBB;
264 }
265 
267  return make_range<phi_iterator>(dyn_cast<PHINode>(&front()), nullptr);
268 }
269 
270 /// This method is used to notify a BasicBlock that the
271 /// specified Predecessor of the block is no longer able to reach it. This is
272 /// actually not used to update the Predecessor list, but is actually used to
273 /// update the PHI nodes that reside in the block. Note that this should be
274 /// called while the predecessor still refers to this block.
275 ///
277  bool DontDeleteUselessPHIs) {
278  assert((hasNUsesOrMore(16)||// Reduce cost of this assertion for complex CFGs.
279  find(pred_begin(this), pred_end(this), Pred) != pred_end(this)) &&
280  "removePredecessor: BB is not a predecessor!");
281 
282  if (InstList.empty()) return;
283  PHINode *APN = dyn_cast<PHINode>(&front());
284  if (!APN) return; // Quick exit.
285 
286  // If there are exactly two predecessors, then we want to nuke the PHI nodes
287  // altogether. However, we cannot do this, if this in this case:
288  //
289  // Loop:
290  // %x = phi [X, Loop]
291  // %x2 = add %x, 1 ;; This would become %x2 = add %x2, 1
292  // br Loop ;; %x2 does not dominate all uses
293  //
294  // This is because the PHI node input is actually taken from the predecessor
295  // basic block. The only case this can happen is with a self loop, so we
296  // check for this case explicitly now.
297  //
298  unsigned max_idx = APN->getNumIncomingValues();
299  assert(max_idx != 0 && "PHI Node in block with 0 predecessors!?!?!");
300  if (max_idx == 2) {
301  BasicBlock *Other = APN->getIncomingBlock(APN->getIncomingBlock(0) == Pred);
302 
303  // Disable PHI elimination!
304  if (this == Other) max_idx = 3;
305  }
306 
307  // <= Two predecessors BEFORE I remove one?
308  if (max_idx <= 2 && !DontDeleteUselessPHIs) {
309  // Yup, loop through and nuke the PHI nodes
310  while (PHINode *PN = dyn_cast<PHINode>(&front())) {
311  // Remove the predecessor first.
312  PN->removeIncomingValue(Pred, !DontDeleteUselessPHIs);
313 
314  // If the PHI _HAD_ two uses, replace PHI node with its now *single* value
315  if (max_idx == 2) {
316  if (PN->getIncomingValue(0) != PN)
317  PN->replaceAllUsesWith(PN->getIncomingValue(0));
318  else
319  // We are left with an infinite loop with no entries: kill the PHI.
320  PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
321  getInstList().pop_front(); // Remove the PHI node
322  }
323 
324  // If the PHI node already only had one entry, it got deleted by
325  // removeIncomingValue.
326  }
327  } else {
328  // Okay, now we know that we need to remove predecessor #pred_idx from all
329  // PHI nodes. Iterate over each PHI node fixing them up
330  PHINode *PN;
331  for (iterator II = begin(); (PN = dyn_cast<PHINode>(II)); ) {
332  ++II;
333  PN->removeIncomingValue(Pred, false);
334  // If all incoming values to the Phi are the same, we can replace the Phi
335  // with that value.
336  Value* PNV = nullptr;
337  if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue()))
338  if (PNV != PN) {
339  PN->replaceAllUsesWith(PNV);
340  PN->eraseFromParent();
341  }
342  }
343  }
344 }
345 
347  const Instruction *FirstNonPHI = getFirstNonPHI();
348  if (isa<LandingPadInst>(FirstNonPHI))
349  return true;
350  // This is perhaps a little conservative because constructs like
351  // CleanupBlockInst are pretty easy to split. However, SplitBlockPredecessors
352  // cannot handle such things just yet.
353  if (FirstNonPHI->isEHPad())
354  return false;
355  return true;
356 }
357 
359  auto *Term = getTerminator();
360  // No terminator means the block is under construction.
361  if (!Term)
362  return true;
363 
364  // If the block has no successors, there can be no instructions to hoist.
365  assert(Term->getNumSuccessors() > 0);
366 
367  // Instructions should not be hoisted across exception handling boundaries.
368  return !Term->isExceptional();
369 }
370 
371 /// This splits a basic block into two at the specified
372 /// instruction. Note that all instructions BEFORE the specified iterator stay
373 /// as part of the original basic block, an unconditional branch is added to
374 /// the new BB, and the rest of the instructions in the BB are moved to the new
375 /// BB, including the old terminator. This invalidates the iterator.
376 ///
377 /// Note that this only works on well formed basic blocks (must have a
378 /// terminator), and 'I' must not be the end of instruction list (which would
379 /// cause a degenerate basic block to be formed, having a terminator inside of
380 /// the basic block).
381 ///
383  assert(getTerminator() && "Can't use splitBasicBlock on degenerate BB!");
384  assert(I != InstList.end() &&
385  "Trying to get me to create degenerate basic block!");
386 
388  this->getNextNode());
389 
390  // Save DebugLoc of split point before invalidating iterator.
391  DebugLoc Loc = I->getDebugLoc();
392  // Move all of the specified instructions from the original basic block into
393  // the new basic block.
394  New->getInstList().splice(New->end(), this->getInstList(), I, end());
395 
396  // Add a branch instruction to the newly formed basic block.
397  BranchInst *BI = BranchInst::Create(New, this);
398  BI->setDebugLoc(Loc);
399 
400  // Now we must loop through all of the successors of the New block (which
401  // _were_ the successors of the 'this' block), and update any PHI nodes in
402  // successors. If there were PHI nodes in the successors, then they need to
403  // know that incoming branches will be from New, not from Old.
404  //
405  for (succ_iterator I = succ_begin(New), E = succ_end(New); I != E; ++I) {
406  // Loop over any phi nodes in the basic block, updating the BB field of
407  // incoming values...
408  BasicBlock *Successor = *I;
409  for (auto &PN : Successor->phis()) {
410  int Idx = PN.getBasicBlockIndex(this);
411  while (Idx != -1) {
412  PN.setIncomingBlock((unsigned)Idx, New);
413  Idx = PN.getBasicBlockIndex(this);
414  }
415  }
416  }
417  return New;
418 }
419 
422  if (!TI)
423  // Cope with being called on a BasicBlock that doesn't have a terminator
424  // yet. Clang's CodeGenFunction::EmitReturnBlock() likes to do this.
425  return;
426  for (BasicBlock *Succ : TI->successors()) {
427  // N.B. Succ might not be a complete BasicBlock, so don't assume
428  // that it ends with a non-phi instruction.
429  for (iterator II = Succ->begin(), IE = Succ->end(); II != IE; ++II) {
430  PHINode *PN = dyn_cast<PHINode>(II);
431  if (!PN)
432  break;
433  int i;
434  while ((i = PN->getBasicBlockIndex(this)) >= 0)
435  PN->setIncomingBlock(i, New);
436  }
437  }
438 }
439 
440 /// Return true if this basic block is a landing pad. I.e., it's
441 /// the destination of the 'unwind' edge of an invoke instruction.
443  return isa<LandingPadInst>(getFirstNonPHI());
444 }
445 
446 /// Return the landingpad instruction associated with the landing pad.
449 }
uint64_t CallInst * C
Return a value (possibly void), from a function.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks &#39;this&#39; from the containing basic block and deletes it.
Definition: Instruction.cpp:69
bool canSplitPredecessors() const
Definition: BasicBlock.cpp:346
This class provides a symbol table of name/value pairs.
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
Notify the BasicBlock that the predecessor Pred is no longer able to reach it.
Definition: BasicBlock.cpp:276
void dropAllReferences()
Drop all references to operands.
Definition: User.h:279
BasicBlock * getNextNode()
Get the next node, or nullptr for the list tail.
Definition: ilist_node.h:289
iterator erase(iterator where)
Definition: ilist.h:280
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
bool isLegalToHoistInto() const
Return true if it is legal to hoist instructions into this block.
Definition: BasicBlock.cpp:358
Various leaf nodes.
Definition: ISDOpcodes.h:60
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:63
const CallInst * getTerminatingMustTailCall() const
Returns the call instruction marked &#39;musttail&#39; prior to the terminating return instruction of this ba...
Definition: BasicBlock.cpp:125
This class represents a function call, abstracting a target machine&#39;s calling convention.
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Definition: Constants.cpp:1665
A debug info location.
Definition: DebugLoc.h:34
LLVMContext & getContext() const
Get the context in which this basic block lives.
Definition: BasicBlock.cpp:33
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:130
iterator begin()
Instruction iterator methods.
Definition: BasicBlock.h:252
The address of a basic block.
Definition: Constants.h:813
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
const CallInst * getTerminatingDeoptimizeCall() const
Returns the call instruction calling .experimental.deoptimize prior to the terminating return instruc...
Definition: BasicBlock.cpp:156
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Remove an incoming value.
int getBasicBlockIndex(const BasicBlock *BB) const
Return the first index of the specified basic block in the value list for this PHI.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
void setName(const Twine &Name)
Change the name of the value.
Definition: Value.cpp:284
ELFYAML::ELF_STO Other
Definition: ELFYAML.cpp:695
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
const Instruction * getFirstNonPHIOrDbgOrLifetime() const
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic...
Definition: BasicBlock.cpp:185
static Type * getLabelTy(LLVMContext &C)
Definition: Type.cpp:162
#define F(x, y, z)
Definition: MD5.cpp:55
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:245
const BasicBlock * getUniquePredecessor() const
Return the predecessor of this block if it has a unique predecessor block.
Definition: BasicBlock.cpp:230
const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
Definition: BasicBlock.cpp:244
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Definition: Value.cpp:428
const char * Name
Value * getOperand(unsigned i) const
Definition: User.h:154
Interval::succ_iterator succ_end(Interval *I)
Definition: Interval.h:109
void replaceSuccessorsPhiUsesWith(BasicBlock *New)
Update all phi nodes in this basic block&#39;s successors to refer to basic block New instead of to it...
Definition: BasicBlock.cpp:420
succ_range successors()
Definition: InstrTypes.h:267
bool hasNUsesOrMore(unsigned N) const
Return true if this value has N users or more.
Definition: Value.cpp:134
The landingpad instruction holds all of the information necessary to generate correct exception handl...
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
Definition: BasicBlock.cpp:171
Subclasses of this class are all able to terminate a basic block.
Definition: InstrTypes.h:54
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
Definition: BasicBlock.cpp:200
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
Definition: Instruction.h:277
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
Definition: BasicBlock.cpp:217
LLVM Basic Block Representation.
Definition: BasicBlock.h:59
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
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...
const Instruction & front() const
Definition: BasicBlock.h:264
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
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
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:101
self_iterator getIterator()
Definition: ilist_node.h:82
static UndefValue * get(Type *T)
Static factory methods - Return an &#39;undef&#39; object of the specified type.
Definition: Constants.cpp:1320
Value(Type *Ty, unsigned scid)
Definition: Value.cpp:49
bool isLandingPad() const
Return true if this basic block is a landing pad.
Definition: BasicBlock.cpp:442
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
Definition: BasicBlock.h:376
Value * hasConstantValue() const
If the specified PHI node always merges together the same value, return the value, otherwise return null.
const InstListType & getInstList() const
Return the underlying instruction list container.
Definition: BasicBlock.h:317
void removeFromParent()
Unlink &#39;this&#39; 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
#define E
Definition: LargeTest.cpp:27
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:839
void setIncomingBlock(unsigned i, BasicBlock *BB)
iterator end()
Definition: BasicBlock.h:254
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:560
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
unsigned getNumIncomingValues() const
Return the number of incoming edges.
A range adaptor for a pair of iterators.
void push_back(pointer val)
Definition: ilist.h:326
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:91
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:176
void clear()
Definition: ilist.h:322
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:108
SymbolTableList< BasicBlock >::iterator eraseFromParent()
Unlink &#39;this&#39; 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:58
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:323
const BasicBlockListType & getBasicBlockList() const
Get the underlying elements of the Function...
Definition: Function.h:557
void destroyConstant()
Called if some element of this constant is no longer valid.
Definition: Constants.cpp:300
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
Definition: BasicBlock.h:308
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
Definition: BasicBlock.cpp:382
Value * getReturnValue() const
Convenience accessor. Returns null if there is no return value.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:545
LLVM Value Representation.
Definition: Value.h:73
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
Definition: Instruction.h:503
const LandingPadInst * getLandingPadInst() const
Return the landingpad instruction associated with the landing pad.
Definition: BasicBlock.cpp:447
const Instruction * getFirstNonPHIOrDbg() const
Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic...
Definition: BasicBlock.cpp:178
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Definition: BasicBlock.cpp:120
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
bool use_empty() const
Definition: Value.h:322
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
Definition: BasicBlock.cpp:210
User * user_back()
Definition: Value.h:381
const BasicBlock * getUniqueSuccessor() const
Return the successor of this block if it has a unique successor.
Definition: BasicBlock.cpp:252