|
| 1 | +//===- XeVMToLLVM.cpp - XeVM to LLVM dialect conversion -------------------===// |
| 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 "gc/Conversion/XeVMToLLVM/XeVMToLLVM.h" |
| 10 | + |
| 11 | +#include "gc/Dialect/LLVMIR/XeVMDialect.h" |
| 12 | +#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h" |
| 13 | +#include "mlir/Conversion/LLVMCommon/Pattern.h" |
| 14 | +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" |
| 15 | +#include "mlir/Pass/Pass.h" |
| 16 | +#include "mlir/Support/LLVM.h" |
| 17 | + |
| 18 | +#define DEBUG_TYPE "xevm-to-llvm" |
| 19 | + |
| 20 | +namespace mlir { |
| 21 | +#define GEN_PASS_DEF_CONVERTXEVMTOLLVMPASS |
| 22 | +#include "gc/Conversion/Passes.h.inc" |
| 23 | +} // namespace mlir |
| 24 | + |
| 25 | +using namespace mlir; |
| 26 | +using namespace xevm; |
| 27 | + |
| 28 | +namespace { |
| 29 | +struct ConvertXeVMToLLVMPass |
| 30 | + : public impl::ConvertXeVMToLLVMPassBase<ConvertXeVMToLLVMPass> { |
| 31 | + using Base::Base; |
| 32 | + |
| 33 | + void getDependentDialects(DialectRegistry ®istry) const override { |
| 34 | + registry.insert<LLVM::LLVMDialect, xevm::XeVMDialect>(); |
| 35 | + } |
| 36 | + |
| 37 | + void runOnOperation() override { |
| 38 | + ConversionTarget target(getContext()); |
| 39 | + target.addLegalDialect<::mlir::LLVM::LLVMDialect>(); |
| 40 | + RewritePatternSet pattern(&getContext()); |
| 41 | + mlir::populateXeVMToLLVMConversionPatterns(pattern); |
| 42 | + if (failed( |
| 43 | + applyPartialConversion(getOperation(), target, std::move(pattern)))) |
| 44 | + signalPassFailure(); |
| 45 | + } |
| 46 | +}; |
| 47 | +} // namespace |
| 48 | + |
| 49 | +void mlir::populateXeVMToLLVMConversionPatterns(RewritePatternSet &patterns) { |
| 50 | + /*TODO*/ |
| 51 | +} |
| 52 | + |
| 53 | +void mlir::registerConvertXeVMToLLVMInterface(DialectRegistry ®istry) { |
| 54 | + /*TODO*/ |
| 55 | +} |
0 commit comments