MLIR 22.0.0git
TranslateRegistration.cpp
Go to the documentation of this file.
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-exception
6//
7//===----------------------------------------------------------------------===//
10#include "mlir/IR/OwningOpRef.h"
13
14using namespace mlir;
15
16namespace mlir {
18 TranslateToMLIRRegistration registration{
19 "import-wasm", "Translate WASM to MLIR",
20 [](llvm::SourceMgr &sourceMgr,
22 return wasm::importWebAssemblyToModule(sourceMgr, context);
23 },
24 [](DialectRegistry &registry) {
25 registry.insert<wasmssa::WasmSSADialect>();
26 }};
27}
28} // namespace mlir
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
MLIRContext is the top-level object for a collection of MLIR operations.
Definition MLIRContext.h:63
This class acts as an owning reference to an op, and will automatically destroy the held op on destru...
Definition OwningOpRef.h:29
OwningOpRef< ModuleOp > importWebAssemblyToModule(llvm::SourceMgr &source, MLIRContext *context)
If source contains a valid Wasm binary file, this function returns a a ModuleOp containing the repres...
Include the generated interface declarations.
void registerFromWasmTranslation()
Use Translate[ToMLIR|FromMLIR]Registration as an initializer that registers a function and associates...