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<
115 BlockRange(std::initializer_list<Block *> blocks LLVM_LIFETIME_BOUND)
125 static OwnerT offset_base(OwnerT
object, ptrdiff_t
index);
128 static Block *dereference_iterator(OwnerT
object, ptrdiff_t
index);
140template <
typename OpT,
typename IteratorT>
142 :
public llvm::filter_iterator<IteratorT, bool (*)(Operation &)> {
143 static bool filter(
Operation &op) {
return llvm::isa<OpT>(op); }
151 operator const IteratorT &()
const {
return this->wrapped(); }
156template <
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);
212 using OptionsT = compute_node_options<mlir::Operation>::type;
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.
BlockRange(Arg &&arg LLVM_LIFETIME_BOUND)
BlockRange(ArrayRef< Block * > blocks={})
BlockRange(std::initializer_list< Block * > blocks LLVM_LIFETIME_BOUND)
Block represents an ordered list of Operations.
This class represents a single IR object that contains a use list.
IROperand(Operation *owner)
Operation is the basic unit of execution within MLIR.
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)
op_iterator(op_filter_iterator< OpT, IteratorT > it)
Initializes the iterator to the specified filter iterator.
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()
OptionsT::const_pointer const_pointer
static const_pointer getValuePtr(const node_type *N)
compute_node_options< mlir::Operation >::type OptionsT
static pointer getValuePtr(node_type *N)
static const node_type * getNodePtr(const_pointer N)
static node_type * getNodePtr(pointer N)
ilist_node_impl< OptionsT > node_type
OptionsT::pointer pointer
void transferNodesFromList(ilist_traits< Block > &otherList, block_iterator first, block_iterator last)
This is a trait method invoked when an operation is moved from one block to another.
simple_ilist<::mlir::Block >::iterator block_iterator
void removeNodeFromList(Block *block)
This is a trait method invoked when an operation is removed from a region.
void addNodeToList(Block *block)
This is a trait method invoked when a basic block is added to a region.
void removeNodeFromList(Operation *op)
This is a trait method invoked when an operation is removed from a block.
void transferNodesFromList(ilist_traits< Operation > &otherList, op_iterator first, op_iterator last)
This is a trait method invoked when an operation is moved from one block to another.
void addNodeToList(Operation *op)
This is a trait method invoked when an operation is added to a block.
static void deleteNode(Operation *op)
::mlir::Operation Operation
simple_ilist< Operation >::iterator op_iterator