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