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