14 #ifndef LLVM_IR_BASICBLOCK_H
15 #define LLVM_IR_BASICBLOCK_H
42 class ValueSymbolTable;
117 return const_cast<Module *
>(
262 inline size_t size()
const {
return InstList.size(); }
263 inline bool empty()
const {
return InstList.empty(); }
270 template <
typename PHINodeT = PHINode,
typename BBIteratorT = iterator>
273 std::forward_iterator_tag, PHINodeT> {
286 template <
typename PHINodeU,
typename BBIteratorU>
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)));
322 return &BasicBlock::InstList;
330 return V->
getValueID() == Value::BasicBlockVal;
407 void AdjustBlockAddressRefCount(
int Amt) {
410 "Refcount wrap-around");
415 void setValueSubclassData(
unsigned short D) {
425 #endif // LLVM_IR_BASICBLOCK_H
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.
InstListType & getInstList()
base_list_type::const_iterator const_iterator
const Instruction & back() const
base_list_type::const_reverse_iterator const_reverse_iterator
void insertInto(Function *Parent, BasicBlock *InsertBefore=nullptr)
Insert unlinked basic block into a function.
A Module instance is used to store all the information related to an LLVM module. ...
BasicBlock * getSingleSuccessor()
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
This class represents a function call, abstracting a target machine's calling convention.
const CallInst * getTerminatingDeoptimizeCall() const
Returns the call instruction calling .experimental.deoptimize prior to the terminating return instruc...
const CallInst * getTerminatingMustTailCall() const
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this ba...
bool isEHPad() const
Return true if this basic block is an exception handling block.
const Function * getParent() const
Return the enclosing method, or null if none.
const Instruction & front() const
reverse_iterator rbegin()
iterator begin()
Instruction iterator methods.
const_iterator begin() const
InstListType::const_iterator const_iterator
The address of a basic block.
ilist_iterator< OptionsT, IsReverse, false > getNonConst() const
Const-cast.
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
PHINodeT & operator*() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr it the function does no...
const_reverse_iterator rend() const
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
Instruction * getFirstNonPHIOrDbg()
const_reverse_iterator rbegin() const
BasicBlock * getSinglePredecessor()
BasicBlock & operator=(const BasicBlock &)=delete
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
bool canSplitPredecessors() const
phi_iterator_impl & operator++()
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
bool isLegalToHoistInto() const
Return true if it is legal to hoist instructions into this block.
const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
BasicBlock * getUniqueSuccessor()
void replaceSuccessorsPhiUsesWith(BasicBlock *New)
Update all phi nodes in this basic block's successors to refer to basic block New instead of to it...
An ilist node that can access its parent list.
BasicBlock * getUniquePredecessor()
phi_iterator_impl(const phi_iterator_impl< PHINodeU, BBIteratorU > &Arg)
The landingpad instruction holds all of the information necessary to generate correct exception handl...
Subclasses of this class are all able to terminate a basic block.
const LandingPadInst * getLandingPadInst() const
Return the landingpad instruction associated with the landing pad.
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
LandingPadInst * getLandingPadInst()
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
CallInst * getTerminatingMustTailCall()
const InstListType & getInstList() const
Return the underlying instruction list container.
unsigned getValueID() const
Return an ID for the concrete type of this object.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Instruction * getFirstNonPHIOrDbgOrLifetime()
self_iterator getIterator()
iterator getFirstInsertionPt()
const BasicBlock * getUniqueSuccessor() const
Return the successor of this block if it has a unique successor.
phi_iterator_impl()=default
void removeFromParent()
Unlink 'this' from the containing function, but do not delete it.
Iterator for intrusive lists based on ilist_node.
base_list_type::iterator iterator
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
bool operator==(const phi_iterator_impl &Arg) const
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
const_iterator end() const
CallInst * getTerminatingDeoptimizeCall()
void setValueSubclassData(unsigned short D)
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
A range adaptor for a pair of iterators.
InstListType::iterator iterator
Instruction iterators...
Iterator to walk just the phi nodes in the basic block.
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
unsigned short getSubclassDataFromValue() const
static InstListType BasicBlock::* getSublistAccess(Instruction *)
Returns a pointer to a member of the instruction list.
SymbolTableList< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
ValueSymbolTable * getValueSymbolTable()
Returns a pointer to the symbol table if one exists.
bool isLandingPad() const
Return true if this basic block is a landing pad.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast.
BasicBlock * splitBasicBlock(Instruction *I, const Twine &BBName="")
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
const BasicBlock * getUniquePredecessor() const
Return the predecessor of this block if it has a unique predecessor block.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVMContext & getContext() const
Get the context in which this basic block lives.
LLVM Value Representation.
const Instruction * getFirstNonPHIOrDbg() const
Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic...
Instruction * getFirstNonPHI()
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...
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
const Instruction * getFirstNonPHIOrDbgOrLifetime() const
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic...
base_list_type::reverse_iterator reverse_iterator
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...