1 //===- standalone-translate.cpp ---------------------------------*- C++ -*-===// 2 // 3 // This file is licensed 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 // This is a command line utility that translates a file from/to MLIR using one 10 // of the registered translations. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "Standalone/StandaloneDialect.h" 15 #include "mlir/IR/DialectRegistry.h" 16 #include "mlir/IR/Operation.h" 17 #include "mlir/InitAllTranslations.h" 18 #include "mlir/Tools/mlir-translate/MlirTranslateMain.h" 19 #include "mlir/Tools/mlir-translate/Translation.h" 20 #include "llvm/Support/raw_ostream.h" 21 main(int argc,char ** argv)22int main(int argc, char **argv) { 23 mlir::registerAllTranslations(); 24 25 // TODO: Register standalone translations here. 26 mlir::TranslateFromMLIRRegistration withdescription( 27 "option", "different from option", 28 [](mlir::Operation *op, llvm::raw_ostream &output) { 29 return llvm::LogicalResult::success(); 30 }, 31 [](mlir::DialectRegistry &a) {}); 32 33 return failed( 34 mlir::mlirTranslateMain(argc, argv, "MLIR Translation Testing Tool")); 35 } 36