13 #ifndef MLIR_IR_BLOCKSUPPORT_H 14 #define MLIR_IR_BLOCKSUPPORT_H 17 #include "llvm/ADT/PointerUnion.h" 18 #include "llvm/ADT/ilist.h" 19 #include "llvm/ADT/ilist_node.h" 50 :
public llvm::mapped_iterator<ValueUseIterator<BlockOperand>,
51 Block *(*)(BlockOperand &)> {
64 unsigned getSuccessorIndex()
const;
74 SuccessorRange, BlockOperand *, Block *, Block *, Block *> {
76 using RangeBaseT::RangeBaseT;
84 return object + index;
88 return object[index].get();
106 BlockRange, llvm::PointerUnion<BlockOperand *, Block *const *>,
107 Block *, Block *, Block *> {
109 using RangeBaseT::RangeBaseT;
112 template <
typename Arg,
113 typename =
typename std::enable_if_t<
114 std::is_constructible<ArrayRef<Block *>, Arg>::value>>
127 static OwnerT offset_base(
OwnerT object, ptrdiff_t index);
130 static Block *dereference_iterator(
OwnerT object, ptrdiff_t index);
142 template <
typename OpT,
typename IteratorT>
144 :
public llvm::filter_iterator<IteratorT, bool (*)(Operation &)> {
145 static bool filter(
Operation &op) {
return llvm::isa<OpT>(op); }
149 :
llvm::filter_iterator<IteratorT, bool (*)(
Operation &)>(it, end,
153 operator const IteratorT &()
const {
return this->wrapped(); }
158 template <
typename OpT,
typename IteratorT>
160 :
public llvm::mapped_iterator<op_filter_iterator<OpT, IteratorT>,
161 OpT (*)(Operation &)> {
172 operator const IteratorT &()
const {
return this->wrapped(); }
191 return llvm::hash_combine_range(value.begin(), value.end());
194 if (rhs.getBase() == getEmptyKey().getBase())
195 return lhs.getBase() == getEmptyKey().getBase();
196 if (rhs.getBase() == getTombstoneKey().getBase())
197 return lhs.getBase() == getTombstoneKey().getBase();
206 namespace ilist_detail {
212 struct SpecificNodeAccess<
215 using OptionsT =
typename compute_node_options<mlir::Operation>::type;
235 void transferNodesFromList(ilist_traits<Operation> &otherList,
251 void addNodeToList(
Block *block);
252 void removeNodeFromList(
Block *block);
253 void transferNodesFromList(ilist_traits<Block> &otherList,
262 #endif // MLIR_IR_BLOCKSUPPORT_H Include the generated interface declarations.
This class contains a list of basic blocks and a link to the parent operation it is attached to...
typename OptionsT::const_pointer const_pointer
Explicitly register a set of "builtin" types.
Operation is a basic unit of execution within MLIR.
unsigned getOperandNumber()
Return which operand this is in the BlockOperand list of the Operation.
Block represents an ordered list of Operations.
PredecessorIterator(BlockOperand *operand)
An iterator class that allows for iterating over the uses of an IR operand type.
A block operand represents an operand that holds a reference to a Block, e.g.
BlockRange(std::initializer_list< Block *> blocks)
ilist_node_impl< OptionsT > node_type
simple_ilist< Operation >::iterator op_iterator
typename OptionsT::pointer pointer
static unsigned getHashValue(mlir::SuccessorRange value)
typename compute_node_options< mlir::Operation >::type OptionsT
op_filter_iterator(IteratorT it, IteratorT end)
This class implements the successor iterators for Block.
This class provides iteration over the held operations of a block for a specific operation type...
simple_ilist<::mlir::Block >::iterator block_iterator
static bool isEqual(mlir::SuccessorRange lhs, mlir::SuccessorRange rhs)
static IRObjectWithUseList< BlockOperand > * getUseList(Block *value)
Provide the use list that is attached to the given block.
static mlir::SuccessorRange getEmptyKey()
Implement a predecessor iterator for blocks.
op_iterator(op_filter_iterator< OpT, IteratorT > it)
Initializes the iterator to the specified filter iterator.
This class provides an abstraction over the different types of ranges over Blocks.
A utility iterator that filters out operations that are not 'OpT'.
A reference to a value, suitable for use as an operand of an operation.
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
PredecessorIterator(ValueUseIterator< BlockOperand > it)
Initializes the operand type iterator to the specified operand iterator.
static mlir::SuccessorRange getTombstoneKey()