147c7df0eSJacques Pienaar //===- mlir-translate.cpp - MLIR Translate Driver -------------------------===// 247c7df0eSJacques Pienaar // 330857107SMehdi Amini // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 456222a06SMehdi Amini // See https://llvm.org/LICENSE.txt for license information. 556222a06SMehdi Amini // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 647c7df0eSJacques Pienaar // 756222a06SMehdi Amini //===----------------------------------------------------------------------===// 847c7df0eSJacques Pienaar // 947c7df0eSJacques Pienaar // This is a command line utility that translates a file from/to MLIR using one 1047c7df0eSJacques Pienaar // of the registered translations. 1147c7df0eSJacques Pienaar // 1247c7df0eSJacques Pienaar //===----------------------------------------------------------------------===// 1347c7df0eSJacques Pienaar 14223154d2SJonathan Roelofs #include "mlir/InitAllTranslations.h" 15*db791b27SRamkumar Ramachandra #include "mlir/Support/LLVM.h" 16ee1d447eSRiver Riddle #include "mlir/Tools/mlir-translate/MlirTranslateMain.h" 1747c7df0eSJacques Pienaar 1847c7df0eSJacques Pienaar using namespace mlir; 1947c7df0eSJacques Pienaar 20223154d2SJonathan Roelofs namespace mlir { 21223154d2SJonathan Roelofs // Defined in the test directory, no public header. 22223154d2SJonathan Roelofs void registerTestRoundtripSPIRV(); 2329b955f9SDenis Khalikov void registerTestRoundtripDebugSPIRV(); 242ae5d1c7SSergio Afonso #ifdef MLIR_INCLUDE_TESTS 252ae5d1c7SSergio Afonso void registerTestToLLVMIR(); 26a2c4b7c8SFabian Mora void registerTestFromLLVMIR(); 272ae5d1c7SSergio Afonso #endif 28223154d2SJonathan Roelofs } // namespace mlir 29223154d2SJonathan Roelofs registerTestTranslations()3029b955f9SDenis Khalikovstatic void registerTestTranslations() { 3129b955f9SDenis Khalikov registerTestRoundtripSPIRV(); 3229b955f9SDenis Khalikov registerTestRoundtripDebugSPIRV(); 332ae5d1c7SSergio Afonso #ifdef MLIR_INCLUDE_TESTS 342ae5d1c7SSergio Afonso registerTestToLLVMIR(); 35a2c4b7c8SFabian Mora registerTestFromLLVMIR(); 362ae5d1c7SSergio Afonso #endif 3729b955f9SDenis Khalikov } 38223154d2SJonathan Roelofs main(int argc,char ** argv)3947c7df0eSJacques Pienaarint main(int argc, char **argv) { 40223154d2SJonathan Roelofs registerAllTranslations(); 41223154d2SJonathan Roelofs registerTestTranslations(); 4296cb8cdeSMehdi Amini return failed(mlirTranslateMain(argc, argv, "MLIR Translation Testing Tool")); 4347c7df0eSJacques Pienaar } 44