MLIR  16.0.0git
SPIRVToLLVM.h
Go to the documentation of this file.
1 //===- SPIRVToLLVM.h - SPIR-V 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 SPIR-V dialect to LLVM dialect.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H
14 #define MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H
15 
17 
18 namespace mlir {
19 class LLVMTypeConverter;
20 class MLIRContext;
21 class ModuleOp;
22 
23 template <typename SPIRVOp>
24 class SPIRVToLLVMConversion : public OpConversionPattern<SPIRVOp> {
25 public:
27  PatternBenefit benefit = 1)
28  : OpConversionPattern<SPIRVOp>(typeConverter, context, benefit),
30 
31 protected:
33 };
34 
35 /// Encodes global variable's descriptor set and binding into its name if they
36 /// both exist.
37 void encodeBindAttribute(ModuleOp module);
38 
39 /// Populates type conversions with additional SPIR-V types.
41 
42 /// Populates the given list with patterns that convert from SPIR-V to LLVM.
44  RewritePatternSet &patterns);
45 
46 /// Populates the given list with patterns for function conversion from SPIR-V
47 /// to LLVM.
49  LLVMTypeConverter &typeConverter, RewritePatternSet &patterns);
50 
51 /// Populates the given patterns for module conversion from SPIR-V to LLVM.
53  LLVMTypeConverter &typeConverter, RewritePatternSet &patterns);
54 
55 } // namespace mlir
56 
57 #endif // MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H
Conversion from types to the LLVM IR dialect.
Definition: TypeConverter.h:30
MLIRContext is the top-level object for a collection of MLIR operations.
Definition: MLIRContext.h:56
OpConversionPattern is a wrapper around ConversionPattern that allows for matching and rewriting agai...
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
Definition: PatternMatch.h:32
SPIRVToLLVMConversion(MLIRContext *context, LLVMTypeConverter &typeConverter, PatternBenefit benefit=1)
Definition: SPIRVToLLVM.h:26
LLVMTypeConverter & typeConverter
Definition: SPIRVToLLVM.h:32
Include the generated interface declarations.
void populateSPIRVToLLVMFunctionConversionPatterns(LLVMTypeConverter &typeConverter, RewritePatternSet &patterns)
Populates the given list with patterns for function conversion from SPIR-V to LLVM.
void populateSPIRVToLLVMModuleConversionPatterns(LLVMTypeConverter &typeConverter, RewritePatternSet &patterns)
Populates the given patterns for module conversion from SPIR-V to LLVM.
void populateSPIRVToLLVMTypeConversion(LLVMTypeConverter &typeConverter)
Populates type conversions with additional SPIR-V types.
void encodeBindAttribute(ModuleOp module)
Encodes global variable's descriptor set and binding into its name if they both exist.
void populateSPIRVToLLVMConversionPatterns(LLVMTypeConverter &typeConverter, RewritePatternSet &patterns)
Populates the given list with patterns that convert from SPIR-V to LLVM.