Fix the slir-opt tool to use slir and few builtin IRs
This commit is contained in:
parent
b7af46cdde
commit
12c2d1d455
|
@ -18,12 +18,16 @@
|
|||
|
||||
#include "serene/slir/dialect.h"
|
||||
|
||||
#include <mlir/Dialect/Func/IR/FuncOps.h>
|
||||
#include <mlir/IR/Dialect.h>
|
||||
#include <mlir/Tools/mlir-lsp-server/MlirLspServerMain.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mlir::DialectRegistry registry;
|
||||
registry.insert<serene::slir::SereneDialect>();
|
||||
|
||||
serene::slir::registerTo(registry);
|
||||
|
||||
registry.insert<mlir::func::FuncDialect>();
|
||||
|
||||
// TODO: Register passes here
|
||||
return static_cast<int>(
|
||||
|
|
|
@ -18,14 +18,17 @@
|
|||
|
||||
#include "serene/slir/dialect.h"
|
||||
|
||||
#include <mlir/Dialect/Arithmetic/IR/Arithmetic.h>
|
||||
#include <mlir/Dialect/Func/IR/FuncOps.h>
|
||||
#include <mlir/IR/Dialect.h>
|
||||
#include <mlir/Tools/mlir-opt/MlirOptMain.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mlir::DialectRegistry registry;
|
||||
registry.insert<serene::slir::SereneDialect>();
|
||||
|
||||
serene::slir::registerTo(registry);
|
||||
registry.insert<mlir::arith::ArithmeticDialect, mlir::func::FuncDialect>();
|
||||
// TODO: Register passes here
|
||||
return static_cast<int>(
|
||||
mlir::failed(mlir::MlirOptMain(argc, argv, registry)));
|
||||
mlir::failed(mlir::MlirOptMain(argc, argv, "slir-opt", registry)));
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module @some.ns {
|
||||
%1 = "serene.define"{}()
|
||||
%1 = "serene.define" (): () -> i32
|
||||
}
|
||||
|
|
|
@ -18,9 +18,12 @@
|
|||
#ifndef SERENE_SLIR_DIALECT_H
|
||||
#define SERENE_SLIR_DIALECT_H
|
||||
|
||||
#include <serene/export.h>
|
||||
|
||||
#include <llvm/ADT/TypeSwitch.h>
|
||||
#include <mlir/IR/BuiltinOps.h>
|
||||
#include <mlir/IR/Dialect.h>
|
||||
#include <mlir/IR/DialectRegistry.h>
|
||||
#include <mlir/Interfaces/ControlFlowInterfaces.h>
|
||||
#include <mlir/Interfaces/SideEffectInterfaces.h>
|
||||
|
||||
|
@ -35,4 +38,8 @@
|
|||
#define GET_OP_CLASSES
|
||||
#include "serene/slir/ops.h.inc"
|
||||
|
||||
namespace serene::slir {
|
||||
SERENE_EXPORT void registerTo(mlir::DialectRegistry ®istry);
|
||||
} // namespace serene::slir
|
||||
//
|
||||
#endif // SERENE_SLIR_DIALECT_H
|
||||
|
|
|
@ -147,10 +147,10 @@ endif()
|
|||
|
||||
|
||||
set(serene_lib_dialects_in_use
|
||||
MLIRStandard)
|
||||
MLIRFunc)
|
||||
|
||||
set(serene_lib_transformers_in_use
|
||||
MLIRStandardToLLVM)
|
||||
MLIRFuncToLLVM)
|
||||
|
||||
target_link_libraries(serene PRIVATE
|
||||
MLIRIR
|
||||
|
|
|
@ -112,6 +112,10 @@ void SereneDialect::initialize() {
|
|||
// void SereneDialect::printType(
|
||||
// mlir::Type type, mlir::DialectAsmPrinter &printer) const override{};
|
||||
|
||||
void registerTo(mlir::DialectRegistry ®istry) {
|
||||
registry.insert<serene::slir::SereneDialect>();
|
||||
};
|
||||
|
||||
} // namespace slir
|
||||
} // namespace serene
|
||||
#define GET_TYPEDEF_CLASSES
|
||||
|
|
Loading…
Reference in New Issue