brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 46b9c77 Raw
36 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8//9// This is a command line utility that translates a file from/to MLIR using one10// 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 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