First step in introducing the wasm-import target to mlir-translate. This is the first PR to introduce the pass, with this PR, there is very little support for the actual WebAssembly language, it's mostly there to introduce the skeleton of the importer. A follow-up will come with support for a wider range of operators. It was split to make it easier to review, since it's a good chunk of work. --------- Co-authored-by: Luc Forget <dev@alias.lforget.fr> Co-authored-by: Ferdinand Lemaire <ferdinand.lemaire@woven-planet.global> Co-authored-by: Jessica Paquette <jessica.paquette@woven-planet.global> Co-authored-by: Luc Forget <luc.forget@woven.toyota>
29 lines
1.0 KiB
C++
29 lines
1.0 KiB
C++
//===- TranslateRegistration.cpp - Register translation -------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#include "mlir/Dialect/WasmSSA/IR/WasmSSA.h"
|
|
#include "mlir/IR/DialectRegistry.h"
|
|
#include "mlir/IR/OwningOpRef.h"
|
|
#include "mlir/Target/Wasm/WasmImporter.h"
|
|
#include "mlir/Tools/mlir-translate/Translation.h"
|
|
|
|
using namespace mlir;
|
|
|
|
namespace mlir {
|
|
void registerFromWasmTranslation() {
|
|
TranslateToMLIRRegistration registration{
|
|
"import-wasm", "Translate WASM to MLIR",
|
|
[](llvm::SourceMgr &sourceMgr,
|
|
MLIRContext *context) -> OwningOpRef<Operation *> {
|
|
return wasm::importWebAssemblyToModule(sourceMgr, context);
|
|
},
|
|
[](DialectRegistry ®istry) {
|
|
registry.insert<wasmssa::WasmSSADialect>();
|
|
}};
|
|
}
|
|
} // namespace mlir
|