|
| 1 | +//===- SYCLToLLVM.h - SYCL to LLVM Patterns ---------------------*- C++ -*-===// |
| 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 | +// Provides patterns to convert SYCL dialect to LLVM dialect. |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +#ifndef MLIR_CONVERSION_SYCLTOLLVM_SYCLTOLLVM_H |
| 14 | +#define MLIR_CONVERSION_SYCLTOLLVM_SYCLTOLLVM_H |
| 15 | + |
| 16 | +#include "mlir/Transforms/DialectConversion.h" |
| 17 | + |
| 18 | +namespace mlir { |
| 19 | +class LLVMTypeConverter; |
| 20 | +class MLIRContext; |
| 21 | +class ModuleOp; |
| 22 | + |
| 23 | +namespace sycl { |
| 24 | +template <typename SYCLOp> |
| 25 | +class SYCLToLLVMConversion : public OpConversionPattern<SYCLOp> { |
| 26 | +public: |
| 27 | + SYCLToLLVMConversion(MLIRContext *context, LLVMTypeConverter &typeConverter, |
| 28 | + PatternBenefit benefit = 1) |
| 29 | + : OpConversionPattern<SYCLOp>(typeConverter, context, benefit), |
| 30 | + typeConverter(typeConverter) {} |
| 31 | + |
| 32 | +protected: |
| 33 | + LLVMTypeConverter &typeConverter; |
| 34 | +}; |
| 35 | + |
| 36 | +/// Populates type conversions with additional SYCL types. |
| 37 | +void populateSYCLToLLVMTypeConversion(LLVMTypeConverter &typeConverter); |
| 38 | + |
| 39 | +/// Populates the given list with patterns that convert from SYCL to LLVM. |
| 40 | +void populateSYCLToLLVMConversionPatterns(LLVMTypeConverter &typeConverter, |
| 41 | + RewritePatternSet &patterns); |
| 42 | + |
| 43 | +} // namespace sycl |
| 44 | +} // namespace mlir |
| 45 | + |
| 46 | +#endif // MLIR_CONVERSION_SYCLTOLLVM_SYCLTOLLVM_H |
0 commit comments