14 #ifndef LLVM_IR_BASICBLOCK_H
15 #define LLVM_IR_BASICBLOCK_H
22 #include "llvm/Support/DataTypes.h"
241 inline size_t size()
const {
return InstList.
size(); }
257 return &BasicBlock::InstList;
265 return V->
getValueID() == Value::BasicBlockVal;
328 void AdjustBlockAddressRefCount(
int Amt) {
331 "Refcount wrap-around");
335 void setValueSubclassData(
unsigned short D) {
BasicBlock * getUniqueSuccessor()
Return the successor of this block if it has a unique successor.
This class provides a symbol table of name/value pairs.
BasicBlock * getUniquePredecessor()
Return the predecessor of this block if it has a unique predecessor block.
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
Notify the BasicBlock that the predecessor Pred is no longer able to reach it.
InstListType & getInstList()
static void noteHead(BasicBlock *, BasicBlock *)
const Instruction & back() const
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. ...
CallInst * getTerminatingMustTailCall()
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this ba...
CallInst - This class represents a function call, abstracting a target machine's calling convention...
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
reverse_iterator rbegin()
Instruction * getFirstNonPHIOrDbg()
Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic...
BlockAddress - The address of a basic block.
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
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...
Instruction * getFirstNonPHI()
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
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.
const BasicBlock * getSingleSuccessor() const
const_reverse_iterator rbegin() const
const BasicBlock * getSinglePredecessor() const
InstListType::const_iterator const_iterator
iplist< Instruction > InstListType
const_iterator getFirstInsertionPt() const
InstListType::reverse_iterator reverse_iterator
const Instruction * getFirstNonPHI() const
void replaceSuccessorsPhiUsesWith(BasicBlock *New)
Update all phi nodes in this basic block's successors to refer to basic block New instead of to it...
const BasicBlock * getUniquePredecessor() const
LandingPadInst - The landingpad instruction holds all of the information necessary to generate correc...
Subclasses of this class are all able to terminate a basic block.
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
size_type LLVM_ATTRIBUTE_UNUSED_RESULT size() const
LandingPadInst * getLandingPadInst()
Return the landingpad instruction associated with the landing pad.
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.
const BasicBlock * getUniqueSuccessor() const
BasicBlock * provideInitialHead() const
Instruction * getFirstNonPHIOrDbgOrLifetime()
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic...
const CallInst * getTerminatingMustTailCall() const
void removeFromParent()
Unlink 'this' from the containing function, but do not delete it.
const Instruction * getFirstNonPHIOrDbgOrLifetime() const
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
static iplist< Instruction > BasicBlock::* getSublistAccess(Instruction *)
Returns a pointer to a member of the instruction list.
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
const_iterator end() const
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
std::reverse_iterator< iterator > reverse_iterator
void setValueSubclassData(unsigned short D)
BasicBlock * getSingleSuccessor()
Return the successor of this block if it has a single successor.
BasicBlock * getSinglePredecessor()
Return the predecessor of this block if it has a single predecessor block.
unsigned short getSubclassDataFromValue() const
ilist_node - Base class that provides next/prev services for nodes that use ilist_nextprev_traits or ...
BasicBlock * ensureHead(BasicBlock *) const
iplist< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
ValueSymbolTable * getValueSymbolTable()
Returns a pointer to the symbol table if one exists.
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
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.
static bool getSymTab(Value *V, ValueSymbolTable *&ST)
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
static NodeTy * createSentinel()
createSentinel - create the dynamic sentinel
LLVMContext & getContext() const
Get the context in which this basic block lives.
LLVM Value Representation.
static void destroySentinel(BasicBlock *)
std::reverse_iterator< const_iterator > const_reverse_iterator
iterator getFirstInsertionPt()
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
InstListType::const_reverse_iterator const_reverse_iterator
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
InstListType::iterator iterator
Instruction iterators...
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
const Instruction * getFirstNonPHIOrDbg() const