Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mlir/include/mlir/Conversion/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h"
#include "mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h"
#include "mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h"
#include "mlir/Conversion/RaiseWasm/RaiseWasmMLIR.h"
#include "mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h"
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
#include "mlir/Conversion/SCFToEmitC/SCFToEmitC.h"
Expand Down
13 changes: 13 additions & 0 deletions mlir/include/mlir/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,19 @@ def ConvertVectorToAMX : Pass<"convert-vector-to-amx"> {
];
}

//===----------------------------------------------------------------------===//
// RaiseWasmMLIR
//===----------------------------------------------------------------------===//

def RaiseWasmMLIR : Pass<"raise-wasm-mlir"> {
let summary = "Convert Wasm dialect to a group of dialect as a bridge to LLVM MLIR conversion";
let dependentDialects = [
"func::FuncDialect", "arith::ArithDialect", "cf::ControlFlowDialect",
"memref::MemRefDialect", "vector::VectorDialect", "wasmssa::WasmSSADialect",
"math::MathDialect"
];
}

//===----------------------------------------------------------------------===//
// XeVMToLLVM
//===----------------------------------------------------------------------===//
Expand Down
29 changes: 29 additions & 0 deletions mlir/include/mlir/Conversion/RaiseWasm/RaiseWasmMLIR.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===- RaiseWasmMLIR.h - Convert wasm to standard dialects ------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_CONVERSION_RAISEWASM_RAISEWASMMLIR_H
#define MLIR_CONVERSION_RAISEWASM_RAISEWASMMLIR_H

#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/DialectConversion.h"

namespace mlir {
class Pass;
class RewritePatternSet;

#define GEN_PASS_DECL_RAISEWASMMLIR
#include "mlir/Conversion/Passes.h.inc"

/// Collect a set of patterns to convert from the Wasm dialect to standard
/// dialects.
void populateRaiseWasmMLIRConversionPatterns(TypeConverter &,
RewritePatternSet &);

} // namespace mlir

#endif // MLIR_CONVERSION_RAISEWASM_RAISEWASMMLIR_H
5 changes: 4 additions & 1 deletion mlir/include/mlir/Dialect/WasmSSA/IR/WasmSSAOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,19 @@ def WasmSSA_GlobalOp : WasmSSA_Op<"global", [
}
```
}];
let regions = (region AnyRegion: $initializer);
let regions = (region SizedRegion<1>: $initializer);

let extraClassDeclaration = [{
::mlir::SymbolTable::Visibility getVisibility() {
return getExported() ?
::mlir::SymbolTable::Visibility::Public :
::mlir::SymbolTable::Visibility::Nested;
};

wasmssa::ReturnOp getInitTerminator();
}];
let hasCustomAssemblyFormat = 1;
let hasVerifier = 1;
}

def WasmSSA_GlobalImportOp : WasmSSA_Op<"import_global", [
Expand Down
1 change: 1 addition & 0 deletions mlir/lib/Conversion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ add_subdirectory(OpenACCToSCF)
add_subdirectory(OpenMPToLLVM)
add_subdirectory(PDLToPDLInterp)
add_subdirectory(PtrToLLVM)
add_subdirectory(RaiseWasm)
add_subdirectory(ReconcileUnrealizedCasts)
add_subdirectory(SCFToControlFlow)
add_subdirectory(SCFToEmitC)
Expand Down
19 changes: 19 additions & 0 deletions mlir/lib/Conversion/RaiseWasm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
add_mlir_conversion_library(MLIRWasmRaise
RaiseWasmMLIR.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/RaiseWasm

DEPENDS
MLIRConversionPassIncGen

LINK_LIBS PUBLIC
MLIRArithDialect
MLIRControlFlowDialect
MLIRFuncDialect
MLIRMathDialect
MLIRMemRefDialect
MLIRTransforms
MLIRVectorDialect
MLIRWasmSSADialect
)
Loading