File tree Expand file tree Collapse file tree 26 files changed +348
-78
lines changed
Expand file tree Collapse file tree 26 files changed +348
-78
lines changed Original file line number Diff line number Diff line change 1+ //===-- mlir-c/Dialect/Sol.h - C API for Sol dialect --------------*- C -*-===//
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+ //===----------------------------------------------------------------------===//
8+
9+ #ifndef MLIR_C_DIALECT_SOL_H
10+ #define MLIR_C_DIALECT_SOL_H
11+
12+ #include "mlir-c/IR.h"
13+ #include "mlir-c/Support.h"
14+
15+ #ifdef __cplusplus
16+ extern "C" {
17+ #endif
18+
19+ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION (Sol , sol );
20+
21+ /// Lowers llvm.setimmutable ops using the provided immutable offset map.
22+ MLIR_CAPI_EXPORTED void mlirEvmLowerSetImmutables (MlirModule mod ,
23+ const char * * immIDs ,
24+ const uint64_t * immOffsets ,
25+ uint64_t immCount );
26+
27+ /// Removes all llvm.setimmutable ops.
28+ MLIR_CAPI_EXPORTED void mlirEvmRemoveSetImmutables (MlirModule mod );
29+
30+ #ifdef __cplusplus
31+ }
32+ #endif
33+
34+ #include "mlir/Dialect/Sol/Transforms/Passes.capi.h.inc"
35+
36+ #endif // MLIR_C_DIALECT_SOL_H
Original file line number Diff line number Diff line change 1+ //===-- mlir-c/Dialect/Yul.h - C API for Yul dialect --------------*- C -*-===//
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+ //===----------------------------------------------------------------------===//
8+
9+ #ifndef MLIR_C_DIALECT_YUL_H
10+ #define MLIR_C_DIALECT_YUL_H
11+
12+ #include "mlir-c/IR.h"
13+ #include "mlir-c/Support.h"
14+
15+ #ifdef __cplusplus
16+ extern "C" {
17+ #endif
18+
19+ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION (Yul , yul );
20+
21+ #ifdef __cplusplus
22+ }
23+ #endif
24+
25+ #include "mlir/Dialect/Yul/Transforms/Passes.capi.h.inc"
26+
27+ #endif // MLIR_C_DIALECT_YUL_H
Original file line number Diff line number Diff line change 6565#include " mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h"
6666#include " mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
6767#include " mlir/Conversion/ShapeToStandard/ShapeToStandard.h"
68+ // EVM local begin
69+ #include " mlir/Conversion/SolToStandard/SolToStandard.h"
70+ // EVM local end
6871#include " mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h"
6972#include " mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h"
7073#include " mlir/Conversion/TosaToArith/TosaToArith.h"
Original file line number Diff line number Diff line change @@ -1504,4 +1504,22 @@ def ConvertXeVMToLLVMPass : Pass<"convert-xevm-to-llvm"> {
15041504 let dependentDialects = ["LLVM::LLVMDialect"];
15051505}
15061506
1507+ // EVM local begin
1508+ //===----------------------------------------------------------------------===//
1509+ // SolToStandard
1510+ //===----------------------------------------------------------------------===//
1511+
1512+ def ConvertSolToStandard : Pass<"convert-sol-to-std", "ModuleOp"> {
1513+ let summary = "Convert Sol dialect to standard dialects";
1514+ let dependentDialects = [
1515+ "yul::YulDialect",
1516+ "func::FuncDialect",
1517+ "scf::SCFDialect",
1518+ "cf::ControlFlowDialect",
1519+ "arith::ArithDialect",
1520+ "LLVM::LLVMDialect",
1521+ ];
1522+ }
1523+ // EVM local end
1524+
15071525#endif // MLIR_CONVERSION_PASSES
Original file line number Diff line number Diff line change @@ -22,12 +22,9 @@ class Pass;
2222class TypeConverter ;
2323class RewritePatternSet ;
2424
25- namespace sol {
25+ #define GEN_PASS_DECL_CONVERTSOLTOSTANDARD
26+ #include " mlir/Conversion/Passes.h.inc"
2627
27- // / Creates a pass to lower sol dialect to standard dialects.
28- std::unique_ptr<Pass> createConvertSolToStandardPass ();
29-
30- } // namespace sol
3128} // namespace mlir
3229
3330#endif // MLIR_CONVERSION_SOLTOSTANDARD_SOLTOSTANDARD_H
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ mlir_tablegen(SolCanonicalization.inc -gen-rewriters)
2121# Create MLIRSolExtraIncGen.
2222add_public_tablegen_target(MLIRSolExtraIncGen)
2323
24+ set (LLVM_TARGET_DEFINITIONS Transforms/Passes.td)
25+ mlir_tablegen(Transforms/Passes.h.inc -gen-pass-decls -name Sol)
26+ mlir_tablegen(Transforms/Passes.capi.h.inc -gen-pass-capi-header --prefix Sol)
27+ mlir_tablegen(Transforms/Passes.capi.cpp.inc -gen-pass-capi-impl --prefix Sol)
28+ add_public_tablegen_target(MLIRSolPassIncGen)
29+
2430# Generate the docs
2531add_mlir_doc(SolDialect SolDialect Sol/ -gen-dialect-doc )
2632add_mlir_doc(SolOps SolOps Sol/ -gen-op-doc )
Original file line number Diff line number Diff line change 1414#define MLIR_DIALECT_SOL_TRANSFORMS_PASSES_H
1515
1616#include " mlir/Pass/Pass.h"
17- #include < memory>
1817
1918namespace mlir {
2019namespace sol {
2120
22- // / Creates a pass that lowers modifier-related ops.
23- std::unique_ptr<Pass> createModifierOpLoweringPass ();
21+ # define GEN_PASS_DECL
22+ # include " mlir/Dialect/Sol/Transforms/Passes.h.inc "
2423
25- // / Creates a pass for loop invariant code motion.
26- std::unique_ptr<Pass> createLoopInvariantCodeMotionPass ();
24+ # define GEN_PASS_REGISTRATION
25+ # include " mlir/Dialect/Sol/Transforms/Passes.h.inc "
2726
2827} // namespace sol
2928} // namespace mlir
Original file line number Diff line number Diff line change 1+ //===-- Passes.td - Sol pass definition file ---------------*- tablegen -*-===//
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+ //===----------------------------------------------------------------------===//
8+
9+ #ifndef MLIR_DIALECT_SOL_TRANSFORMS_PASSES
10+ #define MLIR_DIALECT_SOL_TRANSFORMS_PASSES
11+
12+ include "mlir/Pass/PassBase.td"
13+
14+ def SolModifierOpLowering : Pass<"sol-lower-modifier", "ModuleOp"> {
15+ let summary = "Lower modifier-related ops in the Sol dialect";
16+ }
17+
18+ def SolLoopInvariantCodeMotion : Pass<"sol-licm"> {
19+ let summary = "Loop invariant code motion for the Sol dialect";
20+ }
21+
22+ #endif
Original file line number Diff line number Diff line change 1- // ===- Immutables .h - Solidity immutable lowering --- ------------*- C++ -*-===//
1+ // ===- SolImmutables .h - Solidity immutable lowering ------------*- C++ -*-===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44// See https://llvm.org/LICENSE.txt for license information.
1010//
1111// ===----------------------------------------------------------------------===//
1212
13- #ifndef MLIR_DIALECT_SOL_TRANSFORMS_IMMUTABLES_H
14- #define MLIR_DIALECT_SOL_TRANSFORMS_IMMUTABLES_H
13+ #ifndef MLIR_DIALECT_SOL_TRANSFORMS_SOLIMMUTABLES_H
14+ #define MLIR_DIALECT_SOL_TRANSFORMS_SOLIMMUTABLES_H
1515
1616#include " mlir/IR/BuiltinOps.h"
1717#include " llvm/ADT/SmallVector.h"
@@ -31,4 +31,4 @@ void removeSetImmutables(ModuleOp mod);
3131} // namespace evm
3232} // namespace mlir
3333
34- #endif // MLIR_DIALECT_SOL_TRANSFORMS_IMMUTABLES_H
34+ #endif // MLIR_DIALECT_SOL_TRANSFORMS_SOLIMMUTABLES_H
Original file line number Diff line number Diff line change @@ -7,3 +7,9 @@ set(LLVM_TARGET_DEFINITIONS YulOps.td)
77# Generate documentation.
88add_mlir_doc(YulDialect YulDialect Yul/ -gen-dialect-doc )
99add_mlir_doc(YulOps YulOps Yul/ -gen-op-doc )
10+
11+ set (LLVM_TARGET_DEFINITIONS Transforms/Passes.td)
12+ mlir_tablegen(Transforms/Passes.h.inc -gen-pass-decls -name Yul)
13+ mlir_tablegen(Transforms/Passes.capi.h.inc -gen-pass-capi-header --prefix Yul)
14+ mlir_tablegen(Transforms/Passes.capi.cpp.inc -gen-pass-capi-impl --prefix Yul)
15+ add_public_tablegen_target(MLIRYulPassIncGen)
You can’t perform that action at this time.
0 commit comments