14 #ifndef LLVM_IR_BASICBLOCK_H 15 #define LLVM_IR_BASICBLOCK_H 41 class ValueSymbolTable;
116 return const_cast<Module *
>(
187 std::function<bool(const Instruction &)>>>
193 std::function<bool(Instruction &)>>>
279 inline size_t size()
const {
return InstList.size(); }
280 inline bool empty()
const {
return InstList.empty(); }
287 template <
typename PHINodeT = PHINode,
typename BBIteratorT = iterator>
290 std::forward_iterator_tag, PHINodeT> {
303 template <
typename PHINodeU,
typename BBIteratorU>
311 using phi_iterator_impl::iterator_facade_base::operator++;
313 assert(PN &&
"Cannot increment the end iterator!");
314 PN =
dyn_cast<PHINodeT>(std::next(BBIteratorT(PN)));
339 return &BasicBlock::InstList;
347 return V->
getValueID() == Value::BasicBlockVal;
425 void AdjustBlockAddressRefCount(
int Amt) {
428 "Refcount wrap-around");
433 void setValueSubclassData(
unsigned short D) {
447 #endif // LLVM_IR_BASICBLOCK_H
unsigned short getSubclassDataFromValue() const
bool canSplitPredecessors() const
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.
bool hasNPredecessors(unsigned N) const
Return true if this block has exactly N predecessors.
InstListType & getInstList()
base_list_type::const_iterator const_iterator
unsigned getValueID() const
Return an ID for the concrete type of this object.
base_list_type::const_reverse_iterator const_reverse_iterator
This class represents lattice values for constants.
bool isLegalToHoistInto() const
Return true if it is legal to hoist instructions into this block.
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()
const_iterator end() const
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 'musttail' prior to the terminating return instruction of this ba...
This class represents a function call, abstracting a target machine's calling convention.
reverse_iterator rbegin()
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...
LLVMContext & getContext() const
Get the context in which this basic block lives.
iterator begin()
Instruction iterator methods.
InstListType::const_iterator const_iterator
The address of a basic block.
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
amdgpu Simplify well known AMD library false Value Value const Twine & Name
const CallInst * getTerminatingDeoptimizeCall() const
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return in...
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const_iterator begin() const
Instruction * getFirstNonPHIOrDbg()
BasicBlock * getSinglePredecessor()
const Instruction * getFirstNonPHIOrDbgOrLifetime() const
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic...
BasicBlock & operator=(const BasicBlock &)=delete
const BasicBlock * getUniquePredecessor() const
Return the predecessor of this block if it has a unique predecessor block.
const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
phi_iterator_impl & operator++()
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
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...
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
const_reverse_iterator rbegin() const
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
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...
LandingPadInst * getLandingPadInst()
const Instruction & front() const
CallInst * getTerminatingMustTailCall()
const Instruction & back() const
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()
phi_iterator_impl()=default
PHINodeT & operator*() const
bool isLandingPad() const
Return true if this basic block is a landing pad.
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
bool hasNPredecessorsOrMore(unsigned N) const
Return true if this block has N predecessors or more.
const InstListType & getInstList() const
Return the underlying instruction list container.
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...
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
CallInst * getTerminatingDeoptimizeCall()
void setValueSubclassData(unsigned short D)
A range adaptor for a pair of iterators.
bool operator==(const phi_iterator_impl &Arg) const
InstListType::iterator iterator
Instruction iterators...
Iterator to walk just the phi nodes in the basic block.
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.
const Function * getParent() const
Return the enclosing method, or null if none.
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.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast.
BasicBlock * splitBasicBlock(Instruction *I, const Twine &BBName="")
Optional< uint64_t > getIrrLoopHeaderWeight() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isEHPad() const
Return true if this basic block is an exception handling block.
LLVM Value Representation.
Instruction * getTerminator()
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
Specialization of filter_iterator_base for forward iteration only.
const LandingPadInst * getLandingPadInst() const
Return the landingpad instruction associated with the landing pad.
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()
BasicBlock::iterator skipDebugIntrinsics(BasicBlock::iterator It)
Advance It while it points to a debug instruction and return the result.
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 ...
const_reverse_iterator rend() const
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
const BasicBlock * getUniqueSuccessor() const
Return the successor of this block if it has a unique successor.