29#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_ACCSPECIALIZEPATTERNS_H
30#define MLIR_DIALECT_OPENACC_TRANSFORMS_ACCSPECIALIZEPATTERNS_H
44template <
typename OpTy>
63template <
typename OpTy>
70 assert(op->getNumResults() == 0 &&
"expected op with no results");
81template <
typename OpTy>
88 assert(op.getRegion().hasOneBlock() &&
"expected one block");
89 Block *block = &op.getRegion().front();
108 if (!op->use_empty()) {
109 assert(op->hasOneUse() &&
"expected one use");
110 auto exitOp = dyn_cast<acc::DeclareExitOp>(*op->getUsers().begin());
111 assert(exitOp &&
"expected declare exit op");
Block represents an ordered list of Operations.
Operation * getTerminator()
Get the terminator operation of this block.
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
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
Include the generated interface declarations.
OpRewritePattern(MLIRContext *context, PatternBenefit benefit=1, ArrayRef< StringRef > generatedNames={})