//===- TranslateRegistration.cpp - hooks to mlir-translate ----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements a translation from SPIR-V binary module to MLIR SPIR-V // ModuleOp. // //===----------------------------------------------------------------------===// #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" #include "mlir/IR/Builders.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/Verifier.h" #include "mlir/Parser/Parser.h" #include "mlir/Support/FileUtilities.h" #include "mlir/Target/SPIRV/Deserialization.h" #include "mlir/Target/SPIRV/Serialization.h" #include "mlir/Tools/mlir-translate/Translation.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/ToolOutputFile.h" usingnamespacemlir; //===----------------------------------------------------------------------===// // Deserialization registration //===----------------------------------------------------------------------===// // Deserializes the SPIR-V binary module stored in the file named as // `inputFilename` and returns a module containing the SPIR-V module. static OwningOpRef<Operation *> deserializeModule(const llvm::MemoryBuffer *input, MLIRContext *context) { … } namespace mlir { void registerFromSPIRVTranslation() { … } } // namespace mlir //===----------------------------------------------------------------------===// // Serialization registration //===----------------------------------------------------------------------===// static LogicalResult serializeModule(spirv::ModuleOp module, raw_ostream &output) { … } namespace mlir { void registerToSPIRVTranslation() { … } } // namespace mlir //===----------------------------------------------------------------------===// // Round-trip registration //===----------------------------------------------------------------------===// static LogicalResult roundTripModule(spirv::ModuleOp module, bool emitDebugInfo, raw_ostream &output) { … } namespace mlir { void registerTestRoundtripSPIRV() { … } void registerTestRoundtripDebugSPIRV() { … } } // namespace mlir