This patch adds the `ConvertToLLVMAttrInterface` and `ConvertToLLVMOpInterface` interfaces. It also modifies the `convert-to-llvm` pass to use these interfaces when available. The `ConvertToLLVMAttrInterface` interfaces allows attributes to configure conversion to LLVM, including the conversion target, LLVM type converter, and populating conversion patterns. See the `NVVMTargetAttr` implementation of this interface for an example of how this interface can be used to configure conversion to LLVM. The `ConvertToLLVMOpInterface` interface collects all convert to LLVM attributes stored in an operation. Finally, the `convert-to-llvm` pass was modified to use these interfaces when available. This allows applying `convert-to-llvm` to GPU modules and letting the `NVVMTargetAttr` decide which patterns to populate.
33 lines
523 B
CMake
33 lines
523 B
CMake
set(LLVM_OPTIONAL_SOURCES
|
|
ConvertToLLVMPass.cpp
|
|
ToLLVMInterface.cpp
|
|
)
|
|
|
|
add_mlir_conversion_library(MLIRConvertToLLVMInterface
|
|
ToLLVMInterface.cpp
|
|
|
|
DEPENDS
|
|
MLIRConvertToLLVMInterfaceIncGen
|
|
|
|
LINK_LIBS PUBLIC
|
|
MLIRIR
|
|
MLIRSupport
|
|
)
|
|
|
|
add_mlir_conversion_library(MLIRConvertToLLVMPass
|
|
ConvertToLLVMPass.cpp
|
|
|
|
DEPENDS
|
|
MLIRConversionPassIncGen
|
|
|
|
LINK_LIBS PUBLIC
|
|
MLIRIR
|
|
MLIRConvertToLLVMInterface
|
|
MLIRLLVMCommonConversion
|
|
MLIRLLVMDialect
|
|
MLIRPass
|
|
MLIRRewrite
|
|
MLIRSupport
|
|
MLIRTransformUtils
|
|
)
|