29 lines · cpp
1//===- TranslateRegistration.cpp - Register translation -------------------===//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-exception6//7//===----------------------------------------------------------------------===//8#include "mlir/Dialect/WasmSSA/IR/WasmSSA.h"9#include "mlir/IR/DialectRegistry.h"10#include "mlir/IR/OwningOpRef.h"11#include "mlir/Target/Wasm/WasmImporter.h"12#include "mlir/Tools/mlir-translate/Translation.h"13 14using namespace mlir;15 16namespace mlir {17void registerFromWasmTranslation() {18 TranslateToMLIRRegistration registration{19 "import-wasm", "Translate WASM to MLIR",20 [](llvm::SourceMgr &sourceMgr,21 MLIRContext *context) -> OwningOpRef<Operation *> {22 return wasm::importWebAssemblyToModule(sourceMgr, context);23 },24 [](DialectRegistry ®istry) {25 registry.insert<wasmssa::WasmSSADialect>();26 }};27}28} // namespace mlir29