aboutsummaryrefslogtreecommitdiffstats
path: root/standalone-translate
diff options
context:
space:
mode:
Diffstat (limited to 'standalone-translate')
-rw-r--r--standalone-translate/CMakeLists.txt24
-rw-r--r--standalone-translate/standalone-translate.cpp27
2 files changed, 51 insertions, 0 deletions
diff --git a/standalone-translate/CMakeLists.txt b/standalone-translate/CMakeLists.txt
new file mode 100644
index 0000000..137f794
--- /dev/null
+++ b/standalone-translate/CMakeLists.txt
@@ -0,0 +1,24 @@
+set(LLVM_LINK_COMPONENTS
+ Support
+ )
+
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
+get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS)
+
+add_llvm_executable(standalone-translate
+ standalone-translate.cpp
+ )
+llvm_update_compile_flags(standalone-translate)
+target_link_libraries(standalone-translate
+ PRIVATE
+ ${dialect_libs}
+ ${translation_libs}
+ MLIRIR
+ MLIRParser
+ MLIRPass
+ MLIRSPIRV
+ MLIRTranslation
+ MLIRSupport
+ )
+
+mlir_check_link_libraries(standalone-translate)
diff --git a/standalone-translate/standalone-translate.cpp b/standalone-translate/standalone-translate.cpp
new file mode 100644
index 0000000..f2f0ac5
--- /dev/null
+++ b/standalone-translate/standalone-translate.cpp
@@ -0,0 +1,27 @@
+//===- standalone-translate.cpp ---------------------------------*- C++ -*-===//
+//
+// This file is licensed 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This is a command line utility that translates a file from/to MLIR using one
+// of the registered translations.
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/InitAllTranslations.h"
+#include "mlir/Support/LogicalResult.h"
+#include "mlir/Translation.h"
+
+#include "Standalone/StandaloneDialect.h"
+
+int main(int argc, char **argv) {
+ mlir::registerAllTranslations();
+
+ // TODO: Register standalone translations here.
+
+ return failed(
+ mlir::mlirTranslateMain(argc, argv, "MLIR Translation Testing Tool"));
+}