MLIR  19.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 
19 
20 namespace mlir {
21 class LLVMTypeConverter;
22 class MLIRContext;
23 class ModuleOp;
24 
25 template <typename SPIRVOp>
26 class SPIRVToLLVMConversion : public OpConversionPattern<SPIRVOp> {
27 public:
29  PatternBenefit benefit = 1)
30  : OpConversionPattern<SPIRVOp>(typeConverter, context, benefit),
32 
33 protected:
35 };
36 
37 /// Encodes global variable's descriptor set and binding into its name if they
38 /// both exist.
39 void encodeBindAttribute(ModuleOp module);
40 
41 /// Populates type conversions with additional SPIR-V types.
43  LLVMTypeConverter &typeConverter,
44  spirv::ClientAPI clientAPIForAddressSpaceMapping =
45  spirv::ClientAPI::Unknown);
46 
47 /// Populates the given list with patterns that convert from SPIR-V to LLVM.
49  LLVMTypeConverter &typeConverter, RewritePatternSet &patterns,
50  spirv::ClientAPI clientAPIForAddressSpaceMapping =
51  spirv::ClientAPI::Unknown);
52 
53 /// Populates the given list with patterns for function conversion from SPIR-V
54 /// to LLVM.
56  LLVMTypeConverter &typeConverter, RewritePatternSet &patterns);
57 
58 /// Populates the given patterns for module conversion from SPIR-V to LLVM.
60  LLVMTypeConverter &typeConverter, RewritePatternSet &patterns);
61 
62 } // namespace mlir
63 
64 #endif // MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H
Conversion from types to the LLVM IR dialect.
Definition: TypeConverter.h:34
MLIRContext is the top-level object for a collection of MLIR operations.
Definition: MLIRContext.h:60
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:34
SPIRVToLLVMConversion(MLIRContext *context, LLVMTypeConverter &typeConverter, PatternBenefit benefit=1)
Definition: SPIRVToLLVM.h:28
LLVMTypeConverter & typeConverter
Definition: SPIRVToLLVM.h:34
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 populateSPIRVToLLVMTypeConversion(LLVMTypeConverter &typeConverter, spirv::ClientAPI clientAPIForAddressSpaceMapping=spirv::ClientAPI::Unknown)
Populates type conversions with additional SPIR-V types.
void populateSPIRVToLLVMConversionPatterns(LLVMTypeConverter &typeConverter, RewritePatternSet &patterns, spirv::ClientAPI clientAPIForAddressSpaceMapping=spirv::ClientAPI::Unknown)
Populates the given list with patterns that convert from SPIR-V to LLVM.
void populateSPIRVToLLVMModuleConversionPatterns(LLVMTypeConverter &typeConverter, RewritePatternSet &patterns)
Populates the given patterns for module conversion from SPIR-V to LLVM.
void encodeBindAttribute(ModuleOp module)
Encodes global variable's descriptor set and binding into its name if they both exist.