LLVM  6.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 /// \brief 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  /// \brief 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  /// \brief Get the context in which this basic block lives.
88  LLVMContext &getContext() const;
89 
90  /// Instruction iterators...
95 
96  /// \brief 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  /// \brief Return the enclosing method, or null if none.
108  const Function *getParent() const { return Parent; }
109  Function *getParent() { return Parent; }
110 
111  /// \brief Return the module owning the function this basic block belongs to,
112  /// or nullptr it 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  /// \brief Returns the terminator instruction if the block is well formed or
122  /// null if the block is not well formed.
125  return const_cast<TerminatorInst *>(
126  static_cast<const BasicBlock *>(this)->getTerminator());
127  }
128 
129  /// \brief Returns the call instruction calling @llvm.experimental.deoptimize
130  /// prior to the terminating return instruction of this basic block, if such a
131  /// 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  /// \brief Returns the call instruction marked 'musttail' prior to the
139  /// terminating return instruction of this basic block, if such a call is
140  /// present. Otherwise, returns null.
141  const CallInst *getTerminatingMustTailCall() const;
143  return const_cast<CallInst *>(
144  static_cast<const BasicBlock *>(this)->getTerminatingMustTailCall());
145  }
146 
147  /// \brief Returns a pointer to the first instruction in this block that is
148  /// not a 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  /// \brief Returns a pointer to the first instruction in this block that is not
160  /// a 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  /// \brief Returns a pointer to the first instruction in this block that is not
168  /// a PHINode, a debug intrinsic, or a lifetime intrinsic.
171  return const_cast<Instruction *>(
172  static_cast<const BasicBlock *>(this)->getFirstNonPHIOrDbgOrLifetime());
173  }
174 
175  /// \brief 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  /// \brief Unlink 'this' from the containing function, but do not delete it.
186  void removeFromParent();
187 
188  /// \brief Unlink 'this' from the containing function and delete it.
189  ///
190  // \returns an iterator pointing to the element after the erased one.
192 
193  /// \brief Unlink this basic block from its current function and insert it
194  /// into the function that \p MovePos lives in, right before \p MovePos.
195  void moveBefore(BasicBlock *MovePos);
196 
197  /// \brief Unlink this basic block from its current function and insert it
198  /// right after \p MovePos in the function \p MovePos lives in.
199  void moveAfter(BasicBlock *MovePos);
200 
201  /// \brief Insert unlinked basic block into a function.
202  ///
203  /// Inserts an unlinked basic block into \c Parent. If \c InsertBefore is
204  /// provided, inserts before that basic block, otherwise inserts at the end.
205  ///
206  /// \pre \a getParent() is \c nullptr.
207  void insertInto(Function *Parent, BasicBlock *InsertBefore = nullptr);
208 
209  /// \brief Return the predecessor of this block if it has a single predecessor
210  /// block. Otherwise return a null pointer.
211  const BasicBlock *getSinglePredecessor() const;
213  return const_cast<BasicBlock *>(
214  static_cast<const BasicBlock *>(this)->getSinglePredecessor());
215  }
216 
217  /// \brief Return the predecessor of this block if it has a unique predecessor
218  /// block. Otherwise return a null pointer.
219  ///
220  /// Note that unique predecessor doesn't mean single edge, there can be
221  /// multiple edges from the unique predecessor to this block (for example a
222  /// switch statement with multiple cases having the same destination).
223  const BasicBlock *getUniquePredecessor() const;
225  return const_cast<BasicBlock *>(
226  static_cast<const BasicBlock *>(this)->getUniquePredecessor());
227  }
228 
229  /// \brief Return the successor of this block if it has a single successor.
230  /// Otherwise return a null pointer.
231  ///
232  /// This method is analogous to getSinglePredecessor above.
233  const BasicBlock *getSingleSuccessor() const;
235  return const_cast<BasicBlock *>(
236  static_cast<const BasicBlock *>(this)->getSingleSuccessor());
237  }
238 
239  /// \brief Return the successor of this block if it has a unique successor.
240  /// Otherwise return a null pointer.
241  ///
242  /// This method is analogous to getUniquePredecessor above.
243  const BasicBlock *getUniqueSuccessor() const;
245  return const_cast<BasicBlock *>(
246  static_cast<const BasicBlock *>(this)->getUniqueSuccessor());
247  }
248 
249  //===--------------------------------------------------------------------===//
250  /// Instruction iterator methods
251  ///
252  inline iterator begin() { return InstList.begin(); }
253  inline const_iterator begin() const { return InstList.begin(); }
254  inline iterator end () { return InstList.end(); }
255  inline const_iterator end () const { return InstList.end(); }
256 
257  inline reverse_iterator rbegin() { return InstList.rbegin(); }
258  inline const_reverse_iterator rbegin() const { return InstList.rbegin(); }
259  inline reverse_iterator rend () { return InstList.rend(); }
260  inline const_reverse_iterator rend () const { return InstList.rend(); }
261 
262  inline size_t size() const { return InstList.size(); }
263  inline bool empty() const { return InstList.empty(); }
264  inline const Instruction &front() const { return InstList.front(); }
265  inline Instruction &front() { return InstList.front(); }
266  inline const Instruction &back() const { return InstList.back(); }
267  inline Instruction &back() { return InstList.back(); }
268 
269  /// Iterator to walk just the phi nodes in the basic block.
270  template <typename PHINodeT = PHINode, typename BBIteratorT = iterator>
272  : public iterator_facade_base<phi_iterator_impl<PHINodeT, BBIteratorT>,
273  std::forward_iterator_tag, PHINodeT> {
274  friend BasicBlock;
275 
276  PHINodeT *PN;
277 
278  phi_iterator_impl(PHINodeT *PN) : PN(PN) {}
279 
280  public:
281  // Allow default construction to build variables, but this doesn't build
282  // a useful iterator.
283  phi_iterator_impl() = default;
284 
285  // Allow conversion between instantiations where valid.
286  template <typename PHINodeU, typename BBIteratorU>
288  : PN(Arg.PN) {}
289 
290  bool operator==(const phi_iterator_impl &Arg) const { return PN == Arg.PN; }
291 
292  PHINodeT &operator*() const { return *PN; }
293 
294  using phi_iterator_impl::iterator_facade_base::operator++;
296  assert(PN && "Cannot increment the end iterator!");
297  PN = dyn_cast<PHINodeT>(std::next(BBIteratorT(PN)));
298  return *this;
299  }
300  };
302  using const_phi_iterator =
304 
305  /// Returns a range that iterates over the phis in the basic block.
306  ///
307  /// Note that this cannot be used with basic blocks that have no terminator.
309  return const_cast<BasicBlock *>(this)->phis();
310  }
312 
313  /// \brief Return the underlying instruction list container.
314  ///
315  /// Currently you need to access the underlying instruction list container
316  /// directly if you want to modify it.
317  const InstListType &getInstList() const { return InstList; }
318  InstListType &getInstList() { return InstList; }
319 
320  /// \brief Returns a pointer to a member of the instruction list.
322  return &BasicBlock::InstList;
323  }
324 
325  /// \brief Returns a pointer to the symbol table if one exists.
327 
328  /// \brief Methods for support type inquiry through isa, cast, and dyn_cast.
329  static bool classof(const Value *V) {
330  return V->getValueID() == Value::BasicBlockVal;
331  }
332 
333  /// \brief Cause all subinstructions to "let go" of all the references that
334  /// said subinstructions are maintaining.
335  ///
336  /// This allows one to 'delete' a whole class at a time, even though there may
337  /// be circular references... first all references are dropped, and all use
338  /// counts go to zero. Then everything is delete'd for real. Note that no
339  /// operations are valid on an object that has "dropped all references",
340  /// except operator delete.
341  void dropAllReferences();
342 
343  /// \brief Notify the BasicBlock that the predecessor \p Pred is no longer
344  /// able to reach it.
345  ///
346  /// This is actually not used to update the Predecessor list, but is actually
347  /// used to update the PHI nodes that reside in the block. Note that this
348  /// should be called while the predecessor still refers to this block.
349  void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs = false);
350 
351  bool canSplitPredecessors() const;
352 
353  /// \brief Split the basic block into two basic blocks at the specified
354  /// instruction.
355  ///
356  /// Note that all instructions BEFORE the specified iterator stay as part of
357  /// the original basic block, an unconditional branch is added to the original
358  /// BB, and the rest of the instructions in the BB are moved to the new BB,
359  /// including the old terminator. The newly formed BasicBlock is returned.
360  /// This function invalidates the specified iterator.
361  ///
362  /// Note that this only works on well formed basic blocks (must have a
363  /// terminator), and 'I' must not be the end of instruction list (which would
364  /// cause a degenerate basic block to be formed, having a terminator inside of
365  /// the basic block).
366  ///
367  /// Also note that this doesn't preserve any passes. To split blocks while
368  /// keeping loop information consistent, use the SplitBlock utility function.
369  BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "");
370  BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "") {
371  return splitBasicBlock(I->getIterator(), BBName);
372  }
373 
374  /// \brief Returns true if there are any uses of this basic block other than
375  /// direct branches, switches, etc. to it.
376  bool hasAddressTaken() const { return getSubclassDataFromValue() != 0; }
377 
378  /// \brief Update all phi nodes in this basic block's successors to refer to
379  /// basic block \p New instead of to it.
381 
382  /// \brief Return true if this basic block is an exception handling block.
383  bool isEHPad() const { return getFirstNonPHI()->isEHPad(); }
384 
385  /// \brief Return true if this basic block is a landing pad.
386  ///
387  /// Being a ``landing pad'' means that the basic block is the destination of
388  /// the 'unwind' edge of an invoke instruction.
389  bool isLandingPad() const;
390 
391  /// \brief Return the landingpad instruction associated with the landing pad.
392  const LandingPadInst *getLandingPadInst() const;
394  return const_cast<LandingPadInst *>(
395  static_cast<const BasicBlock *>(this)->getLandingPadInst());
396  }
397 
398  /// \brief Return true if it is legal to hoist instructions into this block.
399  bool isLegalToHoistInto() const;
400 
401 private:
402  /// \brief Increment the internal refcount of the number of BlockAddresses
403  /// referencing this BasicBlock by \p Amt.
404  ///
405  /// This is almost always 0, sometimes one possibly, but almost never 2, and
406  /// inconceivably 3 or more.
407  void AdjustBlockAddressRefCount(int Amt) {
408  setValueSubclassData(getSubclassDataFromValue()+Amt);
409  assert((int)(signed char)getSubclassDataFromValue() >= 0 &&
410  "Refcount wrap-around");
411  }
412 
413  /// \brief Shadow Value::setValueSubclassData with a private forwarding method
414  /// so that any future subclasses cannot accidentally use it.
415  void setValueSubclassData(unsigned short D) {
417  }
418 };
419 
420 // Create wrappers for C Binding types (see CBindingWrapping.h).
422 
423 } // end namespace llvm
424 
425 #endif // LLVM_IR_BASICBLOCK_H
uint64_t CallInst * C
unsigned short getSubclassDataFromValue() const
Definition: Value.h:655
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
InstListType & getInstList()
Definition: BasicBlock.h:318
unsigned getValueID() const
Return an ID for the concrete type of this object.
Definition: Value.h:459
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: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
BasicBlock * getSingleSuccessor()
Definition: BasicBlock.h:234
const_iterator end() const
Definition: BasicBlock.h:255
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:125
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:259
reverse_iterator rbegin()
Definition: BasicBlock.h:257
LLVMContext & getContext() const
Get the context in which this basic block lives.
Definition: BasicBlock.cpp:33
iterator begin()
Instruction iterator methods.
Definition: BasicBlock.h:252
InstListType::const_iterator const_iterator
Definition: BasicBlock.h:92
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
#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:253
Instruction * getFirstNonPHIOrDbg()
Definition: BasicBlock.h:162
bool empty() const
Definition: BasicBlock.h:263
BasicBlock * getSinglePredecessor()
Definition: BasicBlock.h:212
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
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:230
const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
Definition: BasicBlock.cpp:244
phi_iterator_impl & operator++()
Definition: BasicBlock.h:295
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:68
const char * Name
BasicBlock * getUniqueSuccessor()
Definition: BasicBlock.h:244
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
Instruction & front()
Definition: BasicBlock.h:265
An ilist node that can access its parent list.
Definition: ilist_node.h:257
BasicBlock * getUniquePredecessor()
Definition: BasicBlock.h:224
phi_iterator_impl(const phi_iterator_impl< PHINodeU, BBIteratorU > &Arg)
Definition: BasicBlock.h:287
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
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
Definition: BasicBlock.cpp:217
const_reverse_iterator rbegin() const
Definition: BasicBlock.h:258
LLVM Basic Block Representation.
Definition: BasicBlock.h:59
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
LandingPadInst * getLandingPadInst()
Definition: BasicBlock.h:393
Function * getParent()
Definition: BasicBlock.h:109
const Instruction & front() const
Definition: BasicBlock.h:264
CallInst * getTerminatingMustTailCall()
Definition: BasicBlock.h:142
size_t size() const
Definition: BasicBlock.h:262
const Instruction & back() const
Definition: BasicBlock.h:266
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:267
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: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
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
iterator end()
Definition: BasicBlock.h:254
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
Definition: Types.h:83
CallInst * getTerminatingDeoptimizeCall()
Definition: BasicBlock.h:133
void setValueSubclassData(unsigned short D)
Definition: Value.h:656
A range adaptor for a pair of iterators.
bool operator==(const phi_iterator_impl &Arg) const
Definition: BasicBlock.h:290
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:91
Iterator to walk just the phi nodes in the basic block.
Definition: BasicBlock.h:271
static InstListType BasicBlock::* getSublistAccess(Instruction *)
Returns a pointer to a member of the instruction list.
Definition: BasicBlock.h:321
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
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: BasicBlock.h:329
BasicBlock * splitBasicBlock(Instruction *I, const Twine &BBName="")
Definition: BasicBlock.h:370
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:308
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
Definition: BasicBlock.cpp:382
#define LLVM_READONLY
Definition: Compiler.h:168
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isEHPad() const
Return true if this basic block is an exception handling block.
Definition: BasicBlock.h:383
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
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:120
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:103
const_reverse_iterator rend() const
Definition: BasicBlock.h:260
#define D
Definition: LargeTest.cpp:26
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
Definition: BasicBlock.cpp:210
const BasicBlock * getUniqueSuccessor() const
Return the successor of this block if it has a unique successor.
Definition: BasicBlock.cpp:252