[RISCV][NFC] precommit for D159399
[llvm-project.git] / mlir / tools / mlir-translate / mlir-translate.cpp
blob4f9661c058c2d3424350018e7b1676a7c145fa33
1 //===- mlir-translate.cpp - MLIR Translate Driver -------------------------===//
2 //
3 // Part of the LLVM Project, 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.
12 //===----------------------------------------------------------------------===//
14 #include "mlir/InitAllTranslations.h"
15 #include "mlir/Support/LogicalResult.h"
16 #include "mlir/Tools/mlir-translate/MlirTranslateMain.h"
18 using namespace mlir;
20 namespace mlir {
21 // Defined in the test directory, no public header.
22 void registerTestRoundtripSPIRV();
23 void registerTestRoundtripDebugSPIRV();
24 #ifdef MLIR_INCLUDE_TESTS
25 void registerTestToLLVMIR();
26 #endif
27 } // namespace mlir
29 static void registerTestTranslations() {
30 registerTestRoundtripSPIRV();
31 registerTestRoundtripDebugSPIRV();
32 #ifdef MLIR_INCLUDE_TESTS
33 registerTestToLLVMIR();
34 #endif
37 int main(int argc, char **argv) {
38 registerAllTranslations();
39 registerTestTranslations();
40 return failed(mlirTranslateMain(argc, argv, "MLIR Translation Testing Tool"));