LLVM  7.0.0svn
BasicBlock.h
Go to the documentation of this file.
1 //===- llvm/BasicBlock.h - Represent a basic block in the VM ----*- C++ -*-===//
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 contains the declaration of the BasicBlock class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_IR_BASICBLOCK_H
15 #define LLVM_IR_BASICBLOCK_H
16 
17 #include "llvm-c/Types.h"
18 #include "llvm/ADT/Twine.h"
19 #include "llvm/ADT/ilist.h"
20 #include "llvm/ADT/ilist_node.h"
21 #include "llvm/ADT/iterator.h"
23 #include "llvm/IR/Instruction.h"
25 #include "llvm/IR/Value.h"
27 #include "llvm/Support/Casting.h"
28 #include "llvm/Support/Compiler.h"
29 #include <cassert>
30 #include <cstddef>
31 #include <iterator>
32 
33 namespace llvm {
34 
35 class CallInst;
36 class Function;
37 class LandingPadInst;
38 class LLVMContext;
39 class Module;
40 class PHINode;
41 class TerminatorInst;
42 class ValueSymbolTable;
43 
44 /// LLVM Basic Block Representation
45 ///
46 /// This represents a single basic block in LLVM. A basic block is simply a
47 /// container of instructions that execute sequentially. Basic blocks are Values
48 /// because they are referenced by instructions such as branches and switch
49 /// tables. The type of a BasicBlock is "Type::LabelTy" because the basic block
50 /// represents a label to which a branch can jump.
51 ///
52 /// A well formed basic block is formed of a list of non-terminating
53 /// instructions followed by a single TerminatorInst instruction.
54 /// TerminatorInst's may not occur in the middle of basic blocks, and must
55 /// terminate the blocks. The BasicBlock class allows malformed basic blocks to
56 /// occur because it may be useful in the intermediate stage of constructing or
57 /// modifying a program. However, the verifier will ensure that basic blocks
58 /// are "well formed".
59 class BasicBlock final : public Value, // Basic blocks are data objects also
60  public ilist_node_with_parent<BasicBlock, Function> {
61 public:
63 
64 private:
65  friend class BlockAddress;
67 
68  InstListType InstList;
69  Function *Parent;
70 
71  void setParent(Function *parent);
72 
73  /// Constructor.
74  ///
75  /// If the function parameter is specified, the basic block is automatically
76  /// inserted at either the end of the function (if InsertBefore is null), or
77  /// before the specified basic block.
78  explicit BasicBlock(LLVMContext &C, const Twine &Name = "",
79  Function *Parent = nullptr,
80  BasicBlock *InsertBefore = nullptr);
81 
82 public:
83  BasicBlock(const BasicBlock &) = delete;
84  BasicBlock &operator=(const BasicBlock &) = delete;
85  ~BasicBlock();
86 
87  /// Get the context in which this basic block lives.
88  LLVMContext &getContext() const;
89 
90  /// Instruction iterators...
95 
96  /// Creates a new BasicBlock.
97  ///
98  /// If the Parent parameter is specified, the basic block is automatically
99  /// inserted at either the end of the function (if InsertBefore is 0), or
100  /// before the specified basic block.
102  Function *Parent = nullptr,
103  BasicBlock *InsertBefore = nullptr) {
104  return new BasicBlock(Context, Name, Parent, InsertBefore);
105  }
106 
107  /// Return the enclosing method, or null if none.
108  const Function *getParent() const { return Parent; }
109  Function *getParent() { return Parent; }
110 
111  /// Return the module owning the function this basic block belongs to, or
112  /// nullptr if the function does not have a module.
113  ///
114  /// Note: this is undefined behavior if the block does not have a parent.
115  const Module *getModule() const;
117  return const_cast<Module *>(
118  static_cast<const BasicBlock *>(this)->getModule());
119  }
120 
121  /// Returns the terminator instruction if the block is well formed or null
122  /// if the block is not well formed.
125  return const_cast<TerminatorInst *>(
126  static_cast<const BasicBlock *>(this)->getTerminator());
127  }
128 
129  /// Returns the call instruction calling \@llvm.experimental.deoptimize
130  /// prior to the terminating return instruction of this basic block, if such
131  /// a call is present. Otherwise, returns null.
132  const CallInst *getTerminatingDeoptimizeCall() const;
134  return const_cast<CallInst *>(
135  static_cast<const BasicBlock *>(this)->getTerminatingDeoptimizeCall());
136  }
137 
138  /// Returns the call instruction marked 'musttail' prior to the terminating
139  /// return instruction of this basic block, if such a call is present.
140  /// Otherwise, returns null.
141  const CallInst *getTerminatingMustTailCall() const;
143  return const_cast<CallInst *>(
144  static_cast<const BasicBlock *>(this)->getTerminatingMustTailCall());
145  }
146 
147  /// Returns a pointer to the first instruction in this block that is not a
148  /// PHINode instruction.
149  ///
150  /// When adding instructions to the beginning of the basic block, they should
151  /// be added before the returned value, not before the first instruction,
152  /// which might be PHI. Returns 0 is there's no non-PHI instruction.
153  const Instruction* getFirstNonPHI() const;
155  return const_cast<Instruction *>(
156  static_cast<const BasicBlock *>(this)->getFirstNonPHI());
157  }
158 
159  /// Returns a pointer to the first instruction in this block that is not a
160  /// PHINode or a debug intrinsic.
161  const Instruction* getFirstNonPHIOrDbg() const;
163  return const_cast<Instruction *>(
164  static_cast<const BasicBlock *>(this)->getFirstNonPHIOrDbg());
165  }
166 
167  /// Returns a pointer to the first instruction in this block that is not a
168  /// PHINode, a debug intrinsic, or a lifetime intrinsic.
171  return const_cast<Instruction *>(
172  static_cast<const BasicBlock *>(this)->getFirstNonPHIOrDbgOrLifetime());
173  }
174 
175  /// Returns an iterator to the first instruction in this block that is
176  /// suitable for inserting a non-PHI instruction.
177  ///
178  /// In particular, it skips all PHIs and LandingPad instructions.
181  return static_cast<const BasicBlock *>(this)
182  ->getFirstInsertionPt().getNonConst();
183  }
184 
185  /// Return a const iterator range over the instructions in the block, skipping
186  /// any debug instructions.
188  std::function<bool(const Instruction &)>>>
189  instructionsWithoutDebug() const;
190 
191  /// Return an iterator range over the instructions in the block, skipping any
192  /// debug instructions.
194  std::function<bool(Instruction &)>>>
196 
197  /// Unlink 'this' from the containing function, but do not delete it.
198  void removeFromParent();
199 
200  /// Unlink 'this' from the containing function and delete it.
201  ///
202  // \returns an iterator pointing to the element after the erased one.
204 
205  /// Unlink this basic block from its current function and insert it into
206  /// the function that \p MovePos lives in, right before \p MovePos.
207  void moveBefore(BasicBlock *MovePos);
208 
209  /// Unlink this basic block from its current function and insert it
210  /// right after \p MovePos in the function \p MovePos lives in.
211  void moveAfter(BasicBlock *MovePos);
212 
213  /// Insert unlinked basic block into a function.
214  ///
215  /// Inserts an unlinked basic block into \c Parent. If \c InsertBefore is
216  /// provided, inserts before that basic block, otherwise inserts at the end.
217  ///
218  /// \pre \a getParent() is \c nullptr.
219  void insertInto(Function *Parent, BasicBlock *InsertBefore = nullptr);
220 
221  /// Return the predecessor of this block if it has a single predecessor
222  /// block. Otherwise return a null pointer.
223  const BasicBlock *getSinglePredecessor() const;
225  return const_cast<BasicBlock *>(
226  static_cast<const BasicBlock *>(this)->getSinglePredecessor());
227  }
228 
229  /// Return the predecessor of this block if it has a unique predecessor
230  /// block. Otherwise return a null pointer.
231  ///
232  /// Note that unique predecessor doesn't mean single edge, there can be
233  /// multiple edges from the unique predecessor to this block (for example a
234  /// switch statement with multiple cases having the same destination).
235  const BasicBlock *getUniquePredecessor() const;
237  return const_cast<BasicBlock *>(
238  static_cast<const BasicBlock *>(this)->getUniquePredecessor());
239  }
240 
241  /// Return the successor of this block if it has a single successor.
242  /// Otherwise return a null pointer.
243  ///
244  /// This method is analogous to getSinglePredecessor above.
245  const BasicBlock *getSingleSuccessor() const;
247  return const_cast<BasicBlock *>(
248  static_cast<const BasicBlock *>(this)->getSingleSuccessor());
249  }
250 
251  /// Return the successor of this block if it has a unique successor.
252  /// Otherwise return a null pointer.
253  ///
254  /// This method is analogous to getUniquePredecessor above.
255  const BasicBlock *getUniqueSuccessor() const;
257  return const_cast<BasicBlock *>(
258  static_cast<const BasicBlock *>(this)->getUniqueSuccessor());
259  }
260 
261  //===--------------------------------------------------------------------===//
262  /// Instruction iterator methods
263  ///
264  inline iterator begin() { return InstList.begin(); }
265  inline const_iterator begin() const { return InstList.begin(); }
266  inline iterator end () { return InstList.end(); }
267  inline const_iterator end () const { return InstList.end(); }
268 
269  inline reverse_iterator rbegin() { return InstList.rbegin(); }
270  inline const_reverse_iterator rbegin() const { return InstList.rbegin(); }
271  inline reverse_iterator rend () { return InstList.rend(); }
272  inline const_reverse_iterator rend () const { return InstList.rend(); }
273 
274  inline size_t size() const { return InstList.size(); }
275  inline bool empty() const { return InstList.empty(); }
276  inline const Instruction &front() const { return InstList.front(); }
277  inline Instruction &front() { return InstList.front(); }
278  inline const Instruction &back() const { return InstList.back(); }
279  inline Instruction &back() { return InstList.back(); }
280 
281  /// Iterator to walk just the phi nodes in the basic block.
282  template <typename PHINodeT = PHINode, typename BBIteratorT = iterator>
284  : public iterator_facade_base<phi_iterator_impl<PHINodeT, BBIteratorT>,
285  std::forward_iterator_tag, PHINodeT> {
286  friend BasicBlock;
287 
288  PHINodeT *PN;
289 
290  phi_iterator_impl(PHINodeT *PN) : PN(PN) {}
291 
292  public:
293  // Allow default construction to build variables, but this doesn't build
294  // a useful iterator.
295  phi_iterator_impl() = default;
296 
297  // Allow conversion between instantiations where valid.
298  template <typename PHINodeU, typename BBIteratorU>
300  : PN(Arg.PN) {}
301 
302  bool operator==(const phi_iterator_impl &Arg) const { return PN == Arg.PN; }
303 
304  PHINodeT &operator*() const { return *PN; }
305 
306  using phi_iterator_impl::iterator_facade_base::operator++;
308  assert(PN && "Cannot increment the end iterator!");
309  PN = dyn_cast<PHINodeT>(std::next(BBIteratorT(PN)));
310  return *this;
311  }
312  };
314  using const_phi_iterator =
316 
317  /// Returns a range that iterates over the phis in the basic block.
318  ///
319  /// Note that this cannot be used with basic blocks that have no terminator.
321  return const_cast<BasicBlock *>(this)->phis();
322  }
324 
325  /// Return the underlying instruction list container.
326  ///
327  /// Currently you need to access the underlying instruction list container
328  /// directly if you want to modify it.
329  const InstListType &getInstList() const { return InstList; }
330  InstListType &getInstList() { return InstList; }
331 
332  /// Returns a pointer to a member of the instruction list.
334  return &BasicBlock::InstList;
335  }
336 
337  /// Returns a pointer to the symbol table if one exists.
339 
340  /// Methods for support type inquiry through isa, cast, and dyn_cast.
341  static bool classof(const Value *V) {
342  return V->getValueID() == Value::BasicBlockVal;
343  }
344 
345  /// Cause all subinstructions to "let go" of all the references that said
346  /// subinstructions are maintaining.
347  ///
348  /// This allows one to 'delete' a whole class at a time, even though there may
349  /// be circular references... first all references are dropped, and all use
350  /// counts go to zero. Then everything is delete'd for real. Note that no
351  /// operations are valid on an object that has "dropped all references",
352  /// except operator delete.
353  void dropAllReferences();
354 
355  /// Notify the BasicBlock that the predecessor \p Pred is no longer able to
356  /// reach it.
357  ///
358  /// This is actually not used to update the Predecessor list, but is actually
359  /// used to update the PHI nodes that reside in the block. Note that this
360  /// should be called while the predecessor still refers to this block.
361  void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs = false);
362 
363  bool canSplitPredecessors() const;
364 
365  /// Split the basic block into two basic blocks at the specified instruction.
366  ///
367  /// Note that all instructions BEFORE the specified iterator stay as part of
368  /// the original basic block, an unconditional branch is added to the original
369  /// BB, and the rest of the instructions in the BB are moved to the new BB,
370  /// including the old terminator. The newly formed BasicBlock is returned.
371  /// This function invalidates the specified iterator.
372  ///
373  /// Note that this only works on well formed basic blocks (must have a
374  /// terminator), and 'I' must not be the end of instruction list (which would
375  /// cause a degenerate basic block to be formed, having a terminator inside of
376  /// the basic block).
377  ///
378  /// Also note that this doesn't preserve any passes. To split blocks while
379  /// keeping loop information consistent, use the SplitBlock utility function.
380  BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "");
381  BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "") {
382  return splitBasicBlock(I->getIterator(), BBName);
383  }
384 
385  /// Returns true if there are any uses of this basic block other than
386  /// direct branches, switches, etc. to it.
387  bool hasAddressTaken() const { return getSubclassDataFromValue() != 0; }
388 
389  /// Update all phi nodes in this basic block's successors to refer to basic
390  /// block \p New instead of to it.
392 
393  /// Return true if this basic block is an exception handling block.
394  bool isEHPad() const { return getFirstNonPHI()->isEHPad(); }
395 
396  /// Return true if this basic block is a landing pad.
397  ///
398  /// Being a ``landing pad'' means that the basic block is the destination of
399  /// the 'unwind' edge of an invoke instruction.
400  bool isLandingPad() const;
401 
402  /// Return the landingpad instruction associated with the landing pad.
403  const LandingPadInst *getLandingPadInst() const;
405  return const_cast<LandingPadInst *>(
406  static_cast<const BasicBlock *>(this)->getLandingPadInst());
407  }
408 
409  /// Return true if it is legal to hoist instructions into this block.
410  bool isLegalToHoistInto() const;
411 
413 
414 private:
415  /// Increment the internal refcount of the number of BlockAddresses
416  /// referencing this BasicBlock by \p Amt.
417  ///
418  /// This is almost always 0, sometimes one possibly, but almost never 2, and
419  /// inconceivably 3 or more.
420  void AdjustBlockAddressRefCount(int Amt) {
421  setValueSubclassData(getSubclassDataFromValue()+Amt);
422  assert((int)(signed char)getSubclassDataFromValue() >= 0 &&
423  "Refcount wrap-around");
424  }
425 
426  /// Shadow Value::setValueSubclassData with a private forwarding method so
427  /// that any future subclasses cannot accidentally use it.
428  void setValueSubclassData(unsigned short D) {
430  }
431 };
432 
433 // Create wrappers for C Binding types (see CBindingWrapping.h).
435 
436 } // end namespace llvm
437 
438 #endif // LLVM_IR_BASICBLOCK_H
uint64_t CallInst * C
unsigned short getSubclassDataFromValue() const
Definition: Value.h:660
bool canSplitPredecessors() const
Definition: BasicBlock.cpp:365
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:295
InstListType & getInstList()
Definition: BasicBlock.h:330
unsigned getValueID() const
Return an ID for the concrete type of this object.
Definition: Value.h:469
LLVMContext & Context
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:377
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
BasicBlock * getSingleSuccessor()
Definition: BasicBlock.h:246
const_iterator end() const
Definition: BasicBlock.h:267
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
const CallInst * getTerminatingMustTailCall() const
Returns the call instruction marked &#39;musttail&#39; prior to the terminating return instruction of this ba...
Definition: BasicBlock.cpp:143
This class represents a function call, abstracting a target machine&#39;s calling convention.
Module * getModule()
Definition: BasicBlock.h:116
reverse_iterator rend()
Definition: BasicBlock.h:271
reverse_iterator rbegin()
Definition: BasicBlock.h:269
LLVMContext & getContext() const
Get the context in which this basic block lives.
Definition: BasicBlock.cpp:33
iterator begin()
Instruction iterator methods.
Definition: BasicBlock.h:264
InstListType::const_iterator const_iterator
Definition: BasicBlock.h:92
The address of a basic block.
Definition: Constants.h:826
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
Definition: BasicBlock.cpp:134
const CallInst * getTerminatingDeoptimizeCall() const
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return in...
Definition: BasicBlock.cpp:174
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
const_iterator begin() const
Definition: BasicBlock.h:265
Instruction * getFirstNonPHIOrDbg()
Definition: BasicBlock.h:162
bool empty() const
Definition: BasicBlock.h:275
BasicBlock * getSinglePredecessor()
Definition: BasicBlock.h:224
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:203
#define LLVM_READONLY
Definition: Compiler.h:168
BasicBlock & operator=(const BasicBlock &)=delete
const BasicBlock * getUniquePredecessor() const
Return the predecessor of this block if it has a unique predecessor block.
Definition: BasicBlock.cpp:248
const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
Definition: BasicBlock.cpp:262
phi_iterator_impl & operator++()
Definition: BasicBlock.h:307
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:68
BasicBlock * getUniqueSuccessor()
Definition: BasicBlock.h:256
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:439
Instruction & front()
Definition: BasicBlock.h:277
An ilist node that can access its parent list.
Definition: ilist_node.h:257
BasicBlock * getUniquePredecessor()
Definition: BasicBlock.h:236
phi_iterator_impl(const phi_iterator_impl< PHINodeU, BBIteratorU > &Arg)
Definition: BasicBlock.h:299
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:189
Subclasses of this class are all able to terminate a basic block.
Definition: InstrTypes.h:55
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:218
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
Definition: BasicBlock.cpp:235
const_reverse_iterator rbegin() const
Definition: BasicBlock.h:270
LLVM Basic Block Representation.
Definition: BasicBlock.h:59
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:69
iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > instructionsWithoutDebug() const
Return a const iterator range over the instructions in the block, skipping any debug instructions...
Definition: BasicBlock.cpp:95
LandingPadInst * getLandingPadInst()
Definition: BasicBlock.h:404
Function * getParent()
Definition: BasicBlock.h:109
const Instruction & front() const
Definition: BasicBlock.h:276
CallInst * getTerminatingMustTailCall()
Definition: BasicBlock.h:142
size_t size() const
Definition: BasicBlock.h:274
const Instruction & back() const
Definition: BasicBlock.h:278
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Definition: BasicBlock.h:101
Instruction & back()
Definition: BasicBlock.h:279
Instruction * getFirstNonPHIOrDbgOrLifetime()
Definition: BasicBlock.h:170
self_iterator getIterator()
Definition: ilist_node.h:82
iterator getFirstInsertionPt()
Definition: BasicBlock.h:180
bool isLandingPad() const
Return true if this basic block is a landing pad.
Definition: BasicBlock.cpp:461
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
Definition: BasicBlock.h:387
const InstListType & getInstList() const
Return the underlying instruction list container.
Definition: BasicBlock.h:329
void removeFromParent()
Unlink &#39;this&#39; from the containing function, but do not delete it.
Definition: BasicBlock.cpp:111
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:128
iterator end()
Definition: BasicBlock.h:266
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
Definition: Types.h:83
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
CallInst * getTerminatingDeoptimizeCall()
Definition: BasicBlock.h:133
void setValueSubclassData(unsigned short D)
Definition: Value.h:661
A range adaptor for a pair of iterators.
bool operator==(const phi_iterator_impl &Arg) const
Definition: BasicBlock.h:302
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:91
Iterator to walk just the phi nodes in the basic block.
Definition: BasicBlock.h:283
amdgpu Simplify well known AMD library false Value Value * Arg
static InstListType BasicBlock::* getSublistAccess(Instruction *)
Returns a pointer to a member of the instruction list.
Definition: BasicBlock.h:333
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:115
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
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: BasicBlock.h:341
BasicBlock * splitBasicBlock(Instruction *I, const Twine &BBName="")
Definition: BasicBlock.h:381
Optional< uint64_t > getIrrLoopHeaderWeight() const
Definition: BasicBlock.cpp:470
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
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
Definition: BasicBlock.h:320
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
Definition: BasicBlock.cpp:401
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isEHPad() const
Return true if this basic block is an exception handling block.
Definition: BasicBlock.h:394
LLVM Value Representation.
Definition: Value.h:73
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
Definition: Instruction.h:547
Specialization of filter_iterator_base for forward iteration only.
Definition: STLExtras.h:324
const LandingPadInst * getLandingPadInst() const
Return the landingpad instruction associated with the landing pad.
Definition: BasicBlock.cpp:466
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:196
Instruction * getFirstNonPHI()
Definition: BasicBlock.h:154
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:138
TerminatorInst * getTerminator()
Definition: BasicBlock.h:124
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
Definition: BasicBlock.cpp:121
const_reverse_iterator rend() const
Definition: BasicBlock.h:272
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
Definition: BasicBlock.cpp:228
const BasicBlock * getUniqueSuccessor() const
Return the successor of this block if it has a unique successor.
Definition: BasicBlock.cpp:270