Skip to content

Commit 3a89cde

Browse files
committed
Add rlc mlir lsp
1 parent e15615d commit 3a89cde

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

tool/rlc-mlir-lsp/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
2+
rlcAddTool(rlc-mlir-lsp
3+
rlc::parser
4+
rlc::backend
5+
rlc::conversions
6+
rlc::dialect
7+
MLIRLspServerLib
8+
${dialect_libs})

tool/rlc-mlir-lsp/src/Main.cpp

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
Copyright 2024 Massimo Fioravanti
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
#include "llvm/Support/CommandLine.h"
17+
#include "llvm/Support/Error.h"
18+
#include "llvm/Support/MemoryBuffer.h"
19+
#include "llvm/Support/SourceMgr.h"
20+
#include "llvm/Support/raw_ostream.h"
21+
#include "mlir/InitAllDialects.h"
22+
#include "mlir/Tools/mlir-lsp-server/MlirLspServerMain.h"
23+
#include "rlc/dialect/Dialect.h"
24+
#include "rlc/dialect/Passes.hpp"
25+
#include "rlc/parser/Parser.hpp"
26+
#include "rlc/utils/IRange.hpp"
27+
28+
using namespace rlc;
29+
using namespace llvm;
30+
using namespace std;
31+
32+
int main(int argc, char* argv[])
33+
{
34+
mlir::rlc::registerdialectPasses();
35+
mlir::DialectRegistry registry;
36+
registry
37+
.insert<mlir::BuiltinDialect, mlir::rlc::RLCDialect, mlir::DLTIDialect>();
38+
return mlir::failed(mlir::MlirLspServerMain(argc, argv, registry));
39+
}

0 commit comments

Comments
 (0)