#include "mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir {
namespace NVVM {
#define GEN_PASS_DEF_NVVMOPTIMIZEFORTARGET
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
}
}
usingnamespacemlir;
namespace {
struct ExpandDivF16 : public OpRewritePattern<LLVM::FDivOp> { … };
struct NVVMOptimizeForTarget
: public NVVM::impl::NVVMOptimizeForTargetBase<NVVMOptimizeForTarget> { … };
}
LogicalResult ExpandDivF16::matchAndRewrite(LLVM::FDivOp op,
PatternRewriter &rewriter) const { … }
void NVVMOptimizeForTarget::runOnOperation() { … }
std::unique_ptr<Pass> NVVM::createOptimizeForTargetPass() { … }