Skip to content

Commit

Permalink
feat: add crab translate driver
Browse files Browse the repository at this point in the history
  • Loading branch information
jetafese authored and agurfinkel committed Dec 8, 2021
1 parent 863efc9 commit 4cede66
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ add_subdirectory(btor2mlir-opt)
add_subdirectory(btor2mlir-translate)
add_subdirectory(smt2mlir-opt)
add_subdirectory(smt2mlir-translate)
add_subdirectory(crab2mlir-opt)
add_subdirectory(crab2mlir-opt)
add_subdirectory(crab2mlir-translate)
24 changes: 24 additions & 0 deletions crab2mlir-translate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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(crab2mlir-translate
crab2mlir-translate.cpp
)
llvm_update_compile_flags(crab2mlir-translate)
target_link_libraries(crab2mlir-translate
PRIVATE
${dialect_libs}
${translation_libs}
MLIRIR
MLIRParser
MLIRPass
MLIRSPIRV
MLIRTranslation
MLIRSupport
)

mlir_check_link_libraries(crab2mlir-translate)
25 changes: 25 additions & 0 deletions crab2mlir-translate/crab2mlir-translate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//===- crab2mlir-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 "Dialect/Crab/IR/CrabDialect.h"

int main(int argc, char **argv) {
mlir::registerAllTranslations();

return failed(
mlir::mlirTranslateMain(argc, argv, "MLIR Translation Testing Tool"));
}

0 comments on commit 4cede66

Please sign in to comment.