29#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_ACCSPECIALIZEPATTERNS_H
30#define MLIR_DIALECT_OPENACC_TRANSFORMS_ACCSPECIALIZEPATTERNS_H
45template <
typename OpTy>
57 if (isa<acc::DataOp, acc::HostDataOp, acc::KernelEnvironmentOp,
58 acc::ParallelOp, acc::SerialOp, acc::KernelsOp,
59 acc::DeclareEnterOp, acc::EnterDataOp>(user))
74template <
typename OpTy>
81 assert(op->getNumResults() == 0 &&
"expected op with no results");
93template <
typename OpTy>
100 Region ®ion = op.getRegion();
101 if (region.
empty()) {
132 if (!op->use_empty()) {
133 assert(op->hasOneUse() &&
"expected one use");
134 auto exitOp = dyn_cast<acc::DeclareExitOp>(*op->getUsers().begin());
135 assert(exitOp &&
"expected declare exit op");
Block represents an ordered list of Operations.
Operation * getTerminator()
Get the terminator operation of this block.
This is a utility class for mapping one set of IR entities to another.
void setInsertionPoint(Block *block, Block::iterator insertPoint)
Set the insertion point to the specified location.
Operation is the basic unit of execution within MLIR.
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
This class contains a list of basic blocks and a link to the parent operation it is attached to.
bool hasOneBlock()
Return true if this region has exactly one block.
virtual void replaceOp(Operation *op, ValueRange newValues)
Replace the results of the given (original) operation with the specified list of values (replacements...
virtual void eraseOp(Operation *op)
This method erases an operation that is known to have no uses.
virtual void inlineBlockBefore(Block *source, Block *dest, Block::iterator before, ValueRange argValues={})
Inline the operations of block 'source' into block 'dest' before the given position.
Pattern to erase acc.declare_enter and its associated acc.declare_exit.
LogicalResult matchAndRewrite(acc::DeclareEnterOp op, PatternRewriter &rewriter) const override
Pattern to simply erase an ACC op (for ops with no results).
LogicalResult matchAndRewrite(OpTy op, PatternRewriter &rewriter) const override
Pattern to replace an ACC op with its var operand.
LogicalResult matchAndRewrite(OpTy op, PatternRewriter &rewriter) const override
Pattern to unwrap a region from an ACC op and erase the wrapper.
LogicalResult matchAndRewrite(OpTy op, PatternRewriter &rewriter) const override
scf::ExecuteRegionOp wrapMultiBlockRegionWithSCFExecuteRegion(Region ®ion, IRMapping &mapping, Location loc, RewriterBase &rewriter)
Wrap a multi-block region in an scf.execute_region.
Include the generated interface declarations.
OpRewritePattern(MLIRContext *context, PatternBenefit benefit=1, ArrayRef< StringRef > generatedNames={})