| 1 | //===- LoopExtensionOps.cpp - Loop extension for the Transform dialect ----===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.h" |
| 10 | |
| 11 | #include "mlir/IR/OpImplementation.h" |
| 12 | #include "mlir/IR/PatternMatch.h" |
| 13 | #include "mlir/Transforms/LoopInvariantCodeMotionUtils.h" |
| 14 | |
| 15 | using namespace mlir; |
| 16 | |
| 17 | #define GET_OP_CLASSES |
| 18 | #include "mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.cpp.inc" |
| 19 | |
| 20 | //===----------------------------------------------------------------------===// |
| 21 | // HoistLoopInvariantSubsetsOp |
| 22 | //===----------------------------------------------------------------------===// |
| 23 | |
| 24 | DiagnosedSilenceableFailure transform::HoistLoopInvariantSubsetsOp::applyToOne( |
| 25 | transform::TransformRewriter &rewriter, LoopLikeOpInterface loopLikeOp, |
| 26 | transform::ApplyToEachResultList &results, |
| 27 | transform::TransformState &state) { |
| 28 | hoistLoopInvariantSubsets(rewriter, loopLikeOp); |
| 29 | return DiagnosedSilenceableFailure::success(); |
| 30 | } |
| 31 | |
| 32 | void transform::HoistLoopInvariantSubsetsOp::getEffects( |
| 33 | SmallVectorImpl<MemoryEffects::EffectInstance> &effects) { |
| 34 | transform::onlyReadsHandle(getTargetMutable(), effects); |
| 35 | transform::modifiesPayload(effects); |
| 36 | } |
| 37 | |