• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "mlir/InitAllTranslations.h"
15 #include "mlir/Support/LogicalResult.h"
16 #include "mlir/Translation.h"
17 
18 using namespace mlir;
19 
20 namespace mlir {
21 // Defined in the test directory, no public header.
22 void registerTestRoundtripSPIRV();
23 void registerTestRoundtripDebugSPIRV();
24 } // namespace mlir
25 
registerTestTranslations()26 static void registerTestTranslations() {
27   registerTestRoundtripSPIRV();
28   registerTestRoundtripDebugSPIRV();
29 }
30 
main(int argc,char ** argv)31 int main(int argc, char **argv) {
32   registerAllTranslations();
33   registerTestTranslations();
34   return failed(mlirTranslateMain(argc, argv, "MLIR Translation Testing Tool"));
35 }
36