1 //===- All.h - MLIR To LLVM IR Translation Registration ---------*- 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 // This file defines a helper to register the translations of all suitable 10 // dialects to LLVM IR. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef MLIR_TARGET_LLVMIR_DIALECT_ALL_H 15 #define MLIR_TARGET_LLVMIR_DIALECT_ALL_H 16 17 #include "mlir/Target/LLVMIR/Dialect/AMX/AMXToLLVMIRTranslation.h" 18 #include "mlir/Target/LLVMIR/Dialect/ArmNeon/ArmNeonToLLVMIRTranslation.h" 19 #include "mlir/Target/LLVMIR/Dialect/ArmSME/ArmSMEToLLVMIRTranslation.h" 20 #include "mlir/Target/LLVMIR/Dialect/ArmSVE/ArmSVEToLLVMIRTranslation.h" 21 #include "mlir/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.h" 22 #include "mlir/Target/LLVMIR/Dialect/GPU/GPUToLLVMIRTranslation.h" 23 #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.h" 24 #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h" 25 #include "mlir/Target/LLVMIR/Dialect/NVVM/LLVMIRToNVVMTranslation.h" 26 #include "mlir/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.h" 27 #include "mlir/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.h" 28 #include "mlir/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.h" 29 #include "mlir/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.h" 30 #include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h" 31 #include "mlir/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.h" 32 #include "mlir/Target/LLVMIR/Dialect/X86Vector/X86VectorToLLVMIRTranslation.h" 33 34 namespace mlir { 35 class DialectRegistry; 36 37 /// Registers all dialects that can be translated to LLVM IR and the 38 /// corresponding translation interfaces. registerAllToLLVMIRTranslations(DialectRegistry & registry)39static inline void registerAllToLLVMIRTranslations(DialectRegistry ®istry) { 40 registerArmNeonDialectTranslation(registry); 41 registerAMXDialectTranslation(registry); 42 registerArmSMEDialectTranslation(registry); 43 registerArmSVEDialectTranslation(registry); 44 registerBuiltinDialectTranslation(registry); 45 registerGPUDialectTranslation(registry); 46 registerLLVMDialectTranslation(registry); 47 registerNVVMDialectTranslation(registry); 48 registerOpenACCDialectTranslation(registry); 49 registerOpenMPDialectTranslation(registry); 50 registerROCDLDialectTranslation(registry); 51 registerSPIRVDialectTranslation(registry); 52 registerVCIXDialectTranslation(registry); 53 registerX86VectorDialectTranslation(registry); 54 55 // Extension required for translating GPU offloading Ops. 56 gpu::registerOffloadingLLVMTranslationInterfaceExternalModels(registry); 57 } 58 59 /// Registers all the translations to LLVM IR required by GPU passes. 60 /// TODO: Remove this function when a safe dialect interface registration 61 /// mechanism is implemented, see D157703. 62 static inline void registerAllGPUToLLVMIRTranslations(DialectRegistry & registry)63registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) { 64 registerBuiltinDialectTranslation(registry); 65 registerGPUDialectTranslation(registry); 66 registerLLVMDialectTranslation(registry); 67 registerNVVMDialectTranslation(registry); 68 registerROCDLDialectTranslation(registry); 69 registerSPIRVDialectTranslation(registry); 70 71 // Extension required for translating GPU offloading Ops. 72 gpu::registerOffloadingLLVMTranslationInterfaceExternalModels(registry); 73 } 74 75 /// Registers all dialects that can be translated from LLVM IR and the 76 /// corresponding translation interfaces. 77 static inline void registerAllFromLLVMIRTranslations(DialectRegistry & registry)78registerAllFromLLVMIRTranslations(DialectRegistry ®istry) { 79 registerLLVMDialectImport(registry); 80 registerNVVMDialectImport(registry); 81 } 82 } // namespace mlir 83 84 #endif // MLIR_TARGET_LLVMIR_DIALECT_ALL_H 85