41template <
class Ptr,
class USE_iterator>
57 if (
auto *Inst = dyn_cast<Instruction>(*
It))
58 if (Inst->isTerminator())
76 assert(!
It.atEnd() &&
"pred_iterator out of range!");
77 return cast<Instruction>(*It)->getParent();
82 assert(!
It.atEnd() &&
"pred_iterator out of range!");
88 Self tmp = *
this; ++*
this;
return tmp;
94 return It.getOperandNo();
137template <
class InstructionT,
class BlockT>
140 std::random_access_iterator_tag, BlockT, int,
141 BlockT *, BlockT *> {
152 inline bool index_is_valid(
int Idx) {
155 return Idx >= 0 && (
Idx == 0 ||
Idx <= (int)Inst->getNumSuccessors());
159 class SuccessorProxy {
163 explicit SuccessorProxy(
const Self &It) : It(It) {}
165 SuccessorProxy(
const SuccessorProxy &) =
default;
167 SuccessorProxy &operator=(SuccessorProxy
RHS) {
173 It.Inst->setSuccessor(It.Idx,
RHS);
177 operator reference()
const {
return *It; }
186 Idx = Inst->getNumSuccessors();
209 assert(Inst ==
RHS.Inst &&
"Cannot compare iterators of different blocks!");
214 assert(Inst ==
RHS.Inst &&
"Cannot compare iterators of different blocks!");
220 assert(index_is_valid(NewIdx) &&
"Iterator index out of bound");
232 return SuccessorProxy(TmpIt);
237 assert(Inst &&
"Source not available, if basic block was malformed");
238 return Inst->getParent();
311static_assert(GraphHasNodeNumbers<BasicBlock *>,
312 "GraphTraits getNumber() not detected");
326static_assert(GraphHasNodeNumbers<const BasicBlock *>,
327 "GraphTraits getNumber() not detected");
345static_assert(GraphHasNodeNumbers<Inverse<BasicBlock *>>,
346 "GraphTraits getNumber() not detected");
359static_assert(GraphHasNodeNumbers<Inverse<const BasicBlock *>>,
360 "GraphTraits getNumber() not detected");
387 return F->getMaxBlockNumber();
390 return F->getBlockNumberEpoch();
411 return F->getMaxBlockNumber();
414 return F->getBlockNumberEpoch();
426 return &
G.Graph->getEntryBlock();
430 return F->getMaxBlockNumber();
433 return F->getBlockNumberEpoch();
439 return &
G.Graph->getEntryBlock();
443 return F->getMaxBlockNumber();
446 return F->getBlockNumberEpoch();
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the little GraphTraits<X> template class that should be specialized by classes that...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Basic Block Representation.
unsigned getNumber() const
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...
bool operator==(const Self &x) const
void advancePastNonTerminators()
PredIterator(Ptr *bb, bool)
bool operator!=(const Self &x) const
std::forward_iterator_tag iterator_category
reference operator*() const
std::ptrdiff_t difference_type
pointer * operator->() const
unsigned getOperandNo() const
getOperandNo - Return the operand number in the predecessor's terminator of the successor.
Use & getUse() const
getUse - Return the operand Use in the predecessor's terminator of the successor.
bool operator==(const Self &x) const
SuccIterator(InstructionT *Inst, bool)
Self & operator-=(int RHS)
int getSuccessorIndex() const
This is used to interface between code that wants to operate on terminator instructions directly.
BlockT * operator->() const
bool operator<(const Self &RHS) const
BlockT * operator*() const
BlockT * getSource()
Get the source BlockT of this iterator.
SuccessorProxy operator[](int Offset)
Self & operator+=(int RHS)
int operator-(const Self &RHS) const
SuccIterator(InstructionT *Inst)
A Use represents the edge between a Value definition and its users.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
A range adaptor for a pair of iterators.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
NodeAddr< UseNode * > Use
This is an optimization pass for GlobalISel generic memory operations.
bool succ_empty(const Instruction *I)
auto pred_end(const MachineBasicBlock *BB)
auto successors(const MachineBasicBlock *BB)
auto pred_size(const MachineBasicBlock *BB)
SuccIterator< Instruction, BasicBlock > succ_iterator
iterator_range< succ_iterator > succ_range
auto succ_size(const MachineBasicBlock *BB)
iterator_range< const_succ_iterator > const_succ_range
iterator_range< pred_iterator > pred_range
RNSuccIterator< NodeRef, BlockT, RegionT > succ_begin(NodeRef Node)
RNSuccIterator< NodeRef, BlockT, RegionT > succ_end(NodeRef Node)
iterator_range< const_pred_iterator > const_pred_range
auto pred_begin(const MachineBasicBlock *BB)
PredIterator< const BasicBlock, Value::const_user_iterator > const_pred_iterator
auto predecessors(const MachineBasicBlock *BB)
bool pred_empty(const BasicBlock *BB)
PredIterator< BasicBlock, Value::user_iterator > pred_iterator
SuccIterator< const Instruction, const BasicBlock > const_succ_iterator
static NodeRef getEntryNode(BasicBlock *BB)
static ChildIteratorType child_begin(NodeRef N)
static unsigned getNumber(const BasicBlock *BB)
static ChildIteratorType child_end(NodeRef N)
static unsigned getMaxNumber(const Function *F)
static nodes_iterator nodes_begin(Function *F)
static unsigned getNumberEpoch(const Function *F)
static nodes_iterator nodes_end(Function *F)
static size_t size(Function *F)
static NodeRef getEntryNode(Function *F)
static ChildIteratorType child_begin(NodeRef N)
static unsigned getNumber(const BasicBlock *BB)
static ChildIteratorType child_end(NodeRef N)
static NodeRef getEntryNode(Inverse< BasicBlock * > G)
static unsigned getNumberEpoch(const Function *F)
static unsigned getMaxNumber(const Function *F)
static NodeRef getEntryNode(Inverse< Function * > G)
static ChildIteratorType child_end(NodeRef N)
static NodeRef getEntryNode(Inverse< const BasicBlock * > G)
static ChildIteratorType child_begin(NodeRef N)
static unsigned getNumber(const BasicBlock *BB)
static unsigned getMaxNumber(const Function *F)
static NodeRef getEntryNode(Inverse< const Function * > G)
static unsigned getNumberEpoch(const Function *F)
static ChildIteratorType child_begin(NodeRef N)
static unsigned getNumber(const BasicBlock *BB)
static NodeRef getEntryNode(const BasicBlock *BB)
static ChildIteratorType child_end(NodeRef N)
static size_t size(const Function *F)
static nodes_iterator nodes_begin(const Function *F)
static NodeRef getEntryNode(const Function *F)
static unsigned getNumberEpoch(const Function *F)
static unsigned getMaxNumber(const Function *F)
static nodes_iterator nodes_end(const Function *F)