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 &)> {
73 SuccessorRange, BlockOperand *, Block *, Block *, Block *> {
75 using RangeBaseT::RangeBaseT;
83 return object + index;
87 return object[index].get();
105 BlockRange, llvm::PointerUnion<BlockOperand *, Block *const *>,
106 Block *, Block *, Block *> {
108 using RangeBaseT::RangeBaseT;
111 template <
typename Arg,
typename = std::enable_if_t<std::is_constructible<
125 static OwnerT offset_base(OwnerT
object, ptrdiff_t index);
128 static Block *dereference_iterator(OwnerT
object, ptrdiff_t index);
140 template <
typename OpT,
typename IteratorT>
142 :
public llvm::filter_iterator<IteratorT, bool (*)(Operation &)> {
143 static bool filter(
Operation &op) {
return llvm::isa<OpT>(op); }
147 :
llvm::filter_iterator<IteratorT, bool (*)(
Operation &)>(it, end,
151 operator const IteratorT &()
const {
return this->wrapped(); }
156 template <
typename OpT,
typename IteratorT>
158 :
public llvm::mapped_iterator<op_filter_iterator<OpT, IteratorT>,
159 OpT (*)(Operation &)> {
160 static OpT unwrap(
Operation &op) {
return cast<OpT>(op); }
169 operator const IteratorT &()
const {
return this->wrapped(); }
188 return llvm::hash_combine_range(value.begin(), value.end());
191 if (rhs.getBase() == getEmptyKey().
getBase())
192 return lhs.getBase() == getEmptyKey().getBase();
193 if (rhs.getBase() == getTombstoneKey().
getBase())
194 return lhs.getBase() == getTombstoneKey().getBase();
203 namespace ilist_detail {
209 struct SpecificNodeAccess<
212 using OptionsT =
typename compute_node_options<mlir::Operation>::type;
233 void transferNodesFromList(ilist_traits<Operation> &otherList,
249 void addNodeToList(
Block *block);
250 void removeNodeFromList(
Block *block);
251 void transferNodesFromList(ilist_traits<Block> &otherList,
static Value getBase(Value v)
Looks through known "view-like" ops to find the base memref.
A block operand represents an operand that holds a reference to a Block, e.g.
unsigned getOperandNumber()
Return which operand this is in the BlockOperand list of the Operation.
static IRObjectWithUseList< BlockOperand > * getUseList(Block *value)
Provide the use list that is attached to the given block.
This class provides an abstraction over the different types of ranges over Blocks.
BlockRange(ArrayRef< Block * > blocks=std::nullopt)
BlockRange(std::initializer_list< Block * > blocks)
Block represents an ordered list of Operations.
A reference to a value, suitable for use as an operand of an operation.
Operation is the basic unit of execution within MLIR.
Implement a predecessor iterator for blocks.
PredecessorIterator(ValueUseIterator< BlockOperand > it)
Initializes the operand type iterator to the specified operand iterator.
PredecessorIterator(BlockOperand *operand)
unsigned getSuccessorIndex() const
Get the successor number in the predecessor terminator.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
This class implements the successor iterators for Block.
An iterator class that allows for iterating over the uses of an IR operand type.
A utility iterator that filters out operations that are not 'OpT'.
op_filter_iterator(IteratorT it, IteratorT end)
This class provides iteration over the held operations of a block for a specific operation type.
op_iterator(op_filter_iterator< OpT, IteratorT > it)
Initializes the iterator to the specified filter iterator.
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Include the generated interface declarations.
static bool isEqual(mlir::SuccessorRange lhs, mlir::SuccessorRange rhs)
static mlir::SuccessorRange getTombstoneKey()
static unsigned getHashValue(mlir::SuccessorRange value)
static mlir::SuccessorRange getEmptyKey()
typename OptionsT::const_pointer const_pointer
ilist_node_impl< OptionsT > node_type
static node_type * getNodePtr(pointer N)
static const node_type * getNodePtr(const_pointer N)
typename OptionsT::pointer pointer
typename compute_node_options< mlir::Operation >::type OptionsT
static pointer getValuePtr(node_type *N)
static const_pointer getValuePtr(const node_type *N)
simple_ilist<::mlir::Block >::iterator block_iterator
simple_ilist< Operation >::iterator op_iterator